Example #1
0
 /**
  * {@inheritdoc}
  */
 public static function postLoad(EntityStorageInterface $storage, array &$orders)
 {
     parent::postLoad($storage, $orders);
     foreach ($orders as $id => $order) {
         $order->products = \Drupal::entityManager()->getStorage('uc_order_product')->loadByProperties(['order_id' => $id]);
         // Load line items... has to be last after everything has been loaded.
         $order->line_items = $order->getLineItems();
     }
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public static function postLoad(EntityStorageInterface $storage, array &$items)
 {
     foreach ($items as $item) {
         $item->product = uc_product_load_variant($item->nid->target_id, $item->data->first()->toArray());
         if ($item->product) {
             $item->title = $item->product->label();
             $item->model = $item->product->model;
             $item->cost = $item->product->cost->value;
             $item->price = $item->product->price;
             $item->weight = $item->product->weight->value;
             $item->weight_units = $item->product->weight->units;
         }
         $item->module = $item->data->module;
     }
     parent::postLoad($storage, $items);
 }