Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jason 92 posts 175 karma points
    Nov 14, 2015 @ 08:59
    Jason
    0

    Varying quantities and discounts

    I'm currently using Merchello 1.10 combined install. The store is 95% completed now and we're just around the corner from going into production.

    A bit of scope creep became apparent last night after receiving an email, informing me that the client would like to be able to offer discounts based on the number of products they buy, for example: 1 sack of coal: £5 10 sacks of coal: £45 20 sacks: £85

    In merchello, Coal is obviously 1 product with one price. To manage these expectations I'll probably suggest we create a bulk section, where a new merchello product be created, i.e. 10 sacks of coal

    Are you guys away of an instance where this quantity discount has been achieved with Merchello?

  • Jason 92 posts 175 karma points
    Nov 14, 2015 @ 21:19
    Jason
    0

    So as a temporary measure I decided to try adding a new property to the Product document type. The prop is called bulkOffer1 and is basically another Merch Product Selectory.

    Then on the Product page itself, if the umbraco product has a bulkOffer property then I pass that to the RenderAddToBasket:

     if (BulkOffers.Any())
                {
                    foreach (var Offer in BulkOffers)
                    {
                        if (Offer != null)
                        {
                            var NewModel = new ProductModelV2(Model);                            
                            NewModel.ProductData = Offer;
                            @Html.Action("RenderAddToBasket", "BasketOperations", new { area = "Bazaar", model = NewModel })
                        }
                    }
                }
    

    Note I've temporarily created a v2 of the ProductModel as the original does not contain a setter for ProductData. I now set it to the bulkOffer merchello product

    public class ProductModelV2 : ProductModel
    {
        public ProductModelV2(IPublishedContent content) : base(content)
        {
        }
    
        public new ProductDisplay ProductData { get; set; }
    }
    

    By the time this reaches the basket, in the form of a AddItemModel, the product details all directly related to the main/parent merch product.

    [ChildActionOnly]
    public ActionResult RenderAddToBasket(ProductModel model)
    {
      AddItemModel addItemModel = new AddItemModel()
      {
        Product = model.ProductData,
        ContentId = model.Id,
        BasketPageId = model.BasketPage.Id,
        ShowWishList = model.ShowWishList,
        WishListPageId = model.WishListPage.Id,
        Currency = model.Currency
      };
      return (ActionResult) this.PartialView(ModelExtensions.ThemePartialViewPath((IMasterModel) model, "AddToCart"), (object) addItemModel);
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft