本文整理汇总了PHP中Mage_Sales_Model_Order::getShipmentsCollection方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order::getShipmentsCollection方法的具体用法?PHP Mage_Sales_Model_Order::getShipmentsCollection怎么用?PHP Mage_Sales_Model_Order::getShipmentsCollection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order::getShipmentsCollection方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTrackingData
/**
* Build an array of tracking data for shipments in ROM order.
*
* @return array
*/
public function getTrackingData()
{
/** @var array */
$data = [];
/** @var Varien_Data_Collection */
$shipments = $this->order->getShipmentsCollection();
/** @var EbayEnterprise_Order_Model_Detail_Process_Response_Shipment */
$shipment = $shipments->getItemByColumnValue('increment_id', $this->shipmentId);
if ($shipment) {
$data[] = $this->extractTrackingDataFromShipment($shipment);
} else {
foreach ($shipments as $shipment) {
$data[] = $this->extractTrackingDataFromShipment($shipment);
}
}
return $data;
}
示例2: deleteOrder
public function deleteOrder(Mage_Sales_Model_Order $order)
{
$invoices = $order->getInvoiceCollection();
foreach ($invoices as $invoice) {
//delete all invoice items
$items = $invoice->getAllItems();
foreach ($items as $item) {
$item->delete();
}
//delete invoice
$invoice->delete();
}
$creditnotes = $order->getCreditmemosCollection();
foreach ($creditnotes as $creditnote) {
//delete all creditnote items
$items = $creditnote->getAllItems();
foreach ($items as $item) {
$item->delete();
}
//delete credit note
$creditnote->delete();
}
$shipments = $order->getShipmentsCollection();
foreach ($shipments as $shipment) {
//delete all shipment items
$items = $shipment->getAllItems();
foreach ($items as $item) {
$item->delete();
}
//delete shipment
$shipment->delete();
}
//delete all order items
$items = $order->getAllItems();
foreach ($items as $item) {
$item->delete();
}
//delete payment - not sure about this one
$order->getPayment()->delete();
//delete quote - this can be skipped
/*if ($order->getQuote()) {
foreach ($order->getQuote()->getAllItems() as $item) {
$item->delete();
}
$order->getQuote()->delete();
}*/
//delete order
$order->delete();
return $this;
}
示例3: _getDeliveryNotes
/**
* @param Mage_Sales_Model_Order $order
* @return array
*/
protected function _getDeliveryNotes($order)
{
$deliveryNotes = array();
foreach ($order->getShipmentsCollection() as $shipment) {
/** @var Mage_Sales_Model_Order_Shipment $shipment */
foreach ($shipment->getAllTracks() as $track) {
/** @var Mage_Sales_Model_Order_Shipment_Track $track */
$note = new ShopgateDeliveryNote();
$note->setShippingServiceId($track->getTitle());
$note->setTrackingNumber($track->getNumber());
$note->setShippingTime($track->getCreatedAt());
array_push($deliveryNotes, $note);
}
}
return $deliveryNotes;
}
示例4: _hasShipments
/**
* @param Mage_Sales_Model_Order $order
*
* @return bool
*/
protected function _hasShipments(Mage_Sales_Model_Order $order)
{
/** @var Mage_Sales_Model_Resource_Order_Shipment_Collection $shipments */
$shipments = $order->getShipmentsCollection();
if ($shipments->getSize() > 0) {
return true;
}
return false;
}
示例5: _isValidShipping
/**
* validate shipping
*
* @param Mage_Sales_Model_Order $magentoOrder
* @param ShopgateOrder $shopgateOrder
* @param Shopgate_Framework_Model_Shopgate_Order|NULL $magentoShopgateOrder
*
* @return bool
*/
protected function _isValidShipping($magentoOrder, $shopgateOrder, $magentoShopgateOrder = null)
{
$isValidShipping = true;
if (($shopgateOrder->getIsShippingBlocked() || $magentoShopgateOrder->getIsShippingBlocked()) && $magentoOrder->getShipmentsCollection()->getSize() > 0) {
$isValidShipping = false;
}
return $isValidShipping;
}
示例6: _convertConfigTags
/**
* @param array $tagsConfig
* @param Mage_Sales_Model_Order $order
*
* @return bool|array
*/
protected function _convertConfigTags($tagsConfig = array(), Mage_Sales_Model_Order $order = null)
{
if (empty($tagsConfig) || empty($order) || !$order->getId()) {
return false;
}
$tags = array();
foreach ($tagsConfig as $key => $config) {
/** @var $config Varien_Object */
$object = $config->getData('object');
switch ($object) {
case 'payment':
/** @var Mage_Sales_Model_Order_Payment $object */
$object = $order->getPayment();
break;
case 'invoice':
/**
* @var Mage_Sales_Model_Resource_Order_Invoice_Collection $invoices
* @var Mage_Sales_Model_Order_Invoice $object
*/
$invoices = $order->getInvoiceCollection();
$object = $invoices->getFirstItem();
break;
case 'shipping_address':
/** @var Mage_Sales_Model_Order_Address $object */
$object = $order->getShippingAddress();
break;
case 'shipment':
/**
* @var Mage_Sales_Model_Resource_Order_Shipment_Collection $shipments
* @var Mage_Sales_Model_Order_Shipment $object
*/
$shipments = $order->getShipmentsCollection();
$object = $shipments->getFirstItem();
break;
case 'order':
default:
$object = $order;
break;
}
if (!$object || !$object->getId()) {
continue;
}
$dataKey = $config->getData('data');
$data = $this->_extractTagData($dataKey, $config, $object);
switch ($config->getData('type')) {
case 'int':
$data = (int) $data;
break;
case 'float':
$data = (double) $data;
break;
case 'double':
$data = (double) $data;
break;
case 'date':
/** @var Mage_Core_Model_Date $date */
$date = Mage::getModel('core/date');
$data = $date->date('d/m/Y H:i:s', strtotime($data));
break;
case 'currency':
$data = (string) $this->_helper()->formatCurrency((double) $data, false);
break;
case 'string':
default:
$data = (string) $data;
break;
}
$label = $config->getData('alias');
if (empty($label)) {
$label = $config->getData('label');
}
$label = $this->__($label);
$tags[$label] = $data;
}
return $tags;
}