Hi!
I've been searching and found many threads talking about how to get this done but it just doesn't seem to work. The problem is that we need to hide or disable products from listings once they are out of stock. The nature of our shop is that we rarely have more than one of each products.
EDIT: As I have been noted, my original post had insufficient information on what I've tried. I meant to originally say that I found a lot of threads pointing somewhat in the same direction (modified the original sentence too). By following the instructions and tips from those threads, I have tried modifying the catalog/model/catalog/product.php (adding p.quantity > 0 after the p.status = '1' statement on the second entry and also for all the other entries I could find).
I appreciate all help regarding this problem!
OpenCart version: 2.3.0.2
Theme: Journal2
Kind regards,
Tomi
But none of them have been posted on the topic to better described the strategies that you used in order to better described the source of the issue. Forum rules.I've been searching and trying out many tricks to get this done but it just doesn't seem to work.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Hi Straightlight!straightlight wrote: ↑Thu Feb 14, 2019 10:43 pmBut none of them have been posted on the topic to better described the strategies that you used in order to better described the source of the issue. Forum rules.I've been searching and trying out many tricks to get this done but it just doesn't seem to work.
Thank you for your answer. I have modified my original post to better describe the situation.
Kind regards,
Tomi
Hi here is a solution to show all items that have 1 or more in the quantity field
Open Catalog/model/catalog/product.php
Find
public function getProduct($product_id) { //Usually line 7
and in the sql just below it //starts with $query = $this->db->query
Search for AND p.date_available <= NOW() //Usually towards the end of the query
right after that put a space then add the following code
AND p.quantity > 0
Now your code should look like this
AND p.date_available <= NOW() AND p.quantity > 0 AND p2s.store_id
if you get stuck let me know
Open Catalog/model/catalog/product.php
Find
public function getProduct($product_id) { //Usually line 7
and in the sql just below it //starts with $query = $this->db->query
Search for AND p.date_available <= NOW() //Usually towards the end of the query
right after that put a space then add the following code
AND p.quantity > 0
Now your code should look like this
AND p.date_available <= NOW() AND p.quantity > 0 AND p2s.store_id
if you get stuck let me know
Hi paid1234 and thank you for your help!paid1234 wrote: ↑Wed Feb 20, 2019 6:15 amHi here is a solution to show all items that have 1 or more in the quantity field
Open Catalog/model/catalog/product.php
Find
public function getProduct($product_id) { //Usually line 7
and in the sql just below it //starts with $query = $this->db->query
Search for AND p.date_available <= NOW() //Usually towards the end of the query
right after that put a space then add the following code
AND p.quantity > 0
Now your code should look like this
AND p.date_available <= NOW() AND p.quantity > 0 AND p2s.store_id
if you get stuck let me know
I tried that modification and it didn't solve the problem. Actually there is a "p.quantity >= 1" already in place at the location you instructed me to add that modification. I also tried changing it to "p.quantity > 0" but it didn't work either.
Any idea what's wrong? Am I missing something? The products have quantity of 1 and when they're sold, the number goes to 0. Still the products remain on the listing pages but their image gets replaced by the OpenCart placeholder image and the price goes to 0.00€.
Kind regards,
Tomi
Who is online
Users browsing this forum: No registered users and 352 guests