2
votes

I am familiar with theming and using template hints in the Magento back office to locate .phtml files.

What I am not really familiar with are the core files such as app/code/core/Mage/Catalog/Model

What I need to do is override a core file like I would a core phtml file by copying it to 'my theme'.

I basically want to amend some labels which appear on the order summary page of the Magento checkout process - domain.com/checkout/cart/

I followed the trail to the phtml files using template hints. Within the app/design/frontend/default/mytheme/template/checkout/cart I found the code

renderTotals(); ?>

Now I managed, by accident, to stumble upon two of the files I wanted to change:

/httpdocs/app/code/local/Mage/Sales/Model/Quote/Address/Total/Grand.php /httpdocs/app/code/local/Mage/Sales/Model/Quote/Address/Total/Shipping.php

I made local copies of these files (http://www.magentocommerce.com/wiki/how_to/how_to_create_a_local_copy_of_app_code_core_mage) to override the default labels, like I would if I was overriding a template file.

My question is, how can you locate core files which pertain to the 'stuff' you want to change, located in function calls such as renderTotals(); ?> in the phtml files?

Not being able to pinpoint stuff like I can with template hints is slowing me down, and I am struggling to find a solution as I am not up on all the vocab surrounding Magento yet.

Hope this makes sense and thanks in advance!

2

2 Answers

1
votes

From the same settings page where you turn on Template Path Hints, also turn on the "Add Block Names to Hints" setting. This will show you PHP class names such as: Mage_Sales_Model_Quote_Address_Total_Grand to which you can deduce the folder path (underscores represent a subfolder, and the last piece represents the file name).

If you're getting a block such as Mage_Sales_Model_Quote_Address_Total_Default then sometimes it just takes a little common sense to see that it's pulling in other files from the same folder (such as Grand.php and Shipping.php). But there are generally only a couple files in the same folder, so this is pretty easy to see.

As Sid Vel said, a good Search Project functionality is helpful. But if you find yourself looking at Abstract.php of some class, often you need to look in a subfolder in that directory with the proper name to find the concrete implementations. But still, it gets you very close to where you need to be.

0
votes

I always use Dreamweaver's site / directory search function. It will scan through all the files in the Core folder and tell you where the function is from. In your case, I would search for "renderTotals". You need to enable PHTML editing in Dreamweaver.

Most IDE's will allow this kind of search option. In Aptana you can Ctrl + Click on the function to open the file it is coming from. Magento takes ages to index itself on Aptana, due to its sheer size.