PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 8/17/2020 12:10 PM by  Will Strohl
Separate products in category view
 4 Replies
 1 Subscribed to this topic
 1 Subscribed to this forum
Sort:
You are not authorized to post a reply.
Author Messages





Basic Member






--
7/31/2020 1:07 AM
    Hi Guys,

    I'm trying to separate products that have options with products that dont have options.

    I wanted to do this via Product types but cannot find a way to reference ProductTypes in The Category Index.cshtml..

    So currently I have the below written in one Category View,
    But there seems to be an issue when the products are in multiple categories, they only show in the 1st category that was added when the options were added to the product.

    [code=markup]
    @foreach (var item in Model.Products )
    {

    if (item.Item.HasOptions()){
    <div class="col-lg-2 col-sm-6">
    @Html.Partial("_RenderSingleProduct", item)
    </div>
    }
    else
    {


    }
    [/code]

    I hope this makes sense, any suggestions would be helpful :)





    Veteran Member






    --
    8/1/2020 3:46 AM
    [quote=Gilderroot;1490]Hi Guys,

    I'm trying to separate products that have options with products that dont have options. [/quote]

    Honestly, I'm not sure I completely understand what you're trying to do. Maybe you can describe the use case further?
    Will Strohl, Upendo Ventures Hotcakes Cloud | Get Support | Code Support Official Cloud & Support provider for Hotcakes





    Basic Member






    --
    8/2/2020 4:50 PM
    Hi Will,

    So what im trying to achieve is to have one category view displaying Products with Choices, and another displaying products without choices.
    The products with the multiple choice (or options) will be what we sell, the products without choices will be just for display purposes.

    I have tried to display the product that has choices (options) by using "if (item.Item.HasOptions())" but this doesnt seem to work when the product is in multiple categories (The Product will only display one of the multiple categories selected).

    Also is there anyway to reference ProductType in the category view.cshtml so I could only display a specific Product Type in say the category view module?

    Let me know if this still doesnt make sense.. i'll ease off the drinks :P





    Basic Member






    --
    8/13/2020 8:05 PM
    My solution to this issue was the above code I had originally put in this post, But i had not set the number of products in my settings so it was only displaying the 1st few products.

    As there are over 2k products in this shop, the purchaseable ones were near the bottom of the list, so you have to add the product number in settings over 2k (999999 is what i entered) for those product to display.

    Hopefully this helps someone in the future :)





    Veteran Member






    --
    8/17/2020 12:10 PM
    Ah, yes... You should always have a limit in some way when you know the catalog is large enough to warrant it. :)
    Will Strohl, Upendo Ventures Hotcakes Cloud | Get Support | Code Support Official Cloud & Support provider for Hotcakes
    You are not authorized to post a reply.


    Loading
    • Sign-up for the Hotcakes Community Newsletter: