Rewrite you can do this magento two process
Process One:
one is rewrite the class Mage_Checkout_CartController
and in this addAction()
at code if (!$cart->getQuote()->getHasError()) {
add redirection
code $this->_redirect('checkout/onepage');
Process two:
Using event/Observer
Event:
checkout_cart_add_product_complete
This event provide the data of product object and cart request parameters
Mage::dispatchEvent('checkout_cart_add_product_complete',
array('product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse())
);
Config.xml code:
<frontend>
<events>
<checkout_cart_add_product_complete>
<observers>
<packagename_modulename_observer>
<type>singleton</type>
<class>packagename_modulename/observer</class>
<method>addToCartComplete</method>
</packagename_modulename_observer>
</observers>
</checkout_cart_add_product_complete>
</events>
</frontend>
Observer code:
using this event you can set your return url
$observer->getEvent()->getRequest()->setParam('return_url',Mage::getUrl('checkout/onepage'));
this redirect to you at checkout Onepage
function:
public function addToCartComplete(Varien_Event_Observer $observer) {
$product = $observer->getEvent()->getProduct();
$Request=$observer->getEvent()->getRequest();
$Request->setParam('return_url',Mage::getUrl('checkout/onepage'));
}
this redirect to you at Checkout onepage
So to translate the text you can do a few things.
- Inline translations: you can set-up inline translations in the admin section then when you visit the frontend you can then translate strings and translate the button text.
- Add a locale file to your theme: if in your theme you add a locale file you can then add any translations that you wish.
- Update the template in your theme: if you add the template to your theme you can simply change the text shown.
I would go with the theme locale option here. Just create a file public/app/design/frontend/your_package/your_theme/locale/en_US/translate.csv
then in this file translate your string.
Best Answer
Please add this in your phtml file where you want to add :
and must be added this script for Buy Now button :