本文整理汇总了PHP中Mage_Sales_Model_Order_Shipment::getStoreId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Shipment::getStoreId方法的具体用法?PHP Mage_Sales_Model_Order_Shipment::getStoreId怎么用?PHP Mage_Sales_Model_Order_Shipment::getStoreId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order_Shipment
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order_Shipment::getStoreId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPdf
/**
* @param Mage_Sales_Model_Order_Shipment $shipment
* @return string
*/
public function getPdf(Mage_Sales_Model_Order_Shipment $shipment)
{
if ($shipment->getStoreId()) {
Mage::app()->getLocale()->emulate($shipment->getStoreId());
Mage::app()->setCurrentStore($shipment->getStoreId());
}
$map = $this->buildMap($shipment);
$stylesTemplate = $this->getTemplateFileContents($this->_pdfStylesTemplatePath);
$mainTemplate = $this->getTemplateFileContents($this->_pdfMainTemplatePath);
$mainTemplate = $this->applyMap($mainTemplate, $map);
$html = $stylesTemplate . $mainTemplate;
if ($shipment->getStoreId()) {
Mage::app()->getLocale()->revert();
}
return $this->generatePdf($html, Mage::getBaseDir('tmp') . DS . $this->getFileName() . '.pdf');
}
示例2: _getTrackingUrl
/**
* Retrieve tracking url with params
*
* @param string $key
* @param Mage_Sales_Model_Order|Mage_Sales_Model_Order_Shipment|Mage_Sales_Model_Order_Shipment_Track $model
* @param string $method Optional - method of a model to get id
* @return string
*/
protected function _getTrackingUrl($key, $model, $method = 'getId')
{
$helper = Mage::helper('Mage_Core_Helper_Data');
$urlPart = "{$key}:{$model->{$method}()}:{$model->getProtectCode()}";
$param = array('hash' => $helper->urlEncode($urlPart));
$storeModel = Mage::app()->getStore($model->getStoreId());
return $storeModel->getUrl('shipping/tracking/popup', $param);
}
示例3: requestToShipment
/**
* Prepare and do request to shipment
*
* @param Mage_Sales_Model_Order_Shipment $orderShipment
* @return Varien_Object
*/
public function requestToShipment(Mage_Sales_Model_Order_Shipment $orderShipment)
{
$admin = Mage::getSingleton('admin/session')->getUser();
$order = $orderShipment->getOrder();
$address = $order->getShippingAddress();
$selectedShipMethod = $this->_mapShipMethod($order->getShippingMethod(true), $order->getShippingCarrier(), $address);
$shipmentStoreId = $orderShipment->getStoreId();
$shipmentCarrier = Mage::getModel('wsaendicia/carrier_endicia');
$shippingMethod = $this->_getShipmentCarrier($selectedShipMethod, $shipmentCarrier->getCarrierCode());
$baseCurrencyCode = Mage::app()->getStore($shipmentStoreId)->getBaseCurrencyCode();
if (!$shipmentCarrier) {
Mage::throwException('Invalid carrier: ' . $shippingMethod->getCarrierCode());
}
$shipperRegionCode = Mage::getStoreConfig(self::XML_PATH_STORE_REGION_ID, $shipmentStoreId);
if (is_numeric($shipperRegionCode)) {
$shipperRegionCode = Mage::getModel('directory/region')->load($shipperRegionCode)->getCode();
}
$recipientRegionCode = Mage::getModel('directory/region')->load($address->getRegionId())->getCode();
$originStreet1 = Mage::getStoreConfig(self::XML_PATH_STORE_ADDRESS1, $shipmentStoreId);
$originStreet2 = Mage::getStoreConfig(self::XML_PATH_STORE_ADDRESS2, $shipmentStoreId);
$storeInfo = new Varien_Object(Mage::getStoreConfig('general/store_information', $shipmentStoreId));
if (!$admin->getFirstname() || !$admin->getLastname() || !$storeInfo->getName() || !$storeInfo->getPhone() || !$originStreet1 || !Mage::getStoreConfig(self::XML_PATH_STORE_CITY, $shipmentStoreId) || !$shipperRegionCode || !Mage::getStoreConfig(self::XML_PATH_STORE_ZIP, $shipmentStoreId) || !Mage::getStoreConfig(self::XML_PATH_STORE_COUNTRY_ID, $shipmentStoreId)) {
Mage::throwException(Mage::helper('sales')->__('Insufficient information to create shipping label(s). Please verify your Store Information and Shipping Settings.'));
}
/** @var $request Mage_Shipping_Model_Shipment_Request */
$request = Mage::getModel('shipping/shipment_request');
$request->setOrderShipment($orderShipment);
$request->setShipperContactPersonName($admin->getName());
$request->setShipperContactPersonFirstName($admin->getFirstname());
$request->setShipperContactPersonLastName($admin->getLastname());
$request->setShipperContactCompanyName($storeInfo->getName());
$request->setShipperContactPhoneNumber($storeInfo->getPhone());
$request->setShipperEmail($admin->getEmail());
$request->setShipperAddressStreet(trim($originStreet1 . ' ' . $originStreet2));
$request->setShipperAddressStreet1($originStreet1);
$request->setShipperAddressStreet2($originStreet2);
$request->setShipperAddressCity(Mage::getStoreConfig(self::XML_PATH_STORE_CITY, $shipmentStoreId));
$request->setShipperAddressStateOrProvinceCode($shipperRegionCode);
$request->setShipperAddressPostalCode(Mage::getStoreConfig(self::XML_PATH_STORE_ZIP, $shipmentStoreId));
$request->setShipperAddressCountryCode(Mage::getStoreConfig(self::XML_PATH_STORE_COUNTRY_ID, $shipmentStoreId));
$request->setRecipientContactPersonName(trim($address->getFirstname() . ' ' . $address->getLastname()));
$request->setRecipientContactPersonFirstName($address->getFirstname());
$request->setRecipientContactPersonLastName($address->getLastname());
$request->setRecipientContactCompanyName($address->getCompany());
$request->setRecipientContactPhoneNumber($address->getTelephone());
$request->setRecipientEmail($address->getEmail());
$request->setRecipientAddressStreet(trim($address->getStreet1() . ' ' . $address->getStreet2()));
$request->setRecipientAddressStreet1($address->getStreet1());
$request->setRecipientAddressStreet2($address->getStreet2());
$request->setRecipientAddressCity($address->getCity());
$request->setRecipientAddressStateOrProvinceCode($address->getRegionCode());
$request->setRecipientAddressRegionCode($recipientRegionCode);
$request->setRecipientAddressPostalCode($address->getPostcode());
$request->setRecipientAddressCountryCode($address->getCountryId());
$request->setShippingMethod($shippingMethod->getMethod());
$request->setPackageWeight($order->getWeight());
$request->setPackages($orderShipment->getPackages());
$request->setBaseCurrencyCode($baseCurrencyCode);
$request->setStoreId($shipmentStoreId);
return $shipmentCarrier->requestToShipment($request);
}