violinman Posted September 3, 2018 Share Posted September 3, 2018 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 More sharing options...
havenswift-hosting Posted September 3, 2018 Share Posted September 3, 2018 Take a look at https://www.cubecart.com/extensions/plugins/enhanced-sorting - does that and a lot more all via a plugin Link to comment Share on other sites More sharing options...
violinman Posted September 3, 2018 Author Share Posted September 3, 2018 Hello, that looks interesting but it does not specifically mention having the ability to sort Featured Products! Brian Link to comment Share on other sites More sharing options...
bsmither Posted September 3, 2018 Share Posted September 3, 2018 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 More sharing options...
violinman Posted September 3, 2018 Author Share Posted September 3, 2018 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 More sharing options...
bsmither Posted September 3, 2018 Share Posted September 3, 2018 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 More sharing options...
violinman Posted September 3, 2018 Author Share Posted September 3, 2018 Yes Product Code. I will check the file you mention. Many thanks, Brian Link to comment Share on other sites More sharing options...
violinman Posted September 10, 2018 Author Share Posted September 10, 2018 Another question if you don't mind. I would also like to look into how the "Latest Products" are fetched, it seems to be high stock numbers to low but would like to reverse that. Will I find the code for that in the same ui.class.php file? Thanks, Brian Link to comment Share on other sites More sharing options...
bsmither Posted September 10, 2018 Share Posted September 10, 2018 The Latest Products query is found in the CubeCart class, public function displayHomePage(). The query asks for a recordset sorted by 'date_added' descending. Link to comment Share on other sites More sharing options...
violinman Posted September 10, 2018 Author Share Posted September 10, 2018 Thanks Bsmither, that is great, I can make a small change so that it does what I want. Brian Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.