Skip to content
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

Allow getGallery to use different Isotope Galleries #2461

Merged
merged 5 commits into from
Sep 12, 2023
Merged

Allow getGallery to use different Isotope Galleries #2461

merged 5 commits into from
Sep 12, 2023

Conversation

bright-cloud-studio
Copy link
Contributor

We have a Product Reader page where we have multiple galleries being displayed. We wanted the ability to pick a different Isotope Gallery (Store configuration > Galleries) so I've added to getGallery a second parameter which is null by default but can be the ID of which gallery you want. Below that, if the ID is detected it replaces the current on inside $arrConfig.

I've tested this and it works perfectly. Feel free to change to any style you'd like, but for a three line change this adds very helpful functionality.

We have a Product Reader page where we have multiple galleries being displayed. We wanted the ability to pick a different Isotope Gallery (Store configuration > Galleries) so I've added to getGallery a second parameter which is null by default but can be the ID of which gallery you want. Below that, if the ID is detected it replaces the current on inside $arrConfig.

I've tested this and it works perfectly. Feel free to change to any style you'd like, but for a three line change this adds very helpful functionality.
@aschempp aschempp added this to the 2.9.0 milestone Jun 16, 2023
Copy link
Member

@aschempp aschempp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please adjust the coding style. Also, will this work with the $currentGallery cache?

@bright-cloud-studio
Copy link
Contributor Author

I always tend to add iso to variable names when I am customizing something with Isotope but that doesn't make sense if I'm trying to add to the actual project. I've changed to the naming convention you suggested.

I can't say I am entirely sure what $currentGallery cache is, but we have been using this change on two different sites for a week or two now with no noticable issues.

@aschempp
Copy link
Member

I can't say I am entirely sure what $currentGallery cache is, but we have been using this change on two different sites for a week or two now with no noticable issues.

I think this would only be a problem if you would try to use two different galleries on the same attribute in the same product (e.g. for the main image and for thumbnails). I'll look into this after merging the PR 😊

@bright-cloud-studio
Copy link
Contributor Author

So, another developer here was using my modification here and ran into the issue you predicted. This does not work when using the same image attribute for generateMainImage and generateGallery. Any suggestions on where to look next to adjust this? It looks like the getGallery function is called in ProductCollection.php in the addToTemplate function. Does that sound right?

@aschempp
Copy link
Member

I guess the easiest fix would be to remove the $currentGallery cache… or improve the cache to better handle configs.

@aschempp aschempp changed the base branch from 2.8 to 2.9 September 12, 2023 23:13
@aschempp aschempp merged commit a4a5778 into isotope:2.9 Sep 12, 2023
@bright-cloud-studio
Copy link
Contributor Author

I know in the grand scheme of things this is basically nothing, but I've never contributed to a piece of software I've used before. Pretty darn cool if you ask me.

@aschempp
Copy link
Member

Open Source FTW! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants