The #satchmo irc channel helped me understand this, I was failing to
understand the purpose of the site settings>product settings selection
box, and also misunderstood the django admin panel workings.

So the summary is this:
1.) The Product list in /admin/ will not contain your custom product,
as Ryan Headley said above. It is possible to hack it in there, but
neither elegant nor clean, thus not recommended.
2.) I misunderstood the purpose of this. See #3.
3.) The "Products list" in /admin/ doesn't change based on what you
select in "site settings>product settings". I misunderstood the
purpose for this selection box. I still don't fully understand why
it's there, but I know what it does: it just informs satchmo that you
have those types of products that you selected, so satchmo will check
the tables for individual attributes of those types. I don't get how
this is really useful, but I understand that you should just select it
for each product type you will support.

Although, Juanjo, I still can't get the code from your blog that I
posted working. However the docs from the satchmo project do work just
fine.

On Aug 11, 12:17 pm, hobi <[email protected]> wrote:
> Thanks for the response. I actually found your blog before asking, but
> I was unable to make it work.
>
> Here is my app containing your blog method:
>
> admin.py>
> from django.contrib import admin
> from product.models import Product
> from mystore.stones.models import Stone
> from livesettings import config_value
> from product.admin import ProductAttribute_Inline, Price_Inline, \
>     ProductImage_Inline, ProductTranslation_Inline, ProductOptions
>
> class Stone_Inline(admin.StackedInline):
>     model = Stone
>     extra = 1
>
> class StoneOptions(ProductOptions):
>     exclude = ('slug', 'sku', 'meta', 'length', 'length_units',
>                'width', 'width_units', 'height', 'height_units',
>                'weight_units', 'related_items', 'also_purchased',
>                'date_added', 'taxable', 'taxClass', 'shipclass',
>                'site',)
>
>     fieldsets = (
>         (None, {'fields': ('name', 'category', 'description',
>         'short_description', 'weight', 'active', 'featured',
>         'items_in_stock', 'total_sold','ordering',)}),
>         )
>
>     list_display = ('name', 'items_in_stock', 'unit_price')
>     list_display_links = ('name',)
>     search_fields = ['name', 'description', 'short_description']
>     inlines = [Stone_Inline, Price_Inline, ProductImage_Inline]
>     filter_horizontal = ('category',)
>
>     if config_value('LANGUAGE','SHOW_TRANSLATIONS'):
>         inlines.append(ProductTranslation_Inline)
>
> admin.site.unregister(Product)
> admin.site.register(Product, StoneOptions)
>
> --------------
>
> models.py>
> from django.db import models
> from django.utils.translation import ugettext_lazy as _
>
> import django.db.models.signals as djangosignals
> from product.models import Product
> from satchmo_store.contact.models import Organization
>
> class Stone(models.Model):
>     product = models.OneToOneField(Product, verbose_name=_('Base
> Product'))
>
>     code = models.CharField(verbose_name=_('Code'), max_length=32,
> blank=True, null=True)
>     suplier = models.ManyToManyField(Organization, verbose_name=_
> ('Supplier'), blank=True, null=True)
>
>     def _get_subtype(self):  return 'Stone'
>
>     def __unicode__(self):
>         if self.code:
>             return u"%s [%s]" % (self.product.name, self.code)
>         else:
>             return u'%s' % self.product.name
>
>     class Admin: pass
>
>     class Meta:
>         verbose_name = _('Stone')
>         verbose_name_plural = _('Stones')
>
> import config
>
> from satchmo_store.shop import get_satchmo_setting, signals
> from listeners import *
>
> djangosignals.pre_save.connect(product_pre_save, sender = Product)
>
> -------------
>
> config.py>
> from django.utils.translation import ugettext_lazy as _
> from livesettings import config_get
>
> PRODUCT_TYPES = config_get('PRODUCT', 'PRODUCT_TYPES')
> PRODUCT_TYPES.add_choice(('mystore.stones::Stone', _('Stone')))
>
> ---------
>
> And of course settings.py has it in the installed apps.
>
> RESULTS:
> There is no extra module named "Stones", unlike following the satchmo
> documentation (good). In site settings/product settings, I can see
> "Stones". Selecting ONLY stones and clicking "save" gets me this
> message:
>
> Tue, 11 Aug 2009 12:01:08 configuration INFO     Updated setting
> PRODUCT.PRODUCT_TYPES = [u'mystore.stones::Stone']
>
> However my "Products" module still has the same old list:
>
> Categories
> Configurable Products
> Custom Products
> Custom text fields
> Discounts
> Downloadable Products
> Option Groups
> Option Items
> Product variations
> Products
> Subscription Products
> Tax Classes
>
> So, 3 issues:
> 1.) Is there a problem in my rendition of your blog code, which causes
> "Stones" not to show under "Products"?
> 2.) Why does the "Products" list in admin never update? It's always
> the same, no matter what I choose in "site settings"!
> 3.) Is it like that for everyone? If so, what is the purpose of site
> settings/product settings?
>
> Sorry for the huge code dump, and thanks again.
>
> On Aug 11, 1:11 am, Juanjo <[email protected]> wrote:
>
> > Hobi,
>
> > Check what I did, which works for me, using admin inlines and
> > unregistering and re-registering the ProductOptions model:
>
> >http://juanjoalvarez.net/es/detail/2009/jul/27/why-bad-idea-tm-overri...
>
> > On 10 ago, 21:53, hobi <[email protected]> wrote:
>
> > > Very sorry if this is a duplicate post (I can't find the last one I
> > > submitted an hour ago)
>
> > > I followed the directions 
> > > here:http://www.satchmoproject.com/docs/svn/custom-product.html
> > > In addition, I added the app to settings.py, and I imported config in
> > > model.py
>
> > > I now see "MyNewProduct" as it's own module, which although was not my
> > > intended goal, does make perfect sense, since admin.py says:
>
> > > admin.site.register(MyNewProduct)
>
> > > However I expected it to show up in the "products" module. So after
> > > selecting my new product, and ONLY my new product in the site settings/
> > > product settings, I went back to localhost:8000/admin/product, where I
> > > found that the new product was not there. In fact, nothing had changed
> > > at all. It lists:
>
> > > Categories
> > > Configurable Products
> > > Custom Products
> > > Custom text fields
> > > Discounts
> > > Downloadable Products
> > > Option Groups
> > > Option Items
> > > Product variations
> > > Products
> > > Subscription Products
> > > Tax Classes
>
> > > This problem occurs whether or not I load my custom product. No matter
> > > what I select in settings for products, the product module always
> > > contains that entire list. So it's completely ignoring whatever I set
> > > in /admin/settings. I was expecting it to change.
>
> > > I suspect these two problems are related. Did I stumble upon a bug, in
> > > that the following are ignored:
>
> > > settings.py>
> > > 'CUSTOM_PRODUCT_MODULES' : ['mystore.MyNewProduct',],
>
> > > MyNewProduct/config.py>
> > > PRODUCT_TYPES.add_choice(('mystore.MyNewProduct::MyNewProduct', _('My
> > > New Product')))
>
> > > Or is there a probable error that I have made?
>
> > > Thanks in advance
--~--~---------~--~----~------------~-------~--~----~
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