cyanoxide Posted July 9, 2018 Share Posted July 9, 2018 So I'm currently using the image caption to get images to display in certain places on the product page. For example if I give the image a caption of "slider" it will only display in the slider on the page and this works well and allows me to display dynamic content without building extensive modules. My problem however is that if the site is set to a different language the images break because the caption changes to whatever it is listed as in that language. One solution to this problem is to manually go through each image for each product and make sure all the captions are the same but we currently have over 200 products with 5 languages and 6 images which would mean an insane amount of work to get this set up. Alternatively I could resolve this with a SQL query that takes the English caption and makes all the other languages use that value for their captions. However this solution will rely on our 30+ team all remembering to name each of their images in all languages going forward which I can guarantee will be forgotten at some point and it will be very difficult for us to monitor this. This leads me to believe that I need to find a way to get the English language to display in the $images variable so I can use that rather than the translated version or at least something along these lines. Any guidance regarding this would be greatly appreciated or if you have an alternative suggestion I'd love to hear it. Link to comment Share on other sites More sharing options...
cyanoxide Posted July 9, 2018 Author Share Posted July 9, 2018 I ended up solving the issue by adjusting my productController.php file. On approximately line 375 I changed the following code: $images = $this->product->getImages((int)$this->context->cookie->id_lang); to $images = $this->product->getImages(1); I did this because the original was using id_lang to get the current language and then using that to pull the array based on that however I know that the language I want to force has an id of "1" so I just entered that and now all my images only use the English captions regardless of what is typed in the other fields. I doubt it but if anyone else plans on doing the same they will need to check the ids of there languages and ensure they use the number associated with the language they wish to enforce as it may not be "1" like in my situation. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now