Author Topic: Error message in Orders  (Read 471 times)

hazael

  • Beginner
  • *
  • Posts: 37
    • Bi┼╝uteria etniczna i orientalna
  • VirtueMart Version: 3.2.14
Error message in Orders
« on: August 09, 2016, 01:23:23 am »
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:
Code: [Select]
if ((strpos($_SERVER['REQUEST_URI'], 'order'))){}else{//oryginal code
Code: [Select]
// 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
Code: [Select]
}