Changing main image path

  • Posts: 7
  • Thank you received: 0
10 years 9 months ago #180168

-- HikaShop version -- : 2.2.3
-- Joomla version -- : 3.3.1

Hi, first of all i'de like to thank you for the great effort you put on providing us a great e-commerce management plugin, with a lot of options and potencialities.
I had a problem during the last weeks concerning the images that the system loads on the product page, as I could see from the code both the thumbnail images and main images are loaded from the same root/file: /media/com_hikashop/upload/thumbnails/430x430/xxxxxxxxxxxxx.jpg , while the image loaded in the pop-up window (via onclick function) is loaded from a different one: onclick="return window.localPage.openImage('hikashop_main_image');" href="/media/com_hikashop/upload/xxxxxxxxxxxxx.jpg". I'd need to have the same source file loaded through the onclick function used as the main image file so that i will be able to manage the thumb files and the main image file singularly. Is it possibile to modify the php files in order to let the system do that? It should be somewhere in show_block_image.php or image.php. i suppose :D

thank you so much!! :blush:

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 9 months ago #180172

Hi,

Yes you indeed have to edit the view "product / show_block_img" and replace:

echo $this->popup->image($html, $img->origin_url, null, $attr);
By:
echo $this->popup->image($html, $img->url, null, $attr);

Please Log in or Create an account to join the conversation.

  • Posts: 7
  • Thank you received: 0
10 years 9 months ago #180301

Hi, I tried to replace the code but the result was uncorrect :unsure: :

this was the original code:

<a onclick="return window.localPage.openImage('hikashop_main_image');" href="/media/com_hikashop/upload/splin_boots_ref_0159_010_49784865.jpg" rel="{handler:'image'}" target="_blank"><img id="hikashop_main_image" class="JMProductImgMain" style="vertical-align:middle" title="Splin Boots Green" alt="Splin Boots Green" src="/media/com_hikashop/upload/thumbnails/600x600/splin_boots_ref_0159_014_1.jpg" width="600" height="600"></a>

replacing the php code i now have the value of "href" after onclick function just alike the "src" one :
<a onclick="return window.localPage.openImage('hikashop_main_image');" href="/media/com_hikashop/upload/thumbnails/600x600/splin_boots_ref_0159_010_49784865.jpg" rel="{handler:'image'}" target="_blank"><img id="hikashop_main_image" class="JMProductImgMain" style="vertical-align:middle" title="Splin Boots Blue" alt="Splin Boots Blue" src="/media/com_hikashop/upload/thumbnails/600x600/splin_boots_ref_0159_0111.jpg" width="600" height="600"></a>

What i'd need to do is the opposite thing: the result should be something like the one below, where the image loaded in the path of the main preview is the original file in place of the thumbnail one (found in 600x600 folder), letting the system use the 600x600 image only for the thumbnails on the right:
<a onclick="return window.localPage.openImage('hikashop_main_image');" href="/media/com_hikashop/upload/splin_boots_ref_0159_010_49784865.jpg" rel="{handler:'image'}" target="_blank"><img id="hikashop_main_image" class="JMProductImgMain" style="vertical-align:middle" title="Splin Boots Blue" alt="Splin Boots Blue" src="/media/com_hikashop/upload/splin_boots_ref_0159_010_49784865.jpg" width="600" height="600"></a>

is it possible?

thank you so much :cheer:

Please Log in or Create an account to join the conversation.

  • Posts: 84304
  • Thank you received: 13698
  • MODERATOR
10 years 9 months ago #180399

In that case, then instead of the previous code change, you want to change:

$html = '<img id="hikashop_main_image'.$variant_name.'" style="margin-top:10px;margin-bottom:10px;display:inline-block;vertical-align:middle" title="'.$this->escape(@$image->file_description).'" alt="'.$this->escape(@$image->file_name).'" src="'.$img->url.'"/>';
by:
$html = '<img id="hikashop_main_image'.$variant_name.'" style="margin-top:10px;margin-bottom:10px;display:inline-block;vertical-align:middle" title="'.$this->escape(@$image->file_description).'" alt="'.$this->escape(@$image->file_name).'" src="'.$img->origin_url.'"/>';

The following user(s) said Thank You: Jarkheld

Please Log in or Create an account to join the conversation.

  • Posts: 7
  • Thank you received: 0
10 years 9 months ago #180596

thank you so so much :D it works perfectly!!!

I've got just one small issue to solve: is there any way to let the system show the thumbnail even if there is only one image referring the product?

thanks :blush:

Please Log in or Create an account to join the conversation.

  • Posts: 84304
  • Thank you received: 13698
  • MODERATOR
10 years 9 months ago #180601

Remove the code:

&& count($this->element->images) > 1

from that view and that should do it.

Please Log in or Create an account to join the conversation.

Time to create page: 0.060 seconds
Powered by Kunena Forum