本文整理汇总了PHP中Mage_Sales_Model_Order_Shipment类的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Shipment类的具体用法?PHP Mage_Sales_Model_Order_Shipment怎么用?PHP Mage_Sales_Model_Order_Shipment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mage_Sales_Model_Order_Shipment类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _addShipmentWithTrack
/**
* Adds shipment with specified tracking number
*
* @param Mage_Sales_Model_Order_Shipment $shipment
* @param Mage_Sales_Model_Order_Shipment_Track $track
*/
private function _addShipmentWithTrack(Mage_Sales_Model_Order_Shipment $shipment, Mage_Sales_Model_Order_Shipment_Track $track = null)
{
$mageCarrierCode = $this->_getCarrierCodeFromOrder($shipment->getOrder());
$carrierCode = $this->_getConfig()->getCarrierCode($mageCarrierCode);
$otherCarrierName = $carrierCode == Mage_GoogleTrustedStore_Model_Config::CARRIER_CODE_OTHER ? $this->_getConfig()->getOtherCarrierName($mageCarrierCode) : '';
$this->_addRow(array($shipment->getOrder()->getIncrementId(), trim($track ? $track->getNumber() : ''), $carrierCode, $otherCarrierName, $shipment->getCreatedAtDate()->toString('yyyy-MM-dd')));
}
开发者ID:CE-Webmaster,项目名称:CE-Hub,代码行数:13,代码来源:Shipment.php
示例2: processOrder
private function processOrder(Ess_M2ePro_Model_Order $order, Mage_Sales_Model_Order_Shipment $shipment, array $trackingDetails = array())
{
if ($order->isSingle() || !$order->isComponentModeEbay() || count($shipment->getAllItems()) != 1) {
return $order->getChildObject()->updateShippingStatus($trackingDetails);
}
// combined eBay orders only
$shipmentItems = $shipment->getAllItems();
$shipmentItem = reset($shipmentItems);
/** @var $shipmentItem Mage_Sales_Model_Order_Shipment_Item */
$additionalData = $shipmentItem->getOrderItem()->getAdditionalData();
$additionalData = is_string($additionalData) ? @unserialize($additionalData) : array();
if (empty($additionalData['ebay_item_id']) || empty($additionalData['ebay_transaction_id'])) {
return $order->getChildObject()->updateShippingStatus($trackingDetails);
}
$itemToShip = null;
foreach ($order->getItemsCollection()->getItems() as $item) {
/** @var $item Ess_M2ePro_Model_Order_Item */
if ($item->getChildObject()->getItemId() == $additionalData['ebay_item_id'] || $item->getChildObject()->getTransactionId() == $additionalData['ebay_transaction_id']) {
$itemToShip = $item;
break;
}
}
if (is_null($itemToShip)) {
return $order->getChildObject()->updateShippingStatus($trackingDetails);
}
$params = array();
if (count($trackingDetails) > 0) {
$params['tracking_number'] = $trackingDetails['tracking_number'];
$params['carrier_code'] = Mage::helper('M2ePro/Component_Ebay')->getCarrierTitle($trackingDetails['carrier_code'], $trackingDetails['carrier_title']);
}
/** @var $dispatcher Ess_M2ePro_Model_Connector_Server_Ebay_OrderItem_Dispatcher */
$dispatcher = Mage::getModel('M2ePro/Connector_Server_Ebay_OrderItem_Dispatcher');
$action = Ess_M2ePro_Model_Connector_Server_Ebay_OrderItem_Dispatcher::ACTION_UPDATE_STATUS;
return $dispatcher->process($action, $itemToShip, $params);
}
开发者ID:xiaoguizhidao,项目名称:beut,代码行数:35,代码来源:Shipment.php
示例3: buildMap
/**
* @param Mage_Sales_Model_Order_Shipment $shipment
* @return array
*/
public function buildMap(Mage_Sales_Model_Order_Shipment $shipment)
{
$map = array('packingslip_id_label' => $this->getSalesHelper()->__('Packingslip # '), 'order_id_label' => $this->getSalesHelper()->__('Order # '), 'order_date_label' => $this->getSalesHelper()->__('Order Date: '), 'billing_address_label' => $this->getSalesHelper()->__('Sold to:'), 'shipping_address_label' => $this->getSalesHelper()->__('Ship to:'), 'payment_method_label' => $this->getSalesHelper()->__('Payment Method:'), 'shipping_method_label' => $this->getSalesHelper()->__('Shipping Method:'), 'products_qty_label' => $this->getSalesHelper()->__('Qty'), 'products_label' => $this->getSalesHelper()->__('Products'), 'products_sku_label' => $this->getSalesHelper()->__('SKU'));
$order = $shipment->getOrder();
$billingAddress = $order->getBillingAddress();
$map['packingslip_id'] = $shipment->getIncrementId();
$map['order_id'] = Mage::getStoreConfigFlag(Mage_Sales_Model_Order_Pdf_Shipment::XML_PATH_SALES_PDF_SHIPMENT_PUT_ORDER_ID, $order->getStoreId()) ? $order->getRealOrderId() : 'N/A';
$map['order_date'] = $this->getCoreHelper()->formatDate($order->getCreatedAtStoreDate(), 'medium', false);
$map['billing_name'] = $billingAddress->getFirstname() . ' ' . $billingAddress->getLastname();
$map['billing_street'] = $billingAddress->getStreetFull();
$map['billing_city'] = $billingAddress->getCity();
$map['billing_zip'] = $billingAddress->getPostcode();
$map['billing_country'] = $billingAddress->getCountryModel()->getIso2Code();
$map['billing_phone'] = $billingAddress->getTelephone();
$shippingAddress = $order->getShippingAddress();
$map['shipping_name'] = $shippingAddress->getFirstname() . ' ' . $shippingAddress->getLastname();
$map['shipping_street'] = $shippingAddress->getStreetFull();
$map['shipping_city'] = $shippingAddress->getCity();
$map['shipping_zip'] = $shippingAddress->getPostcode();
$map['shipping_country'] = $shippingAddress->getCountry();
$map['shipping_phone'] = $shippingAddress->getTelephone();
$map['payment_method'] = $paymentInfo = $this->getPaymentHelper()->getInfoBlock($order->getPayment())->setIsSecureMode(true)->toHtml();
$map['shipping_method'] = $order->getShippingDescription();
$map['shipping_charges'] = '(' . $this->getSalesHelper()->__('Total Shipping Charges') . ' ' . $order->formatPriceTxt($order->getShippingAmount()) . ')';
$map['products_data'] = '';
foreach ($shipment->getAllItems() as $item) {
if ($item->getOrderItem()->getParentItem()) {
continue;
}
$map['products_data'] .= $this->drawItem($item, $order);
}
return $map;
}
开发者ID:swisspost-yellowcube,项目名称:magento-yellowcube,代码行数:37,代码来源:Shipment.php
示例4: _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);
}
开发者ID:relue,项目名称:magento2,代码行数:16,代码来源:Data.php
示例5: mustShipInOneParcel
/**
* True is returned if we transport the shipment in a single package.
*
* @param Mage_Sales_Model_Order_Shipment $shipment
*
* @return boolean
*/
public function mustShipInOneParcel(Mage_Sales_Model_Order_Shipment $shipment)
{
$carrier = $shipment->getOrder()->getShippingCarrier();
if ($carrier instanceof Zitec_PackedShipment_Model_Carrier_Interface) {
$shippingMethod = $shipment->getOrder()->getShippingMethod();
return $carrier->shippingMethodRequiresShipmentsOfOnlyOneParcel($shippingMethod);
}
return true;
}
开发者ID:GabrielCC,项目名称:zitec-dpd-master,代码行数:16,代码来源:Data.php
示例6: getItemsToShip
private function getItemsToShip(Ess_M2ePro_Model_Order $order, Mage_Sales_Model_Order_Shipment $shipment)
{
$productTypesNotAllowedByDefault = array(Mage_Catalog_Model_Product_Type::TYPE_BUNDLE, Mage_Catalog_Model_Product_Type::TYPE_GROUPED);
$items = array();
$allowedItems = array();
foreach ($shipment->getAllItems() as $shipmentItem) {
/** @var $shipmentItem Mage_Sales_Model_Order_Shipment_Item */
$orderItem = $shipmentItem->getOrderItem();
$parentOrderItemId = $orderItem->getParentItemId();
if (!is_null($parentOrderItemId)) {
!in_array($parentOrderItemId, $allowedItems) && ($allowedItems[] = $parentOrderItemId);
continue;
}
if (!in_array($orderItem->getProductType(), $productTypesNotAllowedByDefault)) {
$allowedItems[] = $orderItem->getId();
}
$additionalData = $orderItem->getAdditionalData();
$additionalData = is_string($additionalData) ? @unserialize($additionalData) : array();
$itemId = $transactionId = null;
$orderItemDataIdentifier = Ess_M2ePro_Helper_Data::CUSTOM_IDENTIFIER;
if (isset($additionalData['ebay_item_id']) && isset($additionalData['ebay_transaction_id'])) {
// backward compatibility with versions 5.0.4 or less
$itemId = $additionalData['ebay_item_id'];
$transactionId = $additionalData['ebay_transaction_id'];
} elseif (isset($additionalData[$orderItemDataIdentifier]['items'])) {
if (!is_array($additionalData[$orderItemDataIdentifier]['items']) || count($additionalData[$orderItemDataIdentifier]['items']) != 1) {
return null;
}
if (isset($additionalData[$orderItemDataIdentifier]['items'][0]['item_id'])) {
$itemId = $additionalData[$orderItemDataIdentifier]['items'][0]['item_id'];
}
if (isset($additionalData[$orderItemDataIdentifier]['items'][0]['transaction_id'])) {
$transactionId = $additionalData[$orderItemDataIdentifier]['items'][0]['transaction_id'];
}
}
if (is_null($itemId) || is_null($transactionId)) {
continue;
}
$item = Mage::helper('M2ePro/Component_Ebay')->getCollection('Order_Item')->addFieldToFilter('order_id', $order->getId())->addFieldToFilter('item_id', $itemId)->addFieldToFilter('transaction_id', $transactionId)->getFirstItem();
if (!$item->getId()) {
continue;
}
$items[$orderItem->getId()] = $item;
}
$resultItems = array();
foreach ($items as $orderItemId => $item) {
if (!in_array($orderItemId, $allowedItems)) {
continue;
}
$resultItems[] = $item;
}
return $resultItems;
}
开发者ID:newedge-media,项目名称:iwantmymeds,代码行数:53,代码来源:Handler.php
示例7: generateShipmentArray
public function generateShipmentArray(Mage_Sales_Model_Order_Shipment $shipment)
{
$address = $shipment->getShippingAddress();
$trackingMethods = $shipment->getAllTracks();
$primaryTrack = count($trackingMethods) ? $trackingMethods[0] : false;
$array = array('@context' => 'http://schema.org', '@type' => 'ParcelDelivery', 'deliveryAddress' => array('@type' => 'PostalAddress', 'streetAddress' => $address->getStreetFull(), 'addressLocality' => $address->getCity(), 'addressRegion' => $address->getRegionCode(), 'addressCountry' => $address->getCountry(), 'postalCode' => $address->getPostcode()), 'partOfOrder' => $this->generateOrderArray($shipment->getOrder()), "expectedArrivalUntil" => date("c", time() + 60 * 60 * 24 * 365.25));
if (count($trackingMethods)) {
$array['carrier'] = $primaryTrack->getTitle();
$array['trackingNumber'] = $primaryTrack->getNumber();
$array['trackingUrl'] = $this->helper('shipping')->getTrackingPopUpUrlByTrackId($primaryTrack->getId());
}
return $array;
}
开发者ID:salsero35,项目名称:gmailactions,代码行数:13,代码来源:Shipment.php
示例8: getTrackingDetails
protected function getTrackingDetails(Mage_Sales_Model_Order_Shipment $shipment)
{
$track = $shipment->getTracksCollection()->getLastItem();
$trackingDetails = array();
if ($track->getData('number') != '') {
$carrierCode = trim($track->getData('carrier_code'));
if (strtolower($carrierCode) == 'dhlint') {
$carrierCode = 'dhl';
}
$trackingDetails = array('carrier_title' => trim($track->getData('title')), 'carrier_code' => $carrierCode, 'tracking_number' => (string) $track->getData('number'));
}
return $trackingDetails;
}
开发者ID:technomagegithub,项目名称:magento,代码行数:13,代码来源:Handler.php
示例9: saveShipment
/**
* Save shipment
*
* @param Mage_Sales_Model_Order_Shipment $shipment
* @param array $data
* @return bool
*/
public function saveShipment($shipment, $data)
{
$result = false;
$carrierCode = $shipment->getOrder()->getShippingCarrier()->getCarrierCode();
switch (true) {
case Mage::getModel('shippingcore/carrier_aramex')->isUsed($carrierCode):
$result = Mage::getModel('shippingcore/carrier_aramex')->saveShipment($shipment, $data);
break;
case Mage::getModel('shippingcore/carrier_skynet')->isUsed($carrierCode):
$result = Mage::getModel('shippingcore/carrier_skynet')->saveShipment($shipment, $data);
break;
}
return $result;
}
开发者ID:amr-z,项目名称:shipping-core,代码行数:21,代码来源:Core.php
示例10: testSendEmail
/**
* @magentoConfigFixture current_store design/theme/full_name default/default/default
* @magentoDataFixture Mage/Sales/_files/order.php
*/
public function testSendEmail()
{
$order = new Mage_Sales_Model_Order();
$order->loadByIncrementId('100000001');
$order->setCustomerEmail('[email protected]');
$shipment = new Mage_Sales_Model_Order_Shipment();
$shipment->setOrder($order);
$payment = $order->getPayment();
$paymentInfoBlock = Mage::helper('Mage_Payment_Helper_Data')->getInfoBlock($payment);
$paymentInfoBlock->setArea('invalid-area');
$payment->setBlockMock($paymentInfoBlock);
$this->assertEmpty($shipment->getEmailSent());
$shipment->sendEmail(true);
$this->assertNotEmpty($shipment->getEmailSent());
$this->assertEquals('frontend', $paymentInfoBlock->getArea());
}
开发者ID:nayanchamp,项目名称:magento2,代码行数:20,代码来源:ShipmentTest.php
示例11: getItemsToShip
/**
* @param Ess_M2ePro_Model_Order $order
* @param Mage_Sales_Model_Order_Shipment $shipment
*
* @return Ess_M2ePro_Model_Order_Item[]
*/
private function getItemsToShip(Ess_M2ePro_Model_Order $order, Mage_Sales_Model_Order_Shipment $shipment)
{
$shipmentItems = $shipment->getAllItems();
$orderItemDataIdentifier = Ess_M2ePro_Helper_Data::CUSTOM_IDENTIFIER;
$items = array();
foreach ($shipmentItems as $shipmentItem) {
$additionalData = $shipmentItem->getOrderItem()->getAdditionalData();
$additionalData = is_string($additionalData) ? @unserialize($additionalData) : array();
if (!isset($additionalData[$orderItemDataIdentifier]['items'][0]['order_item_id'])) {
continue;
}
$id = $additionalData[$orderItemDataIdentifier]['items'][0]['order_item_id'];
$item = $order->getItemsCollection()->getItemByColumnValue('play_order_item_id', $id);
if (is_null($item)) {
continue;
}
$items[] = $item;
}
return $items;
}
开发者ID:ppkowalski,项目名称:M2E,代码行数:26,代码来源:Handler.php
示例12: getItemToShip
/**
* @param Ess_M2ePro_Model_Order $order
* @param Mage_Sales_Model_Order_Shipment $shipment
*
* @return null|Ess_M2ePro_Model_Order_Item
*/
private function getItemToShip(Ess_M2ePro_Model_Order $order, Mage_Sales_Model_Order_Shipment $shipment)
{
if ($order->isSingle()) {
return null;
}
$shipmentItems = $shipment->getAllItems();
if (count($shipmentItems) != 1) {
return null;
}
/** @var $shipmentItem Mage_Sales_Model_Order_Shipment_Item */
$shipmentItem = reset($shipmentItems);
$additionalData = $shipmentItem->getOrderItem()->getAdditionalData();
$additionalData = is_string($additionalData) ? @unserialize($additionalData) : array();
$itemId = $transactionId = null;
$orderItemDataIdentifier = Ess_M2ePro_Helper_Data::CUSTOM_IDENTIFIER;
if (isset($additionalData['ebay_item_id']) && isset($additionalData['ebay_transaction_id'])) {
// backward compatibility with versions 5.0.4 or less
$itemId = $additionalData['ebay_item_id'];
$transactionId = $additionalData['ebay_transaction_id'];
} elseif (isset($additionalData[$orderItemDataIdentifier]['items'])) {
if (!is_array($additionalData[$orderItemDataIdentifier]['items']) || count($additionalData[$orderItemDataIdentifier]['items']) != 1) {
return null;
}
if (isset($additionalData[$orderItemDataIdentifier]['items'][0]['item_id'])) {
$itemId = $additionalData[$orderItemDataIdentifier]['items'][0]['item_id'];
}
if (isset($additionalData[$orderItemDataIdentifier]['items'][0]['transaction_id'])) {
$transactionId = $additionalData[$orderItemDataIdentifier]['items'][0]['transaction_id'];
}
}
if (is_null($itemId) || is_null($transactionId)) {
return null;
}
$item = Mage::helper('M2ePro/Component_Ebay')->getCollection('Order_Item')->addFieldToFilter('order_id', $order->getId())->addFieldToFilter('item_id', $itemId)->addFieldToFilter('transaction_id', $transactionId)->getFirstItem();
return $item->getId() ? $item : null;
}
开发者ID:technomagegithub,项目名称:magento,代码行数:42,代码来源:Handler.php
示例13: getItemsToShip
/**
* @param Ess_M2ePro_Model_Order $order
* @param Mage_Sales_Model_Order_Shipment $shipment
*
* @throws LogicException
*
* @return array
*/
private function getItemsToShip(Ess_M2ePro_Model_Order $order, Mage_Sales_Model_Order_Shipment $shipment)
{
$shipmentItems = $shipment->getAllItems();
$orderItemDataIdentifier = Ess_M2ePro_Helper_Data::CUSTOM_IDENTIFIER;
$items = array();
foreach ($shipmentItems as $shipmentItem) {
$additionalData = $shipmentItem->getOrderItem()->getAdditionalData();
$additionalData = is_string($additionalData) ? @unserialize($additionalData) : array();
if (!isset($additionalData[$orderItemDataIdentifier]['items'])) {
continue;
}
if (!is_array($additionalData[$orderItemDataIdentifier]['items'])) {
continue;
}
$qtyAvailable = (int) $shipmentItem->getQty();
foreach ($additionalData[$orderItemDataIdentifier]['items'] as $data) {
if ($qtyAvailable <= 0) {
continue;
}
if (!isset($data['order_item_id'])) {
continue;
}
$item = $order->getItemsCollection()->getItemByColumnValue('amazon_order_item_id', $data['order_item_id']);
if (is_null($item)) {
continue;
}
$qty = $item->getChildObject()->getQtyPurchased();
if ($qty > $qtyAvailable) {
$qty = $qtyAvailable;
}
$items[] = array('qty' => $qty, 'amazon_order_item_id' => $data['order_item_id']);
$qtyAvailable -= $qty;
}
}
return $items;
}
开发者ID:newedge-media,项目名称:iwantmymeds,代码行数:44,代码来源:Handler.php
示例14: _saveShipment
/**
* Saving shipment and order in one transaction.
* @param Mage_Sales_Model_Order_Shipment $shipment
* @param string $incrementId
* @return self
*/
protected function _saveShipment(Mage_Sales_Model_Order_Shipment $shipment, $incrementId)
{
$order = $shipment->getOrder();
$order->setIsInProcess(true);
$transactionSave = Mage::getModel('core/resource_transaction')->addObject($shipment)->addObject($order);
try {
$transactionSave->save();
} catch (Exception $e) {
$logData = ['increment_id' => $incrementId];
$logMessage = 'An error occurred saving shipment confirmation to order id ({increment_id}). See exception log for details.';
$this->_logger->error($logMessage, $this->_context->getMetaData(__CLASS__, $logData));
$this->_logger->logException($e, $this->_context->getMetaData(__CLASS__, [], $e));
}
return $this;
}
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:21,代码来源:Shipment.php
示例15: 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);
}
开发者ID:AleksNesh,项目名称:pandora,代码行数:67,代码来源:Shipping.php
示例16: addShipmentInformation
/**
* Add Shipment Information
*
* @param Mage_Sales_Model_Order_Shipment $data
* @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_Page
* @throws Exception
*/
public function addShipmentInformation($data)
{
$this->_page->saveGS();
$this->_page->setFont($this->_fontNormal, 6);
$refCode = $data->getOrder()->getIncrementId();
if (!$refCode) {
throw new InvalidArgumentException(Mage::helper('usa')->__('Reference code is missing'));
}
$this->_page->drawText('Ref Code: ' . Mage::helper('usa')->__('Order #%s', $refCode), $this->_x(8), $this->_y(224));
$this->_page->restoreGS();
return $this;
}
开发者ID:hazaeluz,项目名称:magento_connect,代码行数:19,代码来源:PageBuilder.php
示例17: _saveShipment
/**
* Save shipment and order in one transaction
* @param Mage_Sales_Model_Order_Shipment $shipment
*/
protected function _saveShipment($shipment)
{
$shipment->getOrder()->setIsInProcess(true);
$transactionSave = Mage::getModel('core/resource_transaction')->addObject($shipment)->addObject($shipment->getOrder())->save();
return $this;
}
开发者ID:votanlean,项目名称:Magento-Pruebas,代码行数:10,代码来源:ShipmentController.php
示例18: sendEmail
/**
* Send email with shipment data
*
* @param boolean $notifyCustomer
* @param string $comment
* @return Mage_Sales_Model_Order_Shipment
*/
public function sendEmail($notifyCustomer = true, $comment = '')
{
if (!Mage::getStoreConfig('pdfpro/config/enabled')) {
return parent::sendEmail($notifyCustomer, $comment);
}
switch (Mage::getStoreConfig('pdfpro/config/shipment_email_attach')) {
case VES_PdfPro_Model_Source_Attach::ATTACH_TYPE_NO:
return parent::sendEmail();
case VES_PdfPro_Model_Source_Attach::ATTACH_TYPE_ADMIN:
$this->sendEmailForAdmin($notifyCustomer, $comment, true);
$this->sendEmailForCustomer($notifyCustomer, $comment, false);
return $this;
case VES_PdfPro_Model_Source_Attach::ATTACH_TYPE_CUSTOMER:
$this->sendEmailForAdmin($notifyCustomer, $comment, false);
$this->sendEmailForCustomer($notifyCustomer, $comment, true);
return $this;
}
$order = $this->getOrder();
$storeId = $order->getStore()->getId();
if (!Mage::helper('sales')->canSendNewShipmentEmail($storeId)) {
return $this;
}
// Get the destination email addresses to send copies to
$copyTo = $this->_getEmails(self::XML_PATH_EMAIL_COPY_TO);
$copyMethod = Mage::getStoreConfig(self::XML_PATH_EMAIL_COPY_METHOD, $storeId);
// Check if at least one recepient is found
if (!$notifyCustomer && !$copyTo) {
return $this;
}
// Start store emulation process
$appEmulation = Mage::getSingleton('pdfpro/app_emulation');
$initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
try {
// Retrieve specified view block from appropriate design package (depends on emulated store)
$paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment())->setIsSecureMode(true);
$paymentBlock->getMethod()->setStore($storeId);
$paymentBlockHtml = $paymentBlock->toHtml();
} catch (Exception $exception) {
// Stop store emulation process
$appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
throw $exception;
}
// Stop store emulation process
$appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
// Retrieve corresponding email template id and customer name
if ($order->getCustomerIsGuest()) {
$templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_GUEST_TEMPLATE, $storeId);
$customerName = $order->getBillingAddress()->getName();
} else {
$templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE, $storeId);
$customerName = $order->getCustomerName();
}
$mailer = Mage::getModel('pdfpro/email_template_mailer');
if ($notifyCustomer) {
$emailInfo = Mage::getModel('pdfpro/email_info');
$emailInfo->addTo($order->getCustomerEmail(), $customerName);
if ($copyTo && $copyMethod == 'bcc') {
// Add bcc to customer email
foreach ($copyTo as $email) {
$emailInfo->addBcc($email);
}
}
$mailer->addEmailInfo($emailInfo);
}
// Email copies are sent as separated emails if their copy method is 'copy' or a customer should not be notified
if ($copyTo && ($copyMethod == 'copy' || !$notifyCustomer)) {
foreach ($copyTo as $email) {
$emailInfo = Mage::getModel('pdfpro/email_info');
$emailInfo->addTo($email);
$mailer->addEmailInfo($emailInfo);
}
}
// Set all required params and send emails
$mailer->setSender(Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId));
$mailer->setStoreId($storeId);
$mailer->setTemplateId($templateId);
$mailer->setTemplateParams(array('order' => $order, 'shipment' => $this, 'comment' => $comment, 'billing' => $order->getBillingAddress(), 'payment_html' => $paymentBlockHtml));
/* Attach Invoice PDF in email */
$shipmentData = Mage::getModel('pdfpro/order_shipment')->initShipmentData($this);
try {
$result = Mage::helper('pdfpro')->initPdf(array($shipmentData), 'shipment');
if ($result['success']) {
$mailer->setPdf(array('filename' => Mage::helper('pdfpro')->getFileName('shipment', $this) . '.pdf', 'content' => $result['content']));
} else {
Mage::log($result['msg']);
}
} catch (Exception $e) {
Mage::log($e->getMessage());
}
$mailer->send();
return $this;
}
开发者ID:uibar,项目名称:peggysgift,代码行数:99,代码来源:Shipment.php
示例19: _createShippingLabel
/**
* Create shipping label for specific shipment with validation.
*
* @param Mage_Sales_Model_Order_Shipment $shipment
* @return bool
*/
protected function _createShippingLabel(Mage_Sales_Model_Order_Shipment $shipment)
{
if (!$shipment) {
return false;
}
$carrier = $shipment->getOrder()->getShippingCarrier();
if (!$carrier->isShippingLabelsAvailable()) {
return false;
}
$shipment->setPackages($this->getRequest()->getParam('packages'));
$response = Mage::getModel('shipping/shipping')->requestToShipment($shipment);
if ($response->hasErrors()) {
Mage::throwException($response->getErrors());
}
if (!$response->hasInfo()) {
return false;
}
$labelsContent = array();
$trackingNumbers = array();
$info = $response->getInfo();
foreach ($info as $inf) {
if (!empty($inf['tracking_number']) && !empty($inf['label_content'])) {
$labelsContent[] = $inf['label_content'];
$trackingNumbers[] = $inf['tracking_number'];
}
}
$outputPdf = $this->_combineLabelsPdf($labelsContent);
$shipment->setShippingLabel($outputPdf->render());
$carrierCode = $carrier->getCarrierCode();
$carrierTitle = Mage::getStoreConfig('carriers/' . $carrierCode . '/title', $shipment->getStoreId());
if ($trackingNumbers) {
foreach ($trackingNumbers as $trackingNumber) {
$track = Mage::getModel('sales/order_shipment_track')->setNumber($trackingNumber)->setCarrierCode($carrierCode)->setTitle($carrierTitle);
$shipment->addTrack($track);
}
}
return true;
}
开发者ID:xiaoguizhidao,项目名称:ecommerce,代码行数:44,代码来源:ShipmentControllerBKP.php
示例20: getDefaultWeight
/**
* Get default weight.
*
* @param Mage_Sales_Model_Order_Shipment $shipment
* @return float $weight
*/
public function getDefaultWeight(Mage_Sales_Model_Order_Shipment $shipment)
{
$weight = 0;
if (true === $this->getConfig()->useProductWeightAsDefault()) {
/* @var $item Mage_Sales_Model_Order_Item */
foreach ($shipment->getOrder()->getItemsCollection() as $item) {
if (false === Mage::helper('intraship')->isAllowedProductTypeForWeightCalculation($item->getProductType())) {
continue;
}
$weight += Mage::helper('intraship')->convertWeight((double) $item->getWeight() * (double) $item->getQtyOrdered());
}
} else {
$weight = $this->getConfig()->getWeightDefault($shipment->getShippingAddress()->getCountryId());
}
return (double) $weight;
}
开发者ID:igorvasiliev4,项目名称:magento_code,代码行数:22,代码来源:Autocreate.php
注:本文中的Mage_Sales_Model_Order_Shipment类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论