要在BO中的产品关联中对类别进行排序, 我在classes / Category.php文件中修改了一个查询(我更改了ORDER_BY), 当我替换服务器上的修改文件时 我收到错误500,所以我放回原始文件,但仍然错误500,
我现在将prestashop置于调试模式,现在可以再次在Boss前面和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;
}
已更改:
'。($ orderBy ==''&& $ useShopRestriction?',category_shop。
position
ASC':“”)。 '。($ limit!=''?$ limit:'') );
使用:
'。($ orderBy ==''&& $ useShopRestriction?',cl。
name
ASC':'')。 '。($ limit!=''?$ limit:'') );
错误:
[2019年6月26日14:53:12欧洲] PHP致命错误:未捕获的错误:在/public_html/classes/Product.php:4653中找不到类'Category' 堆栈跟踪:
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(Object(Cart))
3 /public_html/classes/controller/FrontController.php(544):FrontControllerCore-> assignGeneralPurposeVariables()
4 /public_html/controllers/front/PageNotFoundController.php(42):FrontControllerCore-> initContent()
5 /public_html/classes/controller/Controller.php(255):PageNotFoundControllerCore-> initContent()
6 /public_html/classes/Dispatcher.php(428):ControllerCore-> run()
7 /public_html/index.php(28):DispatcherCore-> dispatch()
8 {main} 在第4653行的/public_html/classes/Product.php中抛出