如果多个实体(例如类别,产品,CMS页面和模块FrontName)所有尝试使用相同的SEF URL,那么Magento用于决定哪些算法或进程将保存在中core_url_rewrite
具有所需的 request_path
,它将附加的后缀解析冲突(例如'sale-123.html')。
提出问题另一种方式,如果一个CMS页面和类别都要求"销售" 作为他们的URL,这将获胜?
如果多个实体(例如类别,产品,CMS页面和模块FrontName)所有尝试使用相同的SEF URL,那么Magento用于决定哪些算法或进程将保存在中core_url_rewrite
具有所需的 request_path
,它将附加的后缀解析冲突(例如'sale-123.html')。
提出问题另一种方式,如果一个CMS页面和类别都要求"销售" 作为他们的URL,这将获胜?
If multiple entities (e.g. a category, a product, a CMS page and a module frontname) all attempt to use the same SEF URL, what is the algorithm or process that Magento uses to decide which will be saved in core_url_rewrite
with the desired request_path
, and which will have suffixes appended to resolve the conflict (e.g. 'sale-123.html').
To ask the question another way, if a CMS page and category both ask for 'sale' as their URL, which will win?
艾伦风暴写了一篇关于它的长篇文章: http://alanstorm.com/magento_dispatch_rewrites_intro
并缩短一点点,它是惩罚(?)
// Go through all found records and choose one with lowest penalty - earlier path in array, concrete store $mapPenalty = array_flip(array_values($path)); // we got mapping array(path => index), lower index - better $currentPenalty = null; $foundItem = null; foreach ($items as $item) { $penalty = $mapPenalty[$item['request_path']] << 1 + ($item['store_id'] ? 0 : 1); if (!$foundItem || $currentPenalty > $penalty) { $foundItem = $item; $currentPenalty = $penalty; if (!$currentPenalty) { break; // Found best matching item with zero penalty, no reason to continue } } }
Alan Storm wrote a long blog article about it: http://alanstorm.com/magento_dispatch_rewrites_intro
And to shorten it a little bit, it is all around penalty (?)
// Go through all found records and choose one with lowest penalty - earlier path in array, concrete store $mapPenalty = array_flip(array_values($path)); // we got mapping array(path => index), lower index - better $currentPenalty = null; $foundItem = null; foreach ($items as $item) { $penalty = $mapPenalty[$item['request_path']] << 1 + ($item['store_id'] ? 0 : 1); if (!$foundItem || $currentPenalty > $penalty) { $foundItem = $item; $currentPenalty = $penalty; if (!$currentPenalty) { break; // Found best matching item with zero penalty, no reason to continue } } }
© 2022 it.wenda123.org All Rights Reserved. 问答之家 版权所有