Magento - How to add a custom block to a validation page

I want to add some information to the successful verification page by adding a block to the page (without duplicating the template page and changing it).

I looked at the loadable module and tried to copy it, but that didn't work. I have a custom module and I tried to do this:

1) adding a block file: ... \ application \ code \ Local \ SHANI \ MyModule \ Block \ Checkout \ Details.php

class SHANI_MyModule_Block_Checkout_Details extends Mage_Checkout_Block_Onepage_Success
{
}

2) adding a template file to: ... \ application \ design \ frontend \ default \ default \ template \ MyModule \ Checkout \ details.phtml

<?php
echo "test ffdagdf";
?>

3) adding a block to: ... \ app \ design \ frontend \ default \ default \ layout \ mymodule.xml

<default>
</default>

....
....
....

<checkout_onepage_success>
    <reference name="checkout.success">
        <block type="mymodule/checkout_success" name="mymodule.checkout.details" template="mymodule/checkout/details.phtml"/>
    </reference>
</checkout_onepage_success>

Is there any way to do this? What am I missing?

///////////////////////////////////////// / update //////// /////////////////////////////////

mymodule.xml, Lrrr, ...

<checkout_onepage_success>
        <reference name="checkout.success">
            <block type="mymodule/checkout_details" name="mymodule.checkout.details" template="mymodule/checkout/details.phtml"/>
        </reference>
</checkout_onepage_success>

, ?

, "product.info.additional" "product.info" .

:

<catalog_product_view>
        <reference name="product.info.additional">
           <block type="catalog/product_view" name="mymodule.saledetails" before="-" template="mymodule/product/details.phtml"/>
            <block type="mymodule/product_participant_list" name="mymodule.participants" before="-" template="mymodule/product/participant/list.phtml"/>
        </reference>
    </catalog_product_view>

<catalog_product_view>
        <reference name="product.info">
                <block type="catalog/product_view" name="mymodule.saledetails" before="-" template="mymodule/product/details.phtml"/>
        </reference>
        <reference name="product.info.additional">
            <block type="mymodule/product_participant_list" name="mymodule.participants" before="-" template="mymodule/product/participant/list.phtml"/>
        </reference>
    </catalog_product_view>

"product.info.additional" "product.info" , ( ), "". "product.info" ?

+3
3

<checkout_onepage_success>
    <reference name="content">
        <block type="mymodule/checkout_success" name="mymodule.checkout.details" template="mymodule/checkout/details.phtml"/>
    </reference>
</checkout_onepage_success>

checkout.success, , , $this->getChildHtml('yourblockname') output="toHtml"

+2

print $this->getChildHtml('mymodule.checkout.details')

= "" xml.

.

,

type="core/template"

SHANI_MyModule_Block_Checkout_Details

type="mymodule/checkout_details"
0

<block type="core/template" name="parent" template="parent.phtml>

<block type="core/template" name="child" template="child" />

</block>

parent.phtml, print $this->getChildHtml('child') Magento child.phtml parent.phtml

... , , , - . "product.info.additional" echo $this->getChildHtml(), "product.info" echo $this->getChildHtml('block_name')

, config.xml

0
source

Source: https://habr.com/ru/post/1781816/


All Articles