Skip to Content
author's profile photo Former Member
Former Member

How to query products with image data

I need to retrieve products with media images' url (at least one url). I can not find product and media relation. If i execute below flexible search query, returns no rows because of there is no information(checked with not null) on picture field on product item records.

select {sl.productCode} as stock_prodCode,{prod.name[tr]} as prod_name,{c.name[tr]} as c_name, {c.code}, {cv.version} as cv_version, {sl.available} as available from { StockLevel as sl join Product as prod on ({prod.code}=substring({sl.productCode},1,11) and {sl.available}>1) left join CategoryProductRelation as cpr on {prod.pk}={cpr.target} left join Category as c on {c.pk}={cpr.source} join Catalog as cat on {cat.pk}={c.catalog} and {cat.id}='kotonProductCatalog' join CatalogVersion as cv on ({cv.pk}={cat.activeCatalogVersion} and {cv.version}='Online') join Media as pic on {pic.pk}={prod.picture} } order by {prod.code} Brgds

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Dec 28, 2015 at 11:21 AM

    Hi Mustafa, Include the below where clause in your query "WHERE {pic:INTERNALURL} IS NOT NULL"

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thank you for your reply. Maybe your information makes sense as well. But my complaint was actually on the relation part. I meant to how can i join with prod and media. When i try with prod.picture , it returns no rows because of prod.picture field is empty.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.