CustomProperties or other way to add data to Mini Cart?

8 years ago
#10107 Quote
  • 7
I often add data to a model in nop using the
CustomProperties or viewbag.  I want to try and add a small item onto the ShoppingCartBox.  Does this model have any CustomProperties or inherit from another model?  Or can I pass a parameter in the Action call that I can place where I want it in the view?

8 years ago
#10110 Quote
  • 347

Unfortunately the MiniShoppingCartModel does not have any custom properties, but if you want you can add CustomeProperties in it and populate it with your information in the ShoppingCartController.

If you go to the ShoppingCartController in Nop.Web, you will find the prepare method for the mini shopping cart and a method colled AddProductToCart_Catalog, which renders the FlyoutShoppingCart view and uses the PrepareMiniShoppingCartModel to prepare a MiniShoppingCartModel that the view uses to display the information that you see in the mini shopping cart.

Hope this helps!
Iliyan Tanev
Nop-Templates Dev Team