我有两个场景需要解决:)
-
假设我构建了插件(使用构建器),其中有产品和类别。
现在在列出类别的页面上我拥有所有类别,但我不想显示空类别。
如何删除列表中的空类别?
-
第二个场景。有些产品有选项,有些则没有。
产品和选项有关系表。
在单个产品页面上我有一些类似的内容:
产品描述
该产品的选项
(效果很好)
但如果产品没有任何我想要的选项:
产品描述
文本“此产品没有选项”(或根本不显示任何文本)
到目前为止,我已经尝试过类似的操作:
{{ if option in record.options == true }}
显示选项
{{ 别的 }}
“该产品没有选项”
{{ endif }}
但这根本不起作用。
有没有办法检查产品的现有选项?
感谢您抽出时间。
I have a two scenarios to solve :)
-
Let's say I built plugin (with builder) where I have products and categories.
Now on page with listed categories I have all of them, but I want to not display empty categories.
How to remove empty categories form listing?
-
Second scenario. Some of products have options and some none.
Products and options have relation table.
On single product page I have some like:
product description
options for this product
(that work well)
But in case of product doesn't have any options I want to have:
product description
text "this product have no options" (or not display any text at all)
So far I have tried something like:
{{ if option in record.options == true }}
display options
{{ else }}
"this product have no options"
{{ endif }}
But this doesn't work at all.
Is there a way to check for existing options for product?
Thanks for your time.