Guest hafree Posted August 14, 2006 Share Posted August 14, 2006 I am currently setting up a store that will primarily sell t-shirts, and had a few questions regarding options. First, the options I am using are sizes: XS, S, M, L, XL, XXL. Is there a way to have it list these values in this order, rather than sorting them alphabetically? From a customer's perspective, it just seems to make more sense to list the sizes in size order. Secondly, is it possible to track inventory levels including options? If I have 5 available in each of 6 sizes, I don't have a total of 30 items in stock - I actually have 5 in stock of 6 items. It seems silly to have to list them as separate items, but I didn't see a way to track inventory this way. Am I missing something here? Quote Link to comment Share on other sites More sharing options...
roban Posted August 14, 2006 Share Posted August 14, 2006 I had the same situation when I was selling Tshirts and if memory serves me I adjusted the order of options in the database. As for your stock question, there is a mod by Estelle at cubecart.org stock levels for product options that will serve your needs. It goes well with another mod quick edit product options. Quote Link to comment Share on other sites More sharing options...
Guest hafree Posted August 14, 2006 Share Posted August 14, 2006 I had the same situation when I was selling Tshirts and if memory serves me I adjusted the order of options in the database. As for your stock question, there is a mod by Estelle at cubecart.org stock levels for product options that will serve your needs. It goes well with another mod quick edit product options. Awesome, thank you very much for your help. I'll definitely look into that mod this evening. Regarding the options ordering, what do you mean when you say you had to adjust their order in the database - did you have to modify SQL query to not use ORDER BY, or was it just a matter of manually editing the database contents to put them into the right order? Thanks again for your help. Quote Link to comment Share on other sites More sharing options...
roban Posted August 14, 2006 Share Posted August 14, 2006 I think I ordered them the way I wanted them in the database. The other thing that comes to mond is that CC by default orders things alphabetically. In skins/your skin/styleTemplates/content/viewProd.tpl look at about line 42 <option value="{VAL_ASSIGN_ID}"> You can try changing this to <option value="{VAL_OPTION_ID}"> Assuming you've entered them in the correct order. Quote Link to comment Share on other sites More sharing options...
Guest hafree Posted August 15, 2006 Share Posted August 15, 2006 Unfortunately, that didn't do the trick. However, I took some time to dig into the code, and simply changed the ORDER BY clause to use the value_id or assign_id as its first sort key. Now the options appear sorted in the order they were created or assigned! Thanks again for the help. Here are the details of this mod: In includes/content/viewProd.inc.php, line 155, I changed the ORDER BY clause from: ORDER BY option_name, value_name ASC To: ORDER BY value_id, option_name, value_name ASC This will display the options in the order they were created. Alternatively, I could have changed it to: ORDER BY assign_id, option_name, value_name ASC to display the options in the order they were assigned, which would allow the same options to be re-ordered for different items. Quote Link to comment Share on other sites More sharing options...
roban Posted August 15, 2006 Share Posted August 15, 2006 Easy fix. Quote Link to comment Share on other sites More sharing options...
Guest foreknowapparel Posted March 31, 2007 Share Posted March 31, 2007 Awesome, this worked great. Quote Link to comment Share on other sites More sharing options...
Guest despeaux Posted December 29, 2007 Share Posted December 29, 2007 THANK YOU!!! You saved me a lot of headache. :) Quote Link to comment Share on other sites More sharing options...
Guest cyrilthemonkey Posted September 5, 2008 Share Posted September 5, 2008 If anybody is browsing the forum archives and needs a fix for the new version of CC, go onto viewProd.inc.php and find the: ## Build SQL for product options $query = sprintf("SELECT B.*, T.option_name, T.option_type, M.value_name FROM %1\$sCubeCart_options_bot AS B LEFT JOIN %1\$sCubeCart_options_mid AS M ON B.value_id = M.value_id, %1\$sCubeCart_options_top AS T WHERE B.option_id = T.option_id AND B.product = %2\$d ORDER BY T.option_name ASC", $glob['dbprefix'], $_GET['productId']); $options = $db->select($query); and replace with: ## Build SQL for product options $query = sprintf("SELECT B.*, T.option_name, T.option_type, M.value_name FROM %1\$sCubeCart_options_bot AS B LEFT JOIN %1\$sCubeCart_options_mid AS M ON B.value_id = M.value_id, %1\$sCubeCart_options_top AS T WHERE B.option_id = T.option_id AND B.product = %2\$d ORDER BY M.value_id, T.option_name ASC", $glob['dbprefix'], $_GET['productId']); $options = $db->select($query); You need to add M.value_id instead of the suggested value_id... I think it works anyway. Quote Link to comment Share on other sites More sharing options...
Guest alphonseha Posted September 9, 2009 Share Posted September 9, 2009 I tried digging through the forum but I can't find how to sort by price in CC3. I have tried this but it doesn't work. $query = "SELECT ".$glob['dbprefix']."CubeCart_options_bot.option_id, ".$glob['dbprefix']."CubeCart_options_bot.value_id, option_price, option_symbol, value_name, option_name, assign_id FROM `".$glob['dbprefix']."CubeCart_options_bot` INNER JOIN `".$glob['dbprefix']."CubeCart_options_mid` ON ".$glob['dbprefix']."CubeCart_options_mid.value_id = ".$glob['dbprefix']."CubeCart_options_bot.value_id INNER JOIN `".$glob['dbprefix']."CubeCart_options_top` ON ".$glob['dbprefix']."CubeCart_options_bot.option_id = ".$glob['dbprefix']."CubeCart_options_top.option_id WHERE product =".$db->mySQLSafe($_GET['productId'])." ORDER BY [b]option_price,[/b] option_name, value_name ASC"; The code in bold is what I added. Anybody have any ideas? Thanks 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.