Magento 忽略额外的 URL 参数集

发布于 2024-09-30 00:50:27 字数 519 浏览 0 评论 0原文

我正在尝试从外部站点打开 Magento 商店链接。打开商店链接时,我需要使用查询字符串参数发送一些信息。 所以我打开一个链接(通过 php 代码),例如: http://magentostore.com/myproduct.html?id=3434&user=445

然而,Magento 商店链接会忽略查询字符串参数并重新加载页面: magentostore.com/myproduct.html

我检查了 Firebug,可以看到有一个重定向到 Magento 商店,没有查询字符串参数。有没有办法覆盖这种行为并让 Magento 加载查询字符串参数? 我可以在 Magento 商店中进行哪些设置以允许使用查询字符串参数? 有没有其他方法可以向 Magento 商店页面发送更多信息?

有没有办法查明是 Magento 执行此操作而不是服务器执行此操作?

谢谢

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 other 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你的心境我的脸 2024-10-07 00:50:27

Magento 正在接收第一个请求的查询,但重定向到 URL 重写列表中的 URL。这可能是出于 SEO 的原因。无论您的代码需要这些值,都应该在重定向发生之前将它们存储在会话变量中。

deveffort 说:
我研究了 URL 重写,看起来产品链接有一个 URL 重定向!我已将其删除并让我的场景正常工作。但是,如果知道是否可以采取任何措施来确保 Magento 代码不会执行任何查询字符串参数清理,那就太好了。非常感谢..

clockworkgeek 说:
我担心删除重写是暂时的。它将在下一次产品重新索引或保存产品时替换自身。由于您只想设置一些 cookie,因此不需要通过 javascript 来完成,无论如何,这不太可靠。
相反,创建一个观察者来监视 catalog_controller_product_view 事件。让观察者检查查询参数,如果存在正确的参数,则设置 cookie。此外,它可能会尝试检查引荐来源网址是否与您的期望相匹配,这可能会使欺骗值变得更加困难。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文