Post by clicknfixonline » Mon Jun 11, 2012 1:35 am

Hi, I have quite a large product base on my site but I have alot of products that are out of stock and I am trying to hide them so they do not appear on the search and category pages.

I can hide them using a post I found for a simular issue but that was just for the latest module. the problem I have is even though I have hidden the product the pagination at the bottom and the page still thinks the item is there

EG category page has 20 items 5 out of stock the pagination still registers 20 items even though only 15 will be visable the page also does not move the product down either so say each page has 10 items and all 5 items are out of stock on the first page it will only show 5 items on the first page and 10 on the second ???

Here is what I have amended to allow the product to hide
File path: catalog/controller/product/category.php
added the below

Code: Select all

!$result['quantity']) { continue; }
inbetween

Code: Select all

			foreach ($results as $result) {

				if ($result['image']) {
this is the link to the post that advised on how to hide
http://forum.opencart.com/viewtopic.php?t=54273

Anybody able to help with this?

Website: http://www.Clicknfixonline.com
OC version: 1.5.3 (Have tried on a fresh install and on 1.5.2 with the same results)
Last edited by clicknfixonline on Thu Jun 14, 2012 2:27 am, edited 1 time in total.


Posts

Joined
Mon Jun 11, 2012 1:26 am

Post by inactiveaccount9912 » Mon Jun 11, 2012 2:01 am

Edit catalog/model/catalog/product.php

Twice, you will find the code:

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') . "'";
the second time, replace it with:

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 p.quantity > '0' AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";
If you were to replace it the first time too, then that one would hide the products in all listings, but you allready did that.

Expert Member

Posts

Joined
Fri May 14, 2010 2:36 am

Post by clicknfixonline » Thu Jun 14, 2012 2:27 am

Thank you Florinsith for the quick reply this looks to have sorted it.
Thank you again much appreciated.

;D


Posts

Joined
Mon Jun 11, 2012 1:26 am

Post by thizzladen » Thu Jul 26, 2012 5:40 am

Does anyone know how to fix this in the latest products module, I'm really in need of a fix because it's doing the same thing and messing up pagination.

Regards,
joe

New member

Posts

Joined
Wed Jun 20, 2012 10:22 am

Post by inactiveaccount9912 » Thu Jul 26, 2012 6:27 am

Works for latest products too. Messes up the pagination if you dont do the modification twice as written.

Expert Member

Posts

Joined
Fri May 14, 2010 2:36 am

Post by TraderDan » Thu Aug 09, 2012 5:30 pm

The following is incorrect:

Code: Select all

!$result['quantity']) { continue; }
Should be:

Code: Select all

if (!$result['quantity']) { continue; }
;-)

Image


User avatar
New member

Posts

Joined
Thu Oct 27, 2011 10:44 pm
Location - Lawrence, MA

Post by opencart-solutions » Mon Jan 22, 2018 3:46 am

Hello
InStock Only for all page when show products: category, special, search, manufacturer
https://www.opencart.com/index.php?rout ... n_id=33009

Opencart Solutions | opencart-solutions.com


New member

Posts

Joined
Fri Jan 19, 2018 1:55 am
Who is online

Users browsing this forum: No registered users and 367 guests