Magento 뉴스 레터 구독자는 이름과 성을 기입하기를 원합니다. 폼에 두 개의 입력 필드를 추가했습니다. 필드 이름은 'firstname'과 'lastname'입니다. 내가 마법사/뉴스/컨트롤러를 확장하는거야Magento 가입자 성 & 이름
/newAction에서
SubscriberController.php는() :
여기 포스트 변수를 검색 한 :
$email = (string) $this->getRequest()->getPost('email');
$firstname = (string) $this->getRequest()->getPost('firstname');
$lastname = (string) $this->getRequest()->getPost('lastname');
성공 메시지 뒤에 다음 코드를 추가했습니다.
$subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
$subscriber->setEmail("[email protected]");
$subscriber->setFirstname("ADAM");
$subscriber->setLastname("MOSS");
$subscriber->save();
나는 first와 last name 방식이 작동하기를 원한다. setEmail 부분은 완벽하게 작동한다. Model/Subscriber.php을보고 구독자 이름을 설정하는 기능이 없다는 것을 알았습니다.
관리자의 그리드를 보면 'Customer First Name'과 'Customer Last Name'이라는 메시지가 나타 났으므로 이름이 가입자 모델이 아닌 고객 모델에 속한다고 가정합니다.
이 방법이 있습니까? 구독자에게 뉴스 레터를 구독 할 때 고객 이름을 지정할 수 있기를 원합니다. 이 게시물에 언급 된 옵저버 방법을 시도했지만 같은 문제가 있다고 생각합니다. Adding a custom field to Magento's subscription module
어떤 도움을 주시면 감사하겠습니다.