Shopping Cart – How to Add an Extra ‘Checkout’ Button in Shopping Basket at the Top of the Page

cartcheckoutshopping-cart

Default Magento themes and pretty much every custom theme as the checkout button at the bottom after the totals of the cart etc. Looking to create the exact same button at the top of the shopping basket page too. I would imagine floating using css would be the best method? Had a quick play about with, but can't get anything happening at all. I've tried editing my theme's styles.css file. I wonder if any editing of the xml page for the basket is needed though? I thought it would be pretty straight forward, but seems to be more complex than I had hoped! Any help would be appreciated.

Best Answer

The "Proceed to Checkout" button is added at the top of the template /app/design/frontend/base/default/template/checkout/cart.phtml by looping through all the 'top_methods'.

<ul class="checkout-types">
    <?php foreach ($this->getMethods('top_methods') as $method): ?>
        <?php if ($methodHtml = $this->getMethodHtml($method)): ?>
        <li><?php echo $methodHtml; ?></li>
        <?php endif; ?>
    <?php endforeach; ?>
</ul>

This is different from the bottom of the template where it loops through the 'methods' I would suggest that either the 'top_methods' loop has been removed from your template or the methods are not being added.

The methods are added via layout.xml file, normally in /app/design/frontend/base/default/layout/checkout.xml with the following code:

<block type="core/text_list" name="checkout.cart.top_methods" as="top_methods" translate="label">
    <label>Payment Methods Before Checkout Button</label>
    <block type="checkout/onepage_link" name="checkout.cart.methods.onepage" template="checkout/onepage/link.phtml"/>
</block>