我可以从$observer
对象调用什么来确定访客或客户是否在结帐时点击了订阅复选框?到目前为止,我有这个:
public function collectCustomerData($observer)
{
$this->observer = $observer;
$this->_order = $this->observer->getEvent()->getOrder();
$this->_address = $this->_order->getShippingAddress();
$this->data['first_name'] = $this->_address->getFirstname();
$this->data['last_name'] = $this->_address->getLastname();
$this->data['city'] = $this->_address->getCity();
$this->data['email'] = $this->_order->getCustomerEmail();
}
但是我需要从$this->data['is_newsletter']
(Mage_Sales_Model_Order)或$this->_order
(Mage_Sales_Model_Order_Address)添加$this->_address
,或者通过静态工厂方法(如Mage)提取具有该信息的其他模型: :getModel()如果我需要
答案 0 :(得分:0)
我想通了,我必须将newsletter/subscriber
模型带入等式中。以下代码返回1或null:
$email = $this->_order->getCustomerEmail();
$isNewsletter = Mage::getModel('newsletter/subscriber')
->loadByEmail($email)
->getSubscriberStatus();
基于此,我能够适当地设置opt in标志:
$this->data['is_newsletter'] = $isNewsletter;