/** * Override for immediate action on a delivery * * @param Varien_Object $row * @return string */ public function render(Varien_Object $row) { $actions = array(); if ($row->isCancelable()) { $actions[] = array('url' => $this->getUrl('*/postpurchase/cancel', array('id' => $row->getId())), 'caption' => $this->__('Cancel'), 'confirm' => $this->__('Are you sure you want to cancel the %s for order #%s?', $row->getPostName(), $row->getOrderIncrementId())); } $actions[] = array('url' => $this->getUrl('*/postpurchase/delete', array('id' => $row->getId())), 'caption' => $this->__('Purge'), 'confirm' => $this->__('Are you sure you want to purge the %s for order #%s?', $row->getPostName(), $row->getOrderIncrementId())); $this->getColumn()->setActions($actions); return parent::render($row); }
public function render(Varien_Object $row) { $order = Mage::getModel('sales/order')->loadByIncrementId($row->getOrderIncrementId()); $orderId = $order->getEntityId(); if (null === $orderId) { return ""; } $url = Mage::helper('adminhtml')->getUrl('adminhtml/sales_order/view', array('order_id' => $orderId)); return "<a href='{$url}'>" . parent::render($row) . "</a>"; }
public function render(Varien_Object $row) { $html = ''; $order = Mage::getModel('sales/order')->loadByIncrementId($row->getOrderIncrementId()); $onaccount = Mage::getStoreConfig('invoicereminder/generalsettings/groupsonaccount', $order->getStoreId()); if (in_array($order->getCustomerGroupId(), explode(',', $onaccount))) { $html .= 'On account'; } else { $html .= 'Prepaid'; } return $html; }
public function render(Varien_Object $row) { $html = ''; $order = Mage::getModel('sales/order')->loadByIncrementId($row->getOrderIncrementId()); if (in_array($order->getPayment()->getMethod(), explode(',', Mage::getStoreConfig('invoicereminder/generalsettings/invoicepayments')))) { $html .= 'Enabled ('; $html .= $order->getPayment()->getMethod(); $html .= ')'; } else { $html .= 'Disabled ('; $html .= $order->getPayment()->getMethod(); $html .= ')'; } return $html; }
/** * Creates Credit Memo * * @param mixed $returns * @return array */ public function returnPush($returns) { if (isset($returns['records'])) { $returns = $returns['records']; } $result = array(); $result['records'] = array(); foreach ($returns as $return) { $returnObj = new Varien_Object($return); Mage::dispatchEvent('retailops_return_push_record', array('record' => $returnObj)); $order = Mage::getModel('sales/order')->loadByIncrementId($returnObj->getOrderIncrementId()); $result['records'][] = $this->create($order, $returnObj->getCreditmemoData(), $returnObj->getComment(), $returnObj->getNotifyCustomer(), $returnObj->getIncludeComment(), $returnObj->getRefundToStoreCredit()); } return $result; }
/** * Creates shipment, adds track numbers, creates new invoices * * @param $shipments array * @return array */ public function shipmentPush($shipments) { $fullResult = array(); $fullResult['records'] = array(); if (isset($shipments['records'])) { $shipments = $shipments['records']; } foreach ($shipments as $shipmentData) { $result = array(); try { $shipment = new Varien_Object($shipmentData); Mage::dispatchEvent('retailops_shipment_process_before', array('record' => $shipment)); $result['order_increment_id'] = $shipment->getOrderIncrementId(); $orderIncrementId = $shipment->getOrderIncrementId(); $shipmentInfo = $shipment->getShipment(); $trackInfo = isset($shipmentInfo['track']) ? $shipmentInfo['track'] : array(); $invoiceInfo = isset($shipmentInfo['invoice']) ? $shipmentInfo['invoice'] : array(); $shipmentIncrementId = null; // create shipment try { $shipmentResult = array(); $shipmentIncrementId = $this->create($orderIncrementId, $shipmentInfo['qtys'], $shipmentInfo['comment'], $shipmentInfo['email'], $shipmentInfo['include_comment']); if ($shipmentIncrementId) { $shipmentResult['status'] = RetailOps_Api_Helper_Data::API_STATUS_SUCCESS; $shipmentResult['shipment_increment_id'] = $shipmentIncrementId; } else { $shipmentResult['status'] = RetailOps_Api_Helper_Data::API_STATUS_FAIL; $shipmentResult['message'] = Mage::helper('retailops_api')->__('Can not create shipment'); } } catch (Mage_Core_Exception $e) { $shipmentResult['status'] = RetailOps_Api_Helper_Data::API_STATUS_FAIL; $shipmentResult['message'] = $e->getCustomMessage() ? $e->getCustomMessage() : $e->getMessage(); } $result['shipment_result'] = $shipmentResult; if ($shipmentIncrementId) { if ($trackInfo) { $result['track_result'] = array(); foreach ($trackInfo as $track) { // add shipment track try { $trackResult = array(); $track = new Varien_Object($track); Mage::dispatchEvent('retailops_shipment_add_track_before', array('record' => $track)); $trackResult['track_number'] = $track->getData('track_number'); $trackId = $this->addTrack($shipmentIncrementId, $track->getData('carrier'), $track->getData('title'), $track->getData('track_number')); $trackResult['status'] = RetailOps_Api_Helper_Data::API_STATUS_SUCCESS; $trackResult['track_id'] = $trackId; } catch (Mage_Core_Exception $e) { $trackResult['status'] = RetailOps_Api_Helper_Data::API_STATUS_FAIL; $trackResult['message'] = $e->getMessage(); } $result['track_result'][] = $trackResult; } } // create invoice /** @var Mage_Sales_Model_Order $order */ $order = Mage::getModel('sales/order'); $order->loadByIncrementId($orderIncrementId); $isFullyShipped = $this->_checkAllItemsShipped($order); $invoices = $order->getInvoiceCollection(); $invoiceResult = array(); if ($order->canInvoice()) { $itemsToInvoice = array(); if ($order->getPayment()->canCapturePartial()) { /** * If payment allows partial capture, trying to create invoice with shipped items only and capture it */ $itemsToInvoice = $shipmentInfo['qtys']; } if (($itemsToInvoice || $isFullyShipped) && $invoiceInfo) { $invoice = new Varien_Object($invoiceInfo); $invoice->setData('items_to_invoice', $itemsToInvoice); Mage::dispatchEvent('retailops_shipment_invoice_before', array('record' => $invoice)); $invoiceResult = $this->_createInvoiceAndCapture($order, $invoice->getItemsToInvoice(), $invoice->getComment(), $invoice->getEmail(), $invoice->getIncludeComment()); $invoiceResult = array($invoiceResult); } } else { if ($isFullyShipped) { /** * Capturing all available invoices if all order items are shipped */ $invoiceResult = $this->_captureInvoices($invoices); } } $result['invoice_result'] = $invoiceResult; } } catch (Exception $e) { $result['status'] = RetailOps_Api_Helper_Data::API_STATUS_FAIL; $result['message'] = $e->getMessage(); } $fullResult['records'][] = $result; } return $fullResult; }
public function render(Varien_Object $row) { $urlModel = Mage::getModel('adminhtml/url'); $href = $urlModel->getUrl('adminhtml/sales_order/view', array('_current' => false, 'order_id' => $row->getOrderId())); return sprintf('<a href="%s">%s</a>', $href, $row->getOrderIncrementId()); }
/** * Returns the url to the order view page * * @param Varien_Object $row * @return string */ public function render(Varien_Object $row) { $url = Mage::getModel('adminhtml/url')->getUrl('*/sales_order/view/', array('order_id' => $row->getOrderId())); return sprintf('<a href="%s">%s</a>', $url, $row->getOrderIncrementId()); }