Tuesday 15 June 2010

php - Product URLs return a 404 error when linked directly from a different store language in Magento 1.7 -


There are 3 languages ​​in my Magenta store if someone links me to an "English" store for example, from a store view, And if I'm on a "Spanish" store view, that product returns a 404 error.

I found it in my investigation, but I am currently trying to understand where this code goes, I think this file is for / app / code / core / Mage / Core /Model/Url/Rewrite.php , but I have not figured out where in that file I should add that code snippet.

Edit:

And I do not even know that my problem will be resolved.

Edit:

OK, I've found this link:

According to this, whatever I saw in my file above There should be something similar to that, unfortunately, the function loadByRequestPath is different on my file and it comes in this way:

/ ** * Load the rewrite information * If there is a $ path array - we need to load the possible records and record an earlier matching array. Choosing will * @param mixed $ path * @ Taran Mage_Core_Model_Url_Rewrite * / public function loadByRequestPath ($ path) {$ this- & gt; Set ID (empty); $ This- & gt; _getResource () - & gt; LoadByRequest path ($ this, $ path); $ This- & gt; _afterLoad (); $ This- & gt; SetOrigData (); $ This- & gt; _hasDataChanges = false; $ This return; }

OK, it was fast! I resolved my issue by setting the loadByRequestPath in the /app/code/core/Mage/Core/Model/Url/Rewrite.php file: < Pre> public function loadByRequestPath ($ path) {$ this- & gt; SetId (empty); If (is_array ($ path)) {foreach ($ path as path path) {$ this- & gt; Load ($ pathInfo, 'request_path'); If (! $ This-> getId () & amp; ;; isset ($ _GET ['___ to_store'])) {$ db = Dana :: getSingleton ('core / resources') -> GetConnection ('default_read'); $ Result = $ db- & gt; Query ('select store_id core_url_rewrite WHERE request_path =' '. $ PathInfo.' ''); If ($ result) {$ storeIds = array (); If ($ line = $ result-> get (PDF :: FETCH_ASSOC)) {$ storeId = $ row ['store_id']; $ StoreCode = Mage :: app () - & gt; GetStore ($ storeId) - & gt; GetCode (); Header ("HTTP / 1.1 301 Permanently Progressed"); Header ("Location: http: //". $ _SERVER ['HTTP_HOST']. "/". $ Path information. "? ___ store =". $ StoreCode); Go out(); }}}}} And {$ this-> Load ($ path, 'request_path'); } $ This return; }

If you do not want any issues while upgrading Magenta do not forget to make a local copy.

No comments:

Post a Comment