1

I'm trying to make a change to the Magento onepage checkout page. I've done a search

$find . -iname *onepage*

and I've gotten 5-6 results for onepage.phtml in my Magento/ directory. A couple of these pages have the exact same source, or nearly the exact same source. Is there a better way for me to know which one is the file being loaded onto the site than using a "trial by fire" method and editing them until I find which one I'm needing?

Sturm
  • 4,105
  • 3
  • 24
  • 39
  • Think of Magento as lego blocks. You start with a page with holes cut in it for content. Those holes have blocks to fill them and may have further holes in them for content blocks to be inserted, all the way down to very basic and specific content like price. Depending on the area you are in on your website, different module trees will be involved in providing the macro content. The code is MVC (Model View Controller) and the display is layout & templates. Observe the template hints below and think about how they relate to the above description, you soon will find any template without them. – Fiasco Labs Jun 09 '12 at 18:16
  • 3
    Self promotional link so I won't rep-fish with it below, but it's exactly the situation you're asking about that led me to build Commerce Bug (http://store.pulsestorm.net/products/commerce-bug), the Magento debugging extension. – Alana Storm Jun 09 '12 at 18:59
  • If the company has the money, going to your local training is useful. http://www.magentocommerce.com/training/descriptions#fundamentals-of-magento-development They also provide a on-demand video of the same training, but it lacks some of the hands-on interaction that can help you learn. This training is for the fundamentals and can be a great introduction on how it all works. – Vern Burton Jun 11 '12 at 16:08

1 Answers1

4

You have the option of using Template Hints. This is a very nifty tool for Magento developers. Template hints will show where to find every visible file on every page of your Magento site. Log into the back end and follow the pictures to see how to turn them on for the front end. enter image description here-dont wanna enter image description here enter image description here Set both Template Path Hints and Add Block Names to Hints to yes. and Voila, you're site should be looking something like this: (Also, Template Path Hints are not shown in the default site scope by default, you may need to select a specific site to enable them for): enter image description here

Now what if you need to make changes to the back end (administration panel)? This part is about just as easy, although you will have to make some changes to some code. In your

app/code/local/Mage/Core/etc/system.xml

directory there is a block of code that will look like:

                        <template_hints translate="label">
                        <frontend_type>select</frontend_type>
                        <source_model>adminhtml/system_config_source_yesno</source_model>
                        <sort_order>20</sort_order>
                        <show_in_default>0</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                    </template_hints>
                    <template_hints_blocks translate="label">
                        <label>Add Block Names to Hints</label>
                        <frontend_type>select</frontend_type>
                        <source_model>adminhtml/system_config_source_yesno</source_model>
                        <sort_order>21</sort_order>
                        <show_in_default>0</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                    </template_hints_blocks>

Now change both of the show_in_default settings from 0 to 1. Return to the admin panel > System > Configuration > Developer under the default site scope and you will have the options to enable template path hints and block names. If you set both of those to yes now, it will enable template path hints for the administration panel.

Sturm
  • 4,105
  • 3
  • 24
  • 39
  • 2
    Don't make that change in Mage_Core config.xml. You can (and should) add a new module to the system which contains only config.xml and system.xml. Add the `dev/debug/template_hints/show_in_default>1` xpath/value and you have an upgrade-safe, easy-to-find change. – benmarks Jun 10 '12 at 15:03