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 message in Orders

Started by hazael, August 09, 2016, 01:23:23 AM

Previous topic - Next topic

hazael

VirtueMart: 3.0.17
Joomla: 3.6.1

If a user is logged in.
And if He bought the last product in stock.
And if He entered into the page: layout=details&view=order or layout=details&view=orders
Will be shown the error message: "COM_VIRTUEMART_CART_PRODUCT_OUT_OF_STOCK"

My temporary solution:
in /components/com_virtuemart/helpers/cart.php

//I added before:
if ((strpos($_SERVER['REQUEST_URI'], 'order'))){}else{
//oryginal code

// Check to see if checking stock quantity
if ($stockhandle!='none' && $stockhandle!='risetime') {

$productsleft = $product->product_in_stock - $product->product_ordered;

// TODO $productsleft = $product->product_in_stock - $product->product_ordered - $quantityincart ;
if ($quantity > $productsleft ){
vmdebug('my products left '.$productsleft.' and my quantity '.$quantity);
if($productsleft>0){
$quantity = $productsleft;
$product->errorMsg = vmText::sprintf('COM_VIRTUEMART_CART_PRODUCT_OUT_OF_QUANTITY',$product->product_name,$quantity);
vmError($product->errorMsg);
} else {
$quantity = 0;
$product->errorMsg = vmText::_('COM_VIRTUEMART_CART_PRODUCT_OUT_OF_STOCK');
vmError($product->errorMsg); // Private error retrieved with getError is used only by addJS, so only the latest is fine
// todo better key string
vmInfo($product->errorMsg. ' '.$product->product_name);
return false;
}
}
}

//i added after
}