Новинки бренда Ароматика
select json_agg(row_to_json(q)) as rows from (select * from ( select * from ( select product_id, product_name, enabled, parent_id, image, product_type, contact_list, iscategory, producer, alias, modification, characteristics, article, root_id, ord, tags, (select min(price) from crm_order.product_price where product_id=a.product_id ) as price1, price, (select max(amount) from crm_order.product_price where product_id=a.product_id ) as amount, (select json_agg(row_to_json(z)) from (select * from crm_order.product_price where product_id=a.product_id)z ) as price_json,user_data, (select json_agg(json_build_object('name', tipe, 'alias', alias)) from crm_order.promotion where a.product_id=any(products) and enabled and start_date <= now() and now() <= end_date)promotions from crm_order.product a where 1=1 and enabled )w )q where iscategory=false and producer='1630' and 'бренд_новинки'=any(tags)
order by (user_data->>'priority')::int nulls last,image is not null desc,ord offset 0 limit 20)q
{"api_key":44766,"limit":20,"count":1,"total":5,"page":1,"prev":false,"next":false,"rows":[{"num":1}],"hash":{},"opt":{"cache":0,"sql1":1,"query":"iscategory=false and producer=''1630'' and ''бренд_новинки''=any(tags)","tag":"catalog_aptekar","limit":20,"order":"(user_data->>''priority'')::int nulls last,image is not null desc,ord","fields":"*","table":"( select * from ( select product_id, product_name, enabled, parent_id, image, product_type, contact_list, iscategory, producer, alias, modification, characteristics, article, root_id, ord, tags, (select min(price) from crm_order.product_price where product_id=a.product_id ) as price1, price, (select max(amount) from crm_order.product_price where product_id=a.product_id ) as amount, (select json_agg(row_to_json(z)) from (select * from crm_order.product_price where product_id=a.product_id)z ) as price_json,user_data, (select json_agg(json_build_object(''name'', tipe, ''alias'', alias)) from crm_order.promotion where a.product_id=any(products) and enabled and start_date <= now() and now() <= end_date)promotions from crm_order.product a where 1=1 and enabled )w )q","page":1,"timing1":1,"pr_id":"1630","query_text":"iscategory=false and producer=''{{opt.pr_id}}'' and ''бренд_новинки''=any(tags)","_table":"product_catalog_view","table_text":"( select * from ( select product_id, product_name, enabled, parent_id, image, product_type, contact_list, iscategory, producer, alias, modification, characteristics, article, root_id, ord, tags, (select min(price) from crm_order.product_price where {{#if opt.city_dep}}department_id = any(''{ {{opt.city_dep}} }'' ) and {{/if}} product_id=a.product_id ) as price1, price, (select max(amount) from crm_order.product_price where {{#if opt.city_dep}}department_id = any(''{ {{opt.city_dep}} }'' ) and {{/if}} product_id=a.product_id ) as amount, (select json_agg(row_to_json(z)) from (select * from crm_order.product_price where {{#if opt.city_dep}}department_id = any(''{ {{opt.city_dep}} }'' ) and {{/if}} product_id=a.product_id)z ) as price_json,user_data, (select json_agg(json_build_object(''name'', tipe, ''alias'', alias)) from crm_order.promotion where a.product_id=any(products) and enabled and start_date <= now() and now() <= end_date)promotions from crm_order.product a where 1=1 and enabled {{#if opt.product_id}} and ( parent_id=''{{opt.product_id}}'' or (select parent_id from crm_order.product where product_id=a.parent_id )=''{{opt.product_id}}'' or (select parent_id from crm_order.product where product_id=(select parent_id from crm_order.product where product_id=a.parent_id ) )=''{{opt.product_id}}'' ) {{/if}} {{#if opt.product_id_}} and product_id=''{{opt.product_id_}}''{{/if}} )w )q","_id":"7Bmkl0FQXtQyK1C7c525j61vpYI-","limit_base":20,"table_q":"( select * from ( select product_id, product_name, enabled, parent_id, image, product_type, contact_list, iscategory, producer, alias, modification, characteristics, article, root_id, ord, tags, (select min(price) from crm_order.product_price where product_id=a.product_id ) as price1, price, (select max(amount) from crm_order.product_price where product_id=a.product_id ) as amount, (select json_agg(row_to_json(z)) from (select * from crm_order.product_price where product_id=a.product_id)z ) as price_json,user_data, (select json_agg(json_build_object(''name'', tipe, ''alias'', alias)) from crm_order.promotion where a.product_id=any(products) and enabled and start_date <= now() and now() <= end_date)promotions from crm_order.product a where 1=1 and enabled )w )q","search_column":null},"domain":"aptekar.ua","uuid":"upORoY6gV_b","req":{"query":{}}}