Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Pass osCommerce session IDs into Flash


blueline

Recommended Posts

:thumbsup:

 

Wow, Chris. Beautiful job and very easy to implement!!!

I doubt you remember, but you and I traded posts a while back about this very same issue and my ideas at that time were to write a script to process the variables so that flash could work with them (and vice versa). You really DID it here. Clean, concise, perfectly functional code that most novices could implement. Truly, kudos. I've stopped using the hack I threw together as a solution and started using your method.

 

Thanks a heap--from us all!

 

B)

Link to comment
Share on other sites

  • Replies 71
  • Created
  • Last Reply

Top Posters In This Topic

This is a great start as i am a flash noob.  I have an observation as well as a question for help.

 

i am able to sign in using the flash cart, and everything seems to work fine.  i have my greeting displaying my name, and the cart button takes me to my saved shopping cart.  the problem is that the header info doesn't contain any SID (looks like /index.php?osCsid=).  So it seems that the flash_variables.php isn't working correctly with the flash file.  I would think that this could possible cause problems in functionality.  any thoughts as to why this is happening?

 

The observation that i had was that any button in oscommerce that uses the history function (i.e. the continue shopping button in the shopping_cart.php page) will send you to the plain flash_variables.php file and display the text sid string (since flash_variables.php was technically the last page called). returns something like: 

 

&customer_id=Guest&osCsid=

 

I was never a fan of how this worked anyways, since when you added something to your cart from the product_info.php page, it would send you back to that page again.  i like to change this to show something more useful, like the first level of the catalog.

 

 

Same prob here.. doesnt show the ID in the Adressbar "catalog/index.php&oscid=" when a flash link has been clicked, but still remembers the content of the shoppingcart.

"seems to work ok"

 

any solution to the "continue shopping" button that sends you to Flash_variables.php?

Link to comment
Share on other sites

  • 1 month later...
thanks i will try that, even though it seems more like a work-aroung than a solution.

 

illmatixx

 

 

I am experiencing the same problem with the "sign in" button sending me to the flash variables file...

eg.

http://www.privatereserve.com.au/login.php...7a617e639f1603c

 

I this situation I do not know how to use the tep_href_link() function instead of <?php echo tep_image_submit('button_login.gif', IMAGE_BUTTON_LOGIN); ?>. If it can be done can anyone give me an example?

 

cheers,

Link to comment
Share on other sites

I am experiencing the same problem with the "sign in" button sending me to the flash variables file...

eg.

http://www.privatereserve.com.au/login.php...7a617e639f1603c

 

I this situation I do not know how to use the tep_href_link() function instead of <?php echo tep_image_submit('button_login.gif', IMAGE_BUTTON_LOGIN); ?>. If it can be done can anyone give me an example?

 

cheers,

 

Here's the href_link function:

tep_href_link($page, $parameters, $connection, $add_session_id, $search_engine_safe)

 

But you can't substitue that for the tep_image_submit() function on the login.php page. Instead, around lines 63-65, you'll see the redirect function that is used once a customer logs in. Change the tep_redirect($origin_href); to whatever page you would like to use instead. Or just copy the tep_redirect(tep_href_link(FILENAME_DEFAULT)); and use that instead.

Link to comment
Share on other sites

  • 1 month later...

I had two bugs using Flash header navigation ...

 

1. In Who's Onlne, the Last URL = /flash_variables.php?action=flash_variables

2. In products_info.php my Back Button went to = /flash_variables.php

 

I fixed the Back Button using Javascript,

<a href="java script:history.go(-1)"><?php echo tep_image_button('button_back.gif', IMAGE_BUTTON_BACK); ?></a>

 

Does anyone know how to fix Who's Online, the Last URL link?

 

Cheers,

EricK

Link to comment
Share on other sites

  • 3 months later...
Ok. Many people would like to use flash throughout their site, whether it is in featured products or navigation headers. Flash has many uses, and osC is the perfect place to integrate these capabilities.

 

I get TONS of emails everyday asking how to incorporate flash into osCommerce. Once this has been accomplished YOU WILL RUN INTO SESSION PROBLEMS. For example, let's say you have a header that has navigation buttons for the site. When the user clicks on a button in the header all of his cart contents will disappear. How come? Well, flash doesn't have osCommerce session IDs in the links, so when the user follows the link from flash, the session ID is dropped and so is all the info for that user (shopping cart contents, login info, etc).

 

I have included a .php file and a .fla and a .swf file so that anyone who is interested in flash can easily fix this problem. Anyone who would like to REALLY CUSTOMIZE their site can do so with flash, and now they'll do it properly.

 

I hope this helps. If you have any questions please post them and I'll do my best to get back to you.

 

For an example of a flash header (with a lot more variables then just session IDs) check out a demo I set up at: http://www.eclyptiq.com/flashosC

 

Thanks,

-Chris

 

Hi their Chris thanks for submitting the fantastic contribution!

 

I was wondering if you could please, please make "http://www.eclyptiq.com/flashosC" available so I may see the structure of the code of how it works together. I have tried to replicate your code using your contribution, but nothing as of yet, please I would simple like to know where I'm going wrong.

 

If you can't help not to worry I will just have to suffer a little longer until I crack it :D

 

 

Thanks for your time!

 

Carlo

Link to comment
Share on other sites

  • 2 months later...

Great contribution! See it in action elsewhere at http://www.bavender.com/index2.php

 

Bavender Custom Clothiers - Custom Tailored Shirts, Sportswear, Outerwear, Cuff Links, Neckties, Pocket Squares

 

I use it for navigation purposes, here is the code I used to attach it to my index2.php file ;0)

 

Insert this and change the filename and file width/height to the appropriate sizes..

 

 

 

<?=// Start of flash header ?>
								<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="751" height="348" align="middle">
								  <param name="allowScriptAccess" value="sameDomain" />
								  <?=// Check to see if a session id has been defined in the URL ?>
								  <?php if ((isset($HTTP_GET_VARS['osCsid']) && ($HTTP_GET_VARS['osCsid'] != '')) || (tep_session_is_registered('osCsid'))) { ?>
								  <?=// If so, append it the the osCsid variable so that flash gets the proper session info ?>
								  <param name="movie" value="images/sportswear.swf?osCsid=<?=$_GET['osCsid'];?>" />
								  <?php } else { ?>
								  <?=// If not, call the movie without defining the osCsid variable ?>
								  <param name="movie" value="images/sportswear.swf" />
								  <?php } ?>
								  <param name="quality" value="high" />
								  <param name="bgcolor" value="#ffffff" />
								  <?=// Check to see if a session id has been defined in the URL ?>
								  <?php if ((isset($HTTP_GET_VARS['osCsid']) && ($HTTP_GET_VARS['osCsid'] != '')) || (tep_session_is_registered('osCsid'))) { ?>
								  <?=// If so, append it the the osCsid variable so that flash gets the proper session info ?>
								  <embed src="images/sportswear.swf?osCsid=<?=$_GET['osCsid'];?>" quality="high" bgcolor="#ffffff" width="751" height="348" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />									
								  <?php } else { ?>
								  <?=// If not, call the movie without defining the osCsid variable ?>
								  <embed src="images/sportswear.swf" quality="high" bgcolor="#ffffff" width="751" height="348" name="flash osc" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />									
								  <?php } ?>
								</object>
								<?=// End of flash header ?></th>

 

Thank you again for the contribution!

Jesse Rooney

Link to comment
Share on other sites

  • 3 months later...
Same prob here.. doesnt show the ID in the Adressbar "catalog/index.php&oscid=" when a flash link has been clicked, but still remembers the content of the shoppingcart.

"seems to work ok"

 

any solution to the "continue shopping" button that sends you to Flash_variables.php?

 

 

Is it normally a good idea to show the session id information on the web page anyway ? Arent we just interested in passing the id at the application level and not displaying it for all to see.

 

Is it just my understanding of session ids that if someone gets a hold of your session id while your session is open that they could technically hijack the session.

 

Just a question.

 

ikhan42

Link to comment
Share on other sites

  • 2 weeks later...

Hi everyone.

 

I'm not sure how often this Support thread is looked at but I'm hoping often!

 

Anyways, I'm here for the same reason many of you have come here. To find a viable solution that integrates flash into osCommerce ... specifically a Flash Menu system.

 

I was VERY excited to find Chris' contribution. I thought that this was what I had been looking for! I downloaded and installed the contributon .... only to have it not work?!? Obviously it must since many of you have gotten it to work.

 

First, I did a completely new of the latest osCommerce release (as of today oscommerce-2.2ms2-051113). Then I installed the very simply Sessions ID into Flash contribution. Finally I tested it and ... nothing. Not much more to say. When I press one of the buttons, it always loads the index page. I noticed that the link URL that appears on the bottom left corner of IE states .... http://www.mywebsite.com/osc/shopping_cart.php?OSCsid= for a brief moment but never actually loads anything other than the index page.

 

So here's my challenge. I am very interested in this. If anyone out there can lead me in the right direction, I will be happy to post a full and complete solution with full custom flash navigation and all. I'll stick with it from beginning to end. I will not stop until we can post a solution for ALL to see ... we all know how tough its been to find anything related to this through Google.

 

Have a go all.

Thanks.

Link to comment
Share on other sites

  • 2 months later...
Hi everyone.

 

I'm not sure how often this Support thread is looked at but I'm hoping often!

 

Anyways, I'm here for the same reason many of you have come here. To find a viable solution that integrates flash into osCommerce ... specifically a Flash Menu system.

 

I was VERY excited to find Chris' contribution. I thought that this was what I had been looking for! I downloaded and installed the contributon .... only to have it not work?!? Obviously it must since many of you have gotten it to work.

 

First, I did a completely new of the latest osCommerce release (as of today oscommerce-2.2ms2-051113). Then I installed the very simply Sessions ID into Flash contribution. Finally I tested it and ... nothing. Not much more to say. When I press one of the buttons, it always loads the index page. I noticed that the link URL that appears on the bottom left corner of IE states .... http://www.mywebsite.com/osc/shopping_cart.php?OSCsid= for a brief moment but never actually loads anything other than the index page.

 

So here's my challenge. I am very interested in this. If anyone out there can lead me in the right direction, I will be happy to post a full and complete solution with full custom flash navigation and all. I'll stick with it from beginning to end. I will not stop until we can post a solution for ALL to see ... we all know how tough its been to find anything related to this through Google.

 

Have a go all.

Thanks.

 

Hi,

 

I use the same osCommerce configuration (osC2.2 MS2) than you with STS v4.1 and Infoboxes templates.

 

I tested the contribution through a small Flash MX fitted into an infobox (using STS infobox templates).

I have the same problem like you, when clicking my Flash link, the index page is always displayed.

But It seems I have this problem using IE.

I do not have using Firefox nor Netscape. The link runs.

 

Does anyone had the same behaviour ?

I use the exact way described in Chris's contribution.

 

Thanks for your response.

 

Jacques

Link to comment
Share on other sites

  • 1 month later...

Can anyone tell me what the code is for the link buttons in this flash contribution? I use SWISHmax rather than adobes product and cannot open the .fla file to retrieve the code. Greatly appreciated.

 

Sheri

 

to load the flash movie i did like this :

<object type="application/x-shockwave-flash" data="menu.swf?id=<?php echo tep_session_id(); ?>"   
width="770" height="40">
<param name="scale" value="exactfit" /> 
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="movie"value="menu.swf?id=<?php echo tep_session_id(); ?>" /> 
<a href=http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash  target="blank"><img src="images/icons/noflash.gif" width="88" height="31" vspace="5" hspace="50" alt="install flash player plugin"/></a>
  </object>

 

as u can see i use the " tep_session_id() " function to get the current id number and send it to flash .

 

in my flash movie i get it using this :

var osCsid = _root.id;

 

and then i use the same code on button as you .

Link to comment
Share on other sites

  • 1 month later...

Isnt there a more easy way to do this? its kinda much text you have to write down every time you want a new flash button.

 

I mean if you could work around this code:

			<?=// Start of flash header ?>
  <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="120" height="120" id="flash osc">
  <param name="allowScriptAccess" value="sameDomain" />
  <?=// Check to see if a session id has been defined in the URL ?>
  <?php if ((isset($HTTP_GET_VARS['osCsid']) && ($HTTP_GET_VARS['osCsid'] != '')) || (tep_session_is_registered('osCsid'))) { ?>
	<?=// If so, append it the the osCsid variable so that flash gets the proper session info ?>
	<param name="movie" value="meny.swf?osCsid=<?=$_GET['osCsid'];?>" />
  <?php } else { ?>
	<?=// If not, call the movie without defining the osCsid variable ?>
	<param name="movie" value="meny.swf" />
  <?php } ?>
  <param name="wmode" value="Transparent">
  <param name="wmode" value="Transparent">
  <?=// Check to see if a session id has been defined in the URL ?>
  <?php if ((isset($HTTP_GET_VARS['osCsid']) && ($HTTP_GET_VARS['osCsid'] != '')) || (tep_session_is_registered('osCsid'))) { ?>
	<?=// If so, append it the the osCsid variable so that flash gets the proper session info ?>
	<embed src="meny.swf?osCsid=<?=$_GET['osCsid'];?>" wmode="transparent" quality="high" width="120" height="120" name="flash osc" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
  <?php } else { ?>
	<?=// If not, call the movie without defining the osCsid variable ?>
	<embed src="meny.swf" wmode="transparent" quality="high" width="120" height="120" name="flash osc" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
  <?php } ?>
  </object>

Edited by Dennis_gull
Link to comment
Share on other sites

Hi everyone.

 

I'm not sure how often this Support thread is looked at but I'm hoping often!

 

Anyways, I'm here for the same reason many of you have come here. To find a viable solution that integrates flash into osCommerce ... specifically a Flash Menu system.

 

I was VERY excited to find Chris' contribution. I thought that this was what I had been looking for! I downloaded and installed the contributon .... only to have it not work?!? Obviously it must since many of you have gotten it to work.

 

First, I did a completely new of the latest osCommerce release (as of today oscommerce-2.2ms2-051113). Then I installed the very simply Sessions ID into Flash contribution. Finally I tested it and ... nothing. Not much more to say. When I press one of the buttons, it always loads the index page. I noticed that the link URL that appears on the bottom left corner of IE states .... http://www.mywebsite.com/osc/shopping_cart.php?OSCsid= for a brief moment but never actually loads anything other than the index page.

 

So here's my challenge. I am very interested in this. If anyone out there can lead me in the right direction, I will be happy to post a full and complete solution with full custom flash navigation and all. I'll stick with it from beginning to end. I will not stop until we can post a solution for ALL to see ... we all know how tough its been to find anything related to this through Google.

 

Have a go all.

Thanks.

 

i have the exactly same problem here. when i click any of the button, just keep refreshing my index page. anyone can help us?

Link to comment
Share on other sites

  • 2 months later...

Hi

 

I have one Q in store for you guys. In php links the session ids are used only for the 1st time, that is when the user entered the site, and after which session ids are not displayed in the url which are visible earlier in the entry page. Is this flash movie going to have something same, or attach a session id each time a user clicks on it.

 

Do u guys also have any live site example. Thanks

Link to comment
Share on other sites

  • 4 months later...

Hi, I'm using this contribution and it works well. Really GooD

 

However, there is something I can't do. Actually, on my flash animation, texts such as "home" are included in 2 movie clips. So the varaibles loaded can't work on those sub levels.

 

I don't know how to load the varaibles on those sub levels. I tried changing this:

 

loadVariablesNum("flash_variables.php?action=flash_variables&osCsid="+osCsid, 0, "POST");

 

to this:

loadVariablesNum("flash_variables.php?action=flash_variables&osCsid="+osCsid, 1, "POST");

 

but it still doesn't work. I tried "2" to.

 

I also tried to use the "loadVars" funtions but can't make it work to:

 

var menu_vars:LoadVars = new LoadVars();
	menu_vars.sendAndLoad("flash_variables.php?action=flash_variables&osCsid="+osCsid, "", "POST");
	menu_vars.onLoad = function(success:Boolean) {
	if (success) {
		trace("passe");
	} else {
		trace("passe pas");
	}
	}
	test_text.text =  "kak: " + menu_vars.BOX_INFORMATION_HOME;

 

Thanks

MS2

Link to comment
Share on other sites

  • 7 months later...

Hi there !! hey am trying to make a flash app that login into oscommerce store using the id sessions the php works great but flash doesnt understands it... this is what am doing (i dont know flash scripts)

 

php:

 

<?

require('includes/application_top.php');

 

 

if ($session_started == false) {

tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE));

}

 

 

if (isset($_GET['action']) && ($_GET['action'] == 'process')) {

 

$email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']);

$password = tep_db_prepare_input($HTTP_POST_VARS['password']);

 

//connect to database

if ($email_address && $password){

mysql_pconnect("internal-db.s21827.gridserver.com","db21827","lyeVaRR8") or die ("didn't connect to mysql");

mysql_select_db("db21827_data_fullcopas") or die ("no database");

//make query

$query = "SELECT customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id FROM customers WHERE customers_email_address = '" . tep_db_input($email_address) . "' AND customers_id = '" . tep_db_input($password) . "'";

$result = mysql_query( $query ) or die ("didn't query");

 

//see if there's an EXACT match

$num = mysql_num_rows( $result );

if ($num == 1){

 

if (SESSION_RECREATE == 'True') {

tep_session_recreate();

}

print "status= Sesion Recreada = True&checklog=1";

 

$check_country_query = tep_db_query("select entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$result['customers_id'] . "' and address_book_id = '" . (int)$result['customers_default_address_id'] . "'");

$check_country = tep_db_fetch_array($check_country_query);

 

$customer_id = $result['customers_id'];

$customer_default_address_id = $result['customers_default_address_id'];

$customer_first_name = $result['customers_firstname'];

$customer_country_id = $check_country['entry_country_id'];

$customer_zone_id = $check_country['entry_zone_id'];

tep_session_register('customer_id');

tep_session_register('osCsid');

tep_session_register('customer_default_address_id');

tep_session_register('customer_first_name');

tep_session_register('customer_country_id');

tep_session_register('customer_zone_id');

 

} else {

 

print "status=Sorry, but your user name and password did not match a user name/password combination in our database. Usernames and passwords are entered in from a different file. Thank you for visiting test login script!!&checklog=2";

}

 

}

if (tep_session_is_registered('customer_id')) {

print "&customer_id=" . $customer_first_name;

print "&osCsid=" . str_replace("osCsid=", "", $SID);

} else {

print "&customer_id=Guest";

print "&osCsid=" . str_replace("osCsid=", "", $SID);

}

if (sizeof($navigation->snapshot) > 0) {

$origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);

$navigation->clear_snapshot();

tep_redirect($origin_href);

}

tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_of_last_logon = now(), customers_info_number_of_logons = customers_info_number_of_logons+1 where customers_info_id = '" . (int)$customer_id . "'");

}

$result = tep_db_query("select customers_private_messages from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . " '");

$check_result = tep_db_fetch_array($result);

 

print "&private_messages=". $check_result['customers_private_messages'];

 

 

?>

 

and the flash scripts:

 

on (release, keyPress "<Enter>") {

if (email_address != "" && password != "") {

 

status = "Begin Login Process - Wait...";

if ((osCsid != undefined) && (osCsid != '')) {

// if the variable osCsid has been defined and it contains a value (not empty), we

// will load the flash_variables.php file with the session id appended at the end

// of the URL.

status = "hay variable";

loadVariablesNum("newlogin.php?action=process&osCsid="+osCsid, 0, "POST");

} else {

local_data = SharedObject.getLocal("user_data");

//osCsids = local_data.data.osCsid;

local_data.data.osCsid=_root.osCsid.text;

//customer_ids = local_data.data.customer_id;

local_data.data.customer_id=_root.customer_id.text;

local_data.flush();

status = " no hay variable";

// if the variable osCsid is undefined or it is defined but contains no value (it is

// empty) than we will load the flash_variables.php file without the session id

// so that osC will generate one for us and pass it back.

loadVariablesNum("newlogin.php?action=process", 0, "POST");

}

 

}

}

 

this send a id session empty and here am trying to tell the user if he or her have a private message then show it in the flash movie :'( can anybody help me please????

Edited by amprodes
Link to comment
Share on other sites

  • 2 years later...

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...