/** * Get processor methods * * @param \XLite\Model\Shipping\Processor\AProcessor $processor Processor * * @return \XLite\Model\Shipping\Method */ protected function getProcessorMethods(\XLite\Model\Shipping\Processor\AProcessor $processor) { return $processor->getShippingMethods(); }
/** * Returns processor's shipping methods (this depends on origin country) * * @return array */ public function getShippingMethods() { $list = parent::getShippingMethods(); $methods = array(); $originCode = $this->getOriginCode(\XLite\Core\Config::getInstance()->Company->location_country); $allowedMethods = array(); foreach ($this->upsServices as $service) { foreach ($service as $countryCode => $methodCode) { if ($countryCode == $originCode) { $allowedMethods[] = $methodCode; } } } foreach ($list as $k => $method) { if (in_array($method->getCode(), $allowedMethods)) { $methods[] = $method; } } return $methods; }