Page 1 of 1
Change admin 'out of stock' counter 4 Enabled products only
Posted: Sat Jan 28, 2017 5:55 pm
by yorkshireboy
When logged into admin there is an Alarm bell symbol in the top right hand corner of the screen, next to the link to the store and logout buttons.
There is also a number shown which equates to the number of out of stock products you have, counted as quantity = 0
This number of 'Out of Stock' items includes both Enabled and Disabled products - does anyone know how to adjust the code so that it only shows Enabled products with Quantity = 0?
Any help to point me in the right direction would be appreaciated
I'm using OC2.0.3.1
Re: Change admin 'out of stock' counter 4 Enabled products o
Posted: Sat Jan 28, 2017 7:09 pm
by opencartmart
In the file
admin/controller/common/header.php, find following line:
Code: Select all
$product_total = $this->model_catalog_product->getTotalProducts(array('filter_quantity' => 0));
Now add
filter_status=1 there. That means replace above line by following one:
Code: Select all
$product_total = $this->model_catalog_product->getTotalProducts(array('filter_quantity' => 0, 'filter_status' => 1));
Re: Change admin 'out of stock' counter 4 Enabled products o
Posted: Sat Jan 28, 2017 10:00 pm
by yorkshireboy
Hi Opencartmart - your instructions worked perfectly - thank you!!
When you click on the number of out of stock items in the header, it takes you to the product page with quantity set as 0.
Is there a way that status would also be set as 'Enabled' when it opens the Product page?
Re: Change admin 'out of stock' counter 4 Enabled products o
Posted: Sat Jan 28, 2017 11:25 pm
by opencartmart
Change following line:
Code: Select all
$data['product'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&filter_quantity=0', true);
by
Code: Select all
$data['product'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&filter_quantity=0&filter_status=1', true);
Re: Change admin 'out of stock' counter 4 Enabled products o
Posted: Sun Jan 29, 2017 12:12 am
by yorkshireboy
Thanks Opencartmart - worked perfectly also.
Really appreaciate your assistance, and helping me learn

Re: Change admin 'out of stock' counter 4 Enabled products o
Posted: Sun Jan 29, 2017 1:21 pm
by opencartmart
Glad to help. Thanks