【问题标题】:Change description order or category pages更改描述顺序或类别页面
【发布时间】:2012-01-24 08:21:30
【问题描述】:

我想知道是否可以将一个类别的描述更改为紧随产品之后。 这里的例子: http://www.theprinterdepo.com/refurbished-printers/monochrome-laser-refurbished-printers

我想某处有一个 phtml 文件,我可以很容易地为此更改

我找到了文件,代码如下

<?php if($_description=$this->getCurrentCategory()->getDescription()): ?>
    <div class="category-description std">

         <?php 
         //$currentPage = $this->getCollection()->getCurPage();
         echo $_helper->categoryAttribute($_category, $_description, 'description') 
         ?>

    </div>
<?php endif; ?>

getCurPage 怎么报错

【问题讨论】:

    标签: php magento magento-1.4


    【解决方案1】:

    // get category id
    $category = $category->load($category_id);
    
    
    // get collection    
    $category->getProductCollection()->addCategoryFilter($category)->addAttributeToSelect('*');    
    
    // print out the description
    echo $category->getDescription();
    
    
    // get current page
    $currentPage = $this->getCollection()->getCurPage();
    if($currentPage = 1) {
       // show Description Here
       echo $category->getDescription();
    } else {
       // Show category name instead of description
       echo $category->getName();
    

    -- 编辑-- 试试这个而不是上面的

    $currentPage->getSelect()->getCurPage();
    

    【讨论】:

    • 对不起,我第一次回答有误。
    • 能不能把所有页面的描述去掉,只出现在第一个?
    • 尝试$this-&gt;IsTopCategory()$this-&gt;isFirstPage()$this-&gt;isLastPage() 方法。
    • 你能告诉我怎么做吗?我不是一个真正的 php 开发者,只是一个控制 magento 的网站管理员。
    • 致命错误:在 /home/theprint/public_html/app/design/frontend/default/MAG060062/template/catalog/category/view 中的非对象上调用成员函数 getCurPage()。 phtml 第 60 行
    【解决方案2】:

    您要查找的文件位于catelog/category/view.phtml 下的主题文件夹中。因此,如果安装了任何自定义主题,请首先在您的主题中找到该文件,如果该文件不存在,那么您可以从基本文件夹中复制该文件并放入您的主题文件夹中,请务必将文件放入正确的文件夹中,否则它不会工作。像 如果文件位于 app/design/frontend/base/default/template/catalog/category/view.phtml
    把文件放进去 app/design/frontend/default/YOUR_THEME/template/catalog/category/view.phtml.
    这样如果你将magento升级到新版本,你所做的更改不会被系统覆盖

    【讨论】:

    • 能不能把所有页面的描述去掉,只出现在第一个?
    【解决方案3】:

    如果您想在产品列表之后放置类别描述,您只需移动元素即可。 您需要修改的模板是这样的: 应用程序/设计/前端/{package}/{theme}/template/catalog/category/view.phtml。 拿这个代码:

    <?php if($_description=$this->getCurrentCategory()->getDescription()): ?>
        <div class="category-description std">
            <?php echo $_helper->categoryAttribute($_category, $_description, 'description') ?>
        </div>
    <?php endif; ?>
    

    并将其移至文件底部。就是这样。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-06
      • 1970-01-01
      • 1970-01-01
      • 2021-06-04
      • 2019-03-14
      相关资源
      最近更新 更多