Пример #1
0
 /**
  * getTotal
  *
  */
 public function getTotal()
 {
     self::$price_total = 0;
     self::$items_total = 0;
     self::$items_unique_total = 0;
     if (!empty($this->data)) {
         foreach ($this->data as $parchase) {
             self::$price_total += $parchase['price'] * $parchase['count'];
             self::$items_total += $parchase['count'];
             if (!empty($parchase['options'])) {
                 //доп параметры товара
                 foreach ($parchase['options'] as $opts) {
                     if (!empty($opts[1])) {
                         self::$price_total += $opts[1] * $parchase['count'];
                     }
                 }
             }
         }
         self::$items_unique_total = count($this->data);
     }
     //Добавляем цену доставки
     if (!empty($this->delivery) && !empty($this->delivery['price'])) {
         self::$price_total += $this->delivery['price'];
     }
     //OnSHKcalcTotalPrice
     $new_price = $this->getFromEvent('OnSHKcalcTotalPrice', array('price_total' => self::$price_total), 'float');
     if ($new_price !== false) {
         self::$price_total = $new_price;
     }
     return self::$price_total;
 }