【问题标题】:Reordering records by category in October CMS?在 10 月 CMS 中按类别重新排序记录?
【发布时间】:2020-08-06 10:05:49
【问题描述】:

到目前为止,我已经根据 October documentation 重新排序了我的插件记录,但现在我需要更进一步。
假设我有多个类别的产品:

apple  -> (fruits, desserts)    
banana -> (fruits, desserts)
cherry -> (fruits, desserts)

现在的想法是根据每个类别重新排序产品:

fruits:
1 - apple
2 - banana
3 - cherry

desserts:
1 - cherry
2 - apple
3 - banana

我想我需要一个额外的数据透视表reorder_category_product,看起来像这样:

category_id | product_id | sort_order 
      1            1            1
      1            2            2
      1            3            3
      2            3            1
      2            1            2
      2            2            3

但是如何实现呢?
是否有任何示例或 10 月的插件可以让我走上正轨?

【问题讨论】:

  • 我知道如何直接通过 QueryBuilder(Db::tablejoin)而不是模型类来实现

标签: octobercms


【解决方案1】:

你可以看看这篇文章

https://octobercms.com/forum/post/reordering-items-in-a-relation

与其 github https://github.com/scottbedard/draganddrop.

或者商城插件已经实现了你要找的东西,看看如何只重新订购某个类别的产品

https://octobercms.com/plugin/offline-mall

希望这会有所帮助!

【讨论】:

  • 恕我直言,这不是答案
  • 嗯,这就是问题所在。 “有什么例子或十月的插件让我走上正轨吗?”。无论如何,请随意不同的想法。干杯
猜你喜欢
  • 1970-01-01
  • 2023-01-17
  • 1970-01-01
  • 1970-01-01
  • 2018-06-11
  • 2017-07-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多