News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

error when last product getting purchased

Started by meysam66, February 24, 2021, 14:31:57 PM

Previous topic - Next topic

meysam66

hello i am using VirtueMart version 3.6.10 for my small shop, most of the time i only have 2-3 or only one of a specific product available for shopping.
i have faced an issue which is:

when a user buys the The last stock quantity of a product, he will get an error or warning message just right after making the payment which says "the quantity of that product in their cart have been changed to 0".


i have searched about similar issues to mine, there were some ideas about minor changes in cart.php helper file. but their code was a little different to me.

currently my check for product quantity method in cart.php helper file is like this:

----------------------------------------------------------------------------------------
      if ($checkForDisable) {
         $productsleft = $product->product_in_stock - $product->product_ordered;

         if ($quantity > $productsleft ){
            vmdebug('my products left '.$productsleft.' and my quantity '.$quantity);
            if($productsleft>=$min ){
               $quantity = $productsleft;
               $product->errorMsg = vmText::sprintf('COM_VIRTUEMART_CART_PRODUCT_OUT_OF_QUANTITY',$product->product_name,$quantity);
               vmWarn($product->errorMsg);
            } else {
               $quantity = 0;
               $product->errorMsg = vmText::_('COM_VIRTUEMART_CART_PRODUCT_OUT_OF_STOCK');
               vmWarn($product->errorMsg);
               return false;
            }
         }
      }
---------------------------------------------------------------------------------------------

does anyone, have clue what to change and how to prevent this issue?


jjk

How about testing an update to the latest VirtueMart version - preferably with a backup of your live shop on a separate test installation. The cart.php file received a lot of changes after VM 3.6.10.
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

meysam66


thanks for your reply and your recommendation, believe me l myself would like to be updated, but updating the vm any further makes me several incompatibilities issue with my template. and those would be extra Frustrating challenges for me at the time.

i think my problem somehow does relate to how virtuemart behave after the selected payment method, because i never receive a similar warning on my last stock, when the customer select the cash on delivery method, and by that the order status will be confirmed by shopper.

but i will receive the warning when the customer buys my last stock quantity through a credit card payment, in that case the status will be confirmed.

but the stock handling mechanism with both status in my system is reserved.

Jörgen

What is Your Payment method ? I would check with them, I never seen this before with other payments. Using both Paypal and standard payment.

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

meysam66

#4
hello again jorgen, thanks for your reply.

i am using a payment method which integrates with an online payment system called zarinpal, only supports credit cards in my country.

i have got the plugin from their supported system section.

Jörgen

Never heard of this payment, I guess  you should compare this helper with similar plugins that work, f.e PayPal. I suspect this is not a VM issue, it is a payment method issue.

Jörgen
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

meysam66

ok, i think that's a progress, i will do that, thank you.

meysam66

the problem was a conflict with awocoupon component, which get solved by updating it.