简体   繁体   English

Shopp:如何按段排序类别

[英]Shopp: How to sort categories by slug

I need to display categories sorted by slug. 我需要显示按子弹排序的类别。 can anyone help me? 谁能帮我?

This is my code so far: 到目前为止,这是我的代码:

 <?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; ?>

Another approach would be something like 另一种方法是

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

You'll have to add some li and ul tags 您必须添加一些li和ul标签

if you just need a linked list use 如果您只需要一个链表使用

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM