Forums / General / Traverse multioption in PHP

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

Traverse multioption in PHP

Author Message

Martin Grønbekk Moen

Monday 14 March 2011 1:35:42 am

Hi,

I need help to traverse all options in a multioption.

I use the Product-class with a new multioption-attribute called "product_properties". I need a function to check if the optionID the user chose on the front-end matches an option in the list, and return true if a match is found.

This way I can check if e.g. the user chose "Red" as the "Color" on a product.

In pseudo-code this is what I need:

Parameters: postedOptionID, currentObjectID

1. Fetch attribute "product_properties" (multioption) on object <currentObjectID>.

2. For each option for "Color" in "product_properties"

2.1 If postedOptionID == optionID

2.1.1 return true

Thanks

Martin Grønbekk Moen

Friday 01 April 2011 8:39:25 am

Answered here:

http://stackoverflow.com/questions/5325018/traverse-ez-multioption-attribute-options-in-ez-publish-php-side/5515582#5515582