예제 #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
 /**
  *
  */
 private static function formatPrice($originalPrice, itemDiscount $discount = null)
 {
     $actualPrice = $discount instanceof itemDiscount ? $discount->recalcPrice($originalPrice) : $originalPrice;
     if ($originalPrice == $actualPrice) {
         $originalPrice = null;
     }
     return array('original' => $originalPrice, 'actual' => $actualPrice);
 }
예제 #3
0
 /**
  * Найти скидку, применимую к этому наименованию в заказе
  */
 protected function searchDiscount()
 {
     $element = $this->getItemElement();
     if ($element instanceof iUmiHierarchyElement) {
         $discount = itemDiscount::search($element);
         if ($discount instanceof discount) {
             return $discount;
         }
     }
     return null;
 }