SalahAdDin SalahAdDin - 1 year ago 190
Python Question

User cash on delivery in django-oscar

I'm working in e-shop project using

and i trying to add COD support. I'm using

I did the steps, you can see my configuration:



And created an app called
and loaded properly:

] + get_core_apps(

folder i created an
file with this code inside:

from import Shop

# from import application as checkout_app
from import application as checkout_app

class ApplicationShop(Shop):
checkout_app = checkout_app

application = ApplicationShop()

But i can't understand why Oscar doesn't show me the checkout template with cash on delivery method.

This is my structure folder:
enter image description here

Can anyone help me with this?

Answer Source

There are two ways for integrate cash on delivery in django-oscar project:

  1. Override checkout application:
    In this case is necessary override checkout templates because by default Oscar don't or can't get the cashondelivery checkout templates, at least payment_details. So, first you need override these template file and after create an app and inside it add a file where you override the checkout application as cashondelivery documentation says.

    enter image description here

  2. Create a custom view and checkout app:
    You can see in django-oscar-paypal integration package a sandbox example for integrate paypal with Oscar. You can see in this package that they use a checkout app for replace the defaul checkout app; inside this app they override file and app.view file; override templates and override file.

    So, we can do the same for django-oscar-cash-on-delivery, so:
    a. Create a new application called checkout inside the apps application if you want, or some like you. This application only will contain the views and application file.enter image description here

    b. In views file we'll put the cash-on-delivery views file, now it is in sanbox folder.

    c. In app file inside checkout we declarate the checkout application:

from oscar.apps.checkout import app

from .views import PaymentDetailsView

class CheckoutApplication(app.CheckoutApplication): payment_details_view = PaymentDetailsView

application = CheckoutApplication()

d. Finally, we declarate our checkout app as default checkout app as documentation says.
e. We have ensure that the application override default check out application, in settings:

INSTALLED_APPS = + get_core_apps(

You can now pay with cash on delivery method in your Oscar project.
We recommend use the second way because enable you use more than one method for payment.