Jump to content

Archived

This topic is now archived and is closed to further replies.

radhavallabh

Adding Product weight to Attributes Latest CE version

Recommended Posts

Hi

I have incorporated more product weight addon into latest CE version-

It working great with 2.3.4 now I am installing it to 2.3.4 CE Edge latest version.

But a small issue is not fixing all the tried so much so help would be deeply appreciated.

Below code is edited and added to - cm_pi_options_attributes.php..

It starts working but all weights of the option get duplicated to the one below it attaching screenshot.

 $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.options_values_weight, pa.weight_prefix from products_attributes pa, products_options_values pov where pa.products_id = '" . (int)$_GET['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "' order by pa.products_options_sort_order");
          while ($products_options = tep_db_fetch_array($products_options_query)) {
            $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
            if ($products_options['options_values_price'] != '0') {
              $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
            }
			 if (PRODUCT_LIST_WEIGHT > 0) {
            if ($products_options['options_values_weight'] != '0') {
              if (!empty($products_options_infotext)) {
                $products_options_infotext .= '; ';
              }
              $products_options_infotext .= $products_options['weight_prefix'] . $products_options['options_values_weight'] . TEXT_PRODUCT_WEIGHT_UNIT;
            }
          }
          if (!empty($products_options_infotext)) {
          $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options_infotext . ')';
       }
          }

The options appear like below-

4 inch idol

6 inch idol +6USD , 0.020kg

8 inch idol +17 USD, 0.020kg + 0.030kg

10 inch idol +20 USD 0.020kg + 0.030kg + 0.050kg

Whereas only the last weight option should be shown leaving out the weight of the previous option.

Help will be deeply appreciated;

Thanks in advance

Warm Regds./

radhavallabh

Share this post


Link to post
Share on other sites

×