out of stock items

  • Posts: 2
  • Thank you received: 0
13 years 7 months ago #13347

currently, if a user tries to add a product to the cart that is out of stock (via the HTML link provided for each product), it just goes to a 'The cart is empty' message.

is there a way to customise it so it says "sorry, product select is out of stock" ? it would make it less confusing :)

Please Log in or Create an account to join the conversation.

  • Posts: 2
  • Thank you received: 0
13 years 7 months ago #13348

just to add - I can see in the language file there is

PRODUCT_NOT_AVAILABLE="The product %s is not available"
NOT_ENOUGH_STOCK_FOR_PRODUCT="There are not enough stock for the product %s"

which means it does exist - but it's not working correctly for me for some reason.

Please Log in or Create an account to join the conversation.

  • Posts: 82864
  • Thank you received: 13372
  • MODERATOR
13 years 7 months ago #13385

The out of stock message is used on the product page BEFORE the product is added to the cart.
IF you use the direct HTML link, that check isn't done and the product is added to the cart and a later check removes the product from the cart and the "The cart is empty" message is displayed.

Could you try to edit the file administrator/components/com_hikashop/classes/cart.php and add the code:
if(empty($quantity)){
$app =& JFactory::getApplication();
$app->enqueueMessage(JText::sprintf('NOT_ENOUGH_STOCK_FOR_PRODUCT',$product->product_name));
}

after the line:
if($product->product_quantity>=0 && $product->product_quantity<$quantity) $quantity = $product->product_quantity;

Please Log in or Create an account to join the conversation.

Time to create page: 0.049 seconds
Powered by Kunena Forum