cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 1.9, need help, phtml dinamic block loaded in another phtml

Magento 1.9, need help, phtml dinamic block loaded in another phtml

Hello Everyone,

 

I started to use Magento and I can say that is really powerful and I love it.

 

Now, because I'm new, I have some a questions about how works the blocks.

I want to make a "landing page" on the website to show different product (with the same attribute) by the $_GET id.

So, I started by making a new cms page on the website, I select the layout design, and I put different blocks in the content section like this:

 

 

{{block type="cms/block" block_id="myblock1"}}
{{block type="core/template" template="Rkt_CustomBlock/CheckProduct.phtml"}}
{{block type="cms/block" block_id="myblock2"}}

 

So that, if someone need to edit some static content could do it very simple.

I made the CheckProduct.phtml following these step:

 

rootdir|________ app
        |________ etc
        |           - Rkt_CustomBlock.xml
        |________ code/local/Rkt/CustomBlock
        |       |________ etc
        |       |           - config.xml
        |       |________ controllers
        |       |           - IndexController.php
        |       |           
        |       |________ Block
        |                   - CheckProduct.php
        |               
        |________ design/frontend/rwd/default
                |________ layout
                |           - rkt_customblock.xml
                |________ template/rkt_customblock
                            - CheckProduct.phtml

1 - Is this the right process? Before if made a phtml block in the design/frontend/rwd/template/rkt_customblock without making any xml, .php files, indexcontroller...

2 - Where is the difference between the 2 method?

 

// CheckProduct.phtml:

$_GET["id"];
if(isset($_GET['id'])) {

echo $this->getChildHtml('loadproduct');

} else {
echo "no id";
}


now, I would like to know the right process to load another phtml block from the phtml page. 

in this case I use this string:

echo $this->getChildHtml('loadproduct');

I put the loadproduct.phtml in the same folder but notning show. I assume is the wrong code.

3 - Is this going to be the right process to achieve something like that? Because I got confused with the xml files and the others php file. How I sholud menage the xml files and php file for the new phtml block? 

 

Thank you very much.