Mike Slinn
Mike Slinn

Reputation: 8407

Using django-oscar to sell fully custom products

I am looking into using django-oscar to sell custom-made products. There is only one SKU, but it has 4 properties that customers can specify: chemicals, color, scent and weight.

Customers will make up recipes and share them with each other. A recipe is a combination of the 4 properties.

Product will be made to order, so we will only stock raw ingredients, not finished product.

We already have an HTML/JavaScript page that allows customers to choose values for the 4 product properties. Costing needs to be done via an Ajax call to an API that needs to be exposed by Django.

Currently, there is one fulfillment partner (me), but out of the box django-oscar only applies fulfillment partners to fully defined products.

It seems (but I am a bit uncertain) that manage.py oscar_fork_app creates forked Oscar apps within an existing webapp, like Frobshop... is that right?

It seems from what I read that django-oscar is capable of selling custom products such as I describe. I think that I'll need to fork the Catalogue and the Dashboard apps. Will I also need to fork Basket and Order and Partner also?

How would I approach setting this type of store up? I have looked at https://django-oscar.readthedocs.io/en/latest/topics/customisation.html, but I have not tried to move forward yet, still trying to get a handle on things.

I decided to try and see what happened. I decided to call the root module ancientwarmth. The following worked just fine, and I forked catalogue, dashboard, basket, order and partner.

for x in catalogue dashboard basket order partner; do
  ./manage.py oscar_fork_app $x ancientwarmth
  sed -i s/oscar.apps.$x.apps.${x^}/ancientwarmth.$x.apps.${x^}/ \
    frobshop/settings/base.py
done

However, I was unable to fork any of these:

I got an error like CommandError: There is no app with the label 'dashboard.catalogue'.

Upvotes: 1

Views: 407

Answers (1)

solarissmoke
solarissmoke

Reputation: 31474

This is quite a broad question, and not one that is likely to get a comprehensive answer because of the time it would take to write one, but a few comments (and help with the forking error):

  1. It's quite possible to sell custom products using Oscar.

  2. Which apps you need to fork really depends on your use case and what from Oscar's core functionality you need to override. You need to first develop a good understanding of what Oscar's apps provide out of the box to determine whether you need to override their functionality. It's not really possible to answer in the general case what apps you need to fork. Oscar is designed to give you as much flexibility to override its functionality as possible - knowing when/where to do this does require becoming familiar with its functionality first though.

  3. The first argument to oscar_fork_app is the label of a Django AppConfig, not a module name, which is what you're trying to use. That is why you're getting an error when attempting to fork the dashboard apps. The correct command would be manage.py oscar_fork_app catalogue_dashboard <destination_path>. This isn't made very clear in the documentation, and there is an issue to fix this. catalogue_dashboard is defined here.

    (It worked for the catalogue, basket, etc. apps because for those the app name defined for the app is identical to the argument you supplied).

Upvotes: 2

Related Questions