News:

Looking for documentation? Take a look on our wiki

Main Menu

problem with loading second image of product in category VM 2.6.6

Started by skhn123, July 12, 2014, 11:23:23 AM

Previous topic - Next topic

skhn123

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]

skhn123


GJC Web Design

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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

skhn123

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.

GJC Web Design

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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

skhn123

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.

GJC Web Design

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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

skhn123

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".

skhn123

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.