Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Can a product link to an external site (ie: cafepress.com)?


Guest

Recommended Posts

maxidvd

 

i took the code

<?php 

  if (isset($cPath) && tep_not_null($cPath)) { 

   if ( $cPath == '1_6' )  {  // Change 1_6 To Your Categories cPath Number 

?> 

   <SCRIPT LANGUAGE="JavaScript"> 

   window.open("http://www.maxidvd.com.au","height=200,width=200,left=80,top=80,scrollbars=yes"); // New Window to New Site 

   onClick=window.location=('<?php echo tep_href_link(FILENAME_DEFAULT);?>') // Redirect background to Homepage (With SID Intact) 

   </SCRIPT> 

<?php 

 } 

} 

?>

 

put it into my catalog/index.php file. nothing showed up anywhere.

my question is, from looking at that code, that is just going to open the window on it's own correct? if so, i'd like to have this code working when clicking a link. i tried doing what this post said:

http://www.oscommerce.com/forums/viewtopic.php?t=38047

 

but whenever i did that i got a parse error on the page holding the ahref code, error listed the ahref line containing the error. i'm on snapshot 9-5-2003 if that helps.

Link to comment
Share on other sites

Oh well thats different, your question does not really relate to this topic, yes the code aboce is specific for using oscommerce categories to open links..

 

anyway this is what you need..

 

<a href="#" onclick="javascript: window.open('http://www.oscommerce.com/forums/viewtopic.php?t=38047', '','width=500,height=140,left=10,top=10,scrollbars=no');return false;">Click for My New Window</a>

 

And that my friend can be paced anywhere you would like it to appear.

 

Cheers MaxiDVD.

Link to comment
Share on other sites

maxi: prior to my coming to the osc software i was using the

 

<a href="#" onclick="window.open('bg.html','detail','width=700,height=420')">

       HERE</a>

 

to open the windows i wanted.

 

when i got on osc i reverted from that format cause i was getting parse errors. i assumed it was from the # sign being used. i just tried the code you posted

 

 

Parse error: parse error in /home/murderth/public_html/distro/includes/languages/english/releases.php on line 38

 

whole center page is black, with "TEXT_INFORMATION" displayed

 

makes me think the # is causing it. is this true? i'm looking at the code used for the larger image click option, it does not have a # in it.

 

<script language="javascript"><!--

document.write('<?php echo '<a href="javascript:popupWindow('' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');

//--></script>

 

how could i edit this to look like the code you posted? or am i just dumb?

Link to comment
Share on other sites

No "#" it does not affect it, I have just tried this with my store, I can only assume that your code placement is causing this problem,,

 

FYI: this code is a combination of "Javascript and HTML" it is not PHP coding in anyway, so what you need to check when placing this code is that you Do-Not place it inside <?php - ?> Tags:

 

?>   // Make Sure its placed after a Closing Tag



<a href="#" onclick="javascript: window.open('http://www.oscommerce.com/forums/viewtopic.php?t=38047', '','width=500,height=140,left=10,top=10,scrollbars=no');return false;">Click for My New Window</a>



// And Placed Before an Opening Tag

<?php

 

If for some reason you are wanting to place this code within "<?php - PHP Tags - ?>", it would need to be written like this:

 

. '<a href="#" onclick="javascript: window.open('http://www.oscommerce.com/forums/viewtopic.php?t=38047', '','width=500,height=140,left=10,top=10,scrollbars=no');return false;">Click for My New Window</a>' .

 

the beggining .' then the end '. need to placed correctly or this will cause parse erroes too.

 

If you still cant get it to work, paste up a code snippet for me to look at where you placing it, If your getting Parse Errors it mean you trying to place the code directly into php coding.

 

 

 

Cheers MaxiDVD

Link to comment
Share on other sites

maxidvd: you are correct it looks like i was trying to place it in open php tags. so i used the 2nd set of code you posted... still parsed.

 

the page i created, was done so in the same manner as the privacy link of osc. catalog/privacy & catalog/includes/language/english/provacy.php with the exception mine is for music releases. releases.php

 

here's my page.

 

<?php

/*

 $Id: releases.php,v 1.4 2002/11/19 01:48:08 dgw_ Exp $



 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com



 Copyright (c) 2002 osCommerce



 Released under the GNU General Public License

*/



define('NAVBAR_TITLE', 'RELEASES');



define('TEXT_INFORMATION', '

<center>

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#993300" width="100%" id="AutoNumber1" height="100%" bgcolor="#000000">

 <tr>

   <td width="100%" height="1" bgcolor="#993300" class="infoBoxHeading">   

   Releases</td>

 </tr>

 <tr>

   <td width="100%" height="100%" class="infoboxcontents" align="center"><br>

   <p><a name="present"><b><font face="Courier" size="4">!! AVAILABLE NOW !!</font></b></a></p>

   <a name="present">

   <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="80%" height="180" bordercolor="#333333" bgcolor="#000000">

     <tr>

       <td height="164" width="35%" align="center">

       <img border="0" src="http://www.murdertheworld.net/images/small.jpg" width="150" height="150"></td>

       <td height="135" width="65%" align="left" valign="top"><b>

       <font color="#CC0000" face="Verdana" size="2">MTW002</font></b><font face="Verdana" size="2"><br>

       </font><font size="2" color="#999999" face="Verdana"><i>Foetopsy  7" 

       EP "Bizarre Gynecology"</i> </font>

       <p><font size="2" color="#333333" face="Verdana">Picking up from where the 

       MCD left...  sicker.... faster.....</font></p>

       <p></p>

       <p><font face="Verdana" size="2"><font color="#333333">Full release details

       </font>Pop open window link would be here</font><br>

       </p>

       </b></td>

     </tr>

   </table>

   <p></td>

 </tr>

</table><br>

');

?>

 

right now it's still using html for all the text, this i will be changing to stylesheet. you should able to see where i'm trying to get this link to work. i appreciate your help and patients.

Link to comment
Share on other sites

This works,

 

I didnt realize you where puting this into a /language file. (all language files are enclosed in php tags from top to bottom..)

 

So-

 

define('TEXT_INFORMATION' '<-- INFO IN HERE any Single Quotes like this --> ' <-- need to be back slashed --> <-- like this --> ' <-- else it breaks the php, see here is the final one -->' );

 

<?php

/*

 $Id: releases.php,v 1.4 2002/11/19 01:48:08 dgw_ Exp $



 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com



 Copyright (c) 2002 osCommerce



 Released under the GNU General Public License

*/



define('NAVBAR_TITLE', 'RELEASES');



define('TEXT_INFORMATION', '<center>

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#993300" width="100%" id="AutoNumber1" height="100%" bgcolor="#000000">

 <tr>

   <td width="100%" height="1" bgcolor="#993300" class="infoBoxHeading">  

   Releases</td>

 </tr>

 <tr>

   <td width="100%" height="100%" class="infoboxcontents" align="center"><br>

   <p><a name="present"><b><font face="Courier" size="4">!! AVAILABLE NOW !!</font></b></a></p>

   <a name="present">

   <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="80%" height="180" bordercolor="#333333" bgcolor="#000000">

     <tr>

       <td height="164" width="35%" align="center">

       <img border="0" src="http://www.murdertheworld.net/images/small.jpg" width="150" height="150"></td>

       <td height="135" width="65%" align="left" valign="top"><b>

       <font color="#CC0000" face="Verdana" size="2">MTW002</font></b><font face="Verdana" size="2"><br>

       </font><font size="2" color="#999999" face="Verdana"><i>Foetopsy  7"

       EP "Bizarre Gynecology"</i> </font>

       <p><font size="2" color="#333333" face="Verdana">Picking up from where the

       MCD left...  sicker.... faster.....</font></p>

       <p></p>

       <p><font face="Verdana" size="2"><font color="#333333">Full release details





       <a href="#" onclick="javascript: window.open('http://www.oscommerce.com/forums/viewtopic.php?t=38047', '','width=500,height=140,left=10,top=10,scrollbars=no');return false;">Pop open window link would be here</a>





       </font></font><br>

       </p>

       </b></td>

     </tr>

   </table>

   <p></td>

 </tr>

</table><br>');

?>

 

do you use a Text Editor or a PHP Editor? a decent PHP editor has different colours for text, php, html, javascript - make life easy the work-out if theres a drama,, like all the info inbetween the single quotes in a define, should be one colour (php colour) if I put a random single quote anywhere in the middle of the define, the information following after the double quote changes to a different colour meaning the php has a break in it somewhere and needs to fixed.. php is very unforgiving.

 

Winsyntax (PHP/Text/Code Editor) is great and very simple, and FULLY FREE from http://www.download.com

 

Cheers

 

Cheers MaxiDVD

Link to comment
Share on other sites

maxi: hey the code worked perfectly. i did not know the backslash ' details. now that i know, i think i should be able to make my a href page jumps to work again, if i fully understand it. learn something new everyday. only took god knows how many posts.

 

right now i'm bouncing between frontpage/notepad/edit plus for my file editing. i picked up a copy of winsyntax and i'll give it a shot. sounds like a pretty cool gadjet. thanks for the help.

Link to comment
Share on other sites

  • 1 year later...
  • 3 weeks later...
  • 1 year later...

First of all thanks to all the contributors of this thread it has been an invaluable resource for me since I couldnt find ANYWHERE else on the net for the past 45 minutes covering this issue. (maybe i need to lrn2google?)

 

Currently on my in dev. OSC site www.fools4jewels.com I have an education section the client wants to post various tid bits of info. I'd like to link to an outside resource using the javascript open window command but the cross browser functionality worries me. I could only get these javascript buttons to work in IE after disabling pop up blocking and I have yet to get it to work in firefox without adding it to the trusted site list. Has anyone discovered a work around to this?

 

heres my script from the index.php starting at line 33

 if (isset($cPath) && tep_not_null($cPath)) {
if ( $cPath == '65_66' ) // replace 23 with your cPath number
{
?>
<script LANGUAGE="JavaScript">
window.open('http://www.ebay.com') // New Window to Link
onClick=window.location=('index.php') // Redirects Page 
</SCRIPT>
<?php
}
}

 

This would also be a great conclusion to this thread to wrap up all info regarding the topic.

thanks!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...