I am trying to open a Magento store link from an external site. While opening the store link I need to send some information using the query string parameters. So I open a link (through php code) such as: http://magentostore.com/myproduct.html?id=3434&user=445
However the Magento store link ignores the query string parameters and reloads the page as: magentostore.com/myproduct.html
I checked in Firebug and can see that there was a redirect to the Magento store without the query string parameters. Is there a way to override this behavior and let Magento load with the query string parameters? What setting can I do in the Magento store to let it allow using the query string parameters? Is there any ot开发者_如何学JAVAher way of sending some more information to the Magento store page?
Is there a way to find out if its Magento doing this and not the server?
Thanks
Magento is receiving the queries on the first request but redirects to the URL it has in the URL Rewrite list. This is probably for SEO reasons. Whatever code you have that needs those values should store them in a session variable before the redirect happens.
deveffort says:
I researched for the URL rewrites and looks like there was a URL redirect for the product link! I have removed it and have my scenario working. However would be great to know if there is anything that can be done to make sure the Magento code does not do any query string parameter sanitization. Thanks a lot..
clockworkgeek says:
I fear removing that rewrite is temporary. It will replace itself on the next product re-index or perhaps when the product is saved. Since you only want to set some cookies it needn't be done by javascript, that is less reliable anyway.
Instead, create an observer to watch for an event of catalog_controller_product_view
. Have the observer check for the query parameters, and if the correct one exists, set the cookie. Also it might try checking the referrer URL matches what you expect of it, that might make spoofing the values a little harder.
精彩评论