Cartridge Product Images don't appear on category page

172 views
Skip to first unread message

Dave Bauer

unread,
Aug 21, 2012, 3:03:12 PM8/21/12
to mezzani...@googlegroups.com
When I import products with product_db.py or upload an image to the product admin page the thumbnail does not appear on the category listing page.
It appears that shop_product.image is not filled in the database causing the template to ignore the image. It works on the product detail and in the admin pages I can see the thumbnail.


Stephen McDonald

unread,
Aug 21, 2012, 4:48:22 PM8/21/12
to mezzani...@googlegroups.com
The product_db command literally hasn't been touched for years and is likely out of date.

All of the data management that needs to occur around setting products up correctly is generally laid out in in the product's admin class:


You can see various calls are made:

copy_default_variation (stores defaults on the product): https://github.com/stephenmcd/cartridge/blob/master/cartridge/shop/admin.py#L228 

set_default_image appears to be needed to called twice.

At a glance, product_db replicates this here, but the steps aren't the same:


So please have a play around with those lines in product_db and see if you can get it to behave the same as the product's admin class - it might just need an extra call or two. If you get it to work, please submit the fix back.



On Wed, Aug 22, 2012 at 5:03 AM, Dave Bauer <dave....@gmail.com> wrote:
When I import products with product_db.py or upload an image to the product admin page the thumbnail does not appear on the category listing page.
It appears that shop_product.image is not filled in the database causing the template to ignore the image. It works on the product detail and in the admin pages I can see the thumbnail.





--
Stephen McDonald
http://jupo.org

Dave Bauer

unread,
Aug 21, 2012, 4:50:52 PM8/21/12
to mezzani...@googlegroups.com
On Tue, Aug 21, 2012 at 4:48 PM, Stephen McDonald <st...@jupo.org> wrote:
> The product_db command literally hasn't been touched for years and is likely
> out of date.
>
> All of the data management that needs to occur around setting products up
> correctly is generally laid out in in the product's admin class:
>
> https://github.com/stephenmcd/cartridge/blob/master/cartridge/shop/admin.py#L199-228
>
> You can see various calls are made:
>
> create_from_options (creates variations):
> https://github.com/stephenmcd/cartridge/blob/master/cartridge/shop/admin.py#L210
> manage_empty (sets default variation):
> https://github.com/stephenmcd/cartridge/blob/master/cartridge/shop/admin.py#L212
> set_default_image (sets default image):
> https://github.com/stephenmcd/cartridge/blob/master/cartridge/shop/admin.py#L216
> copy_default_variation (stores defaults on the product):
> https://github.com/stephenmcd/cartridge/blob/master/cartridge/shop/admin.py#L228
>
> set_default_image appears to be needed to called twice.
>
> At a glance, product_db replicates this here, but the steps aren't the same:
>
> https://github.com/stephenmcd/cartridge/blob/master/cartridge/shop/management/commands/product_db.py#L176-177
>
> So please have a play around with those lines in product_db and see if you
> can get it to behave the same as the product's admin class - it might just
> need an extra call or two. If you get it to work, please submit the fix
> back.
>

Thanks! I'll let you know what I find.

Dave

>
>
> On Wed, Aug 22, 2012 at 5:03 AM, Dave Bauer <dave....@gmail.com> wrote:
>>
>> When I import products with product_db.py or upload an image to the
>> product admin page the thumbnail does not appear on the category listing
>> page.
>> It appears that shop_product.image is not filled in the database causing
>> the template to ignore the image. It works on the product detail and in the
>> admin pages I can see the thumbnail.
>>
>>
>
>
>
> --
> Stephen McDonald
> http://jupo.org



--
Dave Bauer
da...@solutiongrove.com
http://www.solutiongrove.com

Stephen McDonald

unread,
Aug 21, 2012, 4:53:23 PM8/21/12
to mezzani...@googlegroups.com
Thanks Dave. I'd take a look at it but the product_db command was contributed by someone else and I've never used it. You're probably more familiar with it than I am at this point :-)

Sam Kingston

unread,
Feb 23, 2013, 10:14:31 PM2/23/13
to mezzani...@googlegroups.com, st...@jupo.org
On Wednesday, 22 August 2012 06:53:23 UTC+10, Stephen McDonald wrote:
> So please have a play around with those lines in product_db and see if you
> can get it to behave the same as the product's admin class - it might just
> need an extra call or two. If you get it to work, please submit the fix
> back.

Patch attached that fixes this issue (though not sure about the deleted_images part..).

Sam 
set_default_images.patch

Stephen McDonald

unread,
Feb 23, 2013, 10:20:27 PM2/23/13
to mezzani...@googlegroups.com
Thanks Sam! Added here:


Sam 

--
You received this message because you are subscribed to the Google Groups "Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-use...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply all
Reply to author
Forward
0 new messages