简体   繁体   中英

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.

<?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.

  {{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. Hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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