![](/img/trans.png)
[英]Magento 2 - How to call a custom phtml file in another phtml file, xml layout, static block and cms page
[英]Magento how to call phtml file as a block on cms page?
我正在使用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>
现在,我将此cmp文件称为cms页上的块。
{{block type="core/template" name="custombutton" template="custombutton.phtml"}}
但是有时它显示按钮,有时却不显示。 没有得到问题。
请授予阻止goto-> system-> permissions-> block的权限,并添加您的阻止名称。 希望这可以帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.