jeking928 / Dual-Pricing-OLD

Dual Pricing 2.1.5 For Zen Cart 1.5.x
Other
0 stars 0 forks source link

Attribute wholesale pricing does not work past the first level #1

Open jeking928 opened 9 years ago

jeking928 commented 9 years ago

Reported in the forum (link below), pricing beyond the first level for attributes does not work correctly. Additional pricing levels display correctly on the product page but adding to cart always results in the first level pricing being applied.

http://www.zen-cart.com/showthread.php?35450-DUAL-Pricing-v2&p=1270594#post1270594

mrjingguo commented 9 years ago

There are about 3 or 4 "$options_value_price" codes need to be replace.)

Find

if ($customer_check->fields['customers_whole'] != "0") {
            $i = $customer_check->fields['customers_whole'];
            $i--;           
            $options_value_price = (float)$attribute_price->fields['options_values_price_w'];   
               } else {
          $options_value_price = $attribute_price->fields['options_values_price'];
        }
}

replace with:

if ($customer_check->fields['customers_whole'] != "0") {
            $i = $customer_check->fields['customers_whole'];
            $i--;           
            // Jing fix the bug
            //$options_value_price = (float)$attribute_price->fields['options_values_price_w'];
            $option_price_array = $attribute_price->fields['options_values_price_w'];
            $optionprice = explode(",",$option_price_array);
            $options_values_price = (float)$optionprice[$i];

            if ($options_values_price==''){
            $options_values_price = (float)$optionprice[0];
            }
        } else {
          $options_value_price = $attribute_price->fields['options_values_price'];
        }

I think there is only one of "$new_attributes_price " code need to be fix

if ($customer_check->fields['customers_whole'] != "0") { 

              // Jing Fix the bug
              //$new_attributes_price = zen_get_discount_calc($product->fields['products_id'], $attribute_price->fields['products_attributes_id'], $attribute_price->fields['options_values_price_w'], $qty); 

              $option_price_array = $attribute_price->fields['options_values_price_w'];
              $optionprice = explode(",",$option_price_array);
              $options_values_price = (float)$optionprice[$i];

              if ($options_values_price==''){
                $options_values_price = (float)$optionprice[0];
              }

             $new_attributes_price = zen_get_discount_calc($product->fields['products_id'], $attribute_price->fields['products_attributes_id'], $options_values_price, $qty); 
}
jeking928 commented 9 years ago

Thank you mrJingGuo. I'll incorporate and test your suggestion.

jeking928 commented 9 years ago

While the attribute pricing displays correctly on the product page, once adding to cart the attribute levels do not work correctly. As such, this issue is still open.