Question

In Magento. How can I execute some php lines after the checkout confirmation. Without writing them in OnepageController.php : successAction() ?

(i'm developing a shipping module so I don't want to modify existing files)

For example, In Opencart this can be done with vqmod (with xml files)

Was it helpful?

Solution

You can do it with a custom module.

add this in the layout xml of the module

<checkout_onepage_success>
    <reference name="checkout.success">
        <block type="[module]/[block]" name="some_name" as="some_name" template="[module]/success.phtml" />
    </reference>
</checkout_onepage_success>

Now you need to create the block with alias '[module]/[block]'. and the template [module]/success.phtml and add your logic in them.
You can even skip the creation of the block class and replace [module]/[block] with core/template and add your logic in [module]/success.phtml but it's cleaner with a block class.
Note: Don't use '[' and ']' in the block names and aliases. I put them there just to mark that those are placeholders.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top