Reputation: 393
I'm running 1.9.x and have 3 different payment methods, amazon payments, paypal express, sage pay and a continue shopping button. On the cart page I am attempting to reorder how these appear in the checkout-types UL.
I currently have the below which I believe is default
<ul class="checkout-types">
<li><?php if($this->getContinueShoppingUrl()): ?>
<button type="button" title="<?php echo $this->__('Continue Shopping') ?>" class="button btn-continue btn-inline" onclick="setLocation('<?php echo $this->getContinueShoppingUrl() ?>')"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
<?php endif; ?></li>
<?php foreach ($this->getMethods('top_methods') as $method): ?>
<?php if ($methodHtml = $this->getMethodHtml($method)): ?>
<li><?php echo $methodHtml; ?></li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
My aim is to have the pay now button which goes into the one page checkout button appear after the continue shopping button and then amazon and paypal. I have spent hours looking through the code and can't seem to find a way to change the sort order on the $method array.
Upvotes: 2
Views: 2030
Reputation: 2034
The getMethods($name)
method will actually fall for sorting to the configuration in the layout files.
As an example for top_methods
which is an alias in the layout, it will look for all the updates on that handle from XML files in the system, in case of PayPal it will be, Considering that RWD is the package you are using :
app/design/frontend/rwd/default/layout/paypal.xml
And this is the xml block part for it:
<block type="paypal/express_shortcut" name="checkout.cart.methods.paypal_express.top" before="checkout.cart.methods.onepage.top" template="paypal/express/shortcut.phtml">
<action method="setIsQuoteAllowed"><value>1</value></action>
<action method="setShowOrPosition"><value>after</value></action>
</block>
In this default theme configuration, the paypal express checkout is placed before the block checkout.cart.methods.onepage.top
which is configured to be the last block in top_methods
with the after="-"
:
<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.top" template="checkout/onepage/link.phtml" after="-" />
</block>
So in conclusion, what you need to do is to go through the XML layout files for the payment methods you are using, and set the before
and after
depending on the sort you need. if you have cache enabled, you will need to flush it and you should get the result intended.
An example would be:
Change display order of checkout buttons in Magento
Upvotes: 1
Reputation: 393
adding the following to the checkout layout sorted the issue
before="checkout.cart.methods.amazonpayments_pay.top"
Upvotes: 0