Guest Posted July 13, 2011 Share Posted July 13, 2011 When i was running CC4 i had altered my includes/content/index.inc.php file, to Randomize my Latest Products on homepage, can anyone offer advice at which file I should be looking at in CC5 to achieve the same? Quote Link to comment Share on other sites More sharing options...
Guest hennaboy Posted July 14, 2011 Share Posted July 14, 2011 Cant find it myself. Wondering if the actual code for this is in the encoded index file :S Quote Link to comment Share on other sites More sharing options...
Guest Viola Posted August 29, 2011 Share Posted August 29, 2011 The code is in /classes/cubecart.class.php around line 72. The select function, if that's what you intend to modify, is in /classes/db/database.class.php around line 460. Quote Link to comment Share on other sites More sharing options...
bonhomie Posted November 27, 2011 Share Posted November 27, 2011 The code is in /classes/cubecart.class.php around line 72. The select function, if that's what you intend to modify, is in /classes/db/database.class.php around line 460. Please explain what code I need to change and where? Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted November 27, 2011 Share Posted November 27, 2011 Viola is the one who will know, but until she shows up to explain it, you might want to look at the end of this thread: random sales item directions Quote Link to comment Share on other sites More sharing options...
Guest Viola Posted November 30, 2011 Share Posted November 30, 2011 The line where the latest products get selected from the database is cubecart.class.php line 74; it looks like this: $latestProducts = $GLOBALS['db']->select('CubeCart_inventory', false, array('status' => '1', 'featured' => '1'), array('date_added' => 'DESC', 'product_id' => 'DESC'), (int)$GLOBALS['config']->get('config', 'catalogue_latest_products_count')); The variables getting passed to the select() function are $table, $columns, $where, $order, $maxRows. So what I'm assuming what you would need to do is change the order from DESC to RAND(). Replace "array('date_added' => 'DESC', 'product_id' => 'DESC')" with "'RAND()'" so the line looks like this: $latestProducts = $GLOBALS['db']->select('CubeCart_inventory', false, array('status' => '1', 'featured' => '1'), 'RAND()', (int)$GLOBALS['config']->get('config', 'catalogue_latest_products_count')); That should do the trick.... in theory. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.