【问题标题】:Adding a dynamic unsubscribe button to a static block将动态退订按钮添加到静态块
【发布时间】:2014-02-20 08:55:35
【问题描述】:

首先,这涉及到 magento。 我想要一份带有标准页眉和页脚的时事通讯。这个页眉和页脚是通过静态块构建的。 如何在静态页脚块中添加动态取消订阅选项? (每位客户退订) 而如果这不可能,我该如何通过其他方式呢?

欢迎任何帮助。

【问题讨论】:

  • Patrick ,你想要一个表单来取消订阅时事通讯还是只是 url

标签: magento static-block unsubscribe


【解决方案1】:

首先创建一个静态块并从静态块调用phtml .phtml文件的代码

在静态块中调用 phtml 文件

   {{block type="core/template" template="newsletter/unsci.phtml" 
name="newsletterall" }}

在app/design/frontend/yourpackage/youtemplate/newsletter下的unsci.phtml中创建一个phtml

像下面的代码一样调用一个静态块-

如果您只想取消订阅,则应在 phtml 文件中添加以下代码

<?php        $subscriber = Mage::getModel('newsletter/subscriber')
                    ->loadByEmail("dev.amit.bera@gmail.com")
 if( $subscriber->getId()){ 
            $unscibeurl=Mage::helper('newsletter')->getUnsubscribeUrl($subscriber); ?>
    <a href="<?php echo echo $unscibeurl; ?>">Un subcribe</a>
<?php } ?>

使用下面的代码在任何地方调用静态块

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId($indenfirename)->toHtml();  ?>

【讨论】:

  • 这很有帮助,非常感谢
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-03-04
  • 1970-01-01
  • 1970-01-01
  • 2021-11-03
相关资源
最近更新 更多