Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

text "undefined" under product image


KomplikatedOne

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

Link to comment
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

Link to comment
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

Link to comment
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

Link to comment
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)

Link to comment
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.

Link to comment
Share on other sites

  • 2 months later...
  • 2 months later...

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

Link to comment
Share on other sites

  • 2 months later...
  • 2 weeks later...

Archived

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

×
×
  • Create New...