Jump to content

Sorting Featured Product


violinman

Recommended Posts

Hello, I would like to set the ascending, descending order that Cubecart uses to decide which "Featured Product" to display, currently it seems to pick from the higher stock numbers but would prefer to change that to lower. 

I am running Cubecart 6.1.7 with Galaxy X skin.

If you could tell me which file that feature will be in I can then hopefully sort it!

Thanks,

Brian

Link to comment
Share on other sites

Unless the Galaxy X skin, or your installation of CC617 has an extension which gives more, there is only one product shown in the Featured Product box, and that product is randomly chosen from a collection of products that have the "Include in featured products" property checked (as well as status=checked and the product has any assigned category status=checked and not hidden).

So, if you perceive these products that are showing are among those with higher stock levels, then perhaps those are the majority of those products so checked.

Checking the "Include in featured products" property is an administrative decision. It is up to you to decide how you want to skew the collection of eligible products.

Link to comment
Share on other sites

Hi Bsmither,

thank you for your response, the bit you mention that is of interest is that you say the product "is randomly chosen" could you please tell me in which file that piece of code is?

I have perhaps 30 or so products that have the "include in featured properties checked" when I say stock numbers I am not referring to quantity as I only have one of each, I am referring to the number assigned to that product, "stock number" they cover a range from 01 to 170 and it does seem to be mostly the high stock numbers that appear but as you say maybe I have more products in the higher numbers.

Brian

Link to comment
Share on other sites

Would that be the "Product Code"? Otherwise, on the admin's Add/Edit Product screens, what text entry field would you be refering to for your 'stock number'? Or would this be the database table's "product_id" column?

Please review the file /classes/gui.class.php, private function _displayRandomProduct(), near line 1200.

About 15 lines later:

After querying for a collection of records where 'status'=1 and 'featured'=1,
the recordset is in an array. This statement randomly chooses one element
out of that array.

$random_id = $featured_products[mt_rand(0, $n - 1)]['product_id'];

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...