VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product pricing => Topic started by: Marquis2000 on November 01, 2020, 10:37:46 AM

Title: helpers\calculationh.php on line 1214
Post by: Marquis2000 on November 01, 2020, 10:37:46 AM
Hi Guys,

i have a error in pricing configuration. but i dont know what this ist. Has Anyone same Problem?

Warning: Creating default object from empty value in .....\administrator\components\com_virtuemart\helpers\calculationh.php on line 1214

in this line stay:

      $price = $baseprice;
      $finalprice = $baseprice;
      if (isset($rulesEffSorted)) {

         foreach ($rulesEffSorted as $rule) {

            if(isset($rule['subTotal'])){
               $cIn = $rule['subTotal'];
            }
            else if ($relateToBaseAmount) {
               $cIn = $baseprice;
            } else {
               $cIn = $price;
            }

            $cOut = $this->interpreteMathOp($rule, $cIn);
            $tmp = $this->roundInternal($this->roundInternal($cOut) - $cIn);

            if($setCartPrices){
               $this->_cart->cartPrices[$rule['virtuemart_calc_id'] . 'Diff'] = $tmp;
            }
            //okey, this is a bit flawless logic, but should work
            if ($relateToBaseAmount) {
               $finalprice = $finalprice + $tmp;
            } else {
               $price = $cOut;
            }
         }
      }

      //okey done with it
      if (!$relateToBaseAmount) {
         $finalprice = $price;
      }

      return $finalprice;
   }

Can anyone help?

Greatings Norman
Title: Re: helpers\calculationh.php on line 1214
Post by: Jörgen on November 01, 2020, 11:35:47 AM
Probably a PHP upgrade error. You för not tell much of yout Joomla, PHP, VM versions...

Jörgen
Title: Re: helpers\calculationh.php on line 1214
Post by: sirius on February 02, 2022, 09:38:43 AM
Hi
I assume this is now fixed
like so :
if($setCartPrices and isset($this->_cart->cartPrices)){
$this->_cart->cartPrices[$rule['virtuemart_calc_id'] . 'Diff'] = $tmp;
}