This is my layout XML:

<block type="amazonpayments/pay_button" name="product.info.addtocart.amazonpayments" template="creativestyle/amazonpayments/pay/product/button.phtml" before="-">
            <action method="setIdSuffix"><value>product</value></action>
            <action method="setEnableOr"><value>1</value></action>
            <action method="setIsProductButton"><value>1</value></action>

I used this code in my template file but I think the parameters (like setIdSuffix) are missing:

echo $this->getLayout()->createBlock('amazonpayments/pay_button')->setTemplate('creativestyle/amazonpayments/pay/product/button.phtml')->toHtml();

This gives no errors but the corresponding button is not shown either. Any ideas what might be wrong?

Magento 1.9


1 Answer 1


You can try the below code:

$data = array('id_suffix' => 'product', 'enable_or' => 1, 'is_product_button' => 1) 
echo $this->getLayout()->createBlock('amazonpayments/pay_button', 'product.info.addtocart.amazonpayments', $data)->setTemplate('creativestyle/amazonpayments/pay/product/button.phtml')->toHtml();

You can check the method createBlock() under:


They receiving 3 parameters, 1 is type, 2 is name and 3 is data. I have passing the data by creating an array to it. So it should work now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.