コード例 #1
0
ファイル: AModifier.php プロジェクト: kingsj/core
 /**
  * Add order surcharge
  *
  * @param string  $code      Surcharge code
  * @param float   $value     Value
  * @param boolean $include   Include flag OPTIONAL
  * @param boolean $available Availability flag OPTIONAL
  *
  * @return \XLite\Model\Order\Surcharge
  */
 protected function addOrderSurcharge($code, $value, $include = false, $available = true)
 {
     $surcharge = new \XLite\Model\Order\Surcharge();
     $surcharge->setType($this->type);
     $surcharge->setCode($code);
     $surcharge->setValue($value);
     $surcharge->setInclude($include);
     $surcharge->setAvailable($available);
     $surcharge->setClass(get_called_class());
     $info = $this->getSurchargeInfo($surcharge);
     $surcharge->setName($info->name);
     $this->order->getSurcharges()->add($surcharge);
     $surcharge->setOwner($this->order);
     return $surcharge;
 }
コード例 #2
0
 /**
  * {@inheritDoc}
  */
 public function getSurcharges()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getSurcharges', array());
     return parent::getSurcharges();
 }