到目前为止,我已经根据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
但是如何实现呢?有什么例子或十月的插件可以使我走上正确的轨道吗?
您可以看一下这篇文章
https://octobercms.com/forum/post/reordering-items-in-a-relation
及其github https://github.com/scottbedard/draganddrop。
或者Mall插件已经实现了您想要的东西,请看一下如何只重新订购特定类别的产品
https://octobercms.com/plugin/offline-mall
希望这会有所帮助!