本文整理汇总了PHP中Mage_Sales_Model_Order_Shipment::getDcOrderId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Shipment::getDcOrderId方法的具体用法?PHP Mage_Sales_Model_Order_Shipment::getDcOrderId怎么用?PHP Mage_Sales_Model_Order_Shipment::getDcOrderId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order_Shipment
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order_Shipment::getDcOrderId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateDocuments
public static function generateDocuments(Mage_Sales_Model_Order_Shipment $shipment)
{
$result = array();
if ($shipment->getDcOrderId() && Mage::getStoreConfig('dc_charge_extension/dccharge/create-documents')) {
$helper = Mage::helper('dccharge');
$params = array();
$params['calculation_id'] = $shipment->getDcOrderId();
$params['output_currency'] = $shipment->getOrder()->getOrderCurrencyCode();
$params['seller_first_name'] = Mage::getStoreConfig('dc_charge_extension/dccharge/seller-first-name');
$params['seller_last_name'] = Mage::getStoreConfig('dc_charge_extension/dccharge/seller-last-name');
$params['seller_country'] = Mage::getStoreConfig('dc_charge_extension/dccharge/seller-country');
$params['seller_address_line_1'] = Mage::getStoreConfig('dc_charge_extension/dccharge/seller-address-line');
$params['seller_city'] = Mage::getStoreConfig('dc_charge_extension/dccharge/seller-city');
$params['seller_zip'] = Mage::getStoreConfig('dc_charge_extension/dccharge/seller-postcode');
$params['seller_phone'] = Mage::getStoreConfig('dc_charge_extension/dccharge/seller-phone');
$params['shipment_invoice_no'] = $shipment->getIncrementId();
$params['shipment_date'] = $shipment->getCreatedAt();
$params['shipment_number_parcels'] = 1;
$params['shipment_total_actual_weight'] = 0;
foreach ($shipment->getAllItems() as $item) {
$orderItem = $item->getOrderItem();
$product = Mage::getModel('catalog/product')->load($orderItem->getProductId());
if ($orderItem->getParentItemId() || !$orderItem->getQuoteItemId() || $product->isVirtual()) {
continue;
}
$itemWeightInKG = 0;
if ($item->getWeight()) {
$weigthUnit = Mage::getStoreConfig('dc_charge_extension/dccharge/weight-unit');
$weight = Mage::getStoreConfig('dc_charge_extension/dccharge/allow-override-products-weight') ? Mage::getStoreConfig('dc_charge_extension/dccharge/overridden-products-weight') : $item->getWeight();
if ($weigthUnit == 'lb') {
$itemWeightInKG = round($weight * 0.45359237, 2);
} else {
$itemWeightInKG = $weight;
}
}
$params['shipment_total_actual_weight'] += $itemWeightInKG * $item->getQty();
}
$params['shipment_currency_sale'] = $shipment->getOrder()->getOrderCurrencyCode();
if ($shipment->getDeliveryDutyType() == Dutycalculator_Charge_Helper_Data::DC_DELIVERY_TYPE_DDP) {
$params['shipment_incoterms'] = 'DDP';
} elseif ($shipment->getDeliveryDutyType() == Dutycalculator_Charge_Helper_Data::DC_DELIVERY_TYPE_DDU) {
$params['shipment_incoterms'] = 'DAP';
} else {
$params['shipment_incoterms'] = '';
}
$shippingAddress = $shipment->getShippingAddress();
$billingAddress = $shipment->getBillingAddress();
$params['shipto_first_name'] = $shippingAddress->getFirstname();
$params['shipto_last_name'] = $shippingAddress->getLastname();
$params['shipto_address_line_1'] = $shippingAddress->getStreet(-1);
$params['shipto_city'] = $shippingAddress->getCity();
$params['shipto_zip'] = $shippingAddress->getPostcode();
$params['shipto_country'] = $shippingAddress->getCountryId();
$params['shipto_phone'] = $shippingAddress->getTelephone();
$params['soldto_first_name'] = $billingAddress->getFirstname();
$params['soldto_last_name'] = $billingAddress->getLastname();
$params['soldto_address_line_1'] = $billingAddress->getStreet(-1);
$params['soldto_city'] = $billingAddress->getCity();
$params['soldto_zip'] = $billingAddress->getPostcode();
$params['soldto_country'] = $billingAddress->getCountryId();
$params['soldto_phone'] = $billingAddress->getTelephone();
$params['print_first_name'] = Mage::getStoreConfig('dc_charge_extension/dccharge/seller-first-name');
$params['print_last_name'] = Mage::getStoreConfig('dc_charge_extension/dccharge/seller-last-name');
$params['print_date'] = date('Y-m-d');
$rawXml = $helper->sendRequest('documents', $params);
try {
if (stripos($rawXml, '<?xml') === false) {
throw new Exception($rawXml);
}
$answer = new SimpleXMLElement($rawXml);
$commercialInvoice = current($answer->xpath('commercial-invoice'));
$packingList = current($answer->xpath('packing-list'));
$result['commercial_invoice_url'] = (string) $commercialInvoice->url;
$result['packing_list_url'] = (string) $packingList->url;
} catch (Exception $ex) {
Mage::logException($ex);
}
}
return $result;
}
开发者ID:Fishead-Communications,项目名称:dutycalculator_charge_import_duty,代码行数:80,代码来源:Importdutytaxes.php