Bug checkbox products

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

Bug checkbox products

Postby inkoop@.....nl » Wed Apr 25, 2018 11:45 am

It looks like there is a small bug in the latest version of OPC (in combination with Joomla 3.8.7 and virtuemart 3.14)

I have enabled some checkbox products in the cart check out.

But at the checkout, when enabling a checkbox, a message appeared that removing a item was successful. This message appears when enabling al other checkboxe as well, but doesn’t appear disabling them. The message appears reversed, other way around as how it should be.

I also think displaying this message is not necessary at all, only when removing and real item from the cart, but not for these checkbox products.

Can you fix this?
inkoop@.....nl
 
Posts: 35
Joined: Thu May 09, 2013 10:54 am

Re: Bug checkbox products

Postby admin » Thu May 03, 2018 12:58 pm

hello, this is a bug in virtuemart, you may need to comment 2 lines in cart.php code:

\components\com_virtuemart\helpers\cart.php

original code:
Code: Select all
public function updateProductCart() {

      $quantities = vRequest::getInt('quantity');
      if(empty($quantities)) return false;
      $updated = false;

      foreach($quantities as $key=>$quantity){
         if (isset($this->cartProductsData[$key]) and !empty($quantity) and !isset($_POST['delete_'.$key])) {
            if($quantity!=$this->cartProductsData[$key]['quantity']){
               $this->cartProductsData[$key]['quantity'] = $quantity;
               $updated = true;
               vmInfo('COM_VIRTUEMART_PRODUCT_UPDATED_SUCCESSFULLY');
            }

         } else {
            unset($this->cartProductsData[$key]);
            vmInfo('COM_VIRTUEMART_PRODUCT_REMOVED_SUCCESSFULLY');
            $updated = true;
         }
      }

      $this->setCartIntoSession(true);
      return $updated;
   }


and change it to:

Code: Select all
public function updateProductCart() {

      $quantities = vRequest::getInt('quantity');
      if(empty($quantities)) return false;
      $updated = false;

      foreach($quantities as $key=>$quantity){
         if (isset($this->cartProductsData[$key]) and !empty($quantity) and !isset($_POST['delete_'.$key])) {
            if($quantity!=$this->cartProductsData[$key]['quantity']){
               $this->cartProductsData[$key]['quantity'] = $quantity;
               $updated = true;

            }

         } else {
            unset($this->cartProductsData[$key]);

            $updated = true;
         }
      }

      $this->setCartIntoSession(true);
      return $updated;
   }



it's not acceptable that virtuemart prints those messages from within cart helper file instead of the joomla's controller since the function can be used by any autoreload / load / gift or other plugins manipulating the cart.

we'll be considering not to use this function if the messages don't get removed from the core.

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