magento显示“注册此产品退货时会收到通知"简单关联产品的链接 [英] magento show "Sign up to get notified when this product is back in stock" link for simple-associated products

查看:68
本文介绍了magento显示“注册此产品退货时会收到通知"简单关联产品的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于可配置产品的关联产品,我们如何显示注册以获取该产品的库存通知"链接.

How can we display the "Sign up to get notified when this product is back in stock" link for associated products of a configurable product.

说,我们有一件T恤(一种可配置的产品),我们以中,大和Xtra-Large(简单相关产品)的3种尺寸出售.

Say, we have a T-Shirt (a configurable product) and we sell it in 3 sizes - Medium, Large and Xtra-Large (simple - associated products).

Large size缺货时,如何使用户订阅它的库存通知.

When the Large size goes out of stock, how can we make user subscribe for it for notification when it is back in stock.

请注意,我已经在管理员中设置了此设置:

Please note I have already set this setting in admin:

System > Configuration > Catalog > Allow Alert When Product Comes Back in Stock - Yes

我注意到此警报的网址类似于(它是我商店中的一种简单产品的网址):

I noticed that the url for this alert is like (it is for one of the simple products in my store):

http://localhost/mystore/index.php/productalert/add/stock/product_id/1/[some key]/[some key],,/

有什么方法可以直接调用此url,并传递相关产品的产品ID?如果是这样,网址末尾的那些键怎么办?

Is there any way we can call this url directly, passing the product id of our associated product in question? If so, what about those keys at the end of the url?

请指导.

谢谢

推荐答案

我在缺货的关联产品旁边添加了此链接:

I added this link beside the out-of-stock associated product:

http://localhost/mysite/index.php/productalert/add/stock/product_id/[associated_product_id]/uenc/[any_key]/

例如

http://localhost/mysite/index.php/productalert/add/stock/product_id/17/uenc/MTM0MzcyMDk0Mw==/

它能完成我的工作.

唯一的事情是,成功添加警报记录后,它将重定向到主页,而不是通常情况下的同一页面.

Only thing is, after successfully adding the alert record, it redirects to home page, instead of same page as in normal case.

这是由于[any_key]所致,如果我们可以像magento一样以某种方式加密当前页面的URL [any_key],那么在成功保存警报记录后,我们也可以将其重定向到同一页面. 有什么想法吗?

This is due to [any_key], if we could somehow encrypt current page url [the any_key] just like magento does, we can have it redirect to same page also, after successful saving of alert record. Any ideas?

好吧,我终于明白了!

uenc键[any_key]实际上是当前网址的base64编码.

The uenc key [any_key] is actually base64 encoding of current url.

因此在 https://github.com/carlo/jquery-base64 的帮助下,我做到了:

So with the help of https://github.com/carlo/jquery-base64, I did:

var encodedUrl = $.base64.encode(window.location);

var redirectTo = 'http://localhost/mysite/index.php/productalert/add/stock/product_id/[associated_product_id]/uenc/' + encodedUrl + '/';

希望这会有所帮助!

这篇关于magento显示“注册此产品退货时会收到通知"简单关联产品的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆