Matzn Posted September 25, 2020 Share Posted September 25, 2020 Yea, my first post. I used processwire a time, but always all questions a found in this great forum. Thanks to all members. I know, i finding a page by selector. Like this: $pages->find('template=repeater_products, check_access=0, product_keyword=' . $page->title); But, how i find all values by a field name? For example, the code below give 3 results, now i want all values from a field as array. E.g. product_option_key from my screenshot like this: [0] => Speicher [1] => Farbe At time i use the php way, like this: $productOverviewList = $pages->find('template=repeater_products, check_access=0, product_keyword=' . $page->title); $productOptionList = []; foreach ($productOverviewList as $item) { foreach ($item->product_options as $key) { if (array_key_exists($key->product_option_key->title, $productOptionList)) { $str = $productOptionList[$key->product_option_key->title] . ","; $str .= $key->product_option_value; $productOptionList[$key->product_option_key->title] = $str; } else { $productOptionList[$key->product_option_key->title] = $key->product_option_value; } } } Maybe you have a better solution for me? Link to comment Share on other sites More sharing options...
Matzn Posted October 1, 2020 Author Share Posted October 1, 2020 Ok, now i understand that a selector finds only a page not a separated field. For my solution i must iterate the arrays or i using a own db query. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now