istraxx_customsize plugin returning wrong weight or price

If you are runnig Joomla 3.x and Virtuemart 3.x please post to this forum your questions or support tickets about One Page Checkout

istraxx_customsize plugin returning wrong weight or price

Postby admin » Mon Jul 29, 2019 2:37 pm

hello, we were just reported about incompatiblity with istraxx customsize plugin which requires a modification to be compatible with any system which gets checkout prices more than once per request (for example if you got a mini cart module enabled and you are at the checkout page, the plugin will get executed twice)

when used with our OPC which pre-calculates the shipping/payment combination and thus calls the getCheckoutPrices multiple times per request, this plugin will not return proper values at all.

please update your function in :
\plugins\vmcustom\istraxx_customsize\istraxx_customsize.php

(see code below)

best regards, stan
admin
Site Admin
 
Posts: 2708
Joined: Wed Jan 06, 2010 11:43 pm

Re: istraxx_customsize plugin returning wrong weight or price

Postby admin » Tue Jul 30, 2019 2:08 pm

UPDATED CODE:
after price fix + weight fix when calling the function multiple times.

Code: Select all
public function plgVmPrepareCartProduct(&$product, &$customfield, $selected, &$modificatorSum = 0) {
                  
      if($customfield->custom_element !== $this->_name) return;
   
      
      $r = customsizeCalculator::doCalculation($product, $customfield, $selected, $modificatorSum );
      
      if($customfield->changeProductPrice){
         $product->allPrices[$product->selectedPrice]['product_price'] += $r[0];
         $product->prices['product_price'] += $r[0];
      } else {
         $modificatorSum += $r[0];
      }
      
      
      if(!empty($customfield->cm_weight_ratio) and isset($r[1])){
         if (isset($product->product_weight_orig)) {
            $weight = $product->product_weight_orig;
         }
         else {
            $weight = $product->product_weight;
            $product->product_weight_orig = $weight;
         }
         $product->product_weight = $weight + ($weight * $r[1] * $customfield->cm_weight_ratio);
      }
      
      
      
      return true;
   }
   


best regards, stan
admin
Site Admin
 
Posts: 2708
Joined: Wed Jan 06, 2010 11:43 pm


Return to One Page Checkout for Virtuemart 3 on Joomla 3.x