I add custom php code in gallery.phtml to call attribute about product, but i don't know how to put this code inside image.

enter image description here


It would help to see the code you are using in the edited gallery.phtml, but if i understand you correctly, this is just a styles issue. You have a div that is used to display a custom block of content and now you want that block to sit on top of the product image. What you need to do is make sure that your custom div is nested as a child element of the element you want it to overlap, set the custom div to style="position: absolute;" and then make sure that the parent element is set to style="position: relative;".

There may be a chance that your element is not in the right place though (placement in M2 is much more complex then it might seem on it's surface), and in that case, you might end up being better off placing your div in your xml files.

| improve this answer | |
  • OK I will do that, but is any option to modify image gallery to automatic add text to image ? – Ajtimstoj Mar 22 '17 at 7:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.