lightspeedretail / webstore

Web Store eCommerce solution for Lightspeed
http://www.lightspeedpos.com/webstore
Open Software License 3.0
85 stars 63 forks source link

Product::getImages() has an inconsistent return type #570

Closed Dragony closed 10 years ago

Dragony commented 10 years ago

Hello!

When running Product::getImages() on a product with uploaded images the function returns an Array of images. Ex:

array(
    array(
        'image': 'image_1.png'
    ),
    array(
        'image': 'image_2.png'
    )
)

But when a product does not have any images, it returns the "no_product.png" image as a single result. Ex:

array(
    'image': 'no_product.png'
),

This behavior is inconsistent. When a product does not have any images it should return a list of 1 images like so:

array(
    array(
        'image': 'no_product.png'
    )
)

Because in the end I don't care what kind of image i am given. I will use it like any other image on my website. That is what placeholder images are for.

Best Regards Mattias

ktwbc commented 10 years ago

As of 3.0.6, use $model->ProductPhotos which is the new feature that will return everything consistently. getImages() has been deprecated. (getImages returned differently for one image vs multiple because the photo viewer at the time handled individual and mutliple differently. With the introduction of CloudZoom in 3.0.6 we created a new function to avoid breaking backwards compatibility.)

Dragony commented 10 years ago

Thanks for your fast reply :)

It would be great if things like this would be documented in the code.