Jump to content

Archived

This topic is now archived and is closed to further replies.

KomplikatedOne

text "undefined" under product image

Recommended Posts

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

post-296846-0-36510400-1315222985_thumb.jpg

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

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)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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=-

Share this post


Link to post
Share on other sites

×