php - how to get stock status in opencart product page
424
I want to show
out of stock
on my product page and I change the status from admin and is updated in admin but on my product page there is also same
In Stock
and product page code is
if ($product_info['quantity'] <= 0) {
$this->data['stock'] = $product_info['stock_status'];
} elseif ($this->config->get('config_stock_display')) {
$this->data['stock'] = $product_info['quantity'];
} else{
$this->data['stock'] = $this->language->get('text_instock');
}
and language page is
$_['text_outstock'] = 'Out of Stock';
Now what condition is used there?
Answer
Solution:
As far as I understand your issue, you can set it directly in the Admin to show 'out of stock' message.
You need to set it both in the general settings AND in the invidividual product.
Currently, because you did not set your Admin settings correctly,
$product_info['stock_status']
does not display 'out of stock'.However, if you insist of modifying the code, you need to use the following:
Hope this helps!