Hi
has anyone found a way to synchronise sessions so i can use $_SESSION variables across osCommerce and CMSms?
this is probably more of an osCommerce question as I want to force osCommerce to use the CMSms naming convention but I am open to any suggestion.
cheers, mario
[SOLVED] use osCommerce variables across CMSMS
[SOLVED] use osCommerce variables across CMSMS
Last edited by rotezecke on Tue Dec 18, 2012 9:04 am, edited 3 times in total.
Re: use osCommerce variables across CMSMS
This is a separate topic from my CMSMS Shop Skin Helper, and should probably have it's own thread. However, since you have asked, I did write a plugin (circa 2009) for CMSMS that reads the cookie set by osCommerce v2.2. It isn't perfect and that's why I've never released it.rotezecke wrote:has anyone found a way to synchronise sessions so i can use $_SESSION variables accross osCommerce and CMSms?
osc_cookie plugin file attached.
How to use it:
You will need to open the plugin in your php editor of choice, and change lines 28 to 34 under the comment:
/* setup the links */
Then upload it to your CMSMS /plugins/ directory.
To find more instructions on how to use it; In the CMSMS Admin section click on Extenstions -> Tags -> osc_cookie
What it does:
It reads the osC v2.2 cookie and looks up the session information stored in the osCommerce database. You can get:
- get='customer_id'
will return the customer id if the customer is logged in. Othewise it will return 0 (zero). - get='cart'
returns the number of items in the cart and the cost of those items as a string e.g. "4 Items ($49.95)" - get='cart_qty'
returns the number of items in the cart e.g. "4"
this is one of the issues I was talking about above: sometimes the number of items in the cart returned isn't accurate. Didn't really care enough to track down the bug. - get='cart_cost'
returns the cost of the items in the cart e.g. "49.95" - get='login_link' will display a login or logout link based upon the users login state.
Might not be what you are looking for, but it's what I have. Also it's released under the GNU GPL v3 so do what you want with it. Add your own copyright above mine if you re-release it with your own changes.
This also means you could use it as a base to write a plugin that would read osC v3 cookies.
No support provided for this plugin:
Also I'm not going to provide support this plugin, unless someone want's to pay some cash money to have me do it.
I no longer install osCommerce for clients, but I do still support my clients that I haven't convinced to move on yet. It took the osC team 10+ years to release v3 after they announced it as "soon to be released". Guess I got tired of waiting In their latest email the osC team said v3 is going to be a framework and not just an eCommerce platform, so watch for a complete CMS to be developed around it.
- Attachments
-
- function.osc_cookie.zip
- * I will not be providing support this plugin. Released under the GNU GPL v3.
* Reads the osCommerce v2.2 cookie and looks up the session information stored in the osCommerce database.
* Not for v3 of osCommerce. - (2.84 KiB) Downloaded 149 times
Last edited by Owens on Sat Apr 23, 2011 1:22 pm, edited 1 time in total.
Re: use osCommerce variables across CMSMS
doesnt work since 1.11.4.
unable to edit pages that include this plugin.
unable to edit pages that include this plugin.
Re: use osCommerce variables across CMSMS
Just replace
With
And I think it will work again
Code: Select all
global $gCms;
$db =& $gCms->GetDb();
Code: Select all
$db = cmsms()->GetDB();
Re: use osCommerce variables across CMSMS
Yep. This plugin is 4 months away from being 2 years old. It's released under the GPL 3 so someone that's using osCommerce and CMSMS could update it.
Thanks Jos.
Thanks Jos.
Re: use osCommerce variables across CMSMS
The plugin actually still works as expected on the front end (@Jos: i had made those changes a while back).
but i cannot edit pages in backend that include the plugin.
when i comment out the plugin (i use it in a global content block which i can still edit) i can then edit the page.
but i cannot edit pages in backend that include the plugin.
when i comment out the plugin (i use it in a global content block which i can still edit) i can then edit the page.
Re: use osCommerce variables across CMSMS
Found the problem, not related to this plugin.
I had an include line with a relative path:
which since 1.11.4 breaks backend. (but still works in front end). when changing the above to
backend works, frontend breaks.
hence i now grab the path from config file:
now it works again.
I had an include line with a relative path:
Code: Select all
require('config/db.php');
Code: Select all
require('../config/db.php');
hence i now grab the path from config file:
Code: Select all
$config = cmsms()->GetConfig();
require($config['root_path'].'/config/db.php');
Re: use osCommerce variables across CMSMS
Thanks. worked a treat for my (UDT) problemJos wrote:Just replaceWithCode: Select all
global $gCms; $db =& $gCms->GetDb();
And I think it will work againCode: Select all
$db = cmsms()->GetDB();
Allan