PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 7/24/2020 11:11 PM by  Scippy
Show category in SingleProductViewModel
 2 Replies
 1 Subscribed to this topic
 1 Subscribed to this forum
Sort:
You are not authorized to post a reply.
Author Messages





Advanced Member






--
7/24/2020 12:15 PM
    I need to show the product category in _RenderSingleProduct.cshtml
    I can see it uses Hotcakes.Modules.Core.Models.SingleProductViewModel, but how to show the category in that views? In that model there is item to access all product informations, but the category seems missing.
    If I listing fo all products it is very important to show for each product the category it belongs to...









    --
    7/24/2020 1:07 PM
    The main reason that you don't already have a built-in way to do that in the view model is because most stores don't do this. The most common use case is that a product could belong to many categories, so adding this to the view is a nightmare scenario to a designer. :D

    You can add a method to the view in question that queries the API for the product and then list the various categories it belongs to.
    Will Strohl, Upendo Ventures Hotcakes Cloud | Get Support | Code Support Official Cloud & Support provider for Hotcakes





    Advanced Member






    --
    7/24/2020 11:11 PM
    thanks Will but i can't find anywhere how i can use api calls directly from a viewset using a method.
    Is it a programming or designer work?
    Is there any example about?
    You are not authorized to post a reply.


    Loading
    • Sign-up for the Hotcakes Community Newsletter: