Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

next try


Guest

Recommended Posts

how can I setup a java script menu into the header.php? The coding is not the point, my problem is, that the seesion id is not attached to the menu entries. If I have something in my basket, clicking the java script menu entry - the basket is empty.

 

Who can give me a hint?

 

Thx

 

Torsten

Link to comment
Share on other sites

in order to keep the session Id you will need to append it to every link you create. OsCommerce has a function for that called tep_href_link()

which you should use:

 

tep_href_link('path/to/your/page.php', 'some_url_param=some_value', 'NONSSL')

 

You can leave the URL param bit empty but leave the single qoutes if you do.

 

HTH

Mattice

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

correction:

 

tep_href_link('path/to/your/page.php', 'some_url_param=some_value', 'NONSSL');

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

mattoce, thx for your answer, but this is not solving my problem. I will use XARA Webstyle 3 for generating the menus. The code is looking like that:

 

---------------

var clicked=""

var gtype=".gif"

var selstate="_over"

if (typeof(loc)=="undefined" || loc==""){

var loc=""

if (document.body&&document.body.innerHTML){

var tt = document.body.innerHTML.toLowerCase();

var last = tt.indexOf("tabs2002.js"");

if (last>0){

var first = tt.lastIndexOf(""", last);

if (first>0 && first<last) loc = document.body.innerHTML.substr(first+1,last-first-1);

}

}

}

 

document.write("<table border="0" cellspacing="0" cellpadding="0"><tr>");

tr(false);

writeButton(loc+"","../specials.php","tabs2002_b1",75,21,"Angebote","",0);

writeButton(loc+"","../account.php","tabs2002_b2",75,21,"Mein Konto","",0);

writeButton(loc+"","../shopping_cart.php","tabs2002_b3",75,21,"Warenkorb","",0);

writeButton(loc+"","../checkout_payment.php","tabs2002_b4",75,21,"Kasse","",0);

tr(true);

document.write("</tr></table>")

loc="";

 

function tr(B){}

 

function turn_over(name) {

if (document.images != null && clicked != name) {

document[name].src = document[name+"_over"].src;

}

}

 

function turn_off(name) {

if (document.images != null && clicked != name) {

document[name].src = document[name+"_off"].src;

}

}

 

function reg(gname,name)

{

if (document.images)

{

document[name+"_off"] = new Image();

document[name+"_off"].src = loc+gname+gtype;

document[name+"_over"] = new Image();

document[name+"_over"].src = loc+gname+"_over"+gtype;

}

}

 

function evs(name){ return " onmouseover="turn_over('"+ name + "')" onmouseout="turn_off('"+ name + "')""}

 

function writeButton(urld, url, name, w, h, alt, target, hsp)

{

gname = name;

while(typeof(document[name])!="undefined") name += "x";

reg(gname, name);

tr(true);

document.write("<td>");

if (alt != "") alt = " alt="" + alt + """;

if (target != "") target = " target="" + target + """;

if (w > 0) w = " width=""+w+"""; else w = "";

if (h > 0) h = " height=""+h+"""; else h = "";

if (url != "") url = " href="" + urld + url + """;

 

document.write("<a " + url + evs(name) + target + ">");

 

if (hsp == -1) hsp =" align="right"";

else if (hsp > 0) hsp = " hspace=""+hsp+""";

else hsp = "";

 

document.write("<img src=""+loc+gname+gtype+"" name="" + name + """ + w + h + alt + hsp + " border="0" /></a></td>");

tr(false);

}

---------------------------

As you can see, the involved function is calling writebutton.

 

How can I attache the sid within this code?

 

I'm looking forward for your answer...

 

Torsten

Link to comment
Share on other sites

writeButton(loc+"","../specials.php","tabs2002_b1",75,21,"Angebote","",0);

 

You save you document as PHP file and on each occurance of the above format you do:

 

<?php echo 'writeButton(loc+"","' . tep_href_link('http://yourserver.com/your_target_file.php', '', 'NONSSL') . '","tabs2002_b1",75,21,"Angebote","",0);';

 

That should do it.

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

and don't forget to add:

 

?>

 

to that line.

I did :) but you shouldn't.

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

Oh... it's a js file.... missed that bit :)

 

I *think* you can just 'echo' everything but I am no JavaScript person... (to much browser issues).

But I assume it will work if you create a php file that

echos each and every line of the JS file...

 

HTH

Mattice

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...