I installed the Graphic Line AliExpress module and I need to override the AlliExpressAttribute class so that it is taken into account in future updates.
I have done it in a thousand ways and Prestashop does not execute my Override. I have created AlliExpressAttribute.php file in:
/modules/aliexpress_official/override/classes/AlliExpressAttribute.php
/override/modules/aliexpress_official/classes/AlliExpressAttribute.php
/override/classes/AlliExpressAttribute.php (esta ya por desesperación)
The file contains the public static function getGroups($id_category) in which I simply comment the part where the id_category_default is specified to the SQL statement, since we are going to upload products in the SALES category but that is not the default category of the products to upload.
<?php
class AliexpressAttributeOverride extends AliexpressAttribute
{
public static function getGroups($id_category)
{
$id_lang = Context::getContext()->language->id;
$id_shop = AliexpressConf::getShopId();
$sql = 'SELECT DISTINCT fl.`id_feature`, fl.`name` FROM `' . _DB_PREFIX_ . 'feature_lang` fl
JOIN `' . _DB_PREFIX_ . 'feature` f
ON f.`id_feature` = fl.`id_feature`
JOIN `' . _DB_PREFIX_ . 'feature_value` fv
ON fv.`id_feature` = f.`id_feature`
JOIN `' . _DB_PREFIX_ . 'feature_product` fp
ON fp.`id_feature` = f.`id_feature`
JOIN `' . _DB_PREFIX_ . 'product_shop` ps
ON ps.`id_product` = fp.`id_product`
WHERE fl.`id_lang` = ' . (int) $id_lang . ' AND ps.`id_shop` = ' . (int) $id_shop;
/*if ((int) $id_category > 0) {
$sql .= ' AND ps.`id_category_default` = ' . (int) $id_category;
}*/
if ($rows = Db::getInstance()->executeS($sql)) {
foreach ($rows as $k => $row) {
if ($values = FeatureValue::getFeatureValuesWithLang($id_lang, $row['id_feature'])) {
$rows[$k]['values'] = $values;
} else {
$rows[$k]['values'] = array();
}
}
return $rows;
}
return array();
}
}
I have cleared the cache a thousand times, both in Performance > Clear cache , and by SSH deleting the /var/cache/ folder and everything is still the same. I have the templates reconfigure when they are updated, Cache: No and Debug Mode: Yes.
Is there something I'm missing?
Prestashop Version: 1.7.6.4
Thanks in advance. All the best.
Apparently, for modules, Prestashop only overrides its main class. In this case, you can only override aliexpress_official.php located in /modules/aliexpress_official/
All the best.