Looks like I used the wrong email address the first time around. Apologies all round.
---------- Forwarded message ---------- From: Jurgen Blignaut <[email protected]> Date: Wed, Jan 26, 2011 at 7:08 PM Subject: Problem with only one shipping method on checkout page. To: [email protected] Hi all, Not sure if this is the correct mailing list for this, but I have a problem with using a single shipping method on the checkout confirmation page. Here is my analysis of the problem, and a possible solution. I am using Satchmo 0.92-pre. I have only one shipping method, "Tiered Weight", configured on my site. In the "payment.views.payship" module's "simple_pay_ship_process_form" function, there is code that checks if there should be a form displayed on the checkout page to enable selection of shipping method, or if the step can be skipped. I show the code snippet below. form = SimplePayShipForm(request, payment_module, order_data) if allow_skip: skipping = False skipstep = form.shipping_hidden or not ordershippable or (len(form.shipping_dict) == 1) if skipstep: log.debug('Skipping pay ship, nothing to select for shipping') # no shipping choice = skip this step form.save(request, working_cart, contact, payment_module, data={'shipping' : form.fields['shipping'].initial}) skipping = True As can be seen from the code, there are 3 conditions being checked to determine if skipping of the step is allowed. The last condition, i.e. the number of shipping methods being equal to 1, is the True condition in my case. This causes the form to be saved, with the value of the "shipping" key of the "data" dictionary being passed to the "save" method, getting set to the "initial" value of the "shipping" form field. This is where the problem manifests itself, in that the "initial" value of the form field has no value at this point. This causes "None, None, 0.00" to be displayed as the shipping method and cost on the final checkout page, which also means that no shipping charge is added to the final checkout value. My proposed solution would be to add a check just before saving the form to see if the length of the "form.shipping_dict" is indeed 1, and then to set the "initial" value of the form field to the key of the only item in the "form.shipping_dict" dictionary, like so: if skipstep: if len(form.shipping_dict) == 1: form.fields['shipping'].initial = form.shipping_dict.keys()[0] I have tried this in my local installation, and it fixes the problem I am experiencing. Wether this is the correct fix to apply, or has been fixed already in the development tip, I am not sure. Any feedback would be appreciated. Kind regards, -- Jurgen Blignaut Software Engineer with Python http://www.webtide.co.za [email protected] +27829227239 -- You received this message because you are subscribed to the Google Groups "Satchmo users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/satchmo-users?hl=en.
