etek14 Posted December 15, 2007 Posted December 15, 2007 Just installed latest version of Product Listing in Columns 2.2.2, I have "Display add multiples column" selected in the Admin configuration. If I have 5 or more attributes selectable for a product, it will list my product in columns fine but will have multiple qty and attribute selection drop down boxes for the same product. If the product it is listing has 4 or less attributes it displays just 1 qty and drop down box for that product like it should. Has anyone run into this problem? Quote
Jan Zonjee Posted December 15, 2007 Posted December 15, 2007 Just installed latest version of Product Listing in Columns 2.2.2, I have "Display add multiples column" selected in the Admin configuration. If I have 5 or more attributes selectable for a product, it will list my product in columns fine but will have multiple qty and attribute selection drop down boxes for the same product. If the product it is listing has 4 or less attributes it displays just 1 qty and drop down box for that product like it should. Has anyone run into this problem? I have seen that question before once and I don't remember if it was solved. As your post now it was not posted in the thread so very hard to find back. Does this query (change the 1 for the products_id for the one with more than 5 or more attributes and perhaps another language_id) give the correct number: select distinct popt.products_options_id, popt.products_options_name from products_options popt, products_attributes patrib where patrib.products_id='1' and patrib.options_id = popt.products_options_id and popt.language_id = '1'; Also check the column_list variable by adding at the bottom of index.php: <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <?php echo ' <!-- '; print_r($column_list); print ' --> '; ?> <br> </body> You will see and ARRAY in the source code of the page (it is between HTML comment tags). Quote
etek14 Posted December 15, 2007 Author Posted December 15, 2007 I added the code to index.php and the array has items listed [0],[1],[2],[3] which I assume is normal. The problem seems to be when the number of values in the drop down box is 5 or more. It seems to list multiple drop boxes and qty selections for that product. I have included some html source from one of my product pages. If you'll notice the first two are fine but product ID 153 is listing 3 boxes for the same product when there should be 1. <tr class="productListing-odd"> <td align="center" valign="top" class="productListing-data" width="33%"> <select name="id_128[1]"><option value="6">amber</option><option value="3">red/amber</option><option value="2"........ <td align="center" valign="top" class="productListing-data" width="33%"> <a href="http:................. <select name="id_120[1]"><option value="6">amber</option><option value="5">red/white/red .................... <td align="center" valign="top" class="productListing-data" width="33%"> ................ <select name="id_153[1]"><option value="10">red/white/red/white (+$138.00)</option><option value="9"............ <select name="id_153[1]"><option value="10">red/white/red/white (+$138.00)</option><option value="9"............ <select name="id_153[1]"><option value="10">red/white/red/white (+$138.00)</option><option value="9"............ </tr> Quote
Jan Zonjee Posted December 15, 2007 Posted December 15, 2007 I added the code to index.php and the array has items listed [0],[1],[2],[3] which I assume is normal.The problem seems to be when the number of values in the drop down box is 5 or more. It seems to list multiple drop boxes and qty selections for that product. I have included some html source from one of my product pages. If you'll notice the first two are fine but product ID 153 is listing 3 boxes for the same product when there should be 1. <tr class="productListing-odd"> <td align="center" valign="top" class="productListing-data" width="33%"> <select name="id_128[1]"><option value="6">amber</option><option value="3">red/amber</option><option value="2"........ <td align="center" valign="top" class="productListing-data" width="33%"> <a href="http:................. <select name="id_120[1]"><option value="6">amber</option><option value="5">red/white/red .................... <td align="center" valign="top" class="productListing-data" width="33%"> ................ <select name="id_153[1]"><option value="10">red/white/red/white (+$138.00)</option><option value="9"............ <select name="id_153[1]"><option value="10">red/white/red/white (+$138.00)</option><option value="9"............ <select name="id_153[1]"><option value="10">red/white/red/white (+$138.00)</option><option value="9"............ </tr> What happens if you change: for ($n = 0; $n < count($products_options); $n++) { $products_options_array[] = array('id' => $products_options[$n]['products_options_values_id'], 'text' => $products_options[$n]['products_options_values_name']); if ($products_options[$n]['options_values_price'] != '0') { $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options[$n]['price_prefix'] . $currencies->display_price($products_options[$n]['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') '; } } To: for ($n = 0; $n < count($products_options); $n++) { $options_text = ''; // make it empty again $options_text = $products_options[$n]['products_options_values_name']; if ($products_options[$n]['options_values_price'] != '0') { $options_text .= ' (' . $products_options[$n]['price_prefix'] . $currencies->display_price($products_options[$n]['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') '; } $products_options_array[] = array('id' => $products_options[$n]['products_options_values_id'], 'text' => $options_text); } I can't replicate the failure, but this at least gives the same output and doesn't use sizeof($products_options_array)-1] which perhaps introduces the error? Quote
Jan Zonjee Posted December 15, 2007 Posted December 15, 2007 Actually, make that: for ($n = 0; $n < count($products_options); $n++) { $options_text = ''; // make it empty again $options_text = $products_options[$n]['products_options_values_name']; if ($products_options[$n]['options_values_price'] != '0') { $options_text .= ' (' . $products_options[$n]['price_prefix'] . $currencies->display_price($products_options[$n]['options_values_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) .') '; } $products_options_array[] = array('id' => $products_options[$n]['products_options_values_id'], 'text' => $options_text); } $product_info['products_tax_class_id'] will always be empty... Quote
etek14 Posted December 16, 2007 Author Posted December 16, 2007 Thanks for your time checking this, I tried the code above and got the same results. If I set the "display attributes column" in admin to 3 instead of 4 and set "display product price" to 4 then the price is displayed multiple times instead but only when the product contains 1 option with more than 4 attributes (ie. option "color" with attributes "blue","red",.....more than 4) I tried to diagnose the problem more and it seems if you have *only one* option that contains multiple attributes,for example option "color" that contains more than 4 atrributes such as "blue","red", etc is when the loop occurs. If I have two options such as "color" and "size" the problem goes away. I looked at the code and Cannot determine is it is an "IF" statement or Variable setting. Quote
Jan Zonjee Posted December 16, 2007 Posted December 16, 2007 Thanks for your time checking this, I tried the code above and got the same results. If I set the "display attributes column" in admin to 3 instead of 4 and set "display product price" to 4 then the price is displayed multiple times instead but only when the product contains 1 option with more than 4 attributes (ie. option "color" with attributes "blue","red",.....more than 4) I tried to diagnose the problem more and it seems if you have *only one* option that contains multiple attributes,for example option "color" that contains more than 4 atrributes such as "blue","red", etc is when the loop occurs. If I have two options such as "color" and "size" the problem goes away. I looked at the code and Cannot determine is it is an "IF" statement or Variable setting. Excellent (in a way), I can now see the error too. Don't know what's causing it (yet hopefully) but it makes it a bit easier to look for a solution. Quote
Jan Zonjee Posted December 16, 2007 Posted December 16, 2007 OK, it seems that the double use of $n in the code is the problem. If I change the $n to $v everything goes back to normal: for ($v = 0; $v < count($products_options); $v++) { $options_text = ''; // make it empty again $options_text = $products_options[$v]['products_options_values_name']; if ($products_options[$v]['options_values_price'] != '0') { $options_text .= ' (' . $products_options[$v]['price_prefix'] . $currencies->display_price($products_options[$v]['options_values_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) .') '; } $products_options_array[] = array('id' => $products_options[$v]['products_options_values_id'], 'text' => $options_text); } This can be found twice in the code: once for case 'PRODUCT_LIST_BUY_NOW_MULTIPLE': and once for case 'PRODUCT_LIST_MULTIPLE': Tricky... Quote
etek14 Posted December 16, 2007 Author Posted December 16, 2007 Excellent, that did the trick. Many thanks for the prompt help....... Quote
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.
Note: Your post will require moderator approval before it will be visible.