예제 #1
0
 public static function getRelPropData(Order $order)
 {
     $result = array();
     $groups = array();
     $items = $order->getPropertyCollection()->getArray();
     foreach ($items as $key => $item) {
         if ($key == 'properties') {
             $result[$key] = array();
             foreach ($item as $property) {
                 if (isset($property['RELATION'])) {
                     foreach ($property['RELATION'] as $relation) {
                         if (in_array($relation['ENTITY_ID'], $order->getPaymentSystemId()) || in_array($relation['ENTITY_ID'], $order->getDeliverySystemId())) {
                             $result[$key][] = $property;
                             $groups[$property['PROPS_GROUP_ID']] = true;
                             break;
                         }
                     }
                 }
             }
         } else {
             $result[$key] = $item;
         }
     }
     foreach ($result['groups'] as $i => $group) {
         if (!isset($groups[$group['ID']])) {
             unset($result['groups'][$i]);
         }
     }
     return $result;
 }