public static function getNewInstance(ShippingService $service, $cost) { $inst = new ShipmentDeliveryRate(); $inst->setServiceId($service->getID()); $inst->setApplication($service->getApplication()); $inst->setCost((string) round($cost, 3), $service->getApplication()->getDefaultCurrencyCode()); $inst->setService($service); $inst->setServiceName($service->getValueByLang('name')); return $inst; }
/** * Load service rates from known service * * @param ShippingService $service * @param bool $loadReferencedRecords * * @return ARSet */ public static function getRecordSetByService(ShippingService $service, $loadReferencedRecords = false) { $filter = new ARSelectFilter(); $filter->setCondition(new EqualsCond(new ARFieldHandle(__CLASS__, "shippingServiceID"), $service->getID())); return self::getRecordSet($filter, $loadReferencedRecords); }