Solved

osCommerce specific PHP question. How to generate osCsid immediately upon entering first page

Posted on 2006-10-30
2
464 Views
Last Modified: 2007-12-19
I have been modifying osCommerce to simply go to an initial page with 2 products, both with an order now button.

The problem is that when clicking the order now button, it goes to a blank page. I then click Back on my web browser and it goes back to the 2 products page.

The difference with seeing it this second time is that the 2 products page now has an osCsid session variable. - I can now click Order Now, and it goes to the cart with the item added.

How can I get this variable to generate upon immediately entering index.php?cPath=0 (Which is the initial page I enter to from an iFrame).

I was hoping there would be a function within osCommerce that will let me generate an osCsid, just by putting gen_osCsid() at the top of the page or something.

0
Comment
Question by:wbstech
2 Comments
 
LVL 7

Accepted Solution

by:
CraigHarris earned 500 total points
ID: 17838047
Frames are ugly and don't work on many platforms - do you really need them? -- there are extremely few justifications for such on today's web.


Sometimes the easiest workarround for buggy session handling is to force a redirect, e.g. from the index page, do:

<?php
  Session_Start();
  // osCommerce-specifc session handling goes here if needed
  Header('Location: /index.php?cPath=0');
?>
0
 
LVL 4

Author Comment

by:wbstech
ID: 17840992
You're certainly right about frames. Although I think iFrames still have a place and a use in some circumstances.

In this one it was the fact that we needed to include a simple osCommerce website inside an existing design. We couldn't incorporate the existing static design into osCommerce because it wasn't cost-effective for the customer. So an iFrame was the only choice.

I did your suggestion above but ran into some small errors. I modified the idea and just used a 1 second meta refresh, which isn't noticeable.

I had to add some PHP to make sure the meta refresh occurs just once, and this works fine.

Certainly not the cleanest way to do it. But time and money are the biggest issues on this project now.

Thanks for the idea.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

774 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question