订阅者生日客户同步

时间:2014-04-18 09:31:55

标签: php magento subscriber dob

我遇到了一个无法找到正确答案的问题。 在Magento我想将DOB添加到时事通讯订阅者。 按照本教程,我成功地做到了:

http://www.iamrookie.com/blog/159/add-custo-field-in-newsletter-module-magento.html

所以现在我在我的数据库和Magento的后端看到了一个DOB行。如果我在数据库中设置日期(我没有使用注册表单进行测试),我会看到正确的值。

我唯一想做的就是检查客户是否在他的个人资料中设置了DOB。如果是这样,我想用他的DOB覆盖数据库中的值。

这应该是可能的,因为您还会在后端看到客户的名字和姓氏。

我相信我应该更改它的文件是subscriber.php。我已经尝试了不同的东西,但没有任何工作。

我想我应该在这里做点什么:

/**
     * Load subscriber info by customer
     *
     * @param Mage_Customer_Model_Customer $customer
     * @return Mage_Newsletter_Model_Subscriber
     */
    public function loadByCustomer(Mage_Customer_Model_Customer $customer)
    {
        $data = $this->getResource()->loadByCustomer($customer);
        $this->addData($data);
        if (!empty($data) && $customer->getId() && !$this->getCustomerId()) {
            $this->setCustomerId($customer->getId());

            $this->setSubscriberConfirmCode($this->randomSequence());
            if ($this->getStatus()==self::STATUS_NOT_ACTIVE) {
                $this->setStatus($customer->getIsSubscribed() ? self::STATUS_SUBSCRIBED : self::STATUS_UNSUBSCRIBED);
            }
            $this->save();
        }
        return $this;
    }

或者在这里:

/**
     * Retrieve Subscribers Full Name if it was set
     *
     * @return string|null
     */
    public function getSubscriberFullName()
    {
        $name = null;
        if ($this->hasCustomerFirstname() || $this->hasCustomerLastname()) {
            $name = $this->getCustomerFirstname() . ' ' . $this->getCustomerLastname();
        }
        return $name;
    }

但我真的不知道。如果有人知道如何完成这项工作,我真的很感激!

0 个答案:

没有答案