【问题标题】:How to add font awesome icons in top links of Magento如何在 Magento 的顶部链接中添加字体真棒图标
【发布时间】:2014-07-29 12:25:25
【问题描述】:

我正在为 Magento 使用样板模板,并且该模板中已经包含了很棒的字体。我通过在 Links.php 中添加 class="btn btn-primary" 为我的汽车在顶部链接中创建了一个引导按钮,现在我在尝试从字体真棒添加购物车图标时遇到问题......

我想在“我的购物车(2 件)”顶部链接前添加此代码: 我的购物车

我尝试了一些没有成功的事情......

感谢您的帮助

编辑:这是我的 top.links.phtml 的样子,我不知道如何添加您的代码:

<?php if($toplinks && is_array($toplinks)): ?>
<ul class="links">
<?php echo $this->getChildHtml() ?>
<?php foreach($toplinks as $_toplink): ?>
<li<?php if($_toplink['first']||$_toplink['last']): ?> class="<?php if($_toplink['first']): ?>first<?php endif; ?><?php if($_toplink['last']): ?> last<?php endif; ?>"<?php endif; ?> <?php echo $_toplink['liParams'] ?>><?php echo $_toplink['beforeText'] ?><a <?php echo $_toplink['aParams'] ?>><?php echo $_toplink['innerText'] ?></a><?php echo $_toplink['afterText'] ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>

【问题讨论】:

    标签: magento icons html5boilerplate font-awesome-4


    【解决方案1】:

    最佳实践是使用 xml 进行自定义修改。但在这种情况下,您需要添加链接。尝试编辑top.links.phtml..你可以使用这个来调用类

     <action method="addLink" translate="label title" module="customer">
     <label>Logout</label>
    <url helper="customer/getLogoutUrl"/>
    <title>Log Out</title>
    <prepare/>
    <urlParams/>
    <position>2</position>
    <liParams></liParams>
    <aParams>class="logout-link"</aParams>
    <beforeText><![CDATA[<span>]]></beforeText>
    <afterText><![CDATA[</span>]]></afterText>
     </action> 
    

    【讨论】:

    • 谢谢,我不知道如何将它应用到“我的购物车”,我必须仔细检查。谢谢
    【解决方案2】:

    关注此链接:

    http://www.ibeccreative.com/blog/151/Magento-Tutorial-How-to-Customize-the-Top-Links-Block/

    对于一些链接作为愿望清单:

    app/design/frontend/[[YOURTHEME]]/default/layout/wishlist.xml

    变化:

       <reference name="top.links">
                <block type="wishlist/links" name="wishlist_link" />
                <action method="addLinkBlock"><blockName>wishlist_link</blockName></action>
            </reference>
    

    收件人:

    <reference name="top.links">
            <block type="wishlist/links" name="wishlist_link">
                <action method="setBeforeText">
                    <beforeText><![CDATA[<i class="fa fa-gift"></i>]]>    </beforeText>
                </action>
            </block>
            <action method="addLinkBlock">
                <blockName>wishlist_link</blockName>
            </action>
        </reference>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-05-08
      • 1970-01-01
      • 1970-01-01
      • 2021-03-13
      • 2019-06-22
      • 1970-01-01
      • 1970-01-01
      • 2021-06-30
      相关资源
      最近更新 更多