Чтобы отсортировать категории в ассоциациях продуктов в BO, я изменил запрос в файле classes / Category.php (я изменил ORDER_BY), когда я заменил измененный файл на сервере, я получил ошибку 500, поэтому я поставил оригиналфайл возвращен, но ошибка 500,
Я перевел prestashop в режим отладки, теперь снова вижу сайт как спереди, так и в BO, но при вставке нового продукта появляется сообщение об ошибке: Неопределенное свойство: Product:: $ no_discount.
Я прочитал, чтобы удалить файлы app / cache / dev / class_index.php и var / cache / prod / class_index.php, может ли это решить проблему?
Функция изменена
public static function getAllCategoriesName(
$idRootCategory = null,
$idLang = false,
$active = true,
$groups = null,
$useShopRestriction = true,
$sqlFilter = '',
$orderBy = '',
$limit = ''
) {
if (isset($idRootCategory) && !Validate::isInt($idRootCategory)) {
die(Tools::displayError());
}
if (!Validate::isBool($active)) {
die(Tools::displayError());
}
if (isset($groups) && Group::isFeatureActive() && !is_array($groups)) {
$groups = (array) $groups;
}
$cacheId = 'Category::getAllCategoriesName_'.md5(
(int) $idRootCategory.
(int) $idLang.
(int) $active.
(int) $useShopRestriction.
(isset($groups) && Group::isFeatureActive() ? implode('', $groups) : '').
(isset($sqlFilter) ? $sqlFilter : '').
(isset($orderBy) ? $orderBy : '').
(isset($limit) ? $limit : '')
);
if (!Cache::isStored($cacheId)) {
$result = Db::getInstance()->executeS('
SELECT c.`id_category`, cl.`name`
FROM `'._DB_PREFIX_.'category` c
'.($useShopRestriction ? Shop::addSqlAssociation('category', 'c') : '').'
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c.`id_category` = cl.`id_category`'.Shop::addSqlRestrictionOnLang('cl').'
'.(isset($groups) && Group::isFeatureActive() ? 'LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON c.`id_category` = cg.`id_category`' : '').'
'.(isset($idRootCategory) ? 'RIGHT JOIN `'._DB_PREFIX_.'category` c2 ON c2.`id_category` = '.(int) $idRootCategory.' AND c.`nleft` >= c2.`nleft` AND c.`nright` <= c2.`nright`' : '').'
WHERE 1 '.$sqlFilter.' '.($idLang ? 'AND `id_lang` = '.(int) $idLang : '').'
'.($active ? ' AND c.`active` = 1' : '').'
'.(isset($groups) && Group::isFeatureActive() ? ' AND cg.`id_group` IN ('.implode(',', array_map('intval', $groups)).')' : '').'
'.(!$idLang || (isset($groups) && Group::isFeatureActive()) ? ' GROUP BY c.`id_category`' : '').'
'.($orderBy != '' ? $orderBy : ' ORDER BY c.`level_depth` ASC').'
'.($orderBy == '' && $useShopRestriction ? ', category_shop.`position` ASC' : '').'
'.($limit != '' ? $limit : '')
);
Cache::store($cacheId, $result);
} else {
$result = Cache::retrieve($cacheId);
}
return $result;
}
CHanged:
'. ($ OrderBy ==' '&& $ useShopRestriction?', Category_shop. position
ASC ':' ').''. ($ limit! =' '? $ limit:' '));
С:
'. ($ orderBy == '' && $ useShopRestriction? ', кл. name
ASC': ''). ''. ($ limit! =' '? $ limit:' '));
Ошибка:
[26-Jun-2019 14:53:12 Европа] PHP Fatalошибка: неперехваченная ошибка: класс «Категория» не найден в /public_html/classes/Product.php:4653 Трассировка стека:
0 /public_html/classes/Cart.php(804): ProductCore :: getProductProperties (2, Array)
1 /public_html/src/Adapter/Cart/CartPresenter.php(278): CartCore-> getProducts (true)
2 /public_html/classes/controller/FrontController.php(495): PrestaShop \ PrestaShop \ Adapter \ Cart \ CartPresenter-> present (Объект (Корзина))
3 /public_html/classes/controller/FrontController.php(544): FrontControllerCore-> assignGeneralPurposeVariables (*)1034 *
4 /public_html/controllers/front/PageNotFoundController.php(42): FrontControllerCore-> initContent ()
5 /public_html/classes/controller/Controller.php(255): PageNotCoreCore>initContent ()
6 /public_html/classes/Dispatcher.php(428): ControllerCore-> run ()
7 / public_html / index.php (28): DispatcherCore-> dispatch ()
8 {main} добавляется в /public_html/classes/Product.php в строку 4653