Page 1 of 1

Possible to "hide" product in 1.5.x?

Posted: Mon Sep 19, 2011 5:34 am
by tboned
I'd like to offer products to a select group of folks that wouldn't be visible to the public. I also dont want them to have to register or "login" to see the item, because several of the customers will be elderly.

Does 1.5.x have any way to not make a product public...in other words, customers would need the link to the specific product id to "see" the item?

Thanks all!!

Re: Possible to "hide" product in 1.5.x?

Posted: Mon Sep 19, 2011 6:29 am
by SXGuy
cant remember if sort order works for products, but try changing it to -1, but remember the url to the product first before you change it.

If that doesnt work, add it to a category and change that sort order to -1

Re: Possible to "hide" product in 1.5.x?

Posted: Tue Nov 29, 2011 2:45 am
by ronnieb
Unfortunatly this doesn't work, tried hiding category and product as -1 but it put them at the top of the listing

any other solution ?

Re: Possible to "hide" product in 1.5.x?

Posted: Tue Nov 29, 2011 2:53 am
by Qphoria
ronnieb wrote:Unfortunatly this doesn't work, tried hiding category and product as -1 but it put them at the top of the listing

any other solution ?
yea.. this feature of mine was removed in current versions.

<Solved>Re: Possible to "hide" product in 1.5.x?

Posted: Tue Nov 29, 2011 3:07 am
by ronnieb
Found a solution

1. EDIT: catalog/model/catalog/category.php
2. FIND:

Code: Select all
public function getCategories($parent_id = 0) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "category c LEFT JOIN " . DB_PREFIX . "category_description cd ON (c.category_id = cd.category_id) WHERE c.parent_id = '" . (int)$parent_id . "' AND cd.language_id = '" . (int)$this->language->getId() . "' ORDER BY c.sort_order");

return $query->rows;
}

3. REPLACE WITH:

Code: Select all
public function getCategories($parent_id = 0) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "category c LEFT JOIN " . DB_PREFIX . "category_description cd ON (c.category_id = cd.category_id) WHERE c.parent_id = '" . (int)$parent_id . "' AND cd.language_id = '" . (int)$this->language->getId() . "' AND c.sort_order <> '-1' ORDER BY c.sort_order");

return $query->rows;
}

Now just set the sort order to -1 for all the ones you don't want to show.
1.5.1.3 is slightly different

I have stuck it in this code

Code: Select all

AND c2s.store_id = '" . (int)$this->config->get('config_store_id') . "'  [b]AND c.sort_order <> '-1'[/b]  AND c.status = '1' ORDER BY c.sort_order, LCASE(cd.name)");
which seems to work

http://forum.opencart.com/viewtopic.php?f=22&t=6670