本文整理匯總了PHP中Varien_Event_Observer::getInvoice方法的典型用法代碼示例。如果您正苦於以下問題:PHP Varien_Event_Observer::getInvoice方法的具體用法?PHP Varien_Event_Observer::getInvoice怎麽用?PHP Varien_Event_Observer::getInvoice使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Varien_Event_Observer
的用法示例。
在下文中一共展示了Varien_Event_Observer::getInvoice方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: invoiceView
public function invoiceView(Varien_Event_Observer $observer)
{
$block = $observer->getBlock();
$invoice = $observer->getInvoice();
if (strpos($invoice->getOrder()->getPayment()->getMethodInstance()->getCode(), 'saferpaycw') === 0) {
$transaction = Mage::helper('SaferpayCw')->loadTransactionByOrder($invoice->getOrder()->getId());
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/edit') && $invoice->canCapture() && $transaction->getTransactionObject()->isCapturePossible() && $transaction->getTransactionObject()->isPartialCapturePossible()) {
$block->addButton('edit', array('label' => Mage::helper('sales')->__('Edit'), 'class' => 'go', 'onclick' => 'setLocation(\'' . $block->getUrl('*/editsaferpaycw/index', array('invoice_id' => $invoice->getId())) . '\')'));
}
}
}
示例2: addInvoiceComments
/**
* Add the invoice comments
*
* @param Varien_Event_Observer $observer observer object
*
* @return FireGento_Pdf_Model_Observer
*/
public function addInvoiceComments(Varien_Event_Observer $observer)
{
if (!Mage::getStoreConfigFlag('sales_pdf/invoice/show_comments')) {
return $this;
}
/** @var Mage_Sales_Model_Order_Invoice $invoice */
$invoice = $observer->getInvoice();
/** @var Mage_Sales_Model_Resource_Order_Invoice_Comment_Collection $commentsCollection */
$commentsCollection = $invoice->getCommentsCollection();
$commentsCollection->addVisibleOnFrontFilter();
$result = $observer->getResult();
$notes = $result->getNotes();
foreach ($commentsCollection as $comment) {
/** @var $comment Mage_Sales_Model_Order_Invoice_Comment */
$notes[] = $comment->getComment();
}
$result->setNotes($notes);
return $this;
}
示例3: applySerialToOrderItem
/**
* @param Varien_Event_Observer $observer
* @var Mage_Sales_Model_Order_Invoice $invoice
*/
public function applySerialToOrderItem(Varien_Event_Observer $observer)
{
$invoice = $observer->getInvoice();
$order = Mage::getModel('sales/order')->load($invoice->getOrderId());
if (!($order->getVolumeLicense() != 0 && $order->getParentOrderId() == NULL)) {
if ($invoice instanceof Mage_Sales_Model_Order_Invoice) {
$downloadableHelper = Mage::helper('ecodes/downloadable');
foreach ($invoice->getAllItems() as $invoiceItem) {
if (Mage::getModel('catalog/product')->load($invoiceItem->getProductId())->getSerialRequired()) {
$orderItem = Mage::getModel('sales/order_item')->load($invoiceItem->getOrderItemId());
$downloadableCollection = Mage::getModel('ecodes/downloadable')->getCollection();
$downloadableCollection->assignSerials($orderItem);
$serialsAdded = $downloadableCollection->getInfo('serials_added');
$numSerialsNotAssigned = $downloadableCollection->getInfo('num_serials_not_assigned');
$message = $downloadableHelper->generateSerialsAssignedHistoryComment($serialsAdded, $numSerialsNotAssigned, true);
if ($message) {
$this->getSession()->addSuccess($message);
}
}
}
}
}
}
示例4: salesOrderPaymentCapture
public function salesOrderPaymentCapture(Varien_Event_Observer $event)
{
/** @var $payment Mage_Sales_Model_Order_Payment */
$payment = $event->getPayment();
$invoice = $event->getInvoice();
if ($payment->getMethodInstance() instanceof Netresearch_OPS_Model_Payment_Abstract) {
$payment->setInvoice($invoice);
}
return $this;
}
示例5: convertToOrder
/**
* Event fired when invoice is paid
* @param Varien_Event_Observer $observer
*
* @return $this
*/
public function convertToOrder(Varien_Event_Observer $observer)
{
/** @var $order Mage_Sales_Model_Order */
$order = $observer->getInvoice()->getOrder();
$statusOrder = $observer->getInvoice()->getOrder()->getStatus();
$statusArr = explode(',', Mage::getStoreConfig(ITwebexperts_Payperrentals_Helper_Config::XML_PATH_RESERVED_STATUSES));
if (!Mage::helper('payperrentals/config')->reserveInventoryNoInvoice() || Mage::helper('payperrentals/config')->reserveByStatus() && !in_array($statusOrder, $statusArr)) {
$items = $observer->getInvoice()->getOrder()->getItemsCollection();
ITwebexperts_Payperrentals_Helper_Data::reserveOrder($items, $order);
}
return $this;
}
示例6: sendConfirmInvoiceRequest
/**
* Catches magento event 'sales_order_invoice_save_before'
*
* @param Varien_Event_Observer $observer
*/
public function sendConfirmInvoiceRequest(Varien_Event_Observer $observer)
{
$invoice = $observer->getInvoice();
$paymentMethod = $invoice->getOrder()->getPayment()->getMethod();
if ($this->getHelper()->isBillpayPayment($paymentMethod)) {
// Is there a cleaner way to access the post data within a model?
$data = Mage::app()->getRequest()->getPost('invoice');
$delayInDays = 0;
if (is_array($data) && array_key_exists('billpay_delay', $data)) {
$delayInDays = $data['billpay_delay'];
}
$result = $this->getHelper()->sendConfirmInvoiceRequest($invoice, $paymentMethod, $delayInDays, true);
$order = $invoice->getOrder();
// Store bank account in database
$this->setBankAccountData($order, $result);
if ($this->getHelper()->isBillpayRatPayment($paymentMethod)) {
$info = $order->getPayment()->getMethodInstance()->getInfoInstance();
// Store due dates in database for hire purchase
if (is_array($result['dues']) && count($result['dues']) > 0) {
$serializedDuesWithDates = $this->getCalculation()->getSerializedDues($result['dues']);
$info->setBillpayRateDues($serializedDuesWithDates);
} else {
$this->getLog()->logError("No due dates found for hire purchase order after invoiceCreated request");
}
}
// Send copy of invoice mail to billpay
if ($this->getHelper()->getConfigData('settings/send_invoice_mail_copy', $invoice->getStoreId())) {
try {
$this->sendInvoiceCopy($invoice);
$this->getLog()->logDebug('Successfully sent copy of invoice mail to billpay');
} catch (Exception $e) {
$this->getLog()->logError('Error sending copy of invoice mail to billpay');
$this->getLog()->logException($e);
}
}
// Add comment to status history
$comment = $this->getHelper()->__('billpay_activated_successully');
if ($delayInDays > 0) {
$comment .= ' (+' . $delayInDays . ' ' . $this->getHelper()->__('billpay_activated_days') . ')';
}
$order->addStatusToHistory($order->getStatus(), $comment, false);
$invoice->addComment($comment, false);
}
}