Magentos 的结构非常混乱,我会通读此文档,因为它确实有助于了解所有内容的位置。
现在至于找到具体的方法,我发现最好的方法是使用grep。
在您要查找的示例中getTotals
,我运行以下 grep:
grep -RTi 'function getTotals(' ./app/
它返回:
./app/code/core/Mage/Sales/Block/Order/Totals.php : public function getTotals($area=null)
./app/code/core/Mage/Sales/Model/Quote.php : public function getTotals()
./app/code/core/Mage/Sales/Model/Resource/Sale/Collection.php : public function getTotals()
./app/code/core/Mage/Sales/Model/Entity/Sale/Collection.php : public function getTotals()
./app/code/core/Mage/Sales/Model/Quote/Address.php : public function getTotals()
./app/code/core/Mage/Checkout/Block/Onepage/Review/Info.php : public function getTotals()
./app/code/core/Mage/Checkout/Block/Cart/Abstract.php : public function getTotals()
./app/code/core/Mage/Checkout/Block/Cart/Totals.php : public function getTotals()
./app/code/core/Mage/Paypal/Block/Express/Review/Details.php : public function getTotals()
./app/code/core/Mage/Paypal/Model/Cart.php : public function getTotals($mergeDiscount = false)
./app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals.php : public function getTotals()
./app/code/core/Mage/Adminhtml/Block/Sales/Order/Totalbar.php : protected function getTotals()
./app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Sales.php : public function getTotals()
./app/code/core/Mage/Adminhtml/Block/Widget/Grid.php : public function getTotals()
./app/code/core/Mage/Adminhtml/Block/Dashboard/Bar.php : protected function getTotals()
哦,天哪,这似乎是一个流行的方法名称,但至少现在我们可以缩小需要哪个方法的范围。所以我猜它会在销售部分,因为你似乎在谈论销售,所以我们最终得到了一个更易于管理的列表。
./app/code/core/Mage/Sales/Block/Order/Totals.php : public function getTotals($area=null)
./app/code/core/Mage/Sales/Model/Quote.php : public function getTotals()
./app/code/core/Mage/Sales/Model/Resource/Sale/Collection.php : public function getTotals()
./app/code/core/Mage/Sales/Model/Entity/Sale/Collection.php : public function getTotals()
./app/code/core/Mage/Sales/Model/Quote/Address.php : public function getTotals()
狩猎愉快。