-
-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$this->getGallery() on multiple attributes in template yields unintended results. #1512
Comments
Hello Andreas, hello blairwinans, I have a bug within my cart that looks like it has something to do with this issue - but before I post a new issue I want to clarify if that might be the same issue. I've added 7 different products to the cart. Product 1 has a configurable text therefore it is not the exact same product but of same type. All products are rendered when <td class="col_<?php echo $i++; ?> col_first image"><?php echo $this->getGallery('images', $item['item'])->generateMainImage(); ?></td><?php endif; ?> is called within iso_collection_default.html5. (like it is in the original template
In my product cart all products are listed: product 1 text a now for the images of the corresponding products: product 1 - image of product 1 The only solution to remove this issue is (at least what I now tried) to comment/remove
And as I debugged through the source code - it seems as if $arrGalleries is somehow mixed up externally and therefore not working. Because once product 1 needs to be displayed after product 5 was rendered the value of product 1 within that $arrGalleries cache for instance in $arrGalleries['product1_images'] is what you expect should be $arrGalleries['product5_images'] Is that the same issue or is it a new one? Kind regards |
yeah, I guess that's the same issue… |
Fixed in 8253a4d |
This may simply be a variation on #1511, but I consider it a bug, or at the very least "strange behavior" :)
Say you have two Attributes on a product,
images
andspecial_images
.And you call them in your template in different orders, like so:
The problem lies in L55 of
Model\Gallery:: createForProductAttribute()
as well as L594 ofProduct\Standard::generate()
.When you call getGallery on the second attribute, you are resetting the files in the Gallery model in the registry, which does not get reset again since you are passing the same model back in
return $arrGalleries[$strAttribute]
.I know that a lot of the reason you did what you did was for performance reasons, and the easiest workaround on my end is to simply call
Model\Gallery:: createForProductAttribute()
in the template again or just simply change the order of the output, but the behavior is odd and could trip up others....Maybe at least documenting the behavior might be all that is needed.
The text was updated successfully, but these errors were encountered: