Jump to content
DarwinUK

Home Page Latest Products Listing

Recommended Posts

Hello Everyone.

I found this post which I was hoping would answer my question. Dirty Butter asked six questions, and the original poster wasnt actually building a site. But anyway Ive listed them  and my answers here. What Id really like to do is have the home page latest products listed alphabetically, rather than by when they were added.

1. What CC version are you on and what skin?
A. 6.2.2 -  Skin e-Shift Magenta

2. Is your install stock or has it been edited?
A. Not sure what he was asking, but Ive added products

3. What is your store url?
A. https://elvis-online.co.uk/shop/

4. Do you use Categories/subcategories?
A. Yes

5. How many products do you want on the homepage?
A. 16

6. Are you wanting to eliminate the Featured, Latest, Sale Items, and Popular sections?
A. No

Hope you can help.

Thanks

Phillip

Share this post


Link to post
Share on other sites

Question #2 is asking: have you made any changes to CubeCart's programming (aka codebase)? If not, then it is as if it came fresh off the factory floor and your installed CubeCart can be considered in "stock condition".

In /classes/cubecart.class.php:

Find near line 97:

$query = sprintf("SELECT I.* FROM `%1\$sCubeCart_inventory` AS I JOIN `%1\$sCubeCart_category` AS C ON C.cat_id=I.cat_id AND C.`status`=1 AND $where ORDER BY I.date_added DESC, I.product_id DESC", $GLOBALS['config']->get('config', 'dbprefix'));

Change to:

$query = sprintf("SELECT I.* FROM `%1\$sCubeCart_inventory` AS I JOIN `%1\$sCubeCart_category` AS C ON C.cat_id=I.cat_id AND C.`status`=1 AND $where ORDER BY I.name ASC, I.date_added DESC, I.product_id DESC", $GLOBALS['config']->get('config', 'dbprefix'));

Have CubeCart clear its internal cache.

This will now sort on the product's name. If two or more products have the same name, then those will be sorted by the most recent date added, and if that still gets two or more of the same, then those get sorted by which was added last.

Edited by bsmither

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...