[英]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.