I've personally never liked this method of creating Custom Products.
If you'd like another approach, check out my posts, Satchmo Diaries, at

http://thisismedium.com/tech

Start with Part One. It provides the overview of how I create custom
products & the others show a more in-depth look at how to use signals to
provide various kinds of extra functionality.

Best,

Bob Waycott

On Tue, Aug 18, 2009 at 11:25 AM, Lagg <[email protected]> wrote:

>
> I'm trying to get a custom product setup. The only thing this custom
> product will add to product is a
> many-to-many field so that customers can choose up to 10 different
> colors on the same item.
> (Think tie-dye t-shirt or something like that).
>
> Eventually I'll want to let the customer choose these colors with a
> series of checkboxes, but there won't need to be any color selection
> done via admin.
> (Also, I'm going to create the availble colors via sql script, so no
> need to do much for that aspect, except for making another class so
> the model.manytomanyfield('colors') will work.)
>
> For the time being, I just want to add a generic custom product so I
> can understand the process.
> I tried to follow the directions here:
> http://www.satchmoproject.com/docs/svn/custom-product.html
>
> Unfortunately I can't seem to get right.  When I go to "Product
> Settings" and look at the list of products, I don't see "MyNewProduct"
> in the list.
>
> I'm going to list what I did, what I have and maybe
> somebody can help me.
> (just a warning: I'm pretty new to python, django and satchmo, so
> don't be surprised if there is something really stupid going on here)
>
>
> file structure:
>
> store/
> -static/
> -templates/
> -custom_product/
> --->models.py
> --->config.py
> --->admin.py
> -local_settings.py
> -settings.py
> -manage.py
> -urls.py
> -satchmo.log
>
> (my awful diagram is trying to show that my project folder is called
> "store" and inside "store" is a folder ,created via "manage.py
> startapp custom_product",  called "custom_product". Inside of
> custom_product are files models.py, config.py and admin.py)
>
>
> custom_product/models.py
> ------------------------
> from django.db import models
> from django.utils.translation import ugettext_lazy as _
> from product.models import Product
>
> class MyNewProduct(models.Model):
>    product = models.OneToOneField(Product, verbose_name=_('Product'),
>        primary_key=True)
>
>    def _get_subtype(self):
>        return 'MyNewProduct'
>
>    def __unicode__(self):
>        return u"MyNewProduct: %s" % self.product.name
>
>    class Meta:
>        verbose_name = _('My New Product')
>        verbose_name_plural = _('My New Products')
>
> --------------------------
>
> custom_product/config.py
> ---------------------------
> from django.utils.translation import ugettext_lazy as _
> from livesettings import config_get
>
> PRODUCT_TYPES = config_get('PRODUCT', 'PRODUCT_TYPES')
>
> # TODO: Replace app name!
> PRODUCT_TYPES.add_choice(('custom_products::MyNewProduct', _('My New
> Product')))
> -----------------------------
>
> custom_product/admin.py
> ----------------------------
> from django.contrib import admin
> from store.custom_products.models import MyNewProduct
>
> admin.site.register(MyNewProduct)
> ----------------------------
>
>
> settings.py -
> --------------------------
> installed_apps and satchmo_settings area:
> INSTALLED_APPS = (
>    'django.contrib.sites',
>    'satchmo_store.shop',
>    'django.contrib.admin',
>    'django.contrib.auth',
>    'django.contrib.contenttypes',
>    'django.contrib.comments',
>    'django.contrib.sessions',
>    'django.contrib.sitemaps',
>    'registration',
>    'keyedcache',
>    'livesettings',
>    'l10n',
>    'sorl.thumbnail',
>    'satchmo_store.contact',
>    'tax',
>    'tax.modules.no',
>    'tax.modules.area',
>    'tax.modules.percent',
>    'shipping',
>    'product',
>    'payment',
>    'payment.modules.giftcertificate',
>    'satchmo_utils',
>    'app_plugins',
>    'store.custom_products'
>   )
>
> #### Satchmo unique variables ####
> #from django.conf.urls.defaults import patterns, include
> SATCHMO_SETTINGS = {
>    'SHOP_BASE' : '',
>    'MULTISHOP' : False,
>    'CUSTOM_PRODUCT_MODULES' :
> ['store.custom_products.model.MyNewProduct'],
>    }
>
> ---------------------------
>
> (of course after making these changes I run "python manage.py
> syncdb" . Syncdb tells me it's making stuff for "MyNewProduct", so at
> least that part is working)
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Satchmo users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/satchmo-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to