cc,

If you save ProductAttributes to a Product via the admin, you access them
via:

product.productattribute_set.all()

Read that page Chris pointed out.

If I'm not mistaken, the workflow is like this:

You add AttributeOption objects via admin->product->attribute options. Then,
when creating a product, you add ProductAttribute objects to that product
via the inlines. This is done via a select that shows the AttributeOptions
that are saved, you select one, optionally giving it a language code, and a
value for display.

If you're only adding some additional custom fields to a product, this is
the recommended way of doing it.

Creating custom product modules/models should only be done in cases where
you are actually creating some very special product types that are not
easily expressed via Satchmo's existing product models, and generally only
because you have some pretty complex functionality to add to the store that
is somehow dependent on those custom models.

I went the route of custom product models for our last Satchmo store because
our client had some very complex pricing and access logic, as well as a lot
of interconnection between product types and product-to-product
relationships that were affected by non-product factors. But if, like in the
example shown in the documentation Chris pointed you to, you just want to
add some custom descriptors, save yourself a lot of headache and code
maintenance and just use the product attributes that are already available
to you.

Best,

Bob

On Mon, Dec 21, 2009 at 10:36 AM, cc <[email protected]> wrote:

> Chris, do you know if I would be able to query for these attributes
> directly using QuerySets?  I will have to think through my use case to
> see if I have the need, but I'm not sure how it would be possible
> given the Product Attributes implementation.
>
> If I can't and I do need to be able to query these extra attributes,
> what method would you recommend?  Custom Product Modules or
> Inheritance?
>
> On Dec 21, 9:10 am, Chris Moffitt <[email protected]> wrote:
> > If you are developing on trunk, you may want to take a look at using
> Custom
> > Product Attributes -
> http://www.satchmoproject.com/docs/svn/product-attributes.html
> >
> > These are meant to be simple data fields that you attach to your models
> to
> > store additional information. The nice thing is that you can write custom
> > validations for them if you need to. It's meant to be used in cases like
> > this where you only need one or two additional pieces of info on a
> product.
> >
> > -Chris
> >
> > On Mon, Dec 21, 2009 at 12:15 AM, cc <[email protected]> wrote:
> > > Hello, I have a use-case where I need to add fields to most (if not
> > > all) of my products.  I came across Custom Product Modules in the docs
> > > and I was able to register the type and see it in the admin.
> >
> > > It seems to be what I'm looking for but I have a feeling that since my
> > > fields are a simple extension to the vanilla Product type, wouldn't it
> > > be much easier to just inherit from Product so I can instantiate
> > > MyProduct directly and access Product's fields directly?  Not sure if
> > > these "Custom Product Modules" were added before django 1.1 to provide
> > > this functionality or not, but it seems model inheritance is much
> > > better.
> >
> > > Also, when using MyProduct, I wasn't able to access the 'product'
> > > member as it didn't exist right after instantiating (and before
> > > saving).  I'm not even sure how to programmatically add products using
> > > MyProduct.
> >
> > > Also tried: p = new Product()
> > > p.site = current site
> > > p.name = 'test'
> > > p.save()
> >
> > > and I still couldn't access p.myproduct.  Got the exception
> > > DoesNotExist...
> >
> > > Any help is appreciated.
> >
> > > Thanks
> >
> > > --
> >
> > > 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]<satchmo-users%[email protected]>
> <satchmo-users%[email protected]<satchmo-users%[email protected]>
> >
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/satchmo-users?hl=en.
>
> --
>
> 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]<satchmo-users%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/satchmo-users?hl=en.
>
>
>

--

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