Product picture taken from Magento is not the expected one

Bug #1258418 reported by Stefaan Ferket
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenERP Connector - Magento
Fix Released
Low
Guewen Baconnier @ Camptocamp

Bug Description

In Magento product we can define multiple pictures per product.
For every picture we can define at least these settings:
- Sort Order
- Base Image

A product can have only 1 base image.

OpenERP seems to take the image with the lowest sort order number.
We would expect OpenERP to take the picture that is marked as "Base Image"

We use module magentoerpconnect

Related branches

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Hello,

Which revision of the Magento connector do you use?

Normally, the image with the 'base' type should be used first.

It should take the 'base' image first, then sort them by position, as seen in the test case below (images are .pop()'ed from the list, so the order goes from right to left). When one of the image can't be read (404 for instance), the next image will be imported.

    def test_image_priority(self):
        """ Check if the images are sorted in the correct priority """
        env = mock.Mock()
        importer = CatalogImageImporter(env)
        file1 = {'file': 'file1', 'types': ['base'], 'position': '10'}
        file2 = {'file': 'file2', 'types': ['thumbnail'], 'position': '3'}
        file3 = {'file': 'file3', 'types': ['thumbnail'], 'position': '4'}
        file4 = {'file': 'file4', 'types': [], 'position': '10'}
        images = [file2, file1, file4, file3]
        self.assertEquals(importer._sort_images(images),
                          [file4, file3, file2, file1])

affects: openerp-connector → openerp-connector-magento
Revision history for this message
Stefaan Ferket (s-ferket) wrote :

Hi,

We just tested wit this revision:
revno: 935
branch-nick: openerp-connector-magento

We still see the same problem.

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Thanks.

Can you call the XML/RPC API and give me the result of the method "product_media.list" on a product with this problem please?

Revision history for this message
Stefaan Ferket (s-ferket) wrote :

[
{'url': 'http://example.com/media/catalog/product/a/f/afmetingen_picture.jpg',
'label': 'Afmetingen picture',
'file': '/a/f/afmetingen_picture.jpg',
'position': '2'
, 'exclude': '0'
, 'types': []}

, {'url': 'http://example.com/media/catalog/product/0/1/verschil_picture.jpg'
, 'label': 'Verschil picture'
, 'file': '/0/1/verschil_picture.jpg'
, 'position': '3'
, 'exclude': '0'
, 'types': ['image']}

, {'url': 'http://example.com/media/catalog/product/0/1/standard_picture.jpg'
, 'label': 'Standard_picture'
, 'file': '/0/1/standard_picture.jpg'
, 'position': '4'
, 'exclude': '1'
, 'types': []}]

It seems that 'types': ['image'] is the image we are after. This one has the checkbox "Base Image" set.

I should have mentioned we use Magento 1.4.1.1.

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Oh nice, thanks for the data. Looks like we are expecting 'base' while it should be 'image'.
According to the doc [0], that's still "image".

[0] http://www.magentocommerce.com/api/soap/catalog/catalogProductAttributeMedia/catalog_product_attribute_media.types.html

Changed in openerp-connector-magento:
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

I proposed a patch here: https://code.launchpad.net/~camptocamp/openerp-connector-magento/7.0-image-1258418-gbr/+merge/199537

Would you test and give me your result on the merge proposal?

Thanks!

Changed in openerp-connector-magento:
assignee: nobody → Guewen Baconnier @ Camptocamp (gbaconnier-c2c)
Changed in openerp-connector-magento:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.