简体   繁体   English

Magento如何在cms页面上将phtml文件作为块调用?

[英]Magento how to call phtml file as a block on cms page?

I am using magento 1.9.1 and trying to create a product link directly on cms page.I have created a custombutton.phtml file and add button code here. 我正在使用magento 1.9.1并尝试直接在cms页面上创建产品链接。我创建了custombutton.phtml文件并在此处添加按钮代码。

<?php $formKey = Mage::getSingleton('core/session')->getFormKey(); ?>
<a class="animated infinite swing btn btn-yellow btn-lg m-r-2" role="button" href="abc.com/checkout/cart/add?product=401&qty=1&form_key=<?php echo $formKey ?>">Add to cart</a>

Now i am calling this phtml file as block on cms page. 现在,我将此cmp文件称为cms页上的块。

  {{block type="core/template" name="custombutton" template="custombutton.phtml"}}

But sometimes it is showing button and sometimes not. 但是有时它显示按钮,有时却不显示。 Not getting the issue. 没有得到问题。

Please give rights to block goto->system->permissions->block and add your block name. 请授予阻止goto-> system-> permissions-> block的权限,并添加您的阻止名称。 Hope this helps 希望这可以帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM