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 customer开发者_开发问答s 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.
精彩评论