Advertisement
MrViSiOn

Untitled

Oct 22nd, 2014
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 44.34 KB | None | 0 0
  1. SELECT p.id_product FROM ps_product_lang p INNER JOIN ps_product p2 ON p.id_product = p2.id_product WHERE (LOWER(p.name) LIKE LOWER('%faro%') OR LOWER(p.description_short) LIKE LOWER('%faro%') OR LOWER(p.description) LIKE LOWER('%faro%')  ) AND p2.active = 1 AND p2.indexed = 1 AND p2.visibility IN ("both", "search")
  2.  
  3.  
  4. --------------------------------------------------------------------------------------
  5.  
  6.  
  7. SELECT si.id_product
  8. FROM ps_search_word sw
  9. LEFT JOIN ps_search_index si ON sw.id_word = si.id_word INNER JOIN ps_product p2 ON si.id_product = p2.id_product
  10. WHERE sw.id_lang = 1
  11. AND sw.id_shop = 1
  12. AND LOWER(sw.word) LIKE LOWER(
  13. '%faro%')  AND p2.active = 1 AND p2.indexed = 1 AND p2.visibility IN ("both", "search")
  14.  
  15.  
  16. --------------------------------------------------------------------------------------
  17.  
  18.  
  19. SELECT p.id_product FROM ps_product_lang p INNER JOIN ps_product p2 ON p.id_product = p2.id_product WHERE (LOWER(p.name) LIKE LOWER('%derecho%') OR LOWER(p.description_short) LIKE LOWER('%derecho%') OR LOWER(p.description) LIKE LOWER('%derecho%')  ) AND p2.active = 1 AND p2.indexed = 1 AND p2.visibility IN ("both", "search")
  20.  
  21.  
  22. --------------------------------------------------------------------------------------
  23.  
  24.  
  25. SELECT si.id_product
  26. FROM ps_search_word sw
  27. LEFT JOIN ps_search_index si ON sw.id_word = si.id_word INNER JOIN ps_product p2 ON si.id_product = p2.id_product
  28. WHERE sw.id_lang = 1
  29. AND sw.id_shop = 1
  30. AND LOWER(sw.word) LIKE LOWER(
  31. '%derecho%')  AND p2.active = 1 AND p2.indexed = 1 AND p2.visibility IN ("both", "search")
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41. --------------------------------------------------------------------------------------
  42.  
  43.  
  44. SELECT COUNT(*) FROM ( SELECT * FROM ((SELECT
  45. CONVERT(p.reference, UNSIGNED INT) AS reference, p.id_product, p.id_supplier, p.id_manufacturer, p.id_category_default, p.id_shop_default, p.id_tax_rules_group, p.on_sale, p.online_only, p.ean13,             p.upc, p.ecotax, p.minimal_quantity, p.price, p.wholesale_price, p.unity, p.unit_price_ratio, p.additional_shipping_cost, p.supplier_reference, p.location, p.width, p.height, p.depth, p.weight,
  46. p.quantity_discount, p.customizable, p.uploadable_files, p.text_fields, p.active, p.redirect_type, p.id_product_redirected, p.available_for_order, p.available_date, p.condition,
  47. p.show_price, p.indexed, p.visibility, p.cache_is_pack, p.cache_has_attachments, p.is_virtual, p.cache_default_attribute, p.date_add, p.date_upd, p.advanced_stock_management,
  48. product_shop.id_shop
  49. , stock.out_of_stock, IFNULL(stock.quantity, 0) AS quantity,
  50. pl.`description_short`, pl.`available_now`, pl.`available_later`, pl.`link_rewrite`, pl.`name`,
  51. MAX(image_shop.`id_image`) id_image, il.`legend`, m.`name` manufacturer_name ,(
  52. SELECT SUM(weight)
  53. FROM ps_search_word sw
  54. LEFT JOIN ps_search_index si ON sw.id_word = si.id_word
  55. WHERE sw.id_lang = 1
  56. AND sw.id_shop = 1
  57. AND si.id_product = p.id_product
  58. AND (sw.word LIKE 'faro%' OR sw.word LIKE 'derecho%')
  59. ) POSITION, MAX(product_attribute_shop.`id_product_attribute`) id_product_attribute,
  60. DATEDIFF(
  61. p.`date_add`,
  62. DATE_SUB(
  63. NOW(),
  64. INTERVAL 3 DAY
  65. )
  66. ) > 0 NEW,
  67. IFNULL(feat2.VALUE, 0) AS reffab,
  68. IFNULL(feat4.VALUE, 0) AS refmarca
  69. FROM ps_product p
  70. INNER JOIN ps_product_shop product_shop
  71. ON (product_shop.id_product = p.id_product AND product_shop.id_shop = 1)
  72.  
  73. INNER JOIN `ps_product_lang` pl ON (
  74. p.`id_product` = pl.`id_product`
  75. AND pl.`id_lang` = 1 AND pl.id_shop = 1
  76. )
  77. LEFT JOIN `ps_product_attribute` pa ON (p.`id_product` = pa.`id_product`)
  78. LEFT JOIN ps_product_attribute_shop product_attribute_shop
  79. ON (product_attribute_shop.id_product_attribute = pa.id_product_attribute AND product_attribute_shop.id_shop = 1 AND product_attribute_shop.`default_on` = 1)
  80. LEFT
  81. JOIN ps_stock_available stock
  82. ON (stock.id_product = p.id_product AND stock.id_product_attribute = IFNULL(`product_attribute_shop`.id_product_attribute, 0) AND stock.id_shop = 1  )
  83. LEFT JOIN `ps_manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer`
  84. LEFT JOIN `ps_image` i ON (i.`id_product` = p.`id_product`) LEFT JOIN ps_image_shop image_shop
  85. ON (image_shop.id_image = i.id_image AND image_shop.id_shop = 1 AND image_shop.cover=1)
  86. LEFT JOIN `ps_image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = 1)
  87. LEFT JOIN `ps_feature_product` feat1 ON (feat1.id_feature = 9 AND feat1.id_product = p.`id_product`)
  88. LEFT JOIN `ps_feature_value_lang` feat2 ON (feat1.id_feature_value = feat2.id_feature_value AND feat2.`id_lang` = 1)
  89. LEFT JOIN `ps_feature_product` feat3 ON (feat3.id_feature = 15 AND feat3.id_product = p.`id_product`)
  90. LEFT JOIN `ps_feature_value_lang` feat4 ON (feat3.id_feature_value = feat4.id_feature_value AND feat4.`id_lang` = 1)
  91. WHERE p.`id_product`  IN (247,690,724,851,858,865,1020,1097,1151,1152,1235,1414,1569,1575,1598,1673,1873,2087,2279,2280,2281,2283,2302,2458,2476,2663,2686,2824,2843,2923,3031,3113,3163,3236,3254,3454,3501,3770,3986,4147,4177,4203,4206,4207,4208,4210,4216,4217,4218,4225,4228,4229,4230,4232,4233,4235,4252,4254,4259,4263,4266,4267,4268,4269,4270,4274,4283,4284,4285,4287,4288,4289,4415,4644,5378,5409,5737,5760,5782,5856,5999,6396,6486,6541,6686,6687,6763,6786,6815,7022,7083,7084,7189,7199,7215,7270,7273,7275,7276,7278,7280,7292,7293,7294,7301,7303,7306,7307,7322,7324,7325,7331,7334,7337,7340,7341,7344,7346,7348,7420,7603,7609,7797,8027,8410,8562,8834,8958,9460,9526,9825,9834,10546,10776,11308,11370,11413,11491,11685,11899,12319,12335,12351,12352,12513,12553,12604,12647,12804,12824,13364,13568,13592,13621,13720,13754,13774,13806,13819,13836,13875,13893,14081,14152,14186,14230,14278,14290,14298,14317,14488,14570,14638,14639,14650,14663,14807,14829,14901,15205,15552,15587,15589,15781,15792,15923,15938,15994,16069,16097,16154,16234,16495,16559,16672,16700,16743,16771,16955,17029,17153,17689,17753,17824,18080,18150,18163,18208,18288,18352,18390,18485,18506,18532,18586,18686,18709,18726,18767,18859,18871,19058,19078,19080,19104,19220,19274,19276,19354,19379,19493,19530,19539,19770,19818,19891,19897,19993,20024,20297,20376,20398,20609,20702,20760,20791,20885,20890,20928,21039,21234,21311,21350,21404,21406,21524,21548,21592,21701,21804,21834,21841,21896,21988,22005,22007,22017,22033,22137,22204,22344,22375,22426,22449,22504,22630,22715,22867,22946,23045,23046,23078,23105,23311,23471,23543,23580,23623,23676,23721,23795,23881,23919,23929,24131,24138,24282,24315,24499,24531,24801,24843,24975,25014,25181,25195,25398,25422,25437,25649,25672,25700,25706,25746,25758,25797,25814,25913,26034,26231,26394,26409,26519,26620,26643,26677,26837,26956,27111,27113,27155,27222,27261,27298,27331,27372,27436,27460,27502,27516,27531,27552,27567,27623,27651,27685,27770,27817,27870,27912,27934,27978,28113,28139,28191,28515,28518,28521,28972,28973,28974,28979,28985,28986,28987,28989,28990,28991,28995,29001,29007,29008,29072,29225,29306,29479,29691,29991,30127,30214,30236,30558,30664,31175,31879,32039,32040,32049,32059,32145,32199,32352,32509,32513,32615,32628,32665,32765,32778,32779,32806,32817,32818,32852,32876,33432,33687,33954,34097,34215,34421,34425,34581,34637,34648,34741,35031,35173,35243,35246,35365,35618,35648,35802,35803,36023,36147,36423,36424,36514,36624,36856,36888,36903,36905,36911,37251,37354,37428,37473,37669,37916,38277,38287,38499,38724,38741,38870,38884,38896,39038,39183,39268,39430,39452,39767,39851,39893,40000,40002,40003,40020,40073,40247,40248,40370,40653,40716,40751,40938,41012,41013,41015,41051,41104,41196,41221,41282,41306,41309,41407,41431,41432,41433,41436,41437,41518,41520,41522,41669,41689,41690,41691,41721,41794,41796,41806,41807,41809,41862,41926,41927,41974,42017,42211,42220,42246,42315,42387,42392,42431,42508,42561,42665,42913,42968,43141,43315,43411,43412,43461,43576,43691,43755,43785,43868,44121,44129,44434,44436,44768,45008,45389,45831,46029,46129,46198,46590,46662,46774,46782,46867,47041,47042,47370,47481,47819,48118,48459,48467,48480,48535,48542,48590,48634,49256,49298,49313,49318,49324,49342,49362,49371,49380,49440,49467,49483,49566,49616,49639,49706,49765,49784,49841,49928,49946,50017,50110,50116,50124,50148,50164,50223,50249,50269,50282,50346,50366,50389,50394,50411,50425,50434,50586,50638,50651,51267,51319,51327,51336,51340,51440,51453,51498,51538,51644,51658,51739,51767,51796,51804,51943,52005,52634,52648,52722,52729,52822,53008,53229,53374,53418,53568,53587,53618,53677,53715,53727,53751,53811,53909,53924,53936,53943,53948,53952,53965,53976,53983,53994,53996,54076,54198,54274,54381,54416,54495,54517,54604,54674,54750,54794,55010,55130,55157,55216,55231,55236,55269,55374,55406,55410,55588,55629,55640,55667,55672,55678,55683,55737,55793,55819,55945,55960,56049,56055,56065,56113,56134,56176,56258,56277,56287,56335,56423,56424,56583,56799,56844,56862,56884,56885,56902,56903,56914,57020,57031,57124,57179,57274,57323,57391,57427,57432,57531,57617,57678,57772,57838,57844,57847,57852,57855,57926,58189,58232,58372,58376,58405,58421,58449,58478,58600,58612,58619,58705,58711,58749,58795,58960,58969,58971,58993,59011,59017,59107,59118,59135,59188,59195,59202,59206,59350,59364,59389,59428,59475,59500,59511,59545,59548,59567,59628,59820,59821,59825,59826,59828,59830,59833,59834,59840,59869,59910,59986,60021,60107,60194,60219,60225,60249,60331,60373,60427,60476,60488,60491,60533,60549,60554,60593,60653,60655,60730,60746,60763,60842,60843,60852,60867,60874,60880,60954,60965,60986,61000,61072,61075,61086,61089,61100,61286,61341,61490,61499,61601,61612,61613,61643,61784,61794,61836,61849,61877,62111,62160,62203,62207,62227,62249,62263,62279,62286,62321,62354,62363,62365,62415,62417,62447,62466,62474,62501,62513,62517,62541,62546,62563,62693,62706,62768,62775,62836,62919,62934,62991,62995,63030,63050,63114,63172,63215,63258,63273,63279,63281,63342,63388,63431,63436,63589,63596,63619,63626,63633,63680,63699,63780,63811,63899,64009,64035,64047,64128,64153,64179,64203,64219,64278,64317,64412,64415,64533,64547,64575,64591,64754,64757,64812,64959,65064,65279,65333,65485,65487)   AND IFNULL(stock.quantity, 0) > 0  AND IFNULL(p.price, 0) > 0
  92. GROUP BY product_shop.id_product
  93. ORDER BY CONVERT(p.reference, UNSIGNED INT) DESC
  94. ) UNION (SELECT
  95. CONVERT(p.reference, UNSIGNED INT) AS reference, p.id_product, p.id_supplier, p.id_manufacturer, p.id_category_default, p.id_shop_default, p.id_tax_rules_group, p.on_sale, p.online_only, p.ean13,             p.upc, p.ecotax, p.minimal_quantity, p.price, p.wholesale_price, p.unity, p.unit_price_ratio, p.additional_shipping_cost, p.supplier_reference, p.location, p.width, p.height, p.depth, p.weight,
  96. p.quantity_discount, p.customizable, p.uploadable_files, p.text_fields, p.active, p.redirect_type, p.id_product_redirected, p.available_for_order, p.available_date, p.condition,
  97. p.show_price, p.indexed, p.visibility, p.cache_is_pack, p.cache_has_attachments, p.is_virtual, p.cache_default_attribute, p.date_add, p.date_upd, p.advanced_stock_management,
  98. product_shop.id_shop
  99. , stock.out_of_stock, IFNULL(stock.quantity, 0) AS quantity,
  100. pl.`description_short`, pl.`available_now`, pl.`available_later`, pl.`link_rewrite`, pl.`name`,
  101. MAX(image_shop.`id_image`) id_image, il.`legend`, m.`name` manufacturer_name ,(
  102. SELECT SUM(weight)
  103. FROM ps_search_word sw
  104. LEFT JOIN ps_search_index si ON sw.id_word = si.id_word
  105. WHERE sw.id_lang = 1
  106. AND sw.id_shop = 1
  107. AND si.id_product = p.id_product
  108. AND (sw.word LIKE 'faro%' OR sw.word LIKE 'derecho%')
  109. ) POSITION, MAX(product_attribute_shop.`id_product_attribute`) id_product_attribute,
  110. DATEDIFF(
  111. p.`date_add`,
  112. DATE_SUB(
  113. NOW(),
  114. INTERVAL 3 DAY
  115. )
  116. ) > 0 NEW,
  117. IFNULL(feat2.VALUE, 0) AS reffab,
  118. IFNULL(feat4.VALUE, 0) AS refmarca
  119. FROM ps_product p
  120. INNER JOIN ps_product_shop product_shop
  121. ON (product_shop.id_product = p.id_product AND product_shop.id_shop = 1)
  122.  
  123. INNER JOIN `ps_product_lang` pl ON (
  124. p.`id_product` = pl.`id_product`
  125. AND pl.`id_lang` = 1 AND pl.id_shop = 1
  126. )
  127. LEFT JOIN `ps_product_attribute` pa ON (p.`id_product` = pa.`id_product`)
  128. LEFT JOIN ps_product_attribute_shop product_attribute_shop
  129. ON (product_attribute_shop.id_product_attribute = pa.id_product_attribute AND product_attribute_shop.id_shop = 1 AND product_attribute_shop.`default_on` = 1)
  130. LEFT
  131. JOIN ps_stock_available stock
  132. ON (stock.id_product = p.id_product AND stock.id_product_attribute = IFNULL(`product_attribute_shop`.id_product_attribute, 0) AND stock.id_shop = 1  )
  133. LEFT JOIN `ps_manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer`
  134. LEFT JOIN `ps_image` i ON (i.`id_product` = p.`id_product`) LEFT JOIN ps_image_shop image_shop
  135. ON (image_shop.id_image = i.id_image AND image_shop.id_shop = 1 AND image_shop.cover=1)
  136. LEFT JOIN `ps_image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = 1)
  137. LEFT JOIN `ps_feature_product` feat1 ON (feat1.id_feature = 9 AND feat1.id_product = p.`id_product`)
  138. LEFT JOIN `ps_feature_value_lang` feat2 ON (feat1.id_feature_value = feat2.id_feature_value AND feat2.`id_lang` = 1)
  139. LEFT JOIN `ps_feature_product` feat3 ON (feat3.id_feature = 15 AND feat3.id_product = p.`id_product`)
  140. LEFT JOIN `ps_feature_value_lang` feat4 ON (feat3.id_feature_value = feat4.id_feature_value AND feat4.`id_lang` = 1)
  141. WHERE p.`id_product`  IN (247,690,724,851,858,865,1020,1097,1151,1152,1235,1414,1569,1575,1598,1673,1873,2087,2279,2280,2281,2283,2302,2458,2476,2663,2686,2824,2843,2923,3031,3113,3163,3236,3254,3454,3501,3770,3986,4147,4177,4203,4206,4207,4208,4210,4216,4217,4218,4225,4228,4229,4230,4232,4233,4235,4252,4254,4259,4263,4266,4267,4268,4269,4270,4274,4283,4284,4285,4287,4288,4289,4415,4644,5378,5409,5737,5760,5782,5856,5999,6396,6486,6541,6686,6687,6763,6786,6815,7022,7083,7084,7189,7199,7215,7270,7273,7275,7276,7278,7280,7292,7293,7294,7301,7303,7306,7307,7322,7324,7325,7331,7334,7337,7340,7341,7344,7346,7348,7420,7603,7609,7797,8027,8410,8562,8834,8958,9460,9526,9825,9834,10546,10776,11308,11370,11413,11491,11685,11899,12319,12335,12351,12352,12513,12553,12604,12647,12804,12824,13364,13568,13592,13621,13720,13754,13774,13806,13819,13836,13875,13893,14081,14152,14186,14230,14278,14290,14298,14317,14488,14570,14638,14639,14650,14663,14807,14829,14901,15205,15552,15587,15589,15781,15792,15923,15938,15994,16069,16097,16154,16234,16495,16559,16672,16700,16743,16771,16955,17029,17153,17689,17753,17824,18080,18150,18163,18208,18288,18352,18390,18485,18506,18532,18586,18686,18709,18726,18767,18859,18871,19058,19078,19080,19104,19220,19274,19276,19354,19379,19493,19530,19539,19770,19818,19891,19897,19993,20024,20297,20376,20398,20609,20702,20760,20791,20885,20890,20928,21039,21234,21311,21350,21404,21406,21524,21548,21592,21701,21804,21834,21841,21896,21988,22005,22007,22017,22033,22137,22204,22344,22375,22426,22449,22504,22630,22715,22867,22946,23045,23046,23078,23105,23311,23471,23543,23580,23623,23676,23721,23795,23881,23919,23929,24131,24138,24282,24315,24499,24531,24801,24843,24975,25014,25181,25195,25398,25422,25437,25649,25672,25700,25706,25746,25758,25797,25814,25913,26034,26231,26394,26409,26519,26620,26643,26677,26837,26956,27111,27113,27155,27222,27261,27298,27331,27372,27436,27460,27502,27516,27531,27552,27567,27623,27651,27685,27770,27817,27870,27912,27934,27978,28113,28139,28191,28515,28518,28521,28972,28973,28974,28979,28985,28986,28987,28989,28990,28991,28995,29001,29007,29008,29072,29225,29306,29479,29691,29991,30127,30214,30236,30558,30664,31175,31879,32039,32040,32049,32059,32145,32199,32352,32509,32513,32615,32628,32665,32765,32778,32779,32806,32817,32818,32852,32876,33432,33687,33954,34097,34215,34421,34425,34581,34637,34648,34741,35031,35173,35243,35246,35365,35618,35648,35802,35803,36023,36147,36423,36424,36514,36624,36856,36888,36903,36905,36911,37251,37354,37428,37473,37669,37916,38277,38287,38499,38724,38741,38870,38884,38896,39038,39183,39268,39430,39452,39767,39851,39893,40000,40002,40003,40020,40073,40247,40248,40370,40653,40716,40751,40938,41012,41013,41015,41051,41104,41196,41221,41282,41306,41309,41407,41431,41432,41433,41436,41437,41518,41520,41522,41669,41689,41690,41691,41721,41794,41796,41806,41807,41809,41862,41926,41927,41974,42017,42211,42220,42246,42315,42387,42392,42431,42508,42561,42665,42913,42968,43141,43315,43411,43412,43461,43576,43691,43755,43785,43868,44121,44129,44434,44436,44768,45008,45389,45831,46029,46129,46198,46590,46662,46774,46782,46867,47041,47042,47370,47481,47819,48118,48459,48467,48480,48535,48542,48590,48634,49256,49298,49313,49318,49324,49342,49362,49371,49380,49440,49467,49483,49566,49616,49639,49706,49765,49784,49841,49928,49946,50017,50110,50116,50124,50148,50164,50223,50249,50269,50282,50346,50366,50389,50394,50411,50425,50434,50586,50638,50651,51267,51319,51327,51336,51340,51440,51453,51498,51538,51644,51658,51739,51767,51796,51804,51943,52005,52634,52648,52722,52729,52822,53008,53229,53374,53418,53568,53587,53618,53677,53715,53727,53751,53811,53909,53924,53936,53943,53948,53952,53965,53976,53983,53994,53996,54076,54198,54274,54381,54416,54495,54517,54604,54674,54750,54794,55010,55130,55157,55216,55231,55236,55269,55374,55406,55410,55588,55629,55640,55667,55672,55678,55683,55737,55793,55819,55945,55960,56049,56055,56065,56113,56134,56176,56258,56277,56287,56335,56423,56424,56583,56799,56844,56862,56884,56885,56902,56903,56914,57020,57031,57124,57179,57274,57323,57391,57427,57432,57531,57617,57678,57772,57838,57844,57847,57852,57855,57926,58189,58232,58372,58376,58405,58421,58449,58478,58600,58612,58619,58705,58711,58749,58795,58960,58969,58971,58993,59011,59017,59107,59118,59135,59188,59195,59202,59206,59350,59364,59389,59428,59475,59500,59511,59545,59548,59567,59628,59820,59821,59825,59826,59828,59830,59833,59834,59840,59869,59910,59986,60021,60107,60194,60219,60225,60249,60331,60373,60427,60476,60488,60491,60533,60549,60554,60593,60653,60655,60730,60746,60763,60842,60843,60852,60867,60874,60880,60954,60965,60986,61000,61072,61075,61086,61089,61100,61286,61341,61490,61499,61601,61612,61613,61643,61784,61794,61836,61849,61877,62111,62160,62203,62207,62227,62249,62263,62279,62286,62321,62354,62363,62365,62415,62417,62447,62466,62474,62501,62513,62517,62541,62546,62563,62693,62706,62768,62775,62836,62919,62934,62991,62995,63030,63050,63114,63172,63215,63258,63273,63279,63281,63342,63388,63431,63436,63589,63596,63619,63626,63633,63680,63699,63780,63811,63899,64009,64035,64047,64128,64153,64179,64203,64219,64278,64317,64412,64415,64533,64547,64575,64591,64754,64757,64812,64959,65064,65279,65333,65485,65487)   AND IFNULL(stock.quantity, 0) > 0  AND IFNULL(p.price, 0) > 0
  142. GROUP BY product_shop.id_product
  143. ORDER BY CONVERT(p.reference, UNSIGNED INT) DESC
  144. ) UNION (SELECT
  145. CONVERT(p.reference, UNSIGNED INT) AS reference, p.id_product, p.id_supplier, p.id_manufacturer, p.id_category_default, p.id_shop_default, p.id_tax_rules_group, p.on_sale, p.online_only, p.ean13,             p.upc, p.ecotax, p.minimal_quantity, p.price, p.wholesale_price, p.unity, p.unit_price_ratio, p.additional_shipping_cost, p.supplier_reference, p.location, p.width, p.height, p.depth, p.weight,
  146. p.quantity_discount, p.customizable, p.uploadable_files, p.text_fields, p.active, p.redirect_type, p.id_product_redirected, p.available_for_order, p.available_date, p.condition,
  147. p.show_price, p.indexed, p.visibility, p.cache_is_pack, p.cache_has_attachments, p.is_virtual, p.cache_default_attribute, p.date_add, p.date_upd, p.advanced_stock_management,
  148. product_shop.id_shop
  149. , stock.out_of_stock, IFNULL(stock.quantity, 0) AS quantity,
  150. pl.`description_short`, pl.`available_now`, pl.`available_later`, pl.`link_rewrite`, pl.`name`,
  151. MAX(image_shop.`id_image`) id_image, il.`legend`, m.`name` manufacturer_name ,(
  152. SELECT SUM(weight)
  153. FROM ps_search_word sw
  154. LEFT JOIN ps_search_index si ON sw.id_word = si.id_word
  155. WHERE sw.id_lang = 1
  156. AND sw.id_shop = 1
  157. AND si.id_product = p.id_product
  158. AND (sw.word LIKE 'faro%' OR sw.word LIKE 'derecho%')
  159. ) POSITION, MAX(product_attribute_shop.`id_product_attribute`) id_product_attribute,
  160. DATEDIFF(
  161. p.`date_add`,
  162. DATE_SUB(
  163. NOW(),
  164. INTERVAL 3 DAY
  165. )
  166. ) > 0 NEW,
  167. IFNULL(feat2.VALUE, 0) AS reffab,
  168. IFNULL(feat4.VALUE, 0) AS refmarca
  169. FROM ps_product p
  170. INNER JOIN ps_product_shop product_shop
  171. ON (product_shop.id_product = p.id_product AND product_shop.id_shop = 1)
  172.  
  173. INNER JOIN `ps_product_lang` pl ON (
  174. p.`id_product` = pl.`id_product`
  175. AND pl.`id_lang` = 1 AND pl.id_shop = 1
  176. )
  177. LEFT JOIN `ps_product_attribute` pa ON (p.`id_product` = pa.`id_product`)
  178. LEFT JOIN ps_product_attribute_shop product_attribute_shop
  179. ON (product_attribute_shop.id_product_attribute = pa.id_product_attribute AND product_attribute_shop.id_shop = 1 AND product_attribute_shop.`default_on` = 1)
  180. LEFT
  181. JOIN ps_stock_available stock
  182. ON (stock.id_product = p.id_product AND stock.id_product_attribute = IFNULL(`product_attribute_shop`.id_product_attribute, 0) AND stock.id_shop = 1  )
  183. LEFT JOIN `ps_manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer`
  184. LEFT JOIN `ps_image` i ON (i.`id_product` = p.`id_product`) LEFT JOIN ps_image_shop image_shop
  185. ON (image_shop.id_image = i.id_image AND image_shop.id_shop = 1 AND image_shop.cover=1)
  186. LEFT JOIN `ps_image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = 1)
  187. LEFT JOIN `ps_feature_product` feat1 ON (feat1.id_feature = 9 AND feat1.id_product = p.`id_product`)
  188. LEFT JOIN `ps_feature_value_lang` feat2 ON (feat1.id_feature_value = feat2.id_feature_value AND feat2.`id_lang` = 1)
  189. LEFT JOIN `ps_feature_product` feat3 ON (feat3.id_feature = 15 AND feat3.id_product = p.`id_product`)
  190. LEFT JOIN `ps_feature_value_lang` feat4 ON (feat3.id_feature_value = feat4.id_feature_value AND feat4.`id_lang` = 1)
  191. WHERE p.`id_product`  IN (247,690,724,851,858,865,1020,1097,1151,1152,1235,1414,1569,1575,1598,1673,1873,2087,2279,2280,2281,2283,2302,2458,2476,2663,2686,2824,2843,2923,3031,3113,3163,3236,3254,3454,3501,3770,3986,4147,4177,4203,4206,4207,4208,4210,4216,4217,4218,4225,4228,4229,4230,4232,4233,4235,4252,4254,4259,4263,4266,4267,4268,4269,4270,4274,4283,4284,4285,4287,4288,4289,4415,4644,5378,5409,5737,5760,5782,5856,5999,6396,6486,6541,6686,6687,6763,6786,6815,7022,7083,7084,7189,7199,7215,7270,7273,7275,7276,7278,7280,7292,7293,7294,7301,7303,7306,7307,7322,7324,7325,7331,7334,7337,7340,7341,7344,7346,7348,7420,7603,7609,7797,8027,8410,8562,8834,8958,9460,9526,9825,9834,10546,10776,11308,11370,11413,11491,11685,11899,12319,12335,12351,12352,12513,12553,12604,12647,12804,12824,13364,13568,13592,13621,13720,13754,13774,13806,13819,13836,13875,13893,14081,14152,14186,14230,14278,14290,14298,14317,14488,14570,14638,14639,14650,14663,14807,14829,14901,15205,15552,15587,15589,15781,15792,15923,15938,15994,16069,16097,16154,16234,16495,16559,16672,16700,16743,16771,16955,17029,17153,17689,17753,17824,18080,18150,18163,18208,18288,18352,18390,18485,18506,18532,18586,18686,18709,18726,18767,18859,18871,19058,19078,19080,19104,19220,19274,19276,19354,19379,19493,19530,19539,19770,19818,19891,19897,19993,20024,20297,20376,20398,20609,20702,20760,20791,20885,20890,20928,21039,21234,21311,21350,21404,21406,21524,21548,21592,21701,21804,21834,21841,21896,21988,22005,22007,22017,22033,22137,22204,22344,22375,22426,22449,22504,22630,22715,22867,22946,23045,23046,23078,23105,23311,23471,23543,23580,23623,23676,23721,23795,23881,23919,23929,24131,24138,24282,24315,24499,24531,24801,24843,24975,25014,25181,25195,25398,25422,25437,25649,25672,25700,25706,25746,25758,25797,25814,25913,26034,26231,26394,26409,26519,26620,26643,26677,26837,26956,27111,27113,27155,27222,27261,27298,27331,27372,27436,27460,27502,27516,27531,27552,27567,27623,27651,27685,27770,27817,27870,27912,27934,27978,28113,28139,28191,28515,28518,28521,28972,28973,28974,28979,28985,28986,28987,28989,28990,28991,28995,29001,29007,29008,29072,29225,29306,29479,29691,29991,30127,30214,30236,30558,30664,31175,31879,32039,32040,32049,32059,32145,32199,32352,32509,32513,32615,32628,32665,32765,32778,32779,32806,32817,32818,32852,32876,33432,33687,33954,34097,34215,34421,34425,34581,34637,34648,34741,35031,35173,35243,35246,35365,35618,35648,35802,35803,36023,36147,36423,36424,36514,36624,36856,36888,36903,36905,36911,37251,37354,37428,37473,37669,37916,38277,38287,38499,38724,38741,38870,38884,38896,39038,39183,39268,39430,39452,39767,39851,39893,40000,40002,40003,40020,40073,40247,40248,40370,40653,40716,40751,40938,41012,41013,41015,41051,41104,41196,41221,41282,41306,41309,41407,41431,41432,41433,41436,41437,41518,41520,41522,41669,41689,41690,41691,41721,41794,41796,41806,41807,41809,41862,41926,41927,41974,42017,42211,42220,42246,42315,42387,42392,42431,42508,42561,42665,42913,42968,43141,43315,43411,43412,43461,43576,43691,43755,43785,43868,44121,44129,44434,44436,44768,45008,45389,45831,46029,46129,46198,46590,46662,46774,46782,46867,47041,47042,47370,47481,47819,48118,48459,48467,48480,48535,48542,48590,48634,49256,49298,49313,49318,49324,49342,49362,49371,49380,49440,49467,49483,49566,49616,49639,49706,49765,49784,49841,49928,49946,50017,50110,50116,50124,50148,50164,50223,50249,50269,50282,50346,50366,50389,50394,50411,50425,50434,50586,50638,50651,51267,51319,51327,51336,51340,51440,51453,51498,51538,51644,51658,51739,51767,51796,51804,51943,52005,52634,52648,52722,52729,52822,53008,53229,53374,53418,53568,53587,53618,53677,53715,53727,53751,53811,53909,53924,53936,53943,53948,53952,53965,53976,53983,53994,53996,54076,54198,54274,54381,54416,54495,54517,54604,54674,54750,54794,55010,55130,55157,55216,55231,55236,55269,55374,55406,55410,55588,55629,55640,55667,55672,55678,55683,55737,55793,55819,55945,55960,56049,56055,56065,56113,56134,56176,56258,56277,56287,56335,56423,56424,56583,56799,56844,56862,56884,56885,56902,56903,56914,57020,57031,57124,57179,57274,57323,57391,57427,57432,57531,57617,57678,57772,57838,57844,57847,57852,57855,57926,58189,58232,58372,58376,58405,58421,58449,58478,58600,58612,58619,58705,58711,58749,58795,58960,58969,58971,58993,59011,59017,59107,59118,59135,59188,59195,59202,59206,59350,59364,59389,59428,59475,59500,59511,59545,59548,59567,59628,59820,59821,59825,59826,59828,59830,59833,59834,59840,59869,59910,59986,60021,60107,60194,60219,60225,60249,60331,60373,60427,60476,60488,60491,60533,60549,60554,60593,60653,60655,60730,60746,60763,60842,60843,60852,60867,60874,60880,60954,60965,60986,61000,61072,61075,61086,61089,61100,61286,61341,61490,61499,61601,61612,61613,61643,61784,61794,61836,61849,61877,62111,62160,62203,62207,62227,62249,62263,62279,62286,62321,62354,62363,62365,62415,62417,62447,62466,62474,62501,62513,62517,62541,62546,62563,62693,62706,62768,62775,62836,62919,62934,62991,62995,63030,63050,63114,63172,63215,63258,63273,63279,63281,63342,63388,63431,63436,63589,63596,63619,63626,63633,63680,63699,63780,63811,63899,64009,64035,64047,64128,64153,64179,64203,64219,64278,64317,64412,64415,64533,64547,64575,64591,64754,64757,64812,64959,65064,65279,65333,65485,65487)   AND IFNULL(stock.quantity, 0) > 0  AND IFNULL(p.price, 0) > 0
  192. GROUP BY product_shop.id_product
  193. ORDER BY CONVERT(p.reference, UNSIGNED INT) DESC
  194. ) UNION (SELECT
  195. CONVERT(p.reference, UNSIGNED INT) AS reference, p.id_product, p.id_supplier, p.id_manufacturer, p.id_category_default, p.id_shop_default, p.id_tax_rules_group, p.on_sale, p.online_only, p.ean13,             p.upc, p.ecotax, p.minimal_quantity, p.price, p.wholesale_price, p.unity, p.unit_price_ratio, p.additional_shipping_cost, p.supplier_reference, p.location, p.width, p.height, p.depth, p.weight,
  196. p.quantity_discount, p.customizable, p.uploadable_files, p.text_fields, p.active, p.redirect_type, p.id_product_redirected, p.available_for_order, p.available_date, p.condition,
  197. p.show_price, p.indexed, p.visibility, p.cache_is_pack, p.cache_has_attachments, p.is_virtual, p.cache_default_attribute, p.date_add, p.date_upd, p.advanced_stock_management,
  198. product_shop.id_shop
  199. , stock.out_of_stock, IFNULL(stock.quantity, 0) AS quantity,
  200. pl.`description_short`, pl.`available_now`, pl.`available_later`, pl.`link_rewrite`, pl.`name`,
  201. MAX(image_shop.`id_image`) id_image, il.`legend`, m.`name` manufacturer_name ,(
  202. SELECT SUM(weight)
  203. FROM ps_search_word sw
  204. LEFT JOIN ps_search_index si ON sw.id_word = si.id_word
  205. WHERE sw.id_lang = 1
  206. AND sw.id_shop = 1
  207. AND si.id_product = p.id_product
  208. AND (sw.word LIKE 'faro%' OR sw.word LIKE 'derecho%')
  209. ) POSITION, MAX(product_attribute_shop.`id_product_attribute`) id_product_attribute,
  210. DATEDIFF(
  211. p.`date_add`,
  212. DATE_SUB(
  213. NOW(),
  214. INTERVAL 3 DAY
  215. )
  216. ) > 0 NEW,
  217. IFNULL(feat2.VALUE, 0) AS reffab,
  218. IFNULL(feat4.VALUE, 0) AS refmarca
  219. FROM ps_product p
  220. INNER JOIN ps_product_shop product_shop
  221. ON (product_shop.id_product = p.id_product AND product_shop.id_shop = 1)
  222.  
  223. INNER JOIN `ps_product_lang` pl ON (
  224. p.`id_product` = pl.`id_product`
  225. AND pl.`id_lang` = 1 AND pl.id_shop = 1
  226. )
  227. LEFT JOIN `ps_product_attribute` pa ON (p.`id_product` = pa.`id_product`)
  228. LEFT JOIN ps_product_attribute_shop product_attribute_shop
  229. ON (product_attribute_shop.id_product_attribute = pa.id_product_attribute AND product_attribute_shop.id_shop = 1 AND product_attribute_shop.`default_on` = 1)
  230. LEFT
  231. JOIN ps_stock_available stock
  232. ON (stock.id_product = p.id_product AND stock.id_product_attribute = IFNULL(`product_attribute_shop`.id_product_attribute, 0) AND stock.id_shop = 1  )
  233. LEFT JOIN `ps_manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer`
  234. LEFT JOIN `ps_image` i ON (i.`id_product` = p.`id_product`) LEFT JOIN ps_image_shop image_shop
  235. ON (image_shop.id_image = i.id_image AND image_shop.id_shop = 1 AND image_shop.cover=1)
  236. LEFT JOIN `ps_image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = 1)
  237. LEFT JOIN `ps_feature_product` feat1 ON (feat1.id_feature = 9 AND feat1.id_product = p.`id_product`)
  238. LEFT JOIN `ps_feature_value_lang` feat2 ON (feat1.id_feature_value = feat2.id_feature_value AND feat2.`id_lang` = 1)
  239. LEFT JOIN `ps_feature_product` feat3 ON (feat3.id_feature = 15 AND feat3.id_product = p.`id_product`)
  240. LEFT JOIN `ps_feature_value_lang` feat4 ON (feat3.id_feature_value = feat4.id_feature_value AND feat4.`id_lang` = 1)
  241. WHERE p.`id_product`  IN (247,690,724,851,858,865,1020,1097,1151,1152,1235,1414,1569,1575,1598,1673,1873,2087,2279,2280,2281,2283,2302,2458,2476,2663,2686,2824,2843,2923,3031,3113,3163,3236,3254,3454,3501,3770,3986,4147,4177,4203,4206,4207,4208,4210,4216,4217,4218,4225,4228,4229,4230,4232,4233,4235,4252,4254,4259,4263,4266,4267,4268,4269,4270,4274,4283,4284,4285,4287,4288,4289,4415,4644,5378,5409,5737,5760,5782,5856,5999,6396,6486,6541,6686,6687,6763,6786,6815,7022,7083,7084,7189,7199,7215,7270,7273,7275,7276,7278,7280,7292,7293,7294,7301,7303,7306,7307,7322,7324,7325,7331,7334,7337,7340,7341,7344,7346,7348,7420,7603,7609,7797,8027,8410,8562,8834,8958,9460,9526,9825,9834,10546,10776,11308,11370,11413,11491,11685,11899,12319,12335,12351,12352,12513,12553,12604,12647,12804,12824,13364,13568,13592,13621,13720,13754,13774,13806,13819,13836,13875,13893,14081,14152,14186,14230,14278,14290,14298,14317,14488,14570,14638,14639,14650,14663,14807,14829,14901,15205,15552,15587,15589,15781,15792,15923,15938,15994,16069,16097,16154,16234,16495,16559,16672,16700,16743,16771,16955,17029,17153,17689,17753,17824,18080,18150,18163,18208,18288,18352,18390,18485,18506,18532,18586,18686,18709,18726,18767,18859,18871,19058,19078,19080,19104,19220,19274,19276,19354,19379,19493,19530,19539,19770,19818,19891,19897,19993,20024,20297,20376,20398,20609,20702,20760,20791,20885,20890,20928,21039,21234,21311,21350,21404,21406,21524,21548,21592,21701,21804,21834,21841,21896,21988,22005,22007,22017,22033,22137,22204,22344,22375,22426,22449,22504,22630,22715,22867,22946,23045,23046,23078,23105,23311,23471,23543,23580,23623,23676,23721,23795,23881,23919,23929,24131,24138,24282,24315,24499,24531,24801,24843,24975,25014,25181,25195,25398,25422,25437,25649,25672,25700,25706,25746,25758,25797,25814,25913,26034,26231,26394,26409,26519,26620,26643,26677,26837,26956,27111,27113,27155,27222,27261,27298,27331,27372,27436,27460,27502,27516,27531,27552,27567,27623,27651,27685,27770,27817,27870,27912,27934,27978,28113,28139,28191,28515,28518,28521,28972,28973,28974,28979,28985,28986,28987,28989,28990,28991,28995,29001,29007,29008,29072,29225,29306,29479,29691,29991,30127,30214,30236,30558,30664,31175,31879,32039,32040,32049,32059,32145,32199,32352,32509,32513,32615,32628,32665,32765,32778,32779,32806,32817,32818,32852,32876,33432,33687,33954,34097,34215,34421,34425,34581,34637,34648,34741,35031,35173,35243,35246,35365,35618,35648,35802,35803,36023,36147,36423,36424,36514,36624,36856,36888,36903,36905,36911,37251,37354,37428,37473,37669,37916,38277,38287,38499,38724,38741,38870,38884,38896,39038,39183,39268,39430,39452,39767,39851,39893,40000,40002,40003,40020,40073,40247,40248,40370,40653,40716,40751,40938,41012,41013,41015,41051,41104,41196,41221,41282,41306,41309,41407,41431,41432,41433,41436,41437,41518,41520,41522,41669,41689,41690,41691,41721,41794,41796,41806,41807,41809,41862,41926,41927,41974,42017,42211,42220,42246,42315,42387,42392,42431,42508,42561,42665,42913,42968,43141,43315,43411,43412,43461,43576,43691,43755,43785,43868,44121,44129,44434,44436,44768,45008,45389,45831,46029,46129,46198,46590,46662,46774,46782,46867,47041,47042,47370,47481,47819,48118,48459,48467,48480,48535,48542,48590,48634,49256,49298,49313,49318,49324,49342,49362,49371,49380,49440,49467,49483,49566,49616,49639,49706,49765,49784,49841,49928,49946,50017,50110,50116,50124,50148,50164,50223,50249,50269,50282,50346,50366,50389,50394,50411,50425,50434,50586,50638,50651,51267,51319,51327,51336,51340,51440,51453,51498,51538,51644,51658,51739,51767,51796,51804,51943,52005,52634,52648,52722,52729,52822,53008,53229,53374,53418,53568,53587,53618,53677,53715,53727,53751,53811,53909,53924,53936,53943,53948,53952,53965,53976,53983,53994,53996,54076,54198,54274,54381,54416,54495,54517,54604,54674,54750,54794,55010,55130,55157,55216,55231,55236,55269,55374,55406,55410,55588,55629,55640,55667,55672,55678,55683,55737,55793,55819,55945,55960,56049,56055,56065,56113,56134,56176,56258,56277,56287,56335,56423,56424,56583,56799,56844,56862,56884,56885,56902,56903,56914,57020,57031,57124,57179,57274,57323,57391,57427,57432,57531,57617,57678,57772,57838,57844,57847,57852,57855,57926,58189,58232,58372,58376,58405,58421,58449,58478,58600,58612,58619,58705,58711,58749,58795,58960,58969,58971,58993,59011,59017,59107,59118,59135,59188,59195,59202,59206,59350,59364,59389,59428,59475,59500,59511,59545,59548,59567,59628,59820,59821,59825,59826,59828,59830,59833,59834,59840,59869,59910,59986,60021,60107,60194,60219,60225,60249,60331,60373,60427,60476,60488,60491,60533,60549,60554,60593,60653,60655,60730,60746,60763,60842,60843,60852,60867,60874,60880,60954,60965,60986,61000,61072,61075,61086,61089,61100,61286,61341,61490,61499,61601,61612,61613,61643,61784,61794,61836,61849,61877,62111,62160,62203,62207,62227,62249,62263,62279,62286,62321,62354,62363,62365,62415,62417,62447,62466,62474,62501,62513,62517,62541,62546,62563,62693,62706,62768,62775,62836,62919,62934,62991,62995,63030,63050,63114,63172,63215,63258,63273,63279,63281,63342,63388,63431,63436,63589,63596,63619,63626,63633,63680,63699,63780,63811,63899,64009,64035,64047,64128,64153,64179,64203,64219,64278,64317,64412,64415,64533,64547,64575,64591,64754,64757,64812,64959,65064,65279,65333,65485,65487)   AND IFNULL(stock.quantity, 0) > 0  AND IFNULL(p.price, 0) > 0
  242. GROUP BY product_shop.id_product
  243. ORDER BY CONVERT(p.reference, UNSIGNED INT) DESC
  244. ) UNION (SELECT
  245. CONVERT(p.reference, UNSIGNED INT) AS reference, p.id_product, p.id_supplier, p.id_manufacturer, p.id_category_default, p.id_shop_default, p.id_tax_rules_group, p.on_sale, p.online_only, p.ean13,             p.upc, p.ecotax, p.minimal_quantity, p.price, p.wholesale_price, p.unity, p.unit_price_ratio, p.additional_shipping_cost, p.supplier_reference, p.location, p.width, p.height, p.depth, p.weight,
  246. p.quantity_discount, p.customizable, p.uploadable_files, p.text_fields, p.active, p.redirect_type, p.id_product_redirected, p.available_for_order, p.available_date, p.condition,
  247. p.show_price, p.indexed, p.visibility, p.cache_is_pack, p.cache_has_attachments, p.is_virtual, p.cache_default_attribute, p.date_add, p.date_upd, p.advanced_stock_management,
  248. product_shop.id_shop
  249. , stock.out_of_stock, IFNULL(stock.quantity, 0) AS quantity,
  250. pl.`description_short`, pl.`available_now`, pl.`available_later`, pl.`link_rewrite`, pl.`name`,
  251. MAX(image_shop.`id_image`) id_image, il.`legend`, m.`name` manufacturer_name ,(
  252. SELECT SUM(weight)
  253. FROM ps_search_word sw
  254. LEFT JOIN ps_search_index si ON sw.id_word = si.id_word
  255. WHERE sw.id_lang = 1
  256. AND sw.id_shop = 1
  257. AND si.id_product = p.id_product
  258. AND (sw.word LIKE 'faro%' OR sw.word LIKE 'derecho%')
  259. ) POSITION, MAX(product_attribute_shop.`id_product_attribute`) id_product_attribute,
  260. DATEDIFF(
  261. p.`date_add`,
  262. DATE_SUB(
  263. NOW(),
  264. INTERVAL 3 DAY
  265. )
  266. ) > 0 NEW,
  267. IFNULL(feat2.VALUE, 0) AS reffab,
  268. IFNULL(feat4.VALUE, 0) AS refmarca
  269. FROM ps_product p
  270. INNER JOIN ps_product_shop product_shop
  271. ON (product_shop.id_product = p.id_product AND product_shop.id_shop = 1)
  272.  
  273. INNER JOIN `ps_product_lang` pl ON (
  274. p.`id_product` = pl.`id_product`
  275. AND pl.`id_lang` = 1 AND pl.id_shop = 1
  276. )
  277. LEFT JOIN `ps_product_attribute` pa ON (p.`id_product` = pa.`id_product`)
  278. LEFT JOIN ps_product_attribute_shop product_attribute_shop
  279. ON (product_attribute_shop.id_product_attribute = pa.id_product_attribute AND product_attribute_shop.id_shop = 1 AND product_attribute_shop.`default_on` = 1)
  280. LEFT
  281. JOIN ps_stock_available stock
  282. ON (stock.id_product = p.id_product AND stock.id_product_attribute = IFNULL(`product_attribute_shop`.id_product_attribute, 0) AND stock.id_shop = 1  )
  283. LEFT JOIN `ps_manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer`
  284. LEFT JOIN `ps_image` i ON (i.`id_product` = p.`id_product`) LEFT JOIN ps_image_shop image_shop
  285. ON (image_shop.id_image = i.id_image AND image_shop.id_shop = 1 AND image_shop.cover=1)
  286. LEFT JOIN `ps_image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = 1)
  287. LEFT JOIN `ps_feature_product` feat1 ON (feat1.id_feature = 9 AND feat1.id_product = p.`id_product`)
  288. LEFT JOIN `ps_feature_value_lang` feat2 ON (feat1.id_feature_value = feat2.id_feature_value AND feat2.`id_lang` = 1)
  289. LEFT JOIN `ps_feature_product` feat3 ON (feat3.id_feature = 15 AND feat3.id_product = p.`id_product`)
  290. LEFT JOIN `ps_feature_value_lang` feat4 ON (feat3.id_feature_value = feat4.id_feature_value AND feat4.`id_lang` = 1)
  291. WHERE p.`id_product`  IN (43,247,690,724,851,858,865,1020,1097,1151,1152,1235,1392,1414,1521,1569,1575,1598,1652,1673,1873,1893,1938,2087,2279,2280,2281,2283,2302,2458,2476,2633,2663,2686,2744,2797,2824,2843,2923,3031,3113,3139,3163,3236,3254,3334,3454,3501,3747,3770,3986,4087,4147,4177,4203,4206,4207,4208,4210,4216,4217,4218,4224,4225,4228,4229,4230,4232,4233,4235,4252,4254,4259,4263,4266,4267,4268,4269,4270,4274,4283,4284,4285,4287,4288,4289,4359,4415,4644,4652,5030,5378,5409,5737,5760,5782,5856,5999,6195,6396,6486,6541,6686,6687,6763,6786,6815,6893,7022,7083,7084,7189,7199,7215,7223,7270,7273,7275,7276,7278,7280,7292,7293,7294,7301,7303,7306,7307,7322,7324,7325,7331,7334,7337,7340,7341,7344,7346,7348,7420,7527,7603,7609,7797,7960,7968,8027,8410,8562,8790,8834,8958,9460,9526,9825,9834,10102,10546,10567,10776,11308,11370,11413,11491,11545,11653,11685,11899,12319,12335,12351,12352,12513,12553,12604,12637,12647,12804,12824,12944,13283,13364,13561,13568,13592,13621,13696,13720,13754,13774,13806,13819,13836,13875,13893,13907,14081,14152,14186,14230,14278,14290,14298,14317,14488,14570,14638,14639,14650,14663,14721,14799,14807,14829,14901,15151,15205,15225,15328,15552,15587,15589,15753,15781,15792,15823,15923,15938,15994,16069,16072,16097,16103,16154,16234,16290,16323,16495,16496,16559,16672,16700,16713,16743,16771,16955,17029,17153,17689,17753,17824,17919,17974,18080,18150,18163,18208,18256,18288,18316,18352,18390,18431,18434,18485,18506,18532,18586,18686,18709,18726,18767,18848,18859,18871,19047,19056,19058,19078,19080,19104,19161,19220,19274,19276,19313,19354,19379,19469,19470,19493,19530,19533,19539,19770,19818,19891,19897,19931,19993,20024,20240,20280,20297,20376,20398,20403,20548,20609,20702,20760,20791,20793,20852,20885,20890,20928,20966,21039,21234,21311,21314,21350,21404,21406,21430,21524,21548,21592,21594,21701,21804,21834,21841,21896,21988,22005,22007,22016,22017,22033,22137,22172,22204,22344,22375,22426,22449,22504,22630,22665,22715,22867,22946,22980,23045,23046,23078,23105,23311,23408,23471,23543,23580,23623,23676,23721,23795,23801,23881,23919,23923,23929,24018,24027,24131,24138,24143,24171,24282,24315,24378,24398,24499,24531,24631,24776,24801,24843,24934,24975,25014,25085,25181,25195,25396,25398,25405,25422,25437,25439,25649,25672,25700,25706,25746,25758,25797,25814,25815,25913,25936,26034,26036,26231,26366,26394,26409,26519,26620,26643,26677,26837,26909,26956,27111,27113,27155,27171,27222,27261,27298,27331,27372,27436,27452,27460,27502,27516,27531,27552,27567,27572,27623,27651,27685,27770,27817,27870,27879,27912,27934,27947,27978,28113,28117,28139,28191,28515,28516,28518,28521,28523,28972,28973,28974,28979,28985,28986,28987,28989,28990,28991,28995,29001,29007,29008,29072,29225,29306,29479,29691,29991,30127,30214,30236,30558,30635,30664,31175,31251,31879,32039,32040,32049,32059,32145,32199,32351,32352,32428,32509,32513,32541,32612,32615,32628,32665,32765,32778,32779,32806,32817,32818,32852,32876,33417,33432,33687,33954,34097,34108,34215,34421,34425,34518,34581,34637,34648,34741,34992,35031,35173,35243,35246,35334,35365,35618,35648,35802,35803,36023,36147,36423,36424,36514,36624,36856,36888,36903,36905,36911,37036,37052,37251,37354,37428,37473,37669,37916,38277,38287,38345,38499,38724,38741,38809,38865,38870,38884,38896,38912,39038,39183,39184,39268,39430,39452,39715,39767,39851,39893,40000,40002,40003,40020,40031,40073,40247,40248,40370,40387,40399,40653,40716,40751,40938,41012,41013,41015,41051,41104,41196,41221,41282,41306,41309,41407,41431,41432,41433,41436,41437,41518,41520,41522,41586,41669,41689,41690,41691,41721,41794,41796,41806,41807,41809,41822,41862,41926,41927,41974,42017,42211,42220,42246,42286,42287,42315,42387,42392,42431,42508,42561,42665,42913,42968,43141,43315,43411,43412,43461,43576,43691,43755,43785,43868,44121,44129,44186,44287,44434,44436,44768,45008,45053,45389,45831,46029,46129,46198,46499,46590,46662,46697,46774,46782,46867,46951,47041,47042,47370,47481,47559,47809,47819,48118,48459,48467,48480,48509,48535,48542,48568,48590,48634,49256,49298,49313,49318,49324,49342,49362,49371,49376,49380,49429,49440,49467,49483,49566,49616,49639,49658,49706,49765,49784,49839,49841,49897,49926,49928,49946,50017,50079,50110,50116,50124,50148,50164,50223,50249,50269,50280,50282,50346,50366,50389,50394,50411,50425,50434,50586,50599,50627,50638,50651,51256,51267,51319,51327,51329,51334,51336,51340,51440,51453,51498,51524,51538,51644,51649,51658,51671,51739,51767,51796,51804,51809,51941,51943,52005,52031,52634,52646,52648,52722,52729,52822,53008,53079,53219,53229,53372,53374,53418,53448,53568,53572,53587,53598,53618,53677,53715,53727,53751,53811,53899,53909,53924,53936,53943,53948,53952,53965,53976,53983,53994,53996,54076,54128,54198,54252,54274,54325,54381,54416,54471,54495,54517,54602,54604,54674,54750,54794,55010,55130,55157,55216,55227,55229,55231,55236,55269,55374,55406,55410,55588,55629,55640,55667,55672,55678,55683,55737,55793,55819,55901,55902,55903,55945,55954,55960,56049,56055,56065,56113,56117,56123,56134,56176,56258,56277,56287,56335,56370,56423,56424,56583,56799,56829,56831,56844,56862,56884,56885,56902,56903,56914,57020,57031,57124,57179,57274,57323,57380,57391,57427,57432,57531,57617,57678,57772,57836,57838,57844,57847,57852,57855,57860,57926,57927,57998,58011,58189,58232,58372,58376,58405,58414,58421,58449,58478,58600,58612,58619,58621,58705,58711,58749,58785,58795,58803,58960,58969,58971,58993,59003,59011,59017,59107,59118,59135,59188,59195,59202,59206,59207,59350,59364,59368,59389,59428,59438,59475,59500,59511,59545,59548,59567,59571,59628,59633,59755,59762,59805,59820,59821,59825,59826,59828,59830,59833,59834,59840,59869,59910,59986,60021,60107,60136,60194,60219,60225,60249,60331,60372,60373,60427,60476,60488,60491,60533,60549,60554,60593,60650,60653,60655,60730,60746,60763,60831,60842,60843,60846,60847,60851,60852,60867,60874,60877,60880,60954,60965,60986,61000,61072,61075,61086,61089,61100,61243,61284,61286,61341,61444,61490,61499,61508,61601,61612,61613,61636,61641,61643,61691,61713,61784,61794,61806,61807,61836,61849,61856,61870,61877,62075,62105,62111,62124,62160,62162,62201,62203,62207,62227,62249,62263,62279,62286,62321,62354,62363,62365,62415,62417,62447,62466,62474,62501,62513,62517,62531,62541,62546,62562,62563,62693,62700,62706,62768,62775,62780,62836,62843,62919,62934,62991,62993,62995,63001,63030,63050,63065,63114,63115,63172,63215,63221,63258,63273,63279,63281,63290,63306,63342,63343,63388,63431,63436,63589,63596,63619,63626,63633,63680,63699,63727,63770,63780,63811,63899,64009,64035,64047,64074,64102,64128,64153,64179,64198,64203,64219,64278,64317,64330,64412,64415,64513,64533,64547,64575,64591,64610,64619,64754,64757,64812,64959,65064,65234,65279,65333,65473,65485,65487)   AND IFNULL(stock.quantity, 0) > 0  AND IFNULL(p.price, 0) > 0
  292. GROUP BY product_shop.id_product
  293. ORDER BY CONVERT(p.reference, UNSIGNED INT) DESC
  294. )) a ORDER BY a.reference DESC ) abc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement