Prestashop function deprecated > getDefaultCountryId()
-
Hi,
First of all, big up to aytechnet teams for this plugin !
I am trying to use prestashop product integration with an article, however function getDefaultCountryId() used in prestashop-integration.php (line 521) is now deprecated with my current prestashop version (1.5.4.1), so the prestashop product integration doesn’t work.
As described in Prestashop/classes/Country.php :
@deprecated as of 1.5 use $context->country->id insteadTo solve this problem use you can replace getProducts function in prestashop-integration.php by, hope this helps someone.
Regards,
function getProducts( $id_lang, $ids, $get_products_properties = true ) { $context = Context::getContext(); $sql = ' SELECT p.*, pa.<code>id_product_attribute</code>, pl.<code>description</code>, pl.<code>description_short</code>, pl.<code>available_now</code>, pl.<code>available_later</code>, pl.<code>link_rewrite</code>, pl.<code>meta_description</code>, pl.<code>meta_keywords</code>, pl.<code>meta_title</code>, pl.<code>name</code>, i.<code>id_image</code>, il.<code>legend</code>, m.<code>name</code> AS manufacturer_name, tl.<code>name</code> AS tax_name, t.<code>rate</code>, cl.<code>name</code> AS category_default, DATEDIFF(p.<code>date_add</code>, DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0 AS new, (p.<code>price</code> * IF(t.<code>rate</code>,((100 + (t.<code>rate</code>))/100),1)) AS orderprice FROM <code>'._DB_PREFIX_.'product</code> p LEFT JOIN <code>'._DB_PREFIX_.'product_attribute</code> pa ON (p.<code>id_product</code> = pa.<code>id_product</code> AND default_on = 1) LEFT JOIN <code>'._DB_PREFIX_.'category_lang</code> cl ON (p.<code>id_category_default</code> = cl.<code>id_category</code> AND cl.<code>id_lang</code> = '.(int)($id_lang).') LEFT JOIN <code>'._DB_PREFIX_.'product_lang</code> pl ON (p.<code>id_product</code> = pl.<code>id_product</code> AND pl.<code>id_lang</code> = '.(int)($id_lang).') LEFT JOIN <code>'._DB_PREFIX_.'image</code> i ON (i.<code>id_product</code> = p.<code>id_product</code> AND i.<code>cover</code> = 1) LEFT JOIN <code>'._DB_PREFIX_.'image_lang</code> il ON (i.<code>id_image</code> = il.<code>id_image</code> AND il.<code>id_lang</code> = '.(int)($id_lang).') LEFT JOIN <code>'._DB_PREFIX_.'tax_rule</code> tr ON (p.<code>id_tax_rules_group</code> = tr.<code>id_tax_rules_group</code> AND tr.<code>id_country</code> = '.(int)$context->country->id.' AND tr.<code>id_state</code> = 0) LEFT JOIN <code>'._DB_PREFIX_.'tax</code> t ON (t.<code>id_tax</code> = tr.<code>id_tax</code>) LEFT JOIN <code>'._DB_PREFIX_.'tax_lang</code> tl ON (t.<code>id_tax</code> = tl.<code>id_tax</code> AND tl.<code>id_lang</code> = '.(int)($id_lang).') LEFT JOIN <code>'._DB_PREFIX_.'manufacturer</code> m ON m.<code>id_manufacturer</code> = p.<code>id_manufacturer</code> WHERE p.<code>active</code> = 1 AND p.<code>id_product</code> IN ('.$ids.')'; $products = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql); if ($get_products_properties) $products = Product::getProductsProperties((int)($id_lang), $products); return $products; }
https://www.ads-software.com/extend/plugins/prestashop-integration/
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Prestashop function deprecated > getDefaultCountryId()’ is closed to new replies.