Build query DbQuery - Prestashop
$sql = new DbQuery();
// Build SELECT
sql->select('cu.`id_customization`, cu.`quantity` AS customization_quantity');
$sql->from('cart_product', 'cp');
$sql->leftJoin('product', 'p', 'p.`id_product` = cp.`id_product`');
$sql->innerJoin('product_shop', 'product_shop', '(product_shop.`id_shop` = cp.`id_shop` AND product_shop.`id_product` = p.`id_product`)');
$sql->where('cp.`id_cart` = '.(int)$this->id);
$sql->orderBy('cp.`date_add`, cp.`id_product`, cp.`id_product_attribute` ASC');
$result = Db::getInstance()->executeS($sql);
// Build SELECT
sql->select('cu.`id_customization`, cu.`quantity` AS customization_quantity');
$sql->from('cart_product', 'cp');
$sql->leftJoin('product', 'p', 'p.`id_product` = cp.`id_product`');
$sql->innerJoin('product_shop', 'product_shop', '(product_shop.`id_shop` = cp.`id_shop` AND product_shop.`id_product` = p.`id_product`)');
$sql->where('cp.`id_cart` = '.(int)$this->id);
$sql->orderBy('cp.`date_add`, cp.`id_product`, cp.`id_product_attribute` ASC');
$result = Db::getInstance()->executeS($sql);
Comments
Post a Comment