Jump to content

Modification of the prestashop zoom function


need4speed

Recommended Posts

I gave a quick try with same effect but not with default jqzoom.
It is different jquery plugin cloud zoom see first and third example.
But it doesn't work good when choosing attribute form drop-down box.

If you want to try I could write instructions and it doesn't need much code change.

Link to comment
Share on other sites

OK here are steps you need to do, but before make backup of files you are changing.

First download latest version of cloud zoom then unpack(unzip) file. You will see two js files and one css file.

Copy cloud-zoom.1.0.2.min.js to your js/jquery folder and open header.tpl in your theme folder.
Add following line next to rest of script calls.

<script type="text/javascript" src="{$content_dir}js/jquery/cloud-zoom.1.0.2.min.js"></script>



Then copy code from cloud-zoom.css to end of your theme global.css.

Next step is to change code in product.tpl also in your theme folder.

Find

        <!-- product img-->
       <div id="image-block">
       {if $have_image}
               <img src="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large')}" {if $jqZoomEnabled}class="jqzoom" alt="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'thickbox')}"{else} title="{$product->name|escape:'htmlall':'UTF-8'}" alt="{$product->name|escape:'htmlall':'UTF-8'}" {/if} id="bigpic"/>
       {else}
           <img src="{$img_prod_dir}{$lang_iso}-default-large.jpg" alt="" title="{$product->name|escape:'htmlall':'UTF-8'}" />
       {/if}
       </div>



and replace it with

        <!-- product img-->
       <div id="image-block">
       {if $have_image}
           {if $jqZoomEnabled}<a id="zoom1" rel="position: 'inside' , showTitle: false, adjustX:-4, adjustY:-4" class="cloud-zoom" href="{$link->getImageLink($product->link_rewrite, $cover.id_image,'thickbox')}" style="position: relative; display: block;">

           <img alt="{$product->name|escape:'htmlall':'UTF-8'}" title="{$product->name|escape:'htmlall':'UTF-8'}" src="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large')}" style="display: block;">

           </a>
           {else}
                   <img src="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large')}" id="bigpic"/>
           {/if}
       {else}
           <img src="{$img_prod_dir}{$lang_iso}-default-large.jpg" alt="" title="{$product->name|escape:'htmlall':'UTF-8'}" />
       {/if}
       </div> 


Next step is to enable change of big image when thumbnail is clicked (this is different from default - hover).
Change this code

        <div id="thumbs_list">
           <ul style="width: {math equation="width * nbImages" width=80 nbImages=$images|@count}px" id="thumbs_list_frame">
               {foreach from=$images item=image name=thumbnails}
               {assign var=imageIds value=`$product->id`-`$image.id_image`}
               <li id="thumbnail_{$image.id_image}">
                   <a href="{$link->getImageLink($product->link_rewrite, $imageIds, 'thickbox')}" rel="other-views" class="thickbox {if $smarty.foreach.thumbnails.first}shown{/if}" title="{$image.legend|htmlspecialchars}">
                       <img id="thumb_{$image.id_image}" src="{$link->getImageLink($product->link_rewrite, $imageIds, 'medium')}" alt="{$image.legend|htmlspecialchars}" height="{$mediumSize.height}" width="{$mediumSize.width}" />
                   </a>
               </li>
               {/foreach}
           </ul>
       </div>



to

        {if $jqZoomEnabled}                
       <div id="thumbs_list">
           <ul  id="thumbs_list_frame">
               {foreach from=$images item=image name=thumbnails}
               {assign var=imageIds value=`$product->id`-`$image.id_image`}
               <li id="thumbnail_{$image.id_image}">
                                <a href="{$link->getImageLink($product->link_rewrite, $imageIds, 'thickbox')}" class="cloud-zoom-gallery" title="{$image.legend|htmlspecialchars}"
                           rel="useZoom: 'zoom1', smallImage: '{$link->getImageLink($product->link_rewrite, $imageIds, 'large')}'">
                       <img src="{$link->getImageLink($product->link_rewrite, $imageIds, 'medium')}" alt="{$image.legend|htmlspecialchars}"/></a>

               </li>                
               {/foreach}
           </ul>
       </div>

       {else}
       <div id="thumbs_list">
           <ul style="width: {math equation="width * nbImages" width=80 nbImages=$images|@count}px" id="thumbs_list_frame">
               {foreach from=$images item=image name=thumbnails}
               {assign var=imageIds value=`$product->id`-`$image.id_image`}
               <li id="thumbnail_{$image.id_image}">
                   <a href="{$link->getImageLink($product->link_rewrite, $imageIds, 'thickbox')}" rel="other-views" class="thickbox {if $smarty.foreach.thumbnails.first}shown{/if}" title="{$image.legend|htmlspecialchars}">
                       <img id="thumb_{$image.id_image}" src="{$link->getImageLink($product->link_rewrite, $imageIds, 'medium')}" alt="{$image.legend|htmlspecialchars}" height="{$mediumSize.height}" width="{$mediumSize.width}" />
                   </a>
               </li>
               {/foreach}
           </ul>
       </div>
{/if}



That is it.
Almost forgot - you need to enable jqzoom in Back Office >> Preferences >> Products to make this work.

If you have any trouble with code let me know.

  • Like 2
Link to comment
Share on other sites

Hi Razaro,

After I changed the code of product.tpl,

1. the product picture becomes huge.
2. the 'in the same category' tab moved to above the big product picture.
3. the short product description moved below the product picuture. It was originally to the right of the image ( I downloaded the product.tpl file from one of your last post to make jqzoom work and then my product page becomes out of order).

Can you kindly help to check the code of my product.tpl and see what is wrong? Thanks in advance.

Clauf

<!-- left infos-->

<!-- usefull links-->



{if $HOOK_EXTRA_LEFT}{$HOOK_EXTRA_LEFT}{/if}
     


<!-- product img-->




<!-- thumbnails -->

{if count($images) > 3}{l s='Previous'}{/if}
{if $jqZoomEnabled}


{else}

{/if}

{if count($images) > 3}{l s='Next'}{/if}


<!-- right infos-->

34458_s9QeKTtAmhDfmyXQu6gh_t

Link to comment
Share on other sites

Hi
I copied some of my custom code so it have wide as image size wich is wrong.
I updated previous post but you can just change wide to large in two places.

If you still have some problems sent me PM or post her your website link (or attach product.tpl as zip file )
and I will check it.

Link to comment
Share on other sites

  • 1 month later...

you have to edit rel attribute and use option from cloud zoom website

     {if $jqZoomEnabled}<a id="zoom1" rel="position: 'inside' , showTitle: false, adjustX:-4, adjustY:-4" class="cloud-zoom"



This code is in product.tpl, for big image.

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
  • 4 weeks later...
  • 2 weeks later...

this seem to generate a 404 loading problem. It isnt showing on the site, but it shows when debuggen the site with safari debuggen tools.

It must be some Javascript interfearing with it.

When i comment out: getImageLink($product->link_rewrite, $cover.id_image,'thickbox')}" style="position: relative; display: block;"> it 404 disapearts, but offcouse the zoom allso fails.

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...
  • 2 months later...

Hello

After researching I found the type of zoom I need here.

I want to integrate it in a module like the sexylightbox or directly in the product.tpl to have the effect fancybox with the zoom but i need some help to do this.

thx

Link to comment
Share on other sites

  • 5 weeks later...

In this case, the script generates a lot of 404 errors because of the presence of cloud-zoom.1.0.2.min.js file references to "."

If someone does not want 404 errors should be changed file cloud-zoom.1.0.2.min.js:

<div class='mousetrap' style='background-image:url(\".\")

to:

<div class='mousetrap' style='background-image:url(\"/img/empty.png\")

and upload a file empty.png to a folder /img.

post-62760-0-59913300-1315332529.png

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

Hello,

 

I would like to know if anyone have made the integration in PS 1.4.4.1 of Cloud Zoom effect.

See up, CrystalPhoenix question.

 

And also, I'm interesting to use Fine Zoom effect like Hulk said in his post, because it's a very good and simple zoom style.

And it seems to be very light too:

If anyone know how to use it, I'm very interesting.

 

Thanks in Advance

 

La Coliflor

Link to comment
Share on other sites

  • 2 months later...

you have to edit rel attribute and use option from cloud zoom website

	 {if $jqZoomEnabled}<a id="zoom1" rel="position: 'inside' , showTitle: false, adjustX:-4, adjustY:-4" class="cloud-zoom"

This code is in product.tpl, for big image.

 

Hello,

 

I have made changes to my site as per the instructions. But now while viewing product image though cloud zoom product image gets zoomed but at right hand site still the original small product image appears. Please find image for referance. Can anyone tell me solution on it?? You can check my site to get idea what I means to say.

 

Thanks

post-136345-0-99860300-1324136953_thumb.jpg

Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...

Hi,

 

Can anyone know how to use TINT effect for cloud zoom?

 

Please suggest.

 

Thanks

 

 

 

 

 

OK here are steps you need to do, but before make backup of files you are changing.

 

First download latest version of cloud zoom then unpack(unzip) file. You will see two js files and one css file.

 

Copy cloud-zoom.1.0.2.min.js to your js/jquery folder and open header.tpl in your theme folder.

Add following line next to rest of script calls.

<script type="text/javascript" src="{$content_dir}js/jquery/cloud-zoom.1.0.2.min.js"></script>

 

Then copy code from cloud-zoom.css to end of your theme global.css.

 

Next step is to change code in product.tpl also in your theme folder.

 

Find

		<!-- product img-->
	<div id="image-block">
	{if $have_image}
			<img src="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large')}" {if $jqZoomEnabled}class="jqzoom" alt="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'thickbox')}"{else} title="{$product->name|escape:'htmlall':'UTF-8'}" alt="{$product->name|escape:'htmlall':'UTF-8'}" {/if} id="bigpic"/>
	{else}
		<img src="{$img_prod_dir}{$lang_iso}-default-large.jpg" alt="" title="{$product->name|escape:'htmlall':'UTF-8'}" />
	{/if}
	</div>

 

and replace it with

		<!-- product img-->
	<div id="image-block">
	{if $have_image}
		{if $jqZoomEnabled}<a id="zoom1" rel="position: 'inside' , showTitle: false, adjustX:-4, adjustY:-4" class="cloud-zoom" href="{$link->getImageLink($product->link_rewrite, $cover.id_image,'thickbox')}" style="position: relative; display: block;">

		<img alt="{$product->name|escape:'htmlall':'UTF-8'}" title="{$product->name|escape:'htmlall':'UTF-8'}" src="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large')}" style="display: block;">

		</a>
		{else}
				<img src="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large')}" id="bigpic"/>
		{/if}
	{else}
		<img src="{$img_prod_dir}{$lang_iso}-default-large.jpg" alt="" title="{$product->name|escape:'htmlall':'UTF-8'}" />
	{/if}
	</div> 

Next step is to enable change of big image when thumbnail is clicked (this is different from default - hover).

Change this code

		<div id="thumbs_list">
		<ul style="width: {math equation="width * nbImages" width=80 nbImages=$images|@count}px" id="thumbs_list_frame">
			{foreach from=$images item=image name=thumbnails}
			{assign var=imageIds value=`$product->id`-`$image.id_image`}
			<li id="thumbnail_{$image.id_image}">
				<a href="{$link->getImageLink($product->link_rewrite, $imageIds, 'thickbox')}" rel="other-views" class="thickbox {if $smarty.foreach.thumbnails.first}shown{/if}" title="{$image.legend|htmlspecialchars}">
					<img id="thumb_{$image.id_image}" src="{$link->getImageLink($product->link_rewrite, $imageIds, 'medium')}" alt="{$image.legend|htmlspecialchars}" height="{$mediumSize.height}" width="{$mediumSize.width}" />
				</a>
			</li>
			{/foreach}
		</ul>
	</div>

 

to

		{if $jqZoomEnabled}				
	<div id="thumbs_list">
		<ul  id="thumbs_list_frame">
			{foreach from=$images item=image name=thumbnails}
			{assign var=imageIds value=`$product->id`-`$image.id_image`}
			<li id="thumbnail_{$image.id_image}">
							 <a href="{$link->getImageLink($product->link_rewrite, $imageIds, 'thickbox')}" class="cloud-zoom-gallery" title="{$image.legend|htmlspecialchars}"
						rel="useZoom: 'zoom1', smallImage: '{$link->getImageLink($product->link_rewrite, $imageIds, 'large')}'">
					<img src="{$link->getImageLink($product->link_rewrite, $imageIds, 'medium')}" alt="{$image.legend|htmlspecialchars}"/></a>

			</li>				
			{/foreach}
		</ul>
	</div>

	{else}
	<div id="thumbs_list">
		<ul style="width: {math equation="width * nbImages" width=80 nbImages=$images|@count}px" id="thumbs_list_frame">
			{foreach from=$images item=image name=thumbnails}
			{assign var=imageIds value=`$product->id`-`$image.id_image`}
			<li id="thumbnail_{$image.id_image}">
				<a href="{$link->getImageLink($product->link_rewrite, $imageIds, 'thickbox')}" rel="other-views" class="thickbox {if $smarty.foreach.thumbnails.first}shown{/if}" title="{$image.legend|htmlspecialchars}">
					<img id="thumb_{$image.id_image}" src="{$link->getImageLink($product->link_rewrite, $imageIds, 'medium')}" alt="{$image.legend|htmlspecialchars}" height="{$mediumSize.height}" width="{$mediumSize.width}" />
				</a>
			</li>
			{/foreach}
		</ul>
	</div>
{/if}

 

That is it.

Almost forgot - you need to enable jqzoom in Back Office >> Preferences >> Products to make this work.

 

If you have any trouble with code let me know.

Link to comment
Share on other sites

  • 1 month later...

After adding this code

 

              {if $jqZoomEnabled}                             
               <div id="thumbs_list">
                       <ul  id="thumbs_list_frame">
                               {foreach from=$images item=image name=thumbnails}
                               {assign var=imageIds value=`$product->id`-`$image.id_image`}
                               <li id="thumbnail_{$image.id_image}">
                                                                <a href="{$link->getImageLink($product->link_rewrite, $imageIds, 'thickbox')}" class="cloud-zoom-gallery" title="{$image.legend|htmlspecialchars}"
                                                       rel="useZoom: 'zoom1', smallImage: '{$link->getImageLink($product->link_rewrite, $imageIds, 'large')}'">
                                               <img src="{$link->getImageLink($product->link_rewrite, $imageIds, 'medium')}" alt="{$image.legend|htmlspecialchars}"/></a>

                               </li>                           
                               {/foreach}
                       </ul>
               </div>

               {else}
               <div id="thumbs_list">
                       <ul style="width: {math equation="width * nbImages" width=80 nbImages=$images|@count}px" id="thumbs_list_frame">
                               {foreach from=$images item=image name=thumbnails}
                               {assign var=imageIds value=`$product->id`-`$image.id_image`}
                               <li id="thumbnail_{$image.id_image}">
                                       <a href="{$link->getImageLink($product->link_rewrite, $imageIds, 'thickbox')}" rel="other-views" class="thickbox {if $smarty.foreach.thumbnails.first}shown{/if}" title="{$image.legend|htmlspecialchars}">
                                               <img id="thumb_{$image.id_image}" src="{$link->getImageLink($product->link_rewrite, $imageIds, 'medium')}" alt="{$image.legend|htmlspecialchars}" height="{$mediumSize.height}" width="{$mediumSize.width}" />
                                       </a>
                               </li>
                               {/foreach}
                       </ul>
               </div>
{/if}

 

i get blank product page. Anybody know how to fix it ?

Link to comment
Share on other sites

  • 2 months later...

OK here are steps you need to do, but before make backup of files you are changing.

 

First download latest version of cloud zoom then unpack(unzip) file. You will see two js files and one css file.

 

Copy cloud-zoom.1.0.2.min.js to your js/jquery folder and open header.tpl in your theme folder.

Add following line next to rest of script calls.

<script type="text/javascript" src="{$content_dir}js/jquery/cloud-zoom.1.0.2.min.js"></script>

 

Then copy code from cloud-zoom.css to end of your theme global.css.

 

Next step is to change code in product.tpl also in your theme folder.

 

Find

		<!-- product img-->
	<div id="image-block">
	{if $have_image}
			<img src="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large')}" {if $jqZoomEnabled}class="jqzoom" alt="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'thickbox')}"{else} title="{$product->name|escape:'htmlall':'UTF-8'}" alt="{$product->name|escape:'htmlall':'UTF-8'}" {/if} id="bigpic"/>
	{else}
		<img src="{$img_prod_dir}{$lang_iso}-default-large.jpg" alt="" title="{$product->name|escape:'htmlall':'UTF-8'}" />
	{/if}
	</div>

 

and replace it with

		<!-- product img-->
	<div id="image-block">
	{if $have_image}
		{if $jqZoomEnabled}<a id="zoom1" rel="position: 'inside' , showTitle: false, adjustX:-4, adjustY:-4" class="cloud-zoom" href="{$link->getImageLink($product->link_rewrite, $cover.id_image,'thickbox')}" style="position: relative; display: block;">

		<img alt="{$product->name|escape:'htmlall':'UTF-8'}" title="{$product->name|escape:'htmlall':'UTF-8'}" src="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large')}" style="display: block;">

		</a>
		{else}
				<img src="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large')}" id="bigpic"/>
		{/if}
	{else}
		<img src="{$img_prod_dir}{$lang_iso}-default-large.jpg" alt="" title="{$product->name|escape:'htmlall':'UTF-8'}" />
	{/if}
	</div> 

Next step is to enable change of big image when thumbnail is clicked (this is different from default - hover).

Change this code

		<div id="thumbs_list">
		<ul style="width: {math equation="width * nbImages" width=80 nbImages=$images|@count}px" id="thumbs_list_frame">
			{foreach from=$images item=image name=thumbnails}
			{assign var=imageIds value=`$product->id`-`$image.id_image`}
			<li id="thumbnail_{$image.id_image}">
				<a href="{$link->getImageLink($product->link_rewrite, $imageIds, 'thickbox')}" rel="other-views" class="thickbox {if $smarty.foreach.thumbnails.first}shown{/if}" title="{$image.legend|htmlspecialchars}">
					<img id="thumb_{$image.id_image}" src="{$link->getImageLink($product->link_rewrite, $imageIds, 'medium')}" alt="{$image.legend|htmlspecialchars}" height="{$mediumSize.height}" width="{$mediumSize.width}" />
				</a>
			</li>
			{/foreach}
		</ul>
	</div>

 

to

		{if $jqZoomEnabled}				
	<div id="thumbs_list">
		<ul  id="thumbs_list_frame">
			{foreach from=$images item=image name=thumbnails}
			{assign var=imageIds value=`$product->id`-`$image.id_image`}
			<li id="thumbnail_{$image.id_image}">
							 <a href="{$link->getImageLink($product->link_rewrite, $imageIds, 'thickbox')}" class="cloud-zoom-gallery" title="{$image.legend|htmlspecialchars}"
						rel="useZoom: 'zoom1', smallImage: '{$link->getImageLink($product->link_rewrite, $imageIds, 'large')}'">
					<img src="{$link->getImageLink($product->link_rewrite, $imageIds, 'medium')}" alt="{$image.legend|htmlspecialchars}"/></a>

			</li>				
			{/foreach}
		</ul>
	</div>

	{else}
	<div id="thumbs_list">
		<ul style="width: {math equation="width * nbImages" width=80 nbImages=$images|@count}px" id="thumbs_list_frame">
			{foreach from=$images item=image name=thumbnails}
			{assign var=imageIds value=`$product->id`-`$image.id_image`}
			<li id="thumbnail_{$image.id_image}">
				<a href="{$link->getImageLink($product->link_rewrite, $imageIds, 'thickbox')}" rel="other-views" class="thickbox {if $smarty.foreach.thumbnails.first}shown{/if}" title="{$image.legend|htmlspecialchars}">
					<img id="thumb_{$image.id_image}" src="{$link->getImageLink($product->link_rewrite, $imageIds, 'medium')}" alt="{$image.legend|htmlspecialchars}" height="{$mediumSize.height}" width="{$mediumSize.width}" />
				</a>
			</li>
			{/foreach}
		</ul>
	</div>
{/if}

 

That is it.

Almost forgot - you need to enable jqzoom in Back Office >> Preferences >> Products to make this work.

 

If you have any trouble with code let me know.

Hi Prestashop Addict!

I 've enable jqzoom, and zoom function is allright (600 x 600 pixel) when I rollover the mouse on the left image area, but a pitty! The left image (300 x 300 pixel) is missing, when I click on the missing image, I will find 404 Not Found page (http://bajuditoko.com/img/p/27-68-large.jpg). Do you have any idea to help me? I use prestashop 1.4.1 version and send an attachment of the screenshoot.

 

 

Zoom%2520gagal_bajuditoko.jpg

Link to comment
Share on other sites

  • 2 weeks later...

Hello,

 

I am experiencing the same problem as szyms is facing, but without using this code I can get the default jqzoom effect. Now theres only one problem it will be great if anybody can help me to solve it.

 

on the product page exactly below the product image we see the small product variations thumbnails and if we move cursor over those thumbnails we see the big image in the product image box but unfortunately this is not happening in this case.

 

can anybody please help me to solve this problem?

Link to comment
Share on other sites

  • 2 months later...
  • 6 months later...
  • 1 month later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...