-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple fixes and enhancements #41
Open
MaWoScha
wants to merge
13
commits into
PHOENIX-MEDIA:master
Choose a base branch
from
MaWoScha:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
9fcb845
Fix localization issues - Version 1.0.11
MaWoScha b3f9acf
Add locale 'en_GB' and 'pt_PT' - Version 1.0.11
MaWoScha 13a7bcd
SR-714 allow capture offline' - Version 1.0.12
MaWoScha 9960001
Fixed 'Display Zero Fee' in customer account order view (#21) - Versi…
MaWoScha 95ed1cb
Add 'cod_fee', 'base_cod_fee' attributes to webservices (#33) - Versi…
MaWoScha 6e35aa3
Update to better fit ECG/PSR-2 - Version 1.0.12
MaWoScha 9c07413
Hide config options if module is disabled - Version 1.0.12
MaWoScha 8be3d1b
Add 'Create Invoice Option' - Version 1.0.12
MaWoScha 4848ec8
Improve locale 'it_IT' - Version 1.0.12
MaWoScha 30e003f
README.md - Version 1.0.12
MaWoScha b6c4054
Add locale 'fr_FR' - Version 1.0.13
MaWoScha 53370b3
Fix issue #42: 'foreigncosts' to 'foreigncountrycosts' - Version 1.0.14
218887a
Update Phoenix_CashOnDelivery.xml
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,8 +26,8 @@ class Phoenix_CashOnDelivery_Model_Observer extends Mage_Core_Model_Abstract | |
* @param Varien_Event_Observer $observer | ||
* @return Phoenix_CashOnDelivery_Model_Observer | ||
*/ | ||
public function sales_quote_collect_totals_after(Varien_Event_Observer $observer) | ||
{ | ||
public function salesQuoteCollectTotalsAfter(Varien_Event_Observer $observer) | ||
{ | ||
$quote = $observer->getEvent()->getQuote(); | ||
$data = $observer->getInput(); | ||
|
||
|
@@ -51,11 +51,11 @@ public function sales_quote_collect_totals_after(Varien_Event_Observer $observer | |
* @param Varien_Event_Observer $observer | ||
* @return Phoenix_CashOnDelivery_Model_Observer | ||
*/ | ||
public function sales_order_payment_place_end(Varien_Event_Observer $observer) | ||
{ | ||
public function salesOrderPaymentPlaceEnd(Varien_Event_Observer $observer) | ||
{ | ||
$payment = $observer->getPayment(); | ||
if ($payment->getMethodInstance()->getCode() != 'phoenix_cashondelivery') { | ||
return $this;; | ||
return $this; | ||
} | ||
|
||
$order = $payment->getOrder(); | ||
|
@@ -74,36 +74,13 @@ public function sales_order_payment_place_end(Varien_Event_Observer $observer) | |
return $this; | ||
} | ||
|
||
/** | ||
* Performs order_create_loadBlock response update | ||
* adds totals block to each response | ||
* This function is deprecated, the totals block update is implemented | ||
* in phoenix/cashondelivery/sales.js (SalesOrder class extension) | ||
* | ||
* @param Varien_Event_Observer $observer | ||
* @return Phoenix_CashOnDelivery_Model_Observer | ||
*/ | ||
public function controller_action_layout_load_before(Varien_Event_Observer $observer) | ||
{ | ||
$action = $observer->getAction(); | ||
|
||
if ($action->getFullActionName() != 'adminhtml_sales_order_create_loadBlock' || !$action->getRequest()->getParam('json')) { | ||
return $this; | ||
} | ||
|
||
$layout = $observer->getLayout(); | ||
$layout->getUpdate()->addHandle('adminhtml_sales_order_create_load_block_totals'); | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* When the order gets canceled we put the Cash on Delivery fee and tax also in the canceled columns. | ||
* | ||
* @param Varien_Event_Observer $observer | ||
* @return Phoenix_CashOnDelivery_Model_Observer | ||
*/ | ||
public function order_cancel_after(Varien_Event_Observer $observer) | ||
public function orderCancelAfter(Varien_Event_Observer $observer) | ||
{ | ||
$order = $observer->getEvent()->getOrder(); | ||
|
||
|
@@ -116,7 +93,7 @@ public function order_cancel_after(Varien_Event_Observer $observer) | |
$codTax = $order->getCodTaxAmount(); | ||
$baseCodTax = $order->getBaseCodTaxAmount(); | ||
|
||
$codFeeInvoiced = $order->getCodFeeInvoiced(); | ||
$codFeeInvoiced = $order->getCodFeeInvoiced(); | ||
|
||
if ($codFeeInvoiced) { | ||
$baseCodFeeInvoiced = $order->getBaseCodFeeInvoiced(); | ||
|
@@ -139,4 +116,37 @@ public function order_cancel_after(Varien_Event_Observer $observer) | |
|
||
return $this; | ||
} | ||
} | ||
|
||
|
||
/** | ||
* Invoice and set status to Cash On Delivery if order payment type is Cash on Delivery | ||
* | ||
* @author: https://github.com/Flipmediaco/Magento-CashOnDelivery/blob/8ae36cffd3bbab8e61852810c21a3c3a558378b4/app/code/community/Phoenix/CashOnDelivery/Model/Observer.php | ||
* @param Varien_Event_Observer $observer | ||
* @return void | ||
*/ | ||
public function invoiceCashOnDelivery($observer) | ||
{ | ||
// Get order | ||
$order = $observer->getEvent()->getOrder(); | ||
|
||
// If order is instance of Phoenix_CashOnDelivery_Model_CashOnDelivery | ||
if ($order->getPayment()->getMethodInstance()->getCode() == 'phoenix_cashondelivery' && | ||
// Can be invoiced | ||
$order->canvoice() && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo: canvoice() should be canInvoice() |
||
// order_invoice is true | ||
Mage::getStoreConfig('payment/phoenix_cashondelivery/order_invoice')) { | ||
// Prepare invoice | ||
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice(); | ||
// Set capture case - OFFLINE | ||
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_OFFLINE); | ||
$invoice->register(); | ||
// | ||
// Save transaction | ||
$transactionSave = Mage::getModel('core/resource_transaction') | ||
->addObject($invoice) | ||
->addObject($invoice->getOrder()); | ||
$transactionSave->save(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will not work... If codFee check returns false the last && will not be validated. If the codFee Check returns true and display_zero_fee is set to false the total block is not added even if a fee is set.