【问题标题】:How to get the magento category meta description on catalog list page如何在目录列表页面上获取 magento 类别元描述
【发布时间】:2016-12-06 07:09:45
【问题描述】:

我想在类别列表页面上动态显示每个类别的类别描述。首先,我尝试为每个类别设置条件,但这不是完美的解决方案,后来我找到了最好的方法,所以我想我应该分享它以防止有人浪费时间。

【问题讨论】:

    标签: magento magento-1.9


    【解决方案1】:

    通过使用下面的代码,您可以检查您主题的目录列表模板上的当前类别。

    $metaDescription = Mage::getSingleton('catalog/layer')->getCurrentCategory()->getMetaDescription(); 
    if(!empty($metaDescription)): ?>
    <div class="col-md-12 std">
        <p><?php echo $metaDescription; ?></p>
    </div>
    <?php endif; ?>
    

    按照屏幕截图在 magento 管理部分添加类别的元描述。

    【讨论】:

    • echo Mage::registry('current_category')-&gt;getMetaDescription()
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多