VisiSELECT p.product_id, p.price AS sprice, (SELECT AVG(rating) AS total FROM oc_review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM oc_product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '1' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM oc_product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '1' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT ps.date_end FROM oc_product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '1' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND ps.date_end != '0000-00-00' AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special_price_valid_until, pd.url FROM oc_product_to_category p2c LEFT JOIN oc_product p ON (p2c.product_id = p.product_id) LEFT JOIN oc_product_description pd ON (p.product_id = pd.product_id) WHERE pd.language_id = '2' AND p.status = '1' AND p.date_available <= NOW() AND p2c.category_id = '232' AND p.product_id IN (20919,20920,20921,20926,20927,20929,20930,20932,20934,20936,20960) AND p.quantity > 0 GROUP BY p.product_id ORDER BY CASE WHEN p.quantity <= 0 THEN 1 ELSE 0 END, p.sort_order ASC, LCASE(pd.name) ASC LIMIT 0,10000VisiSELECT p.product_id, p.price AS sprice, (SELECT AVG(rating) AS total FROM oc_review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM oc_product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '1' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM oc_product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '1' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT ps.date_end FROM oc_product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '1' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND ps.date_end != '0000-00-00' AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special_price_valid_until, pd.url FROM oc_product_to_category p2c LEFT JOIN oc_product p ON (p2c.product_id = p.product_id) LEFT JOIN oc_product_description pd ON (p.product_id = pd.product_id) WHERE pd.language_id = '2' AND p.status = '1' AND p.date_available <= NOW() AND p2c.category_id = '232' AND p.product_id IN (16684,16697,16710,16721,16726,16731,16769,16799,18037,18131,18142,18214,18227,18233,18234,18239,18246,18248,18261,18272,18274,18277,18281,18285,18288,18293,18295,18296,18301,18302,18303,18304,18305,18306,18486,18750,18751,18766,18776,18815,18830,18853,18919,18920,18921,18945,19382,19434,19438,19448,20211,20214,20215,20218,20219,20226,20229,20260,20280,20317,20321,20341,20342,20352,20363,20366,20367,20368,20369,20370,20371,20372,20373,20468,20476,20497,20498,20506,20507,20539,20550,20560,20573,20607,20611,20614,20618,20637,20653,20663,20664,20665,20666,20667,20668,20669,20670,20671,20672,20673,20759,20766,20778,20785,20919,20920,20921,20926,20927,20929,20930,20932,20934,20936,20960,21110,21112,21113,21118,21128,21129,21146,21150,21152,21153,21154,21155,21157,21158,21161,21162,21164,21165,21171,21254,21264,21320,21321,21322,21350,21351,21352,21354,21355,21408,21419,21566,21569,21581,21582,21583,21584,21585,21586,21587,21598,21599,21600,21663,21664,21665,21666,21717,21718,21719,21944,21954,21958,21961,21971,21978,21991,21992,22004,22007,22008,22011,22021,22030,22043,22046,22062,22084,22144,22282,22283,22284,22286,22287,22293,22302,22304,22312,22314,22318,22412,27700,27703,27704,27705,27709,27710,27711,27713,27719,27720,27722,27724,28252,28257,28271,28273,28275,28290,28512,28513,28514,28515,28545,28546,28547,28548,28549,28553,28554,28557,28558,28559,28560,28565,28566,28581,28582,28583,28584,28585,28587,28588,28590,28594,28599,28600,28601,28602,28606,28610,28611,28612,28619,28622,28623,28693,28713,28715,28717,29507,29508,29509,29510,29565,29566,29570,29571,29572,29573,29574,29575,29576,29577,29578,29579,29593,29594,29595,29685,29686,29687,29688,29689,29690,29691,29692,29693,29694,29695,29696,29697,29698,29699,29700,29701,29702,29703,29704,29705,29706,29707,29708,29709,29854,29855,30480,30481,30487,30494,30496,30503,30510,30521,30528,30537,30585,30587,30603,30649,30652,30653,30656,30658,30667,30675,30676,30677,30682,30688,30692,30694,30700,30701,30702,30704,30706,30709,30756,30841,30863,30891,30921,30922,30949,31024,31029,31040,31042,31044,31048,31063,31066,31068,31071,31074,31079,31081,31082,31085,31087,31088,31089,31091,31092,31093,31110,31124,31228,31237,31240,31245,31341,31342,31345,31347,31348,31350,31359,31360,31362,31363,31365,31366,31368,31369,31371,31372,31373,31374,31376,31377,31378,31379,31380,31382,31383,31386,31393,31396,31397,31398,31399,31401,31402,31403,31404,31406,31408,31409,31411,31434,31451,31454,31458,31464,31465,31478,31481,31484,31490,31504,31536,31538,31553,31583,31584,31585,31586,31587,31588,31589,31590,31591,31592,31593,31594,31595,31596,31597,31598,31599,31602,31603,31604,31605,31617,31618,31624,31628,31633,31636,31637,31641,31644,31645,31646,31668,31669,31670,31676,31677,31678,31679,31680,31682,31686,31688,31689,31729,31736,31740,31761,31768,31819,31829,31833,31847,32017,32027,32029,32031,32040) AND p.quantity > 0 GROUP BY p.product_id ORDER BY CASE WHEN p.quantity <= 0 THEN 1 ELSE 0 END, p.sort_order ASC, LCASE(pd.name) ASC LIMIT 0,10000
Naujos padangos internetu pigiau | Autorolis.lt