Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to Make a link open a new page?


Guest

Recommended Posts

Posted

Hi

 

I have modified the product listing code to include a new field in the product_descriptions table which holds an url to a file on my site. It works fine but instead of opening the file in a new window (blank) it opens it in my cart window which is left blank. I am very confused with how to do this as I have only been involved in PHP for a short while, I would be grateful if someone could point me in the right direction. Here is the added code, added to product_listing.php in the modules folder:

 

case 'PRODUCT_LIST_M3U':

$lc_align = 'center';

$lc_text = '<a href="' . tep_href_link(FILENAME_REDIRECT,'action=url&goto=' . urlencode($listing_values['products_m3u']), 'NONSSL', true, false) . '">' . tep_image_button('button_listen.gif', 'Listen to ' . $listing_values['products_name'] . ' now') . '</a> ';

break;

 

Thanks

Andy

Posted
$lc_text = '<a href="' . tep_href_link(FILENAME_REDIRECT,'action=url&goto=' . urlencode($listing_values['products_m3u']), 'NONSSL', true, false) . '" target="_blank">' . tep_image_button('button_listen.gif', 'Listen to ' . $listing_values['products_name'] . ' now') . '</a> ';

Posted

Thanks for your quick response Linda

 

This works great, however not quite how I expected. The file which is being opened is an m3u file (mp3 playlist). What happens with this method is that a browser window opens and then closes as the mp3 player takes over.

 

I modified some code on product_info.php to open the same file:

 

<td class="main"><a href="<?php echo tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info_values['products_m3u']), 'NONSSL', true, false); ?>"><?php echo tep_image_button('button_listen.gif', IMAGE_BUTTON_LISTEN); ?></a></td>

 

This was based on the product url and this doesn't open a window, it just goes straight to the mp3 player. Have you any idea why?

 

thanks again for your help and your great contributions!

 

Andy

Posted

Afraid I have not fooled with playing files etc. like you are trying to do.

 

You might try openning a second file that opens a new window that has maybe an introductory text to the music and the play button in it so that the music plays but does not close the wrong window.

Posted

I've solved it and I thought I would post the solution in case you (Linda) or anyone else is interested. It is simply a case of replacing _blank with _parent and that works a treat! Thanks for the right direction Linda

 

Andy

Archived

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

×
×
  • Create New...