2014-03-13 42 views
1

我需要显示通过slug排序的类别。 任何人都可以帮助我吗?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; ?> 
+0

poss ible重复[参考:在PHP中排序数组和数据的所有基本方法](http://stackoverflow.com/questions/17364127/reference-all-basic-ways-to-sort-arrays-and-data-in- PHP) – HamZa

回答

0

另一种方法是像

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

你必须要加一些力和UL标签

如果你只需要一个链表使用

shopp('storefront.category-list','orderby=slug'); 
相关问题