Magento URL不区分大小写
来源:互联网 发布:mac ruby 路径 编辑:程序博客网 时间:2024/06/01 16:58
首先找到:app/code/core/Mage/Core/Model/Resource/Url/Rewrite.php,
这个文件的public function loadByRequestPath(Mage_Core_Model_Url_Rewrite $object, $path)方法,大概在134行。
修改这个方法里面的一行代码就可以了。
在158行的样子,找到:if (!array_key_exists($item['request_path'], $mapPenalty))改成
if (!array_key_exists(strtolower($item['request_path']), array_change_key_case($mapPenalty)))就可以了。
完整代码:
public function loadByRequestPath(Mage_Core_Model_Url_Rewrite $object, $path){ if (!is_array($path)) { $path = array($path); } $pathBind = array(); foreach ($path as $key => $url) { $pathBind['path' . $key] = $url; } $adapter = $this->_getReadAdapter(); $select = $adapter->select() ->from($this->getMainTable()) ->where('request_path IN (:' . implode(', :', array_flip($pathBind)) . ')') ->where('store_id IN(?)', array(Mage_Core_Model_App::ADMIN_STORE_ID, (int)$object->getStoreId())); $items = $adapter->fetchAll($select, $pathBind); // 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) { if (!array_key_exists(strtolower($item['request_path']), array_change_key_case($mapPenalty))) { //修改这里就可以了。 continue; } $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 } } } // Set data and finish loading http://www.hicoogle.com/magento-rang-chan-pin-di-url-zhi-chi-da-xiao-xie.html if ($foundItem) { $object->setData($foundItem); } // Finish $this->unserializeFields($object); $this->_afterLoad($object); return $this;}
0 0
- Magento URL不区分大小写
- Tomcat 中设置URL不区分大小写
- Tomcat URL不区分大小写配置
- tomcat url不区分大小写的设置
- Url地址区分大小写
- linux下nginx的url访问不区分大小写
- 不区分大小写
- 域名不区分大小写
- Mysql 不区分大小写
- sql不区分大小写
- mysql 不区分大小写
- binary_search不区分大小写
- mysql 不区分大小写
- Solr不区分大小写
- git不区分大小写
- magento URL大小写404解决
- XML不区分大小写查询
- 正则表达式不区分大小写
- Java学习笔记之面向对象测试代码
- 【个人收藏】PHP+MySQL+jQuery实现发布微博程序——PHP篇
- Win7下安装CentOS 6.5双系统(还没试)
- 0.安装maven
- 分组01背包 POJ Washing Clothes
- Magento URL不区分大小写
- 仿淘宝按热度进行商品排序:参与人数最多
- Java年谱
- Struts2学习笔记(十)方法拦截器
- 【c语言】用π/4 ≈ 1 - 1/3 + 1/5 - 1/7 +... 公式求π的近似值,直到发现某一项的绝对值小于10^6为止。
- PPTP穿透NAT之深入分析
- 【doc】JOBLIB:按需求计算:Memory类
- I - 最少拦截系统 HDU 1257
- MMS与GOOSE