Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Oct 2009
    Posts
    298
    Plugin Contributions
    0

    Default Sort Order Of New Products On Main Page

    Hi,

    I am looking to change the sort order for the New Products that display on the Main Page and have tried changing this through Admin-> Config->New Listing without any success.

    I am assuming this needs to be coded in to a .php file. Would someone be able to point me to which file to change and the code necessary to display these products in a date added descending order?

    Thank you in advance for your help!

  2. #2
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,703
    Plugin Contributions
    123

    Default Re: Sort Order Of New Products On Main Page

    To confirm: you're using the new products centerbox on the home page (You have Admin >Configuration > Index Listing > Show New Products on Main Page set to a non-zero value) and you want to change the order in which these products are sorted - correct?

    What template are you using?
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  3. #3
    Join Date
    Oct 2009
    Posts
    298
    Plugin Contributions
    0

    Default Re: Sort Order Of New Products On Main Page

    Thanks for your reply swguy!

    Yes, I am using the standard default zen cart of v.1.5.8 and in Admin->Config->Index Listing->Show New Products on Main Page is set to 1.

    Yes, you are correct that I would like to change the order in which the products are sorted in this New Products area on the home page. It currently is sorting as random and I would like to sort them as date added descending.

    Thanks for your help!

  4. #4
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,703
    Plugin Contributions
    123

    Default Re: Sort Order Of New Products On Main Page

    Still need your template - is it bootstrap or something else?
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  5. #5
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,694
    Plugin Contributions
    9

    Default Re: Sort Order Of New Products On Main Page

    ok, not the easiest thing to do but not the hardest either.

    copy from:

    includes/modules/new_products.php

    to:

    includes/modules/YOUR_TEMPLATE/new_products.php

    this copied file is the one you want to modify.

    now, i will use this file as a template to show you lines to add and modify.

    https://github.com/zencart/zencart/b...w_products.php

    PHP Code:
    // right after line 17 add:
    $order_by ' ORDER BY p.products_date_added DESC ';

    // modify line 27 to:
    AND p.products_status " . $display_limit . $order_by;

    //modify line 41 to:
    AND p.products_id IN (" 
    $list_of_products ") . $order_by " ;

    // modify line 47 to:
    $new_products $db->Execute($new_products_queryMAX_DISPLAY_NEW_PRODUCTS);

    //modify line 93 to:
    $new_products->MoveNext(); 
    best.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  6. #6
    Join Date
    Oct 2009
    Posts
    298
    Plugin Contributions
    0

    Default Re: Sort Order Of New Products On Main Page

    Hi swguy,

    I am using the Default Template on my site so the files used are the standards that come stock with v.1.5.8

    Thanks!

  7. #7
    Join Date
    Oct 2009
    Posts
    298
    Plugin Contributions
    0

    Default Re: Sort Order Of New Products On Main Page

    Thank you for your help carlwhat!

    I appreciate your detailed coding you have given and I will make these changes later today.

    Thanks again....much appreciated!

  8. #8
    Join Date
    Oct 2009
    Posts
    298
    Plugin Contributions
    0

    Default Re: Sort Order Of New Products On Main Page

    Thanks again for your help carlwhat! I just applied this coding and it works perfectly......just what I was trying to achieve.

    Very much appreciate your help!

  9. #9
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,694
    Plugin Contributions
    9

    Default Re: Sort Order Of New Products On Main Page

    Quote Originally Posted by NWCE View Post
    Thanks again for your help carlwhat! I just applied this coding and it works perfectly......just what I was trying to achieve.

    Very much appreciate your help!
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  10. #10
    Join Date
    Oct 2009
    Posts
    298
    Plugin Contributions
    0

    Default Re: Sort Order Of New Products On Main Page

    Hi carlwhat,

    I had one minor bug crop up with this sort order change. Here is the Debug error:

    PHP Fatal error: 1064:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '. ORDER BY p.products_date_added DESC LIMIT 50' at line 6 :: SELECT DISTINCT p.products_id, p.products_image, pd.products_name, p.products_price, p.master_categories_id
    FROM zen_products p, zen_products_description pd
    WHERE p.products_id = pd.products_id
    AND pd.language_id = 1
    AND p.products_status = 1
    AND p.products_id IN (2476,2477,2478,2479,2480,2481,2482,2483,2484,2485,2486,2487,2488,2489) . ORDER BY p.products_date_added DESC LIMIT 50 ==> (as called by) /shop/includes/modules/customname/new_products.php on line 48 <== in /shop/includes/classes/db/mysql/query_factory.php on line 667.

    In Admin-> Config I have set the Max Number of New Products to Show On Main Page to 50....whereas I only have 14 to show.

    Any ideas why it is throwing this error??

    Thanks.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v139h Product sort order on New Products Page not working
    By jmsnyder23 in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 4 Aug 2014, 02:34 PM
  2. Sort Order not functioning for "Featured Products" on main page of ver 1.5.0
    By sjdeines in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 8 Jan 2014, 06:51 PM
  3. New Products Sort Order on Index Page, Question.
    By blackcap76 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 5 May 2011, 02:52 AM
  4. Change sort order in new products box on index.php page
    By jolewin in forum Customization from the Admin
    Replies: 2
    Last Post: 28 Mar 2011, 05:11 AM
  5. Change default sort order for New Products page?
    By properform in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 1 Feb 2008, 08:34 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR