Hi, i have a question about featured products. im adding this products to the featured list and they display in the module in the front end, but whenever someone buys one of this products and the stock or quantity is 0, the products are still displaying in featured module
Any ideas on how to automatically remove featured products with quantity = 0
Thanks in advance
Any ideas on how to automatically remove featured products with quantity = 0
Thanks in advance
Edit ../catalog/controller/module/featured.php
find:
and change so it loks like this:
Don't forget to add a closing brace ( } )to the bottom of the if statement.
find:
Code: Select all
foreach ($products as $product_id) {
$product_info = $this->model_catalog_product->getProduct($product_id);
if ($product_info) {
Code: Select all
foreach ($products as $product_id) {
$product_info = $this->model_catalog_product->getProduct($product_id);
if ($product_info) {
if ($product_info['quantity'] > 0){
-
VIEW ALL EXTENSIONS * EXTENSION SUPPORT * WEBSITE * CUSTOM REQUESTS
Hi, thanks for the info
Is there any possibility to make this a vqmod?, im reluctant to make direct modification to files as there is a programmer working on a multiseller platform and i dont want to mess things up
Is there any possibility to make this a vqmod?, im reluctant to make direct modification to files as there is a programmer working on a multiseller platform and i dont want to mess things up
Just follow up question on this topic.... now that the products are hidden/removed from displaying then this makes the category counts factually incorrect as these do not ignore any products that have a 0 quantity.
Obviously the counts look at the data somewhere to see whether products are 'enabled/active', thus assume it should be able to check whether there is a quantity > 0?
Has anyone done or are able to assist in the editing of this category count?
Thanks in advance
Obviously the counts look at the data somewhere to see whether products are 'enabled/active', thus assume it should be able to check whether there is a quantity > 0?
Has anyone done or are able to assist in the editing of this category count?
Thanks in advance
You need to edit the relevant query (getTotalProducts) in ../catalog/model/catalog/product.php
edit:
and add a quantity clause:
At a guess, not tried it.
However, i would suggest doing this actually makes the count incorrect as if you have 10 products in a category and one of them is out of stock, you still have 10 products in the category, it's just one is out of stock at the moment so you may or may not be able to buy it, it's still 10 products and not 9.
edit:
Code: Select all
$sql .= " WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";
Code: Select all
$sql .= " WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.quantity > '0' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";
However, i would suggest doing this actually makes the count incorrect as if you have 10 products in a category and one of them is out of stock, you still have 10 products in the category, it's just one is out of stock at the moment so you may or may not be able to buy it, it's still 10 products and not 9.
-
VIEW ALL EXTENSIONS * EXTENSION SUPPORT * WEBSITE * CUSTOM REQUESTS
grgr, thank you for this fix!
I managed to implement it on several other modules but the Featured one was coded differently to them and I (being a non-coding shopkeeper) just couldn't get it to work. All fixed up now, another great job by grgr!
I managed to implement it on several other modules but the Featured one was coded differently to them and I (being a non-coding shopkeeper) just couldn't get it to work. All fixed up now, another great job by grgr!
Stokey
Who is online
Users browsing this forum: Amazon [Bot], Bing [Bot] and 196 guests