RELinMontana Posted March 8, 2003 Posted March 8, 2003 Hi, I installed Attribute Sorter and Copier v5.1 per the readme file and tested it. Most things seem to work pretty well. The database lists the sort order of the attributes correctly and the copying attributes to another product works. However, the shopping cart doesn't list the attributes by the sort order. Here is the file: catalogincludeslanguagesenglishattributes_sorter.php <?php /* WebMakers.com Added: Attributes Sorter */ // Sorter for product_info.php define('PRODUCTS_OPTIONS_SORT_BY_PRICE','1'); // 1= sort by products_options_sort_order + name; 0= sort by products_options_sort_order + price // Categories Image and Name on product_info.php define('SHOW_CATEGORIES','1'); // 0= off 1=on ?> The problem can be viewed at: http://www.skin-protection.com/catalog/pro...?products_id=35 The order should follow the number of the color but doesn't. Any help will be greatly appriciated. Thanks!
Ajeh Posted March 8, 2003 Posted March 8, 2003 Guess I never thought to add a sort there ... :shock: It just picks them up as it finds them. I will have to look into that one.
Ajeh Posted March 8, 2003 Posted March 8, 2003 You have 1 attribute group ... what exactly do you want sorted here?
Ajeh Posted March 8, 2003 Posted March 8, 2003 Also if your numbers represent the sort order of the attributes in that one group, it does not look like you defined the sort order for them.
RELinMontana Posted March 8, 2003 Author Posted March 8, 2003 I did define the sort order in the Products Attributes area however it isn't displaying on the shopping cart. Also I added new attributes on http://www.skin-protection.com/catalog/pro...?products_id=35 so hopefully this problem will be more clear. We had this problem several months ago and user Attribute Sorter v4 to fix it. However we upgraded to a more recent snap shot and lost the fix. The Attribute copier is also going to be very useful once I get this working completely. Linda - thanks for the great improvement on OSCommerce! Rick
Ajeh Posted March 8, 2003 Posted March 8, 2003 Did you enter values in the attributes sort order on the products page? And when you say the shopping cart page do you mean if I add in 1 12 oz bottle then 1 6oz bottle that you want this sorted on shopping_cart.php? This sorts for product_info.php and is based on the attributes sort order set in the Admin and also groups by attribute name or attribute price for when there is not a sort order. So if I mark 6oz as 10 and 12oz as 20 and 24oz as 30 I would see them as: 6oz 12oz 24oz in the dropdown on product_info.php ... if this is loaded correctly. Also, make sure you are using v5.1 And note, this is not setup for MS1.
RELinMontana Posted March 8, 2003 Author Posted March 8, 2003 Did you enter values in the attributes sort order on the products page? I am not sure what the products page is. In the admin area there is a catagories/Products page but that has no sort info. And when you say the shopping cart page do you mean if I add in 1 12 oz bottle then 1 6oz bottle that you want this sorted on shopping_cart.php? No, I don?t care about that. If you go to http://www.skin-protection.com/catalog/pro...?products_id=35 there is a drop down box marked: Available Options: Size. It should list them by size, smallest to largest, but doesn't. This sorts for product_info.php and is based on the attributes sort order set in the Admin and also groups by attribute name or attribute price for when there is not a sort order. So if I mark 6oz as 10 and 12oz as 20 and 24oz as 30 I would see them as: 6oz 12oz 24oz in the dropdown on product_info.php ... if this is loaded correctly. This is precisely the problem. It does not sort the way you just described. I think I am getting close to explaining the problem. Also, make sure you are using v5.1 I am using v5.1 And note, this is not setup for MS1. Stupid question. What is MS1? I don't recognize that acronym. Thanks!
Ajeh Posted March 8, 2003 Posted March 8, 2003 If you do not have an attributes table in your categories.php in the admin when editing the files, then you did not fully install this add-on. There should be a table at the bottom of the product information with all of the attributes and check marks on the ones to use for this product and sort order values filled in for what order to sort them by. MS1 is basically the 02-17-2003 snapshot. It's more or less a starting point to base your updates on.
RELinMontana Posted March 8, 2003 Author Posted March 8, 2003 Ok - I checked the categories.php file and it does not have an attributes table. The catalog.php file does seem to be correctly updated though. That leads me to believe that a file related to it is missing. I have checked and rechecked your instructions and I am missing something but cannot see it. Do you have any idea which file is missing if the catagories.php file is correct? Do you have any idea when this will be set up for MS1? Just curious.
Ajeh Posted March 9, 2003 Posted March 9, 2003 If you have the Attributes Sorter and Copier v5.1 there should be multiple sections of code in the /admin/categories.php file with WebMakers.com Added and a section marked: ///////////////////////////////////////////////////////////////////// // BOF: WebMakers.com Added: Update Product Attributes and Sort Order // Update the changes to the attributes if any changes were made ///////////////////////////////////////////////////////////////////// // BOF: WebMakers.com Added: Update Product Attributes and Sort Order // Update the changes to the attributes if any changes were made // Update Product Attributes $rows = 0; $options_query = tep_db_query("select products_options_id, products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . $languages_id . "' order by products_options_name"); while ($options = tep_db_fetch_array($options_query)) { $values_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov, " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " p2p where pov.products_options_values_id = p2p.products_options_values_id and p2p.products_options_id = '" . $options['products_options_id'] . "' and pov.language_id = '" . $languages_id . "'"); while ($values = tep_db_fetch_array($values_query)) { $rows ++; // original $attributes_query = tep_db_query("select products_attributes_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . $products_id . "' and options_id = '" . $options['products_options_id'] . "' and options_values_id = '" . $values['products_options_values_id'] . "'"); $attributes_query = tep_db_query("select products_attributes_id, options_values_price, price_prefix, products_options_sort_order, product_attributes_one_time, products_attributes_weight, products_attributes_weight_prefix, products_attributes_units, products_attributes_units_price from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . $products_id . "' and options_id = '" . $options['products_options_id'] . "' and options_values_id = '" . $values['products_options_values_id'] . "'"); if (tep_db_num_rows($attributes_query) > 0) { $attributes = tep_db_fetch_array($attributes_query); if ($HTTP_POST_VARS['option'][$rows]) { if ( ($HTTP_POST_VARS['prefix'][$rows] <> $attributes['price_prefix']) || ($HTTP_POST_VARS['price'][$rows] <> $attributes['options_values_price']) || ($HTTP_POST_VARS['products_options_sort_order'][$rows] <> $attributes['products_options_sort_order']) || ($HTTP_POST_VARS['product_attributes_one_time'][$rows] <> $attributes['product_attributes_one_time']) || ($HTTP_POST_VARS['products_attributes_weight'][$rows] <> $attributes['products_attributes_weight']) || ($HTTP_POST_VARS['products_attributes_weight_prefix'][$rows] <> $attributes['products_attributes_weight_prefix']) || ($HTTP_POST_VARS['products_attributes_units'][$rows] <> $attributes['products_attributes_units']) || ($HTTP_POST_VARS['products_attributes_units_price'][$rows] <> $attributes['products_attributes_units_price']) ) { tep_db_query("update " . TABLE_PRODUCTS_ATTRIBUTES . " set options_values_price = '" . $HTTP_POST_VARS['price'][$rows] . "', price_prefix = '" . $HTTP_POST_VARS['prefix'][$rows] . "', products_options_sort_order = '" . $HTTP_POST_VARS['products_options_sort_order'][$rows] . "', product_attributes_one_time = '" . $HTTP_POST_VARS['product_attributes_one_time'][$rows] . "', products_attributes_weight = '" . $HTTP_POST_VARS['products_attributes_weight'][$rows] . "', products_attributes_weight_prefix = '" . $HTTP_POST_VARS['products_attributes_weight_prefix'][$rows] . "', products_attributes_units = '" . $HTTP_POST_VARS['products_attributes_units'][$rows] . "', products_attributes_units_price = '" . $HTTP_POST_VARS['products_attributes_units_price'][$rows] . "' where products_attributes_id = '" . $attributes['products_attributes_id'] . "'"); } } else { tep_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_attributes_id = '" . $attributes['products_attributes_id'] . "'"); } } elseif ($HTTP_POST_VARS['option'][$rows]) { tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES . " values ('', '" . $products_id . "', '" . $options['products_options_id'] . "', '" . $values['products_options_values_id'] . "', '" . $HTTP_POST_VARS['price'][$rows] . "', '" . $HTTP_POST_VARS['prefix'][$rows] . "', '" . $HTTP_POST_VARS['products_options_sort_order'][$rows] . "', '" . $HTTP_POST_VARS['product_attributes_one_time'][$rows] . "', '" . $HTTP_POST_VARS['products_attributes_weight'][$rows] . "', '" . $HTTP_POST_VARS['products_attributes_weight_prefix'][$rows] . "', '" . $HTTP_POST_VARS['products_attributes_units'][$rows] . "', '" . $HTTP_POST_VARS['products_attributes_units_price'][$rows] . "' )"); } } } // EOF: WebMakers.com Added: Update Product Attributes and Sort Order ///////////////////////////////////////////////////////////////////// If not, you do not have the code loaded right.
RELinMontana Posted March 13, 2003 Author Posted March 13, 2003 I got it figured out. I started from scratch and did it again It works great now. Thanks for all your help.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.