joehcc Posted February 10, 2009 Share Posted February 10, 2009 Hello. I need help with sorting the product options names in the shopping cart. Right now I manually sort my product option names manually in product_info.php by updating a column in my product options table called "sort order". I sort my sql query on this column when I pull for product_info.php. Works great! However, this sort order is not maintained in the "shopping_cart.php" page. I have hacked into shopping_cart.php and cannot figure out how to sort since it seems like the product and attributes are pulled from somewhere within classes -> shopping_cart.php. I kind of get most of what is going on here, but this one has me really stumped!!! If there is a contrib that focuses on maintaining the product name sort in the shopping cart that would be great. Or if you can help me sort this out that would be great: I thought sorting on this query in shopping_cart.php would do it, (see my attempt) but I believe this query is run to find attributes for each product option name, not to sort the overall product options - must be upstream of this right? $attributes = tep_db_query("select popt.products_options_name, popt.sort_order, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . (int)$products[$i]['id'] . "' and pa.options_id = '" . (int)$option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int)$value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int)$languages_id . "' and poval.language_id = '" . (int)$languages_id . "' order by popt.sort_order"); Lastly I think it might be here : $products = $cart->get_products(); but get_products seems to only pull from products array. Need to figure out how to sort this array! Let me know if you have any ideas!!!!! -Joe Link to comment Share on other sites More sharing options...
spooks Posted February 10, 2009 Share Posted February 10, 2009 The customers cart is stored in its own table, you need to look at that. Study the shopping cart class & I think you will see your way Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
joehcc Posted February 11, 2009 Author Share Posted February 11, 2009 The customers cart is stored in its own table, you need to look at that. Study the shopping cart class & I think you will see your way Sam thanks - maybe you can shed some light on what I discovered. It looks like the shopping cart class get the attributes from some global var or something. It inserts everything into the cart - I see that - but I cannot figure out where it gets the stuff to insert it into the cart. Make sense? I think I need to sort the stuff before it gets into the cart. Am I right that the add to cart function is what essentially adds the new posted global data to the cart? Just need a tip on how I can sort this posted global data - or if I am on the right track.... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.