示例#1
0
 /**
  * Sets a service as delivery or payment service for an order.
  *
  * @param MShop_Order_Item_Base_Service_Interface $service Order service item for the given domain
  * @param string $type Service type
  * @return MShop_Order_Item_Base_Service_Interface Item that was really added to the basket
  */
 public function setService(MShop_Order_Item_Base_Service_Interface $service, $type)
 {
     $this->_checkPrice($service->getPrice());
     $this->_notifyListeners('setService.before', $service);
     // enforce that the type is the same as the given one
     $service->setType($type);
     $this->_services[$type] = clone $service;
     $this->_modified = true;
     $this->_notifyListeners('setService.after', $service);
     return $this->_services[$type];
 }