How to get an option field value

Author Message

Albert Hornos

Tuesday 24 May 2005 1:37:05 am

Hi I extend the ezoption datatype to incrase the number of fields.
Now my ezoption looks like this

Option + Extra + Date + Additional Price + Quantity.

And the problem is that I need extend the simpleshipping workflow to decrease Quantity but I can't acces to this field.

Albert Hornos

Wednesday 25 May 2005 3:04:20 am

OK Here are more information about my problem. Now I've arrived exactly where I want but now I don't know how to change the option field.
This is the code for my event. The event run after confirm order and his function is decrease "quantity" in the product attribute "option".


function execute( &$process, &$event )
    {
        $ini =& eZINI::instance( 'workflow.ini' );

        $cost = $ini->variable( "DecreaseQuantityWorkflow", "ShippingCost" );
        $description = $ini->variable( "DecreaseQuantity", "DecreaseDescription" );

        $parameters = $process->attribute( 'parameter_list' );
        $orderID = $parameters['order_id'];

        $order =& eZOrder::fetch( $orderID );

//I take the ordered item to decrease the quantity
        $productCollection = $order->productCollection();
        $ordereditems = $productCollection->itemList();
        foreach ($ordereditems as $item){
          $contentObject = $item->contentObject();
					$aux =& $item->optionList();
          $contentObjectVersion =& $contentObject->version( $contentObject->attribute( 'current_version' ) );
          $contentObjectAttributes =& $contentObjectVersion->contentObjectAttributes();
          foreach (array_keys($contentObjectAttributes) as $key){
            $contentObjectAttribute =& $contentObjectAttributes[$key];
            $contentClassAttribute =& $contentObjectAttribute->contentClassAttribute();
            if ($contentClassAttribute->attribute("name") == "Fecha_Hora_Precio"){
						print_r($contentObjectAttribute);
              $aux2 = & eZOptionType::objectAttributeContent($contentObjectAttribute);
							$aux3 =& $aux2->Options;
              foreach ($aux3 as $opcion){
								if ($aux[0]->OptionItemID == $opcion[id]){
//Here I should decrease and store.
								}
							}
             
            }
          }
        }
    }

Could anyone help me? It's so urgent.
Thanks for your attention.

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