Post by storiqax » Mon Sep 24, 2018 6:14 pm

Hello everyone,

I want to somehow hide products that are out of stock, discontinued etc from everywhere (categories, brands, tags...) and make them accessible only from the URL.

I have read many suggestions to remove them from categories but there also the tags, the brand page and the most difficult part is to find where the the product have been related to other products. I don't want to delete them because there always a possibility to make them available again and I do not want to insert them again or going to all of them and re-add the category, brand etc.

Someone told be to put the stock value to -1 but that does nothing at all ???

Is there any good way to do that?
I think a good way is to disable them but then is not accessible with the URL. Can somehow the disabled products could be accessible via the URL?

Thanks in advance!
Last edited by storiqax on Mon Sep 24, 2018 8:07 pm, edited 1 time in total.

User avatar
New member

Posts

Joined
Tue May 29, 2018 10:19 pm

Post by paulfeakins » Mon Sep 24, 2018 7:14 pm

storiqax wrote:
Mon Sep 24, 2018 6:14 pm
Can somehow the disabled products could be accessible via the URL?
Why do you want that?

People will find them from Google ...

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by uksitebuilder » Mon Sep 24, 2018 7:19 pm

Haven't tested this, but certainly it's possible.

The way I would do it would be as follows:

In the product controller, check that the requested URL is for a product view page (e.g. test for the existence of $this->route and that it contains 'product/product')

If it exists append a variable to the getProduct model call eg.

$product_info = $this->model_catalog _product->getProduct($product_id, true);
// notice the added 'true' boolean added to the model call

Then in the catalog product model file, append a variable to the getProduct method:

public function getProduct($product_id, $product_url = false)
// notice the added default parameter in the getProduct method '$product_url = false'

Finally, we can modify the sql statement to allow products if $product_url is set to true

Near the end of the sql statement, find and replace:

AND p.status = 1

with:

AND (p.status = 1 OR $product_url)

--

As I said, I have not tested this, but in theory it should work unless I have missed something

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by storiqax » Mon Sep 24, 2018 7:26 pm

paulfeakins wrote:
Mon Sep 24, 2018 7:14 pm
storiqax wrote:
Mon Sep 24, 2018 6:14 pm
Can somehow the disabled products could be accessible via the URL?
Why do you want that?

People will find them from Google ...
Well, they have to be blocked from Google and other search engines as well then.
I want to do it because I have read that you should never delete products from an eCommerce site. They said you have to made them "invisible" for better SEO and only accessible from the URL which may be have been shared to social medias etc.

User avatar
New member

Posts

Joined
Tue May 29, 2018 10:19 pm

Post by straightlight » Mon Sep 24, 2018 7:50 pm

storiqax wrote:
Mon Sep 24, 2018 7:26 pm
paulfeakins wrote:
Mon Sep 24, 2018 7:14 pm
storiqax wrote:
Mon Sep 24, 2018 6:14 pm
Can somehow the disabled products could be accessible via the URL?
Why do you want that?

People will find them from Google ...
Well, they have to be blocked from Google and other search engines as well then.
I want to do it because I have read that you should never delete products from an eCommerce site. They said you have to made them "invisible" for better SEO and only accessible from the URL which may be have been shared to social medias etc.
While the statement is true about not removing products from eCommerce web sites, they should neither be invisible but rather active with a stock level of 0. The SEO can still provide positive results afterwards.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by storiqax » Mon Sep 24, 2018 8:03 pm

straightlight wrote:
Mon Sep 24, 2018 7:50 pm
While the statement is true about not removing products from eCommerce web sites, they should neither be invisible but rather active with a stock level of 0. The SEO can still provide positive results afterwards.
This should work only for products that is out of stock but I want a solution too for discontinued products, especially if there is a lot of them.
I want the products to be accessible via the URL but hidden from the entire website (expect admin of course).

@uksitebuilder I will give it a try. I'm newbie though and I do not think I have much hope to made it work.

User avatar
New member

Posts

Joined
Tue May 29, 2018 10:19 pm

Post by olahmyde » Mon Sep 24, 2018 9:17 pm

Two ways of doing this.....

1.) Disable product from status (Although it would no longer be accessed by link again, only the admin can see it)
2.) Remove product from all categories its under and also its related products, change its model to a totally different thing so it still can't be accessed via models... (pretty sure this should work fine)

New member

Posts

Joined
Tue Apr 10, 2018 1:24 am

Post by storiqax » Mon Sep 24, 2018 10:05 pm

olahmyde wrote:
Mon Sep 24, 2018 9:17 pm
Two ways of doing this.....

1.) Disable product from status (Although it would no longer be accessed by link again, only the admin can see it)
2.) Remove product from all categories its under and also its related products, change its model to a totally different thing so it still can't be accessed via models... (pretty sure this should work fine)
You know the "problem" with the first one, so...
What do you mean by models? This is a solution but it is bad for a lot of products, and as I said
I don't want to delete them because there always a possibility to make them available again and I do not want to insert them again or going to all of them and re-add the category, brand etc.
The best way will be to set the stock to -1 for example and the code that listing the products to bypass the negative values.
That's what I am looking for.

User avatar
New member

Posts

Joined
Tue May 29, 2018 10:19 pm

Post by olahmyde » Wed Sep 26, 2018 7:18 am

storiqax wrote:
Mon Sep 24, 2018 10:05 pm
olahmyde wrote:
Mon Sep 24, 2018 9:17 pm
Two ways of doing this.....

1.) Disable product from status (Although it would no longer be accessed by link again, only the admin can see it)
2.) Remove product from all categories its under and also its related products, change its model to a totally different thing so it still can't be accessed via models... (pretty sure this should work fine)
You know the "problem" with the first one, so...
What do you mean by models? This is a solution but it is bad for a lot of products, and as I said
I don't want to delete them because there always a possibility to make them available again and I do not want to insert them again or going to all of them and re-add the category, brand etc.
The best way will be to set the stock to -1 for example and the code that listing the products to bypass the negative values.
That's what I am looking for.
It doesnt delete, it only removes from the page... or try this extension... might help

https://www.opencart.com/index.php?rout ... ing&page=3

New member

Posts

Joined
Tue Apr 10, 2018 1:24 am

Post by storiqax » Wed Sep 26, 2018 9:58 pm

Interesting extension. I'm probably gonna tweak it a little to do what I want.
Thank you!

User avatar
New member

Posts

Joined
Tue May 29, 2018 10:19 pm

Post by storiqax » Fri Sep 28, 2018 5:32 pm

olahmyde wrote:
Wed Sep 26, 2018 7:18 am
It doesnt delete, it only removes from the page... or try this extension... might help
https://www.opencart.com/index.php?rout ... ing&page=3
So, I tried this extension and it's working fine on a testing installation of OpenCart (even if I tweak it how I want).
The problem is when I tried it to main site. I am getting the following errors: :(
Image
Could anyone please help?

User avatar
New member

Posts

Joined
Tue May 29, 2018 10:19 pm

Post by storiqax » Sat Sep 29, 2018 12:48 am

So...
The extension is working fine with the template I'm using with the default OpenCart database. Not with mine though. Anyone have a clue what's is going on?

I am not able to find any solution ???

User avatar
New member

Posts

Joined
Tue May 29, 2018 10:19 pm

Post by straightlight » Sat Sep 29, 2018 4:20 am

Contact the extension developer to resolved this issue.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by storiqax » Sat Sep 29, 2018 6:19 am

straightlight wrote:
Sat Sep 29, 2018 4:20 am
Contact the extension developer to resolved this issue.
I will, hope he/she is able to help me.

User avatar
New member

Posts

Joined
Tue May 29, 2018 10:19 pm

Post by Van Quyen » Fri Oct 09, 2020 4:11 am

If you use Journal Theme... hope this helps you. Product quantity settings at the product admin page "-1"

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<modification>
	<name>Hide Product for Quantity "-1"</name>
	<id>Hide Product for Quantity "-1"</id>
	<code>hide-product-quantity-1</code>
	<version>1.0</version>
	<author>ZZZZZZ</author>
	<link>www.opencart.com</link>
	
	<file path="catalog/model/journal3/product.php">
		<operation>
			<search><![CDATA[
			p.status = '1'
			]]></search>
			<add position="replace"><![CDATA[
			p.status = '1' AND p.quantity > '-1'
]]>
			</add>
		</operation> 
	</file>
</modification>

Newbie

Posts

Joined
Wed Jan 09, 2019 3:36 pm
Who is online

Users browsing this forum: No registered users and 3 guests