简体   繁体   English

从Magento中的客户检索产品订阅警报

[英]Retrieve product subscription alerts from a customer in Magento

I'd like to create a new area on the «My account» section that shows to the customer all the products he's been subscribed to by clicking on the «Sign up to get notified when this product is back in stock» button in the product page (a product that is not in stock, of course). 我想在“我的帐户”部分创建一个新区域,向客户显示他订阅的所有产品,方法是点击产品库存中的“注册以获得通知”按钮页面(当然没有库存的产品)。

There is other thing that I'd like to do related to this. 我还想做其他与此相关的事情。 When customers click on that button, it's still present on the product page, even when the customer has already clicked on it. 当客户点击该按钮时,它仍然存在于产品页面上,即使客户已经点击它。 How can I make this button disappear when the customer has already clicked on it? 当客户点击它时,如何使此按钮消失?

I finally found the solution for this. 我终于找到了解决方案。 It's really easy. 这真的很容易。 To get the products that a customer has been subscribed to: 要获取客户已订阅的产品:

$customer_product_alerts = Mage::getModel('productalert/stock')
                           ->getCollection()
                           ->addFieldToFilter('customer_id', $customer_id);

This is for stock alerts. 这是针对库存警报。 If it comes to price alert, just use the productalert/price model. 如果涉及价格提醒,只需使用productalert / price模型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM