Post by Nordikota » Fri Feb 22, 2019 6:10 pm

Is there any way to know what products are assigned with a specific option without having to look at every product individually? Ideally look at the Options list and find out what products are assigned to the option. We've 100s of options and have some duplicates over the years :-\

Thanks in advance ;D

Active Member

Posts

Joined
Tue Feb 11, 2014 8:04 pm

Post by paulfeakins » Fri Feb 22, 2019 8:10 pm

Try this (obviously adjust "option name"):

Code: Select all

select pd.name, po.value from oc_product_description pd
join oc_product p on p.product_id = pd.product_id
join oc_product_option po on po.product_id = p.product_id
where po.value like '%option name%'

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 Nordikota » Fri Feb 22, 2019 8:18 pm

Thanks. I tried that but it returned Zero values and the message below?

Code: Select all

select pd.name, po.value from oc_product_description pd join oc_product p on p.product_id = pd.product_id join oc_product_option po on po.product_id = p.product_id where po.value like '%Preferred Print Colour%'

Active Member

Posts

Joined
Tue Feb 11, 2014 8:04 pm

Post by paulfeakins » Fri Feb 22, 2019 8:23 pm

Ah I see what you're trying to do, try this:

Code: Select all

select pd.name from oc_product_description pd
join oc_product p on p.product_id = pd.product_id
join oc_product_option po on po.product_id = p.product_id
join oc_option_description od on od.option_id = po.option_id
where od.name like '%Preferred Print Colour%'

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 Nordikota » Fri Feb 22, 2019 9:31 pm

B-E-A-UTIFUL! Works a treat. Thanks for your help - it's saved me hours ;D

Active Member

Posts

Joined
Tue Feb 11, 2014 8:04 pm

Post by paulfeakins » Fri Feb 22, 2019 9:59 pm

You're welcome :)

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
Who is online

Users browsing this forum: Semrush [Bot] and 328 guests