2013-11-22 3 views
0

magento에서 직접 수신 거부 페이지를 만들고 싶습니다.이 지침을 따르지만 1 단계와 2 단계는 분명하지 않습니다. 전문가가 아니기 때문에. 누군가이 두 단계를 명확하게 설명 할 수 있습니까? "unsubscribe.phtml"페이지를 만들 위치는 어디입니까? 그냥 방금 만든 블록을 추가하는 방법? 미리 감사드립니다.
1. unsubscribe 양식을 작성하는 코드가 들어있는 phtml 페이지 "unsubscribe.phtml"을 작성하십시오.magento에서 수신 거부 페이지를 만드는 방법

<?php $newsletterObj = new Mage_Newsletter_Block_Subscribe(); ?> 
<div class="newsletter-unsubscribe"> 
<div class="newsletter-unsubscribe-title"><?php echo $this->__('Submit your email id to unsubscribe newsletter') ?></div> 
<form action="<?php echo $newsletterObj->getUnsubscribeFormActionUrl() ?>” method="post" id="newsletter-validate-detail"> 
<div class="block-content"> 
<div class="input-box"> 
<input type="text" name="email" id="newsletter" title="<?php echo $this->__('Sign up for our newsletter') ?>” class="input-text required-entry validate-email” value="<?php echo $this->__('Enter Your Email Here') ?>” onfocus="if(this.value==’<?php echo $this->__('Enter Your Email Here') ?>’)this.value=’’;” onblur="if(this.value==’’)this.value=’<?php echo $this->__('Enter Your Email Here') ?>’;” 
/> 
</div> 
<div class="actions"> 
<button type="submit" title="<?php echo $this->__('Submit') ?>” class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button> 
</div> 
</div> 
</form> 
<script type="text/javascript\"> 
//<![CDATA[ 
var newsletterSubscriberFormDetail = new VarienForm(’newsletter-validate-detail’); 
//]]> 
</script> 
</div> 

2) CMS 페이지를 만듭니다. 방금 생성 된 블록을 추가하십시오. 그러면 CMS 페이지에 해당 양식이 포함됩니다.

3) 이제 \ app \ design \ frontend \ base \ default \ template \ newsletter \ subscribe.phtml 페이지에 cms 페이지의 링크를 추가하는 코드를 추가하십시오. 페이지 \ 응용 프로그램 \ 코드 \ 코어 \ 마법사 \ 뉴스 \ 블록 \ Subscribe.php에서

<div class="unsubscribe"> 
<a href="<?php echo Mage::getUrl('unsubscribe-newsletter') ?>"><?php echo $this->__('Unsubscribe') ?></a> 
</div> 

4)는 "unsubscribe.phtml"에서 호출되는 형태의 액션 URL을 생성하는 기능을 추가 할 수 있습니다. 이제 \ 응용 프로그램의 \ 코드 \ 코어 \ 마법사 \ 뉴스 \ 컨트롤러에서

public function getUnsubscribeFormActionUrl() 
{ 
return $this->getUrl(’newsletter/subscriber/unsubscribecus’, array(’_secure’ => true)); 
} 

5) \ SubscriberController.php 페이지 탈퇴 프로세스에 대한 새로운 액션을 추가 할 수 있습니다. 난 당신이 여전히 필요 가정합니다하는 이후 프론트 엔드 */

public function unsubscribecusAction() 
{ 
$email = $this->getRequest()->getParam(’email’); 
$subsModel = Mage::getModel(’newsletter/subscriber’); 
$subscriber = $subsModel->loadByEmail($email); 

$id = (int) $subsModel->getId(); 
$code = (string) $subsModel->getCode(); 
if ($id && $code) { 
$session = Mage::getSingleton(’core/session’); 
try { 
Mage::getModel(’newsletter/subscriber’)->load($id) 
->setCheckCode($code) 
->unsubscribe(); 
$session->addSuccess($this->__(’You have been unsubscribed.’)); 
} 
catch (Mage_Core_Exception $e) { 
$session->addException($e, $e->getMessage()); 
} 
catch (Exception $e) { 
$session->addException($e, $this->__(’There was a problem with the un-subscription.’)); 
} 
} 
$this->_redirectReferer(); 
} 

답변

0

에서

/** * 탈퇴 뉴스 레터 덧글을 남길 수 없습니다 아직 해결로이 문제는 표시되지 대답. I 2 단계의 경우 /template/newsletter/

unsubscribe.phtml 파일을 배치 제안

는이 코드 때문에 페이지가 양식을 포함

{{block type="core/template" template="newsletter/unsubscribe.phtml"}}

을 사용할 수 있습니다.

이미이 작업을 수행 한 방법을 알고있는 경우 자신의 질문에 대한 답변을 추가로 게시하십시오.

0

구독 버튼 옆에 구독 취소 버튼을 추가하거나 (예 : 아니오로 표시하도록 설정 한 블록 호출의 변수 허용)이 두 가지 방법으로 캡처 할 수 있습니다.