With the IWD onestep checkout plugin, there’s a free method for one step checkouts.
Though it still has a problem when you want to select a payment method, because it doesn’t refresh the review summary. This is feature is vital for payment methods that add service fee. Thanks to this plugin I found a code workaroud.
Just enable jQuery $j and add the following code in the checkout process (onepagecheckout.phtml):
$j(function($) { $j('input[name*="payment[method]"]').live('click', function() { checkout.update({ 'review': 1, //,'shipping-method': 1 'payment-method': 1 }); setTimeout(function(){ checkout.update({ 'review': 1 //'payment-method': 1 }); }, 5000); }); $j('input[name*="shipping_method"]').live('click', function() { checkout.update({ 'review': 1 ,'payment-method': 1 //'shipping-method': 1 }); setTimeout(function(){ checkout.update({ 'review': 1, //'payment-method': 1 }); }, 500); }); });
Now IWD One Step checkout works with payment methods with service costs, because the review/summary is refreshed.
Having too much problems with IWD, than just try OneStepCheckout.
i’m sorry but is not completely right. because there are 2 disadvantages, if the first update response after 5 second, the totally update will be failed and the second upload (on the ‘review order’) is not right for the UX (user interface).
for me the right solution is:
1 beautifier the onepagecheckout.pack.js
2 after the ‘update’ and before ‘setResponse’ functions, you will be add this functions after line 195
update2: function (params) {
if (this.loadWaiting != false) {
return
}
if (this.s_code == '') return this.opcdis();
var parameters = $(this.form).serialize(true);
for (var i in params) {
if (!params[i]) {
continue
}
var obj = $('checkout-' + i + '-load');
if (obj != null) {
var size = obj.getDimensions();
obj.setStyle({
'width': size.width + 'px',
'height': size.height + 'px'
}).update('').addClassName('loading');
parameters[i] = params[i]
}
}
checkout.setLoadWaiting(true);
var request = new Ajax.Request(this.updateUrl, {
method: 'post',
onSuccess: this.setResponse2.bind(this),
onFailure: this.ajaxFailure.bind(this),
parameters: parameters
})
},
setResponse2: function (response) {
response = response.responseText.evalJSON();
if (response.redirect) {
location.href = check_secure_url(response.redirect);
return true
}
checkout.setLoadWaiting(false);
if (response.order_created) {
$('onepagecheckout_orderform').action = this.successUrl;
$('opc_submit_form').click();
return true
} else if (response.error_messages) {
var msg = response.error_messages;
if (typeof (msg) == 'object') {
msg = msg.join("\n")
}
alert(msg)
}
$('review-please-wait').hide();
if (response.update_section) {
for (var i in response.update_section) {
ch_obj = $('checkout-' + i + '-load');
if (ch_obj != null) {
ch_obj.setStyle({
'width': 'auto',
'height': 'auto'
}).update(response.update_section[i]).setOpacity(1).removeClassName('loading');
if (i === 'shipping-method') {
shippingMethod.addObservers()
}
}
}
}
if (response.duplicateBillingInfo) {
shipping.syncWithBilling()
}
if (!response.reload_totals) {
checkout.update({
'review': 1
})
}
return false
},
3 your code will be modified in
$j(function($) {
$j('input[name*="payment[method]"]').live('click', function() {
checkout.update2({
'review': 1,
'payment-method': 1
});
});
$j('input[name*="shipping_method"]').live('click', function() {
checkout.update({
'review': 1
,'payment-method': 1
});
setTimeout(function(){
checkout.update({
'review': 1,
});
}, 500);
});
});
Great, I’ll test it soon, thanks for the input! There’s still a strange fault that when payment fails and it falls back to the site, the cart is empty so you can’t reprocess the order. Do you have a solution for that as well? I will look soon to it as well.
Hi,
I already found the review-refresh code inside brasil checkout (based on IWD I believe). I need to find a way to have canceled payments result in canceled orders, instead of pending orders. Do you have an idea?
For the empty cart, I use some code from vout.nl checkout
edit /etc/config.xml and put this after :
onepagecheckout/observer
setEmptyCartTemplate
remove :
emptyCart
fromin /Model/Observer.php add:
public function setEmptyCartTemplate()
{
if (Mage::helper('onepagecheckout')->isOnepageCheckoutEnabled())
{
$cartHelper = Mage::helper('checkout/cart');
$layout = Mage::getSingleton('core/layout');
if (!$cartHelper->getItemsCount()){
$layout->getBlock('checkout.cart')->setTemplate('onepagecheckout/cart/noItems.phtml');
}
}
}
Checkout the dutch OSC for more info:
https://github.com/Vout/onestepchecout
I’ve got the payment problem solved, but now I have this problem:
I want the review and payment section refreshed when I change the shipping method. Now the Cash on delivery fee won’t go away until I click the same shipping method twice. Any idea?
I now see the coding problem, I will try this again:
in IWD/Onepagecheckout/etc/config.xml remove emptyCart from:
model
onepagecheckout/observer
removeHistoryComment
emptyCart
and add:
onepagecheckout/observer
setEmptyCartTemplate
Is it possible to summarize everything into one complete explanation?
I have the same problem with IWD one page check out and Lesti FPC! Super great magento booster but can’t use it for the moment because i cant receive order in this way. Does anayone have a solutions for this?
Kindest regards Kim, Compliments to the author
Help me!
i’m use ex One Page Checkout of IWD.
I’m having some errors.
One Page Checkout not show shipping methods and payment methods, although im have setup in admin backend.
http://www.uphinhnhanh.com/images/65044Hinh1.jpg
when I filled out the information, and click outside space, my site started to refresh and display shipping method, but does not show payment methods. Until I manually refresh (F5), the display payment methods, and I can end up paying
http://www.uphinhnhanh.com/images/32861Hinh2.jpg
I have to refresh browser, payment methods had show:
http://www.uphinhnhanh.com/images/61163hinh3.jpg
i use magento 1.8
I’m not a developer, please guide me more closely
i have tried to fix 🙁 but im can’t 🙁
Plz help me!
My english very bad, i hope you understand and help me