【发布时间】:2012-03-18 11:38:00
【问题描述】:
我有一些代码调用主类别的子类别,我需要能够更改网站前端子类别的排序顺序。
我尝试将属性添加到排序标签,但这并没有做任何事情。任何人都可以帮助我指出正确的方向以使其正常工作。非常感谢:
->addAttributeToSort(’position’, ‘asc’)
这对订单没有任何影响。我正在使用的代码如下:
<?php
//get the current category
$_cat = new Mage_Catalog_Block_Navigation();
$currentCat = $_cat->getCurrentCategory();
//get the children of the current category
$subCats = Mage::getModel('catalog/category')->load($currentCat->getId())->getChildren();
//get sub category ids
$subCatIds = explode(',',$subCats);
?>
<?php if (count($subCatIds) > 1): ?>
<?php foreach($subCatIds as $subCatId): ?>
<?php $subCat = Mage::getModel('catalog/category')->load($subCatId); ?>
<?php if($subCat->getIsActive()): ?>
【问题讨论】:
标签: php magento e-commerce