tags:

views:

35

answers:

1

I have create a module which at this point does nothing but exist the next step I need to figure out is how to make it does something when someone views the a product at this point I don't care if it says hello world next to the image

can someone help me I can't seem to figure out what I need to extend if i need to use and observer or what I seem to be lost .... or drowning

+1  A: 

Depending on what you want to accomplish, you could go in many different directions from here. If you're looking for visual feedback, creating a new block and adding it to the product page might be a good direction. Try creating a new block in your module (Yournamespace_Yourmodule_Block_Product_View in the file app/code/local/Yournamespace/Yourmodule/Block/Product/View.php) and define a method toHtml in that block that echos some HTML (say "hello world"). Look at other blocks in the system to see how to set up such a class (what to descend from, etc). Later on, you'll want to turn this into a proper template, but this approach will help you understand blocks. Check Alan's other tutorials for how to set up your config.xml to define where blocks are found.

Now, inside your theme, in /templates/catalog/product/view.php, create an instance of your block and display it's contents like this:

<?php print $this->getLayout()->createBlock("yourmodule/product_view")->toHtml(); ?>

This should echo some HTML onto the product view page.

I want to emphasize that this skips several of the steps to doing it the "right" way, but it should get you quick visual feedback and help you understand how a page is built inside of magento.

Joseph Mastey