News:

Support the VirtueMart project and become a member

Main Menu

V.M.3.0.0 Increase quantity in cart gives error

Started by dirdi, December 07, 2014, 16:22:47 PM

Previous topic - Next topic

dirdi

Hello, I am running virtuemart 3.0.0 on a joomla 2.5.27 and is the first time I create an online store... so far so good but now I have this issue is when a product is in cart and I want to increase the number of units to buy, lets say from 1 to 2 the quantity stay the same and give this error:

warning: Invalid argument supplied for foreach() in /home/content/xx/xxx/html/xxxx/components/com_virtuemart/helpers/cart.php on line 720

on this line I have this and really dont know what to do here:

foreach($quantities as $key=>$quantity){
         if (isset($this->cartProductsData[$key]) and !empty($quantity) and !isset($_POST['delete_'.$key])) {
            if($quantity!=$this->cartProductsData[$key]['quantity']){
               $productModel = VmModel::getModel('product');

               $product = $productModel -> getProduct($this->cartProductsData[$key]['virtuemart_product_id'], $quantity);
               if ($this->checkForQuantities($product, $quantity)) {
                  $this->cartProductsData[$key]['quantity'] = $quantity;
                  $updated = true;
               }
            }

         } else {
            //Todo when quantity is 0,  the product should be removed, maybe necessary to gather in array and execute delete func
            unset($this->cartProductsData[$key]);
            $updated = true;
         }
      }

Any help much appreciate!

jenkinhill

Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum