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.
|