matthiask / plata

Plata - the lean and mean Django-based Shop
https://plata-django-shop.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
197 stars 63 forks source link

Just a suggestion #6

Closed bmihelac closed 13 years ago

bmihelac commented 13 years ago

Hi Matthias,

I think that Plata is great shop solution and by looking at the code I get impression it's finished product implemented many times, I would like to make suggestion. Generally I have feeling that some things could be more abstract, and thus more adaptable to specific needs.

For example ProductPrice model is currently related to Product model. In real world, pair of shoes can have different price depending on size. I am not sure how easy it would be to adopt current models for this need. I have a feeling that ProductVariant should answer this questions in abstract way and subclasses would have concrete implementation.

Similiar things that might make both developing plata and implementation simpler is if one could subclass AbstractProduct and override taxes, currency, availability related methods to his own needs.

these was just my 2 cents. bets, Bojan

matthiask commented 13 years ago

Regarding prices and product variants: Satchmo does this by attaching a price modification to product variants. I'm not sure whether that's sufficient. Attaching a "real" price object to a product variant seems nicer. We didn't have the need for that yet, though.

Regarding subclassing: If you subclass the Product (not abstract inheritance, but it should not matter too much in my opinion) and initialize the Shop object with your own Product subclass, it should just work (tm). If methods of the bundled Product class are used instead of your overridden methods that's considered a bug and should be fixed.

matthiask commented 13 years ago

Btw, I was planning to document sort-of a contract for the classes used in the Shop class. F.e. the Product class needs to have this and that attribute, and needs to have a relation with name xy to the OrderItem object etc.

You could drop in your own Product or Discount class and not use the bundled ones in any way. Creating such a contract is really hard though :-(

bmihelac commented 13 years ago

sorry for late answer. Thanks for details, this makes it easier to understand now. For the project we have right now we choose another path but I will keep eye on Plata closely.

Bojan