コード例 #1
0
 public function discountInfo($discountId = false, $template = 'default')
 {
     if (!$template) {
         $template = 'default';
     }
     list($tpl_block, $tpl_block_empty) = def_module::loadTemplates("emarket/discounts/{$template}", 'discount_block', 'discount_block_empty');
     try {
         $discount = itemDiscount::get($discountId);
     } catch (privateException $e) {
         $discount = null;
     }
     if ($discount instanceof discount) {
         $info = array('attribute:id' => $discount->id, 'attribute:name' => $discount->getName(), 'description' => $discount->getValue('description'));
         return def_module::parseTemplate($tpl_block, $info, false, $discount->id);
     } else {
         return def_module::parseTemplate($tpl_block_empty, array());
     }
 }
コード例 #2
0
 /**
  * Конструктор класса. Косвенно вызывается через orderItem::get() и orderItem::create()
  * @param umiObject $object объект наименования (для работы с ним мы наследуем umiObjectProxy)
  */
 protected function __construct(umiObject $object)
 {
     parent::__construct($object);
     $discount = $this->getDiscount();
     $this->price = (double) $object->item_price;
     $this->totalOriginalPrice = (double) $object->item_total_original_price;
     $this->totalActualPrice = (double) $object->item_total_price;
     $this->amount = (int) $object->item_amount;
     $this->discount = itemDiscount::get($object->item_discount_id);
     $this->itemElement = $object->item_link;
 }