PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 8/16/2018 5:43 AM by  Reto Cossalter
Latest addition module?
 7 Replies
 1 Subscribed to this topic
 1 Subscribed to this forum
Sort:
You are not authorized to post a reply.
Page 1 of 212 > >>
Author Messages





New Member






--
7/15/2018 7:11 PM
    Which module do I use to display the most recently added products to my store? I don't see any option for it in any module,. but I might be looking in the wrong place.
    I haven't really looked much into the details of the content column and block functionality. Is that what I need to use?

    Thank you,
    Donald :)





    Veteran Member






    --
    7/20/2018 11:41 AM
    There isn't a built-in view that displays products based on the date the product was added to the store. This is possible to do though.

    [list=1]
    [*] If you're not already doing so, create your custom viewset.
    [*] Add a new view in the Category viewset folder and name it something like, "NewestFirst.cshtml"
    [*] Use LINQ to change the sort at this line of code: foreach (var item in Model.Products)
    [*] Save the view
    [*] Apply the view at the module or category-level
    [/list]
    Will Strohl, Upendo Ventures Hotcakes Cloud | Get Support | Code Support Official Cloud & Support provider for Hotcakes





    New Member






    --
    7/24/2018 9:38 AM
    Thank you Will!

    I have been doing some changes to the viewsets, but am having some problems with this one.

    I changed line 32 in the category viewset to this:
    @foreach (var item in Model.Products.OrderBy(CreationDate))

    But am getting this error:
    "error CS0103: The name 'CreationDate' does not exist in the current context at System.Web.Compilation.AssemblyBuilder.Compile()"

    I checked the database, and I see the 'CreationDate' column in the products table, so I assume that's what I need to use?

    The problem is probably my limited knowledge of LINQ. I tried something like this, but without any better results.

    @foreach (var item in Model.Products.OrderBy(CreationDate =>CreationDate))

    Thanks!





    Basic Member






    --
    7/25/2018 4:30 AM
    Try using the following notation:

    @foreach (var item in Model.Products.OrderBy([h]i => i.CreationDate[/h]))





    Veteran Member






    --
    8/13/2018 1:16 PM
    ^^^ What Reto said. :)
    Will Strohl, Upendo Ventures Hotcakes Cloud | Get Support | Code Support Official Cloud & Support provider for Hotcakes
    You are not authorized to post a reply.
    Page 1 of 212 > >>


    Loading
    • Sign-up for the Hotcakes Community Newsletter: