1 Answer
1

Your question is quite unclear, however I try to help you if I can with the following:

After two hours, I started to understand what your question means. :) That you want to use the Jooomla article intro image as the product main image. Now I got that. It’s confusing first since J2Store has it’s own pretty good image handling part. The developer deliberately developed their own image handling in J2Store in the new version (J2Store 3).

So if you go to Content - J2Store plugin and set the option display image in list view or in item view to no, then J2store will use the article intro image of the article automatically. You do not have to use any coding for that.

So as in the comment it got finally clear that the question was about the J2Store Product display module and now I have a little time to check and test this, here is how you can get and use the article intro image as main image in that module and use that in the display:

You have to just insert these line on the top of the module default_image.php file which you give above (insert it after defined('_JEXEC') or die; line):

What these few lines do is getting the product source ID which is actually the Joomla article id too and then get the article intro image path from the database (via using JTable). And then defines the main product image as article intro image.

Thus, if you set in the module settings the option to show main images then the module will display the article intro images.

This is the solution for the articles inside But I want to display the product module
– niaziblogJan 16 '19 at 19:48

@niaziblog - Ohh, you want to display the article intro image in the product module. Now I understand it better.
– ZollieJan 16 '19 at 20:09

@niaziblog - Just a bit better... Where do you want to display the module? Would it be a normal Joomla module with few product' info in it or how would it look like? Maybe an image about what exactly you would want to see, could explain your need and purpose even better. That's the only way to have anybody help you. $item->images and so on are not defined globally, so that way you cannot just access these variables anywhere within Joomla.
– ZollieJan 16 '19 at 20:29