keat Posted September 7, 2016 Share Posted September 7, 2016 My boss wants the homepage to include all latest products, which is straight forward enough. However, I've complained that it looks diluted, cluttered and quite frankly amateurish. Is there a way to maybe display only 6 latest products, but have these appear randomly. I found a thread whereby the OP achieved this with a mod in includes/content/index.inc.php, but this was for V3. In V6 I'm guessing its in cubecart.class.php ?? if ($GLOBALS['config']->get('config', 'catalogue_latest_products')) { $latestProducts = $GLOBALS['db']->select('CubeCart_inventory', false, $where, array('date_added' => 'DESC', 'product_id' => 'DESC'), (int)$GLOBALS['config']->get('config', 'catalogue_latest_products_count')); if ($latestProducts) { foreach ($latestProducts as $product) { $category_data = $GLOBALS['catalogue']->getCategoryStatusByProductID($product['product_id']); $category_status = false; if (is_array($category_data)) { foreach ($category_data as $trash => $data) { if ($data['status'] == 1) { $category_status = true; Rather than a full blown mod, could this be achieved with a small code change? Quote Link to comment Share on other sites More sharing options...
havenswift-hosting Posted September 7, 2016 Share Posted September 7, 2016 You can very easily achieve that using one part of our Enhanced Sorting plugin https://www.cubecart.com/extensions/plugins/enhanced-sorting which allows you to choose exactly which products you want to display and in what order. Which products are chosen in what order can easily be changed by a simple drag and drop so can be changed whenever you want In addition you will get a lot of other sorting functionality that comes with the plugin Ian Quote Link to comment Share on other sites More sharing options...
keat Posted September 7, 2016 Author Share Posted September 7, 2016 I found this which I'm toying with. in classes/cubecart.class.php changing $GLOBALS['smarty']->assign('LATEST_PRODUCTS', $products); To: $lp_rand_keys = array_rand($products, 6); // Make sure there are 3 or more 'featured' products foreach ($lp_rand_keys as $rand_key) $lp_rand_products[$rand_key] = $products[$rand_key]; $products = $lp_rand_products; $GLOBALS['smarty']->assign('LATEST_PRODUCTS', $products); Seems to do exactly what I wanted to achieve, now I just need to demo this to the team. What's betting they make me roll back ?? 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.