Exemplo n.º 1
0
 /**
  * Установить модификатор цены скидки
  * @param discountModificator $discountModificator модификатор цены скидки
  */
 public function setDiscountModificator(discountModificator $discountModificator)
 {
     $this->modificator = $discountModificator;
     $this->object->discount_modificator_id = $discountModificator->getId();
     $this->commit();
 }
 public function getModificators($discountTypeId = false, $discountId = false)
 {
     $items = discountModificator::getList($discountTypeId);
     if ($discountId) {
         $discount = discount::get($discountId);
         $discountModId = $discount->getDiscountModificator()->getObject()->modificator_type_id;
         foreach ($items as $i => $mod) {
             $items[$i] = array('attribute:id' => $mod->id, 'attribute:name' => $mod->name);
             if ($mod->id == $discountModId) {
                 $items[$i]['attribute:selected'] = 'selected';
             }
         }
     }
     return array('items' => array('nodes:item' => $items));
 }