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

Added ability to modify product Image method by extension. #490

Merged
merged 1 commit into from Apr 29, 2016
Merged

Added ability to modify product Image method by extension. #490

merged 1 commit into from Apr 29, 2016

Conversation

ghost
Copy link

@ghost ghost commented Apr 28, 2016

No description provided.

@markguinn
Copy link

What's the use-case for this? (not saying it's not necessary, just wanting to understand it)

@ghost
Copy link
Author

ghost commented Apr 28, 2016

In my case the customer want to show more than one image per product. So I had to create a many_many relation for images. To make the first image appear in the cart, checkout etc. I had to override this method and return Product->Images->First() from the extensions updateImage. It may be bad practise?

@bummzack
Copy link
Collaborator

I think this should be solvable via templates? Eg. by using $Images.First or $Images.Sort('SortOrder').First in your templates. Or have you tried that already?

@ghost
Copy link
Author

ghost commented Apr 29, 2016

Yes, agree, but somehow I can't get it to work and i don't figure why. Created a gist to show how I done things (With the CustomProduct_Extension active it works off course):
https://gist.github.com/hpeide/ef62e676a9a7dcef76f106f684c2bda2

There is also numerus templates to edit to adjust the thumbnail, is it a idea to seperate the thumb into an own template? Eg. CartThumbnail for Cart and SideCart, and Order_Thumbnail for OrderAdmin_Content_ItemLine, Order_Content_ItemLine and Order_ItemLine.

@bummzack bummzack merged commit 048a2b3 into silvershop:master Apr 29, 2016
@bummzack
Copy link
Collaborator

I agree that it's cumbersome to create custom templates to just modify the Image.
Not sure if stripping them out into include templates is a good solution… (if we go further down the road with this approach we end up with separate templates for pretty much every HTML tag). But maybe we could identify some common blocks that would be worthwhile as a separate template?

I'm going to merge this into master for now until there's a better solution.
@hpeide it would be great if you could look into the templates… or at least add some information to the extension hooks readme (docs/en/02_Customisation/Hooks.md)

@ghost ghost deleted the master branch May 1, 2016 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants