Page 1 of 1

How to get stock_status_id in Opencart 2.3.0.2

Posted: Fri Nov 27, 2020 9:44 pm
by VanioBoy
How do I change the status color of the product page using warehouse_state? Now I take from a quantity of products - a product with 0 pieces is red. As of this week, I have products with quantity 5 and status "expected", I want the color to be orange. And products with quantity 5 and status "In stock" - green color. How do I get stock_status_id from the database?

Re: How to get stock_status_id in Opencart 2.3.0.2

Posted: Fri Nov 27, 2020 10:09 pm
by OSWorX

Re: How to get stock_status_id in Opencart 2.3.0.2

Posted: Sat Nov 28, 2020 3:44 pm
by lavinpratap
You can use opencart extensions like the following to show out of stock status in frontend.

https://www.opencart.com/index.php?rout ... n_id=40263

Image

Re: How to get stock_status_id in Opencart 2.3.0.2

Posted: Sat Nov 28, 2020 4:07 pm
by VanioBoy
It doesn't work for me

Re: How to get stock_status_id in Opencart 2.3.0.2

Posted: Sat Nov 28, 2020 6:39 pm
by lavinpratap
You can get this by the following code

catalog/controller/product//product.php

$product_info = $this->model_catalog_product->getProduct($product_id);

to get the product status - $product_info['stock_status']
to get the product quantity - $product_info['quantity']

Re: How to get stock_status_id in Opencart 2.3.0.2

Posted: Sat Nov 28, 2020 8:36 pm
by straightlight
Or, you could create an event since the $data['product_id'] can still be pulled.

Re: How to get stock_status_id in Opencart 2.3.0.2

Posted: Fri Feb 26, 2021 7:24 pm
by Alejandrin
How do I change the status color of the product page using warehouse_state? Now I take from a quantity of products - a product with 0 pieces is red. As of this week, I have products with quantity 5 and status "expected", I want the color to be orange. And products with quantity 5 and status "In stock" - green color. How do I get stock_status_id from the database?


KrogerFeed