Making the Product Variations Manager paged didn't appear to help, at least
in my case.

I think it's because the real cause for large database queries is the
get_subtypes method call of the Product model. That call looks through every
Product and tries to access related ConfigurableProduct, Product Variation,
Gift Certificate or any other product sub type and if it doesn't fail it
adds the subtype model to the list of subtypes. So even if you're just
trying to get a list of Products with Configurable Product subtype, the way
the Product Variations Manager does, you get to make the Django ORM look at
every single product subtype instance times the number of product subtypes
you have.

At this point I'm still mulling over how to make Product.get_subtypes() more
efficient. But if you just want to make the Product Variations Manager view
load way faster you can replace the following:

products = [p for p in Product.objects.all() if "ConfigurableProduct" in
p.get_subtypes()]

with:

products = Product.objects.filter(configurableproduct__in =
ConfigurableProduct.objects.all())

We went from ~17,000 database queries to ~400.

On Mon, Mar 22, 2010 at 7:54 AM, Bruce Kroeze <[email protected]> wrote:

> Yes, the Product Variations Manager page tries to load all details of all
> Configurable Products.  I wrote it, and it really isn't ready for quite that
> big a set.
>
> You could take a stab at making it paged, I'd love to see that
> functionality.
>
> On Sun, Mar 21, 2010 at 9:17 AM, Aleksandr Vladimirskiy <
> [email protected]> wrote:
>
>> i think i'm facing a similar problem. we have only about 5,000 products.
>> almost all are configurable products. i've been looking through the code and
>> through the posts here, and as far as i can tell there're a lot of places
>> where having many configurable products results in very large database
>> queries. in our case accessing the products variation manager with our 5000
>> products results in about 17,000 database queries.
>>
>> the only solution i've seen suggested on the list is to use custom
>> products in this case. at this point i don't think that this will work for
>> us so i'm hoping to improve things while continuing to use configurable
>> products.
>>
>> i'm thinking of omitting from the admin if possible the individual product
>> variations pages that have the javascript powered lists of options and
>> trying to optimize the product variations manager page and the queries
>> associated with it. but i've not implemented this, so not entirely sure this
>> will work.
>>
>> On Tue, Mar 16, 2010 at 11:21 AM, Stuart Laughlin 
>> <[email protected]>wrote:
>>
>>> Hello All --
>>>
>>> When I'm in satchmo admin and trying to change an existing Product
>>> Variation or Configurable Product, my browser freezes up and I get a
>>> "Warning: Unresponsive script" dialog.
>>>
>>> I have tracked down the cause of this, and it relates to the
>>> js_make_select_readonly template tag that is being used in
>>> "admin/product/change_form.html". The js output by this template tag
>>> loops through all the children of the passed-in html select searching
>>> for the currently selected item. This works fine in most cases, but it
>>> is too inefficient when your select has 20,000+ items in it, as my
>>> Product select does. (As an aside, I wonder how many folks out there
>>> are using satchmo with a product catalog of this magnitude?)
>>>
>>> Anyway, my quick fix is to simply remove the call to the
>>> js_make_select_readonly template tag in the
>>> "admin/product/change_form.html" template. This makes the product
>>> admin slightly less foolproof, but I can live with that for now.
>>>
>>> I will probably try to improve the js_make_select_readonly templatetag
>>> at some point -- making it more efficient so that it can handle
>>> selects w/ lots of items -- and if that happens I'll be sure to submit
>>> a patch. In the mean time, should I submit a ticket or anything like
>>> that? Or does anyone have any comments/thoughts?
>>>
>>>
>>> Regards,
>>>
>>> --Stuart
>>>
>>> --
>>>
>>> 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.
>>>
>>>
>>
>>
>> --
>> Aleksandr Vladimirskiy
>>
>>  --
>> 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.
>>
>
>
>
> --
> Bruce Kroeze
> http://www.ecomsmith.com
> It's time to hammer your site into shape.
>
> --
> 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.
>



-- 
Aleksandr Vladimirskiy

-- 
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