iterate through this products and add their parents
You should also have an additional array of parent node IDs that you have already added so that you don't get duplicates.
For getting parent nodes of an object see "assigned_nodes" and "parent_nodes" under the docs for ezcontentobject.
Another way would be fetch all the shops, and for each of them do a count fetch for products with brand BMW. Then select only those that have this count >0.
I suggest you try both solutions and see what fits best your needs.
--
Nothing is impossible. Not if you can imagine it!
@Marko, how about the navigator if you try to search products first and then get the parents?
Just thinking...
Shinetech is the leader in next generation global application outsourcing. Shinetech combines world class technical skills, recognized expertise in advanced development methodologies and industry experience to deliver results for global enterprises. Shinetech utilizes distributed Agile methods for rapid and precise systems development.
------------------------------------------------------------------------------------------
Blog: http://www.mingxing.me
Email: chenmx@shinetechchina.com
Hi Marko, I meant how about the total search number, which is used for pages.
Of course, we can append they shops in an array and count it, but if there is too much data, it seems not a good solution.
Please let me know what you think.
Thanks
Shinetech is the leader in next generation global application outsourcing. Shinetech combines world class technical skills, recognized expertise in advanced development methodologies and industry experience to deliver results for global enterprises. Shinetech utilizes distributed Agile methods for rapid and precise systems development.
------------------------------------------------------------------------------------------
Blog: http://www.mingxing.me
Email: chenmx@shinetechchina.com
Chen, the total number has sense only if you use limit and offset. And the solutions I suggested are not ment to be used with limit and offset. In my experience whenever you do some sort of manual filtering of fetched data, you will have a lot of headache in combining this with limit and offset.
The full proof solution that would allow paging would be to create an extended attribute filter that would fetch the shops which contain at least one product of brand BMW. But that might be a little bit of an overkill.
It all depends on what for Zion wants to use this. If this is about only a few shops, then there's no need for paging.
--
Nothing is impossible. Not if you can imagine it!
Hubert Farnsworth
You must be logged in to post messages in this topic!