Index: branches/5.2.x/units/product_option_combinations/product_option_combinations_event_handler.php =================================================================== diff -u -N -r14625 -r14702 --- branches/5.2.x/units/product_option_combinations/product_option_combinations_event_handler.php (.../product_option_combinations_event_handler.php) (revision 14625) +++ branches/5.2.x/units/product_option_combinations/product_option_combinations_event_handler.php (.../product_option_combinations_event_handler.php) (revision 14702) @@ -1,6 +1,6 @@ Name) { case 'OnCreate': case 'OnUpdate': - $object =& $event->getObject(); - $options = unserialize($object->GetDBField('Combination')); - ksort($options); - $object->SetDBField('CombinationCRC', crc32(serialize($options))); + $object =& $event->getObject(); + /* @var $object kDBItem */ + + $options = unserialize($object->GetDBField('Combination')); + ksort($options); + $object->SetDBField('CombinationCRC', crc32(serialize($options))); break; case 'OnMassDelete': - // delete only option combinations that has no assiciated inventory + // delete only option combinations that has no associated inventory $object =& $event->getObject(); $ids = $event->getEventParam('ids'); $sql = 'SELECT '.$object->IDField.' @@ -254,7 +256,7 @@ /* @var $object kDBItem */ $id = $this->getPassedID($event); - + if ( !$id ) { $event->CallSubEvent('OnNew'); @@ -264,7 +266,7 @@ if ( $object->Load($id) ) { $actions =& $this->Application->recallObject('kActions'); /* @var $actions Params */ - + $actions->Set($event->getPrefixSpecial() . '_id', $object->GetId()); } } @@ -299,22 +301,26 @@ protected function OnBeforeClone(&$event) { parent::OnBeforeClone($event); - + $event->Init($event->Prefix, '-item'); + $object =& $event->getObject(); + /* @var $object kDBItem */ $options_mapping = $this->Application->GetVar('poc_mapping'); - if (!$options_mapping) return; + if ( !$options_mapping ) { + return; + } - foreach ($options_mapping as $original => $new) - { + foreach ($options_mapping as $original => $new) { + $n_combs = array (); $comb_data = unserialize($object->GetDBField('Combination')); - $n_combs = array(); - foreach ($comb_data as $key => $val) - { + + foreach ($comb_data as $key => $val) { $n_key = $key == $original ? $new : $key; $n_combs[$n_key] = $val; } + ksort($n_combs); $n_combs = serialize($n_combs); $n_crc = crc32($n_combs);