Custom db query DbQuery prestashop

  $query = new DbQuery();
        $query->select('id_product')
            ->from('product_lang')
            ->where(sprintf('link_rewrite = \'%s\'', pSQL(Tools::getValue('rewrite'))))
            ->where('id_product != ' . (int)Tools::getValue('id_product'))
            ->where('id_lang = ' . (int)$this->context->language->id)
            ->where('id_shop = ' . (int)$this->context->shop->id);

        $id_product = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);

https://devdocs.prestashop.com/1.7/development/database/dbquery/

Comments

Popular Posts