create copy of function addAction
of cartController.php
(app/code/core/checkout/controllers/
) to myaddAction().
add below to end view.phtml(app/design/frontend/your package/your template/template/catalog/product/view.phtml)
<script type="text/javascript">
//<![CDATA[
productAddToCartForm.submit = function(button, url){
replaceURL = url.replace("add/","myadd/");
if(this.validator) {
var nv = Validation.methods;
delete Validation.methods['required-entry'];
delete Validation.methods['validate-one-required'];
delete Validation.methods['validate-one-required-by-name'];
// Remove custom datetime validators
for (var methodName in Validation.methods) {
if (methodName.match(/^validate-datetime-.*/i)) {
delete Validation.methods[methodName];
}
}
if (this.validator.validate()) {
if (url) {
this.form.action = replaceURL;
}
this.form.submit();
}
Object.extend(Validation.methods, nv);
}
}.bind(productAddToCartForm);
//]]>
</script>
add checkout button to addtocart.phhtml (app/design/frontend/your package/your template/template/catalog/product/view
)
<button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="productAddToCartForm.submitmy(this)"><span><span><?php echo "Checkout"; ?></span></span></button>
As i tell you copy addAction to mycartAction
Change
$this->_goBack();
to
$this->_redirect('checkout/onepage');
return;
endof
if (!$cart->getQuote()->getHasError()){
$message = $this->__('%s was added to your shopping cart.', Mage::helper('core')->escapeHtml($product->getName()));
$this->_getSession()->addSuccess($message);
}
add