Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The option to choose between shipping methods #31

Open
Uznick opened this issue Sep 19, 2012 · 4 comments
Open

The option to choose between shipping methods #31

Uznick opened this issue Sep 19, 2012 · 4 comments

Comments

@Uznick
Copy link

Uznick commented Sep 19, 2012

Is there such option in Plata?

I've grepped through the code, and found a field "shipping_method" in the Order model, but I did not find where it is set.

The use case is simple: the user can choose between several shipping methods with different costs, and after that, the costs are added to the bill.

@matthiask
Copy link
Owner

While Plata does come with the infrastructure to plug in your own shipping backends, it's not of very much help. It definitely is possible, but there's some work involved.

What you have to do is this:

  • Modify a form in the checkout process to ask for the shipping method. For example, extend the discounts form with a shipping method radio button. Store the shipping method in the shipping_method field.
  • Write your own order processor (take a look at plata/shop/processors.py, especially the FixedAmountShippingProcessor) which sets the shipping costs depending on the selected method.
  • Define PLATA_ORDER_PROCESSORS, and replace the default shipping processor by your own.

That's it! Just ask if you have additional questions or need some guidance.

@Uznick
Copy link
Author

Uznick commented Sep 19, 2012

Thanks!

And can I modify a form in the checkout process? It's not pluggable, as I can see.

Just override the /shop/checkout/ url with my own view and do there what ever i need?

@matthiask
Copy link
Owner

The official way would be to subclass the plata.shop.views.Shop class, override a few methods (for example discounts_form or checkout_form), and use this instead of the standard Shop class for inclusion into the URLconf.

class MyShop(Shop):
    def checkout_form(...):
        # return XYzzyForm


shop_views = MyShop(Order, ...)

urlpatterns = patterns(
    urL(r'^shop/', include(shop_views.urls)),
)

Hope it helps!

@flaiming
Copy link
Contributor

I was solving just that, you can found it here: https://github.com/Draciinfo/calendar-eshop/blob/master/calendareshop/shopping/forms.py
Go for shopping.views.py for view implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants