script not working on some Macintoshes with IE or Safari

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
filch
Forum Newbie
Posts: 22
Joined: Sat Oct 25, 2003 12:34 pm
Location: Toronto

script not working on some Macintoshes with IE or Safari

Post by filch »

Not sure how to explain this problem but I will give it a go:

I have a commerce site I am just about to finish but I have one nagging issue that I am having trouble tracking down. The site allows the user to choose either $US or $CAN currency and each of the pages relative to the currency are in their own subdirectory. Then, there are some common pages that I did not want to duplicate in each of the subdirs so they are in the root. I needed a way to track which currency the user had chosen so that when the user went to one of these root pages, we would know which currency subdir they had come from and could take them back there when they were ready. I chose to do this with $_SESSION vars and for all intents and purposes it works great. At least on all PC/browsers and most Macs/browsers except for Macs with OSX and running IE 5.23 or Safari Version 1.xxx The othjer twist is that the navigation is contained in a small flash navigation movie that calls a nav.php script and passes a var to it via $_POST that contains the page link to where the user wants to go minus the value of the $_SESSION var which is prepended to this link value to create the entire url.

Here is the nav.php script:

Code: Select all

<?php 
session_start();
switch ($_GET&#1111;'mode']) &#123;

	case choose:
		if ($_POST&#1111;'us_x']) &#123;
			$curPath = "us";
			//echo $curPath . "<br>";
		&#125; elseif ($_POST&#1111;'canada_x']) &#123;
			$curPath = "canada";
			//echo $curPath . "<br>";
		&#125; else &#123;
			die("Path not set!!");
		&#125;
		if ($curPath) &#123;
			$_SESSION&#1111;'path'] = $curPath;
		//echo $_SESSION&#1111;'path'] . "<br>";
		&#125; else &#123;
			die ("Path not set!!");
		&#125;
		if (isset($_SESSION&#1111;'path']) && $_SESSION&#1111;'path'] == "canada") &#123;
			header("Location: " . $_SESSION&#1111;'path'] . $_POST&#1111;'linkpage'] . "");
		&#125; else &#123;
			header ("Location: " . $_SESSION&#1111;'path'] . $_POST&#1111;'linkpage'] . "");
		&#125;
		break;
			
	case change:
		unset($_SESSION&#1111;'path']);
		header("Location: /index.php");
		break;
		
	case root:
		header("Location: " . $_SESSION&#1111;'path'] . $_POST&#1111;'linkpage'] . "");
	
	break;
	
	case rockitwear:
		header("Location: " . $_SESSION&#1111;'path'] . "/rockitwear.php");
	
	&#125;
?>
And the code in Flash that calls the script above:

Code: Select all

on (press) &#123;
	var
	c = new LoadVars();
	c.linkpage = "/school_grp.php";
	c.send("http://roarockit.zuka.net/nav.php?mode=root","_self","POST");
&#125;
Does anyone have any clue as to why this might not work on these few machine, browsers and or machine/browser combinations? Truthfully, I believe it is the $_SESSION that is not being set as the error is an object not found error from Apache 2.0. The url that is in the browsers is correct with the exception of the currency subdir which should be contained in the $_SESSION var.

Sorry about this long assed ramble but this is a bit hard to explain.

Any thoughts would be appreciated.

Cheers

Dave
TheBentinel.com
Forum Contributor
Posts: 282
Joined: Wed Mar 10, 2004 1:52 pm
Location: Columbus, Ohio

Post by TheBentinel.com »

No offense intended at all, and I'm speaking from a position of ignorance of your system and your business needs and etc, etc.. but...

It all sounds overly complicated. Do you need to keep the code to handle different currencies in different subdirs? Do you need to use flash for navigation?

The flash thing is none of my business, but why the subdirs? For that matter, why separate code for different currencies?

I apologize for posting a reply that really doesn't address your question. I just wonder if you couldn't make your question go away by simplifying things.

BUT, to give at least some answer, do you have primarily US or primarily Canadian customers? Would it be ok to default to one or the other, if you don't know which is correct? Assume US, for instance, if you don't have the information. Since it only affects a small number of users anyway, it might be an acceptable solution.
lostboy
Forum Contributor
Posts: 329
Joined: Mon Dec 30, 2002 8:12 pm
Location: toronto,canada

Post by lostboy »

Is the browser set to take session cookies?

Are you testing for the ability to set sessions? and have a work around if session cookies are not allowed on the client machine (ie progagating the SID in the URL, using regular cookies etc)

As for the currency in diff folders, I'd have to agree with Dave, its simply not relevant to the design of the site as long as the currency is noted...

Another work around could be having the user register and choosing their currency at that point. Then its in the DB and can be called when the final checkout processing is invoked. Or having the user choose the currency at final checkout...
filch
Forum Newbie
Posts: 22
Joined: Sat Oct 25, 2003 12:34 pm
Location: Toronto

Post by filch »

The reason for the two currency folders if long and complicated but it all has to do with several different tax structures here in Canada which depend on where the product is shipped from and where the product is shipped to. As well, my client did not want to mix up US transactions (which go to a different account) with Canadian transactions. There is a host of other reasons as well but I won't get into it here.

At any rate, although this may be the reason I have to use sessions in the first place, I don't think it is relavent to my question?

Cheers

Dave
lostboy
Forum Contributor
Posts: 329
Joined: Mon Dec 30, 2002 8:12 pm
Location: toronto,canada

Post by lostboy »

True, its just a design issue. BUt what about my initial suggestions about testing for cookies? Or handling it with the user registration process and storing it in the DB?

Who you work for into TO? I'm working in Uxbridge.
filch
Forum Newbie
Posts: 22
Joined: Sat Oct 25, 2003 12:34 pm
Location: Toronto

Post by filch »

I am checking into your suggestions and I am currently of the mind to save the session_id to the DB with the currency choice. Just trying to get my head around management of that is reference to deleting the DB entry at some point. If I can't write at least the SESSION_ID to the browser then not sure how this will work. Having the clients register would work but I do not think is an option.

Cheers

Dave
lostboy
Forum Contributor
Posts: 329
Joined: Mon Dec 30, 2002 8:12 pm
Location: toronto,canada

Post by lostboy »

What exxactly is the app doing...most commerce sites do require registration of some sort....or hold off everything until the checkout...then let the user check their currency choice at that point
filch
Forum Newbie
Posts: 22
Joined: Sat Oct 25, 2003 12:34 pm
Location: Toronto

Post by filch »

Well the biggest deterent for choosing the currency at the end of the process was the tranaction database. My client does not want mixed currency transactions in the database. I suppose I could write some routines to check this and split it into appropriate tables but for reasons too long to explain here, this is really not a viable option. Suffice to say that we used a commerce template from a supplier to do this site because it was supposed to be a quick and dirty job with only a few pages. Well .... it wasn't when all was said and done. So if I do too much customization (and there is plenty already), updating the template becomes a nightmare.

Anyway, the site works like a charm with this one lonely exception and so I am driven to find a solution at this level.

Dave
lostboy
Forum Contributor
Posts: 329
Joined: Mon Dec 30, 2002 8:12 pm
Location: toronto,canada

Post by lostboy »

Hidden field on the page? only after test for cookies...
filch
Forum Newbie
Posts: 22
Joined: Sat Oct 25, 2003 12:34 pm
Location: Toronto

Post by filch »

I suppose that might work. I'd have to stick a form on each page and I would have to stick it in each URL as well. Not sure ... I would like this to be very transparent to the end user.

I'll have to give this some thought and hopefully come up with something workable. This should not be that hard as it seems only to be a Safari issue on Macintosh. Everything else seems to be working.

I am off to a conference this afternoon and then out for the evening so will try to look at it later. If you have any other thoughts on this I would appreciate hearing them. If you want to try this and let me know if this works for you ... go to http://roarockit.zuka.net click on whatever currency and then click on one of the flash nav buttons at the top of the page. Finally, on the side nav, click on About Us and then try to click on the Flash nav buttons again and see if you get an "Object Not Found" error.

Cheers

Dave
lostboy
Forum Contributor
Posts: 329
Joined: Mon Dec 30, 2002 8:12 pm
Location: toronto,canada

Post by lostboy »

another thought, after looking at the site (no errors btw) What about a frame or iframe to hold the values or even the shopping cart?
Post Reply