Thanks for this Josh.

I managed to get an implementation working using the ideas you have 
suggested.

Seeya. Danny.

On Thursday, 9 October 2014 01:11:55 UTC+10:30, Josh Cartmell wrote:
>
> Hey Danny, I don't have code available that I could let you look at right 
> now, but I have done something similar.
>
> To do this I made a custom order form for Cartridge using the setting 
> SHOP_CHECKOUT_FORM_CLASS.
>
> Make it inherit from the default OrderForm and then add a field allowing 
> the user to select a shipping method:
>
> from cartridge.shop.forms import OrderForm
>
> class CustomOrderForm(OrderForm):
>     shipping_method = forms.ChoiceField(choices=SHIPPING_CHOICES)
>
> The following will assume you have the checkout steps split.
>
>
>    1. In your shipping handler calculate the cost of each shipping 
>    method, at that point I would store it in the session, since the user 
>    hasn't selected a shipping method yet, don't set the shipping.
>    2. In the init for your Custom order form check if you are on the 
>    payment step and if the session data that is stored by the shipping 
>    handler, is present, if so update the choices for shipping method to have 
>    their associated costs.
>    At this point I would probably delete the data from the session in 
>    case the user later goes back in the checkout process and changes their 
>    address.
>    3. Display the shipping method select on the payment screen.
>    4. In the payment handler do the normal payment stuff, but also call 
>    the Cartridge set_shipping method
>    ^ that's not exactly what you are supposed to do, but I don't think 
>    there is anything preventing you from calling set_shipping not in the 
>    shipping handler.
>
> In my case, I didn't have the checkout steps split and didn't precalculate 
> the shipping costs, I just let the user see the shipping cost on order 
> confirm page but I think the above should work to do what you want.
>
> On Tue, Oct 7, 2014 at 6:19 PM, Danny S <[email protected] <javascript:>> 
> wrote:
>
>> Hi,
>>
>> I was just wondering if anyone has previously implemented an add-on to 
>> cartridge which allows a user to select the shipping method?
>>
>> I know that with a billship_handler I could use a shipping address to 
>> determine the available types of shipping and their costs, but what if 
>> there's a choice of more than one?
>> e.g Pick up (free), basic ($X), express ($Y).
>>
>> Ideally, after the user has completed their address info, they would be 
>> presented with a dropdown to choose their preferred shipping method, and 
>> then that gets added to the cart total
>> before moving to the payment step of checkout.
>>
>> If anyone has done something similar, is it possible for me to take a 
>> look at your code?
>>
>> Thanks,
>>
>> Seeya. Danny.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Mezzanine Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to