Open Uznick opened 11 years ago
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:
shipping_method
field.plata/shop/processors.py
, especially the FixedAmountShippingProcessor
) which sets the shipping costs depending on the selected method.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.
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?
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!
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.
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.