I am currently developing a TYPO3 extension where the editors can create datasets within folders. The output of the datasets within one folder works flawless:

SELECT * FROM tx_chiliproducts_domain_model_product 
 WHERE hidden=0 AND deleted=0 
   AND pid='.$folderId.' 
ORDER BY sorting ASC

But I also want to be able to search through sub-folders recursively.

Example:

 windows 
    wood windows
       modern wood windows
       classic wood windows
    plastic windows

If I select "modern wood windows" in my plugin, the output shows the corresponding products. But I also want to be able to select "windows" and show every item that is arranged in one of the folders below.

What would such a SQL query have to look like?

没有正确的解决方案

其他提示

In any case, it is strongly encouraged to the API for submitting your query, either extbase or, if it has to be, the old system, pibase.

In pibase, you can use pi_getPidList($pid_list, $recursive) to get the recursive list of pids and then pass it to your exec_SELECTquery()

(...or, if you absolutely need to - but you really shouldn't - build your SELECT query with WHERE pid IN ($pid_list))

For extbase, I found this workaround, maybe there is something newer already.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top