Just for the record as it was resolved in the comments already - and furthermore to provide some ideas on how one can approach a situation like the questioner.
Unlike the name of the class Ess_M2ePro_Model_Order
may let one assume, it does not provide any relevant information on externally placed orders.
The relevant class seems to be Ess_M2ePro_Model_Ebay_Order
for Ebay- and Ess_M2ePro_Model_Amazon_Order
for Amazon-orders. In both the method getTaxDetails()
can be found.
A practical example would be:
$id = 1; // order id of interest
$order = Mage::getModel('M2ePro/Ebay_Order')->load($id); // load the order
$tax = $order->getTaxDetails(); // get tax details from order
/**
* Note: Since I haven't worked with this module yet and haven't been
* able to find any dummy/demo data I can't tell what the returned array
* looks like exactly, yet, based on other methods in class it seems to
* hold at least the keys 'rate' and 'amount'.
* (@Hector, maybe you could share a var_dump() here?)
*/
Now just some quick ideas how one can approach a situation like this (assuming that there is not sufficient documentation provided and you don'T want to review every single file):
Especially in modules with a large amount of files/classes/methods it's always worth a shot to first of all check how the initial developer did approach a certain task. Basically this is one common way the check how certain functionality is integrated in Magento core as well when it comes to modifying a certain behavior.
For the given module and problem this means, a quick check on what tables / table columns look promising is always a good starting point (unfortunately, due to the separated install/upgrade scripts in Magento 1 there is mostly hardly a way around of installing a module first, before being able to get the whole table structure).
Since the obvious one (m2epro_order
) does not hold any column that seems relevant (it just has columns like account_id
, marketplace_id
, store_id
, ...) the class Ess_M2ePro_Model_Order
got pretty much uninteresting (this assumption was confirmed when having a quick look at the methods in app/code/Ess/M2ePro/Model/Order.php
). Yet (when you wish to assume that the module creator did a nice job) continuing digging for the obvious mostly leads you to what you're looking for - doing so for this module would certainly bring you to the table m2epro_ebay_order
. Since this table fits nicely to Model/Ebay/Order.php
you're pretty much reached your goal already.
Another way to search for something you really expect to be present some where in a given module is to use the (Unix) CLI command grep -r "searchstring" /path/to/folder
. Running this for some catchy phrases such as tax_details
(the column name we found earlier), getTaxDetails
(based on the column name) - or when in doubt getTax
, Tax
or tax
(note that the command is case sensitive - there might be a way to overcome this but that's even further out of scope than what I'm tying already anyway ;) ). Next to some other stuff this will eventually come up with
C:\laragon\www\mage1936\app\code\community\Ess\M2ePro
λ grep -r "getTax" ./
[...]
./Model/Amazon/Order.php: public function getTaxDetails()
./Model/Amazon/Order.php: $taxDetails = $this->getTaxDetails();
./Model/Amazon/Order.php: $taxDetails = $this->getTaxDetails();
./Model/Amazon/Order.php: $taxDetails = $this->getTaxDetails();
./Model/Ebay/Order.php: public function getTaxDetails()
./Model/Ebay/Order.php: public function getTaxRate()
./Model/Ebay/Order.php: $taxDetails = $this->getTaxDetails();
./Model/Ebay/Order.php: public function getTaxAmount()
Module source for reference: https://github.com/m2epro/magento1-extension
$order = Mage::getModel('M2ePro/Ebay_Order')->load($id); $tax = $order->getTaxDetails();
as given inEss_M2ePro_Model_Ebay_Order
(or$order = Mage::getModel('M2ePro/Amazon_Order')->load($id);
perEss_M2ePro_Model_Amazon_Order
)?