Hi!

I'm a complete newbie and I need some help.

I have this piece of code which is opening link in new window:


<script type="text/javascript">//<![CDATA[
document.write('<a href="javascript:void window.open(\'<?php echo $product_flypage ?>\');">');
document.write( '<?php echo ps_product::image_tag( $product_thumb_image, 'class="browseProductImage" target="_self" border="0" title="'.$product_name.'" alt="'.$product_name .'"' ) ?></a>' );
//]]>
</script>

How to change this code so link would open in the same window?
Probably I should change this part: javascript:void window.open

Thanks for your help!

Rather than using the window.open() function, use the URL passed in the function as the value of the HREF attribute of the ANCHOR element.

document.write('<a href="<?php echo $product_flypage ?>">');

assuming that the echo part writes out the URL.

Use this code:

<script type="text/javascript">//<![CDATA[
document.write('<a href="<?php echo $product_flypage ?>">');
document.write( '<?php echo ps_product::image_tag( $product_thumb_image, 'class="browseProductImage" target="_self" border="0" title="'.$product_name.'" alt="'.$product_name .'"' ) ?></a>' );
//]]>
</script>