簡體   English   中英

為 sys_category 操作 TCA foreign_table_where 以僅顯示來自某些父項

[英]Manipulate TCA foreign_table_where for sys_category to show only from certain parents

在 tt_address 我只想顯示具有某個父類別的 sys_categories。 在我的 tt_address tca 覆蓋中,我嘗試添加到現有的 where 子句。

$GLOBALS['TCA']['tt_address']['columns']['categories']['config']['foreign_table_where'] = ' AND sys_category.parent IN (14,15,16,67,68) '. $GLOBALS['TCA']['tt_address']['columns']['categories']['config']['foreign_table_where'];

$GLOBALS['TCA']['tt_address']['columns']['categories']['config']['foreign_table_where'] = ' AND sys_category.parent > 13 '. $GLOBALS['TCA']['tt_address']['columns']['categories']['config']['foreign_table_where'];

兩者都正確顯示在后端配置視圖的 TCA 中,但它們都導致 tt_address 條目中的類別字段為空。 我沒有收到任何錯誤,所以我不知道為什么會這樣。 非常感謝任何想法或更好的方法。

經過更多測試后,似乎最父類別(又名 0)必須在列表中才能使這項工作。 然而,這超出了整個目的。 因此,我更改了查詢以檢查保存類別的 pid。 這適用於我的特定用例。

$GLOBALS['TCA']['tt_address']['columns']['categories']['config']['foreign_table_where'] = ' AND sys_category.pid IN (283,284,285,294,295)'. $GLOBALS['TCA']['tt_address']['columns']['categories']['config']['foreign_table_where'];

不過,如果有人知道如何通過母貓解決它,我會很高興聽到這個消息。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM