Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

text "undefined" under product image

product images

18 replies to this topic

#1 KomplikatedOne

  • Community Member
  • 28 posts
  • Real Name:kieren brown

Posted 05 September 2011, 11:45

hello all

started using oscommerce a few weeks back, getting on really well with it and the forums are really useful so far when i have encountered a problem.
but i am stuck with an issue, and cannot find any refrerence to it elsewhere on the net.

Basically on one of the 2 sites i am in process of building i get the words : "undefined" under the main product image, but only when I add more than 1 image.
(product_info.php)
i suspect the reason is that different code is used when more than 1 image present.
Strangely despite the text all images display fine, the lightbox etc all work correctly.
i thought it was at first due to fact images were not in the default directory, but even if i do save them to the /images/ folder i get same issue.

the line of text acts as a hyperlink to the image, not sure if that is useful?

ive compard the data being entered against the products and the images between the site, and they appear to be the same
the only difference i can see between the 2 sites is that the one i have the problem on runs in the root domain folder
whereas the other site runs from the /catalog/ folder

anyone else encountered this? or able to tell me why i am getting this line of text under my image
ive attached a screen shot of what i am getting

many thanks

k

Attached Files



#2 lildog

  • Community Member
  • 608 posts
  • Real Name:Todd
  • Gender:Male
  • Location:Sunny Florida

Posted 05 September 2011, 14:42

I am currently trying to solve this problem also. I have narrowed my problem to jQuery. I updated my jQuery and get this issue. I took a stock osc 2.3.1 site and only changed the jquery include line from:
<script type="text/javascript" src="ext/jquery/jquery-1.4.2.min.js"></script>
to:
<script type="text/javascript" src="ext/jquery/jquery-1.6.2.min.js"></script>

I have not found the solution yet. I assume it may be the same for you.

Todd

Edited by lildog, 05 September 2011, 14:43.


#3 KomplikatedOne

  • Community Member
  • 28 posts
  • Real Name:kieren brown

Posted 05 September 2011, 15:10

ah i reckon thats it
i did upgrade on jquery in an attempt to resolve a different issue with the theme colour scheme (it turned out not to be a version issue)

might see if i can change back to 1.4.2, not a long term solution, but hopefully will get my by for now

thanks

#4 KomplikatedOne

  • Community Member
  • 28 posts
  • Real Name:kieren brown

Posted 05 September 2011, 15:18

i thought i would just do a quick check to make sure there wasnt also a newer version of the bxgalleryor fancybox plugins, as i didnt upgrade those at same time as ui
but it appears 1.1 and 1.3.4 are the current versions

#5 KomplikatedOne

  • Community Member
  • 28 posts
  • Real Name:kieren brown

Posted 05 September 2011, 15:24

i can confirm setting the line in template_top.php back to
<script type="text/javascript" src="ext/jquery/jquery-1.4.2.min.js"></script>

will stop the error, (assuming the file still exists) when i have more time ill have to take a look at in more detail

#6 lildog

  • Community Member
  • 608 posts
  • Real Name:Todd
  • Gender:Male
  • Location:Sunny Florida

Posted 05 September 2011, 15:29

At least we have it narrowed down. Unfortunately I do not want to go back to 1.4.2 because I still want to use theme roller for my themes. I will also look into it. I will see if upgrading fancy box helps...

Todd

#7 lildog

  • Community Member
  • 608 posts
  • Real Name:Todd
  • Gender:Male
  • Location:Sunny Florida

Posted 05 September 2011, 15:54

Oops...it looks like you already determined we have the latest versions of fancybox and bxGallery.

#8 lildog

  • Community Member
  • 608 posts
  • Real Name:Todd
  • Gender:Male
  • Location:Sunny Florida

Posted 05 September 2011, 16:04

Here is a solution. It works, I don't however know if it is correct. Replaced all "attr(" with "prop(" in jquery.bxGallery.1.1.min.js file.

Todd

#9 multimixer

  • Community Sponsor
  • 3,595 posts
  • Real Name:George Zarkadas
  • Gender:Male
  • Location:Greece

Posted 05 September 2011, 16:08

This issue is related to bx gallery. What you get on the screen is a <div class="caption"> and as content the word "undefined"

Following happens:

1) File ext/jquery/begallery/jquery.bxGallery.1.1.min.js is checking if the image has a title or not, like this
function set_main_img(){$orig.find('img').each(function(){var $this=$(this);var $imgheight=$this.height();var $imgwidth=$this.width();if($this.attr('title')!=''){caption=$this.attr('title');$this.parent().append('<div class="caption">'+caption+'</div>');}
If image has a title it should be displayed as the image caption
2) File product_info.php, does not provide a title for the image
		  $pi_entry .= '" target="_blank" rel="fancybox">' . tep_image(DIR_WS_IMAGES . $pi['image']) . '</a>';
3) In the jQuery site we can read that

Quote

As of jQuery 1.6, the .attr() method returns undefined for attributes that have not been set. In addition, .attr() should not be used on plain objects, arrays, the window, or the document. To retrieve and change DOM properties, use the .prop() method.

That is why in version 1.4 the condition of bx gallery work, but in 162 not anymore

What to do? 2 options:
1) Update file product_info.php to get a title for the image
2) Update bx gallery script to use an other condition format (fix on github)

Edited by multimixer, 05 September 2011, 16:12.

Looking for a way to create your own osCommerce template ? click

#10 lildog

  • Community Member
  • 608 posts
  • Real Name:Todd
  • Gender:Male
  • Location:Sunny Florida

Posted 05 September 2011, 16:11

And here is an updated version of bxGallery for those who do not want to edit it themselves. Credit to acidVertigo.

#11 acidvertigo

  • Community Member
  • 140 posts
  • Real Name:Luca
  • Gender:Male
  • Location:Roma

Posted 06 September 2011, 09:29

View Postlildog, on 05 September 2011, 16:11, said:

And here is an updated version of bxGallery for those who do not want to edit it themselves. Credit to acidVertigo.

Thank you for the credit :)

#12 KomplikatedOne

  • Community Member
  • 28 posts
  • Real Name:kieren brown

Posted 06 September 2011, 10:05

great work guys [img]http://forums.oscommerce.com//public/style_emoticons/default/thumbsup.gif[/img]
thank you very much

#13 lildog

  • Community Member
  • 608 posts
  • Real Name:Todd
  • Gender:Male
  • Location:Sunny Florida

Posted 06 September 2011, 18:48

You are very welcome acidVertigo, thank you for the fix.

I would also like to thank multiMixer and komolikatedOne, I did search for the solution to this problem but working with them helped narrow the search down and find the answer.

Great work everyone...the power of many outweighs the power of one.

#14 adelgado

  • Community Member
  • 19 posts
  • Real Name:Antonio Delgado

Posted 11 November 2011, 15:35

Thank you ALL!

Being a newbie at all this, it was my first attempt at changing code - and following your instructions, SUCCESS!

Time to open the bubbly.....LOL

#15 pdise

  • Community Member
  • 2 posts
  • Real Name:Rob
  • Gender:Male
  • Location:Heerde, the netherlands

Posted 15 November 2011, 09:42

Whow!! thank you!! you are great! :D

#16 adam smith

  • Community Member
  • 6 posts
  • Real Name:adam smith

Posted 16 November 2011, 19:16

At least we have it narrowed down. Unfortunately I do not want to go back to 1.4.2 because I still want to use theme roller for my themes. I will also look into it. I will see if upgrading fancy box helps...

#17 sydjeii

  • Community Member
  • 91 posts
  • Real Name:cj losaria
  • Gender:Female

Posted 01 February 2012, 16:53

hello..I tried the solution given by acidvertigo and the "undefined" text was removed successfully.. However it gave me another problem. The large image and the other extra images appear in their actual sizes. So if I have 4 extra images of 500x500px they all appear as is. Please help. :)

thanks in advance.
-=PINOY AKO=-

#18 AlexandrZuyev

  • Community Member
  • 13 posts

Posted 30 April 2012, 18:42

in Firefox and IE everything is fine but in Google Chome the "underfined" word is still exist and no small images. Pease does anybody have got a sollution?

#19 anam_funny

  • Community Member
  • 32 posts
  • Real Name:Anam Aggarwal

Posted 13 May 2012, 05:03

Thank you soo much... it worked...