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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 01:59:33
Script start
Timing: Jan 18 2025 01:59:33
Module start 'layout'
Timing: Jan 18 2025 01:59:33
Module start 'content'
Timing: Jan 18 2025 01:59:33
Module end 'content'
Timing: Jan 18 2025 01:59:33
Script end

Main resources:

Total runtime0.0177 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 589.0391152.6250
Module start 'layout' 0.00630.0038 741.664139.4531
Module start 'content' 0.01010.0059 781.117289.1953
Module end 'content' 0.01600.0017 870.312530.2891
Script end 0.0177  900.6016 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002715.2744140.0002
Check MTime0.00126.5385140.0001
Mysql Total
Database connection0.00116.393110.0011
Mysqli_queries0.003620.556630.0012
Looping result0.00000.125210.0000
Template Total0.00137.610.0013
Template load0.00084.630510.0008
Template processing0.00052.936710.0005
Override
Cache load0.00063.360810.0006
General
dbfile0.00147.996780.0002
String conversion0.00000.044440.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs