Guest jgislermn Posted September 29, 2011 Share Posted September 29, 2011 Hi, I am trying to figure out how to get my products to soft by price (high to low) by default. Any ideas? Thanks Much, Jen :) Quote Link to comment Share on other sites More sharing options...
Guest truebrit1002 Posted October 1, 2011 Share Posted October 1, 2011 Hi, I am trying to figure out how to get my products to soft by price (high to low) by default. Any ideas? Thanks Much, Jen Hi, I've been looking into this too as I wanted to order by Catalogue ID (ie a custom order based around manufacturer's products). It seems as if it's really easy in CC5. Go to the file \classes\catalogue.class.php and find line 616. I changed 'name' to 'cat_id', but you should change it to 'price'. Then save. You should notice the sort function will list products by the column you've specified. Does that sound correct to everyone else (Cubecart guys?). I would hate to recommend a fix that isn't correct, but it sems to work for me. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted October 1, 2011 Share Posted October 1, 2011 Hi, I am trying to figure out how to get my products to soft by price (high to low) by default. Any ideas? Thanks Much, Jen Hi, I've been looking into this too as I wanted to order by Catalogue ID (ie a custom order based around manufacturer's products). It seems as if it's really easy in CC5. Go to the file \classes\catalogue.class.php and find line 616. I changed 'name' to 'cat_id', but you should change it to 'price'. Then save. You should notice the sort function will list products by the column you've specified. Does that sound correct to everyone else (Cubecart guys?). I would hate to recommend a fix that isn't correct, but it sems to work for me. I tried to use your hint to sort by in stock by default, but it doesn't seem to have worked. $order['quantity'] = 'DESC'; Quote Link to comment Share on other sites More sharing options...
Guest truebrit1002 Posted October 1, 2011 Share Posted October 1, 2011 Hi, I am trying to figure out how to get my products to soft by price (high to low) by default. Any ideas? Thanks Much, Jen Hi, I've been looking into this too as I wanted to order by Catalogue ID (ie a custom order based around manufacturer's products). It seems as if it's really easy in CC5. Go to the file \classes\catalogue.class.php and find line 616. I changed 'name' to 'cat_id', but you should change it to 'price'. Then save. You should notice the sort function will list products by the column you've specified. Does that sound correct to everyone else (Cubecart guys?). I would hate to recommend a fix that isn't correct, but it sems to work for me. I tried to use your hint to sort by in stock by default, but it doesn't seem to have worked. $order['quantity'] = 'DESC'; I think you need to use $order['stock_level'] = 'DESC'; Quantity is usually "1" unless you've changed it. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted October 2, 2011 Share Posted October 2, 2011 Hi, I am trying to figure out how to get my products to soft by price (high to low) by default. Any ideas? Thanks Much, Jen Hi, I've been looking into this too as I wanted to order by Catalogue ID (ie a custom order based around manufacturer's products). It seems as if it's really easy in CC5. Go to the file \classes\catalogue.class.php and find line 616. I changed 'name' to 'cat_id', but you should change it to 'price'. Then save. You should notice the sort function will list products by the column you've specified. Does that sound correct to everyone else (Cubecart guys?). I would hate to recommend a fix that isn't correct, but it sems to work for me. I tried to use your hint to sort by in stock by default, but it doesn't seem to have worked. $order['quantity'] = 'DESC'; I think you need to use $order['stock_level'] = 'DESC'; Quantity is usually "1" unless you've changed it. I'll try that, but we only have one of each, so quantity should have sorted it. Quote Link to comment Share on other sites More sharing options...
Guest truebrit1002 Posted October 2, 2011 Share Posted October 2, 2011 $order['quantity'] = 'DESC'; Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted October 2, 2011 Share Posted October 2, 2011 LOL! Our Out of Stock items still show in the catalog on purpose (I assumed they would be quantity=0), but it would be better if they appeared at the end of the listings for someone who is browsing. We run a free Lost Toy Search Service, so if an item is out of stock we want to be able to help people find one somewhere else, or contact them when we get one back in stock. Since it worked so well for you I'll play with it some more using stock_level. THAT WORKED!! Thanks for the feedback!! Quote Link to comment Share on other sites More sharing options...
Guest truebrit1002 Posted October 4, 2011 Share Posted October 4, 2011 LOL! Our Out of Stock items still show in the catalog on purpose (I assumed they would be quantity=0), but it would be better if they appeared at the end of the listings for someone who is browsing. We run a free Lost Toy Search Service, so if an item is out of stock we want to be able to help people find one somewhere else, or contact them when we get one back in stock. Since it worked so well for you I'll play with it some more using stock_level. THAT WORKED!! Thanks for the feedback!! Glad to help. However I now realize that we should really be making amendments to the Cubecart code using PHP hooks. So I'll see if I can get it to do the same thing using one of these. Then you won't have to edit the existing code every time an update comes along! Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted October 4, 2011 Share Posted October 4, 2011 LOL! Our Out of Stock items still show in the catalog on purpose (I assumed they would be quantity=0), but it would be better if they appeared at the end of the listings for someone who is browsing. We run a free Lost Toy Search Service, so if an item is out of stock we want to be able to help people find one somewhere else, or contact them when we get one back in stock. Since it worked so well for you I'll play with it some more using stock_level. THAT WORKED!! Thanks for the feedback!! Glad to help. However I now realize that we should really be making amendments to the Cubecart code using PHP hooks. So I'll see if I can get it to do the same thing using one of these. Then you won't have to edit the existing code every time an update comes along! That would be fantastic! I know the Hooks are important, but I haven't a clue how to make use of that process. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted October 5, 2011 Share Posted October 5, 2011 I found this today while searching for Hooks info: http://helpdocs.info/ACP:Hooks Quote Link to comment Share on other sites More sharing options...
Guest jgislermn Posted October 10, 2011 Share Posted October 10, 2011 For the life of me, I cannot figure out why this sorting is not working. Here is the code from the catalogue.class.php file...... Any ideas? if (($result = $GLOBALS['db']->query('SELECT I.product_id FROM `'.$GLOBALS['config']->get('config', 'dbprefix').'CubeCart_category_index` as I, `'.$GLOBALS['config']->get('config', 'dbprefix').'CubeCart_inventory` as INV WHERE I.cat_id = '.$category_id.' AND I.product_id = INV.product_id AND INV.status = 1')) !== false) { $this->_category_count = $GLOBALS['db']->numrows(); if (isset($_GET['sort']) && is_array($_GET['sort'])) { foreach ($_GET['sort'] as $field => $direction) { $order[$field] = (strtolower($direction) == 'asc') ? 'ASC' : 'DESC'; break; } } else { $order['price'] = 'DESC'; } foreach ($result as $product) { $list[] = $product['product_id']; } foreach ($GLOBALS['hooks']->load('class.catalogue.category_product_list') as $hook) include $hook; $productList = $this->getProductData($list, 1, $order, $per_page, $page, true); } return (isset($productList) && is_array($productList)) ? $productList : false; } 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.