简体   繁体   English

如何在 Joomla 中将项目订购选项添加到 k2 类别管理员?

[英]How do i add item ordering options to k2 category admin in Joomla?

I made a modification to some of the k2 core files to add another ordering option for items in a category (order by category id).我对一些 k2 核心文件进行了修改,为类别中的项目添加了另一个排序选项(按类别 ID 排序)。 Ive made modifications to the following files to achieve this:我已对以下文件进行了修改以实现此目的:

com_k2/models/itemlist.php on line 279 added com_k2/models/itemlist.php 在第 279 行添加

     case 'catid':
         $orderby = 'i.catid ASC';
         break;

com_k2/views/itemslist/tmpl/category.xml on line 81 added com_k2/views/itemslist/tmpl/category.xml 在第 81 行添加

<option value="catid">Category</option>

com_k2/views/itemslist/tmpl/generic.xml on line 22 added com_k2/views/itemslist/tmpl/generic.xml 在第 22 行添加

<option value="catid">Category</option>

The hacks i've made seem to work fine, but only if i change the params field in the jos_k2_categories table by hand in the database.我所做的黑客似乎工作正常,但前提是我在数据库中手动更改 jos_k2_categories 表中的 params 字段。 Whenever i make changes to the category via the admin, the "item ordering" field reverts to "default".每当我通过管理员更改类别时,“项目排序”字段将恢复为“默认”。 It seems to me that adding the option to xml files should make this option available, but i have limited knowledge of extension developement in Joomla.在我看来,将选项添加到 xml 文件应该可以使用此选项,但我对 Joomla 中的扩展开发了解有限。 Is there some where else that add this new option to?还有其他地方可以添加这个新选项吗? How do i get the new ordering option i added to show up in the Joomla admin?如何获得我添加的新订购选项以显示在 Joomla 管理员中?

You didn't specify what kind of hacks you did, but I believe you need to make changes in the components/com_k2/views/itemlist/tmpl/category.xml你没有指定你做了什么样的黑客,但我相信你需要在components/com_k2/views/itemlist/tmpl/category.xml中进行更改
Here you can set the options about item ordering that you'll find in your admin panel.在这里,您可以设置您可以在管理面板中找到的有关商品订购的选项。 You can go for something like:您可以使用 go 进行以下操作:

<param name="itemOrdering" type="list" default="" label="Item ordering" description="Select the order of items">
   <option value="date">Oldest first</option>
   <option value="rdate">Most recent first</option>
   <option value="alpha">Title Alphabetical</option> 
   <option value="order">Ordering</option>
   <option value="rand">Random ordering</option>
</param>

Many values are loaded into components/com_k2/views/itemlist/view.html.php , you call the $item_ordering = $params->get('itemOrdering') and pass it to your model.许多值被加载到components/com_k2/views/itemlist/view.html.php中,您调用$item_ordering = $params->get('itemOrdering')并将其传递给您的 ZFC344DB0F35FZAF68FAD Look into that file for inspiration, I haven't been mangling with Joomla for a while.查看该文件以获取灵感,我已经有一段时间没有使用 Joomla 了。

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

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