Post by nbdevelopdreece » Mon Feb 17, 2020 7:04 pm

There are some clothes where a size has stock and another size is out of stock. The desirable function is when the customer filters the products by size, the system should not show products of the selected size if that product size is out of stock.

Practical example: Product "A" has the sizes "Small", "Medium" and "Large". The "Small" has a stock of "1". The "Medium" has a stock of "1". The "Large" has a stock of "0". If the customer chooses to filter products with "Small" or "Medium" size, I want the product to be shown in the results . If the customer chooses to filter products with "Large" size, I want the product to not be shown in the results.

Is there a system option about that?
I am thinking of a daily cronjob that deletes option values with a zero quantity but I would like this to be my last option.


Posts

Joined
Tue Oct 08, 2019 10:42 pm

Post by letxobnav » Mon Feb 17, 2020 9:36 pm

look in the marketplace if there is a filter which uses options, default filter and product options are unrelated.
I am thinking of a daily cronjob that deletes option values with a zero quantity but I would like this to be my last option.
And when the stock goes back above zero.....

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by paulfeakins » Mon Feb 17, 2020 11:46 pm

nbdevelopdreece wrote:
Mon Feb 17, 2020 7:04 pm
There are some clothes where a size has stock and another size is out of stock.
What extension do you use to manage option stock levels as this is not default behaviour?

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 letxobnav » Tue Feb 18, 2020 3:56 am

options have stock levels in OC.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by paulfeakins » Tue Feb 18, 2020 7:21 pm

letxobnav wrote:
Tue Feb 18, 2020 3:56 am
options have stock levels in OC.
Not if there is more than one option e.g. a t-shirt that can be S, M or L and red, green or blue.

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 nbdevelopdreece » Tue Feb 18, 2020 9:53 pm

paulfeakins wrote:
Tue Feb 18, 2020 7:21 pm
letxobnav wrote:
Tue Feb 18, 2020 3:56 am
options have stock levels in OC.
Not if there is more than one option e.g. a t-shirt that can be S, M or L and red, green or blue.
There is only one option, so there is no extension used for the stock (different colors are different products).

Also, most of the time, products do not come back in stock because new ones come in. Every 3-6 months.
In the case where a product comes back in stock, manual edit would suffice. There is plenty of manual work and corrections being done daily anyway.

For the above reasons a cronjob deleting the product options having a 0 stock, is a good last option, in my point of view.


Posts

Joined
Tue Oct 08, 2019 10:42 pm

Post by nbdevelopdreece » Thu Feb 20, 2020 4:32 pm

So, as no other solution is found, I am going to begin creating the cronjob.

What should I delete?

From what I see, I should delete from table "_product_option_value" where quantity=0.
Then delete from table "_product_option" where "same product_option_id and product_id from above".

Am I wrong somewhere? Should I delete anything else from another table?


Posts

Joined
Tue Oct 08, 2019 10:42 pm

Post by letxobnav » Thu Feb 20, 2020 5:47 pm

you delete the records from product_option_value and either save the product_option_id's of those records and then delete the records from product_option with those id's or you delete the records from product_option where the product_option_id no longer exists in the product_option_value table.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by nbdevelopdreece » Thu Feb 20, 2020 7:42 pm

letxobnav wrote:
Thu Feb 20, 2020 5:47 pm
you delete the records from product_option_value and either save the product_option_id's of those records and then delete the records from product_option with those id's or you delete the records from product_option where the product_option_id no longer exists in the product_option_value table.
Perfect. So it is only 2 tables (_product_option_value and _product_option) and the key that connects them is 'product_option_id'.

I will try to post an update if someone needs an accurate answer.


Posts

Joined
Tue Oct 08, 2019 10:42 pm

Post by nbdevelopdreece » Mon Feb 24, 2020 9:25 pm

nbdevelopdreece wrote:
Thu Feb 20, 2020 7:42 pm
I will try to post an update if someone needs an accurate answer.
No, I was wrong. I only need to delete from _product_option_value where quantity=0.

For what I want to do, if I delete from table _product_option, all options will be lost, not only the ones with no stock.

Having said that, I also made some other checks like if the product is activated (status=1).


Posts

Joined
Tue Oct 08, 2019 10:42 pm
Who is online

Users browsing this forum: kirkhall, Semrush [Bot] and 18 guests