VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: skhn123 on July 12, 2014, 11:23:23 AM

Title: problem with loading second image of product in category VM 2.6.6
Post by: skhn123 on July 12, 2014, 11:23:23 AM
Hello Member

I was using VM 2.0.26D then i upgrade it to 2.6.6 and everything is working fine except some of my override stop working.
I wrote this code in category layout.
<a title="<?php echo $product->product_name ?>" rel="vm-additional-images" href="<?php echo $product->link?>">
<?php echo $product->images[0]->displayMediaThumb('class="browseProductImage"'false); ?>
                        <?php if($product->images[1]) {
echo $product->images[1]->displayMediaThumb('class="browseProductImage flip"'false);
} ?>

</a>

to display first and second image of product in category page. eg when user hover over product image it change to second image. (See Attached Image). but after update its not working. I changed the code from VM 2.6.6 view folder to current template html folder and did the necessary changes but still its not working.

[attachment cleanup by admin]
Title: Re: problem with loading second image of product in category VM 2.6.6
Post by: skhn123 on July 14, 2014, 08:11:22 AM
Its been two days and no-reply.

please help me anyone.
Title: Re: problem with loading second image of product in category VM 2.6.6
Post by: GJC Web Design on July 14, 2014, 10:58:24 AM
there is no such thing as a 'flip' attribute in std VM - you must have been using some bespoke JS to do this or an extension

sth VM 2.6.6 behaviour with Fancybox is you click on the thumb to change the main image

if you change the code in the components/com_virtuemart/views/productdetails/tmpl/default_images.php line 33

from

jQuery(".additional-images img.product-image").click(function() {

to
jQuery(".additional-images img.product-image").hover(function() {

you get the hover effect
Title: Re: problem with loading second image of product in category VM 2.6.6
Post by: skhn123 on July 14, 2014, 11:14:49 AM
Hey GJC Web Design
thanks for noticing my post.
But flip is an extra class which i add to use some custom css on it and i am working in category layout not in product details. see my post again.

Thanks.
Title: Re: problem with loading second image of product in category VM 2.6.6
Post by: GJC Web Design on July 14, 2014, 11:27:35 AM
Quotethere is no such thing as a 'flip' attribute in std VM - you must have been using some bespoke JS to do this or an extension
Title: Re: problem with loading second image of product in category VM 2.6.6
Post by: skhn123 on July 14, 2014, 12:12:39 PM
i am getting this notice when i enable the VM debugging.

Notice: Undefined offset: 1 in C:\htdocs\XYZ\templates\Templatename\html\com_virtuemart\category\default.php

so i changed the number "1" with "0" in my code:
I change this
<?php if($product->images[1])
to this
<?php if($product->images[0])
and this code
echo $product->images[1]->displayMediaThumb('class="browseProductImage flip"', false);
to this
echo $product->images[0]->displayMediaThumb('class="browseProductImage flip"', false);

and it display first (main) image of product twice.
now does anyone now about this notice and how to fix this.
Title: Re: problem with loading second image of product in category VM 2.6.6
Post by: GJC Web Design on July 14, 2014, 22:44:25 PM
I think you need to read up a bit on php objects and arrays  - you can't just stick any number you feel like in the offset brackets!

1. if your showing php notices your error reporting is far too high for a production site

2. to remove it just stick a @ sign in front

e.g.  if(@$product->images[1])

better to turn down your reporting
Title: Re: problem with loading second image of product in category VM 2.6.6
Post by: skhn123 on July 15, 2014, 10:42:00 AM
I know that but in ($product->images[1]) & $product->images[1], 1 refer to first image of additional images of a product.
we have already discussed it earlier in one of my previous post. see this. http://forum.virtuemart.net/index.php?topic=124126.msg424262#msg424262

my code is okey its just not working with VM 2.6.6 where it is working with 2.0.26D.
see the live demo on : www.shot.com.co
go to any category and put mouse over product image it will load the second image with class "flip".
Title: Re: problem with loading second image of product in category VM 2.6.6
Post by: skhn123 on July 15, 2014, 10:59:19 AM
Hey GJC
I have fixed it with help of this article. http://forum.virtuemart.net/index.php?topic=99699.msg358962#msg358962
i cant believe that i missed this part.  :(

but anyway thanks for your time.