Shopp:如何按slug排序类别

时间:2014-03-13 11:01:26

标签: php sorting shopp

我需要显示按slug排序的类别。 有谁可以帮助我?

到目前为止,这是我的代码:

 <?php if(shopp('catalog','has-categories')): ?>
 <ul class="products">
    <li class="row">
        <ul>
        <?php while(shopp('catalog','categories')): ?>
            <li class="product">
                <div class="frame">
                    <a href="<?php shopp('category','url'); ?>"><?php shopp('category','coverimage','setting=thumbnails'); ?></a>
                    <a href="<?php shopp('category','url'); ?>" class="category-link"><h3><?php shopp('category','name'); ?></h3></a>
                </div>
            </li>
        <?php endwhile; ?>
        </ul>
    </li>
  </ul>
<?php endif; ?>

1 个答案:

答案 0 :(得分:0)

另一种方法是

$categories = shopp('storefront.category-list','load=true&orderby=slug');
foreach ($categories as $category){
   // the category markup code goes here
}

您必须添加一些li和ul标签

如果您只需要使用链接列表

shopp('storefront.category-list','orderby=slug');