Technical Help - Coexistance of CMS-Builder with X-Cart Shopping Cart software

4 posts by 2 authors in: Forums > CMS Builder
Last Post: December 3, 2009   (RSS)

This is a bit of technical issue - hopefully someone can help.

Here it goes...

I have a site that needs to have both CMS Builder and X-Cart software on the same site and same pages.

I'm using CMS Builder to deal with navigation of the non-cart pages, all of the content of the non-cart pages, etc., but want to place portions of the e-commerce system on these pages (featured items for example).

I know that CMS Builder does a very nice job of containing it's functions pretty much into the header of the code when we go to get data.

Here's the tricky part - I need to save off the current connection information (connection to database server, "current" database, etc.) before the viewer functions are called and then restore this information upon coming back from the viewer functions.

I think that's all there would be to it, but don't know what I should all do here.

For example, is there a way to get the "current" database?

Can we have a connection to more than one db account within the same script, etc?

Guidance on this would be extremely helpful. While I'm very comfortable doing the programming, I have never had to deal with this type of issue before.

Thanks in advance.
Gary.

Re: [garyhoffmann] Technical Help - Coexistance of CMS-Builder with X-Cart Shopping Cart software

By Dave - December 3, 2009

Hi Gary,

Is there a specific order that X-Cart and CMSB need to be called in? If it's possible to just load the viewer_functions first and load all the records you need for CMSB, then load xcart and call it's function below that, then that would probably be the simplest.

Let me know if that would work for you.
Dave Edis - Senior Developer
interactivetools.com

Re: [garyhoffmann] Technical Help - Coexistance of CMS-Builder with X-Cart Shopping Cart software

By Dave - December 3, 2009

As long as you load all the CMSB records at the top of the page before anything else you should be fine. If you have code in includes that calls getRecords() that won't work though because the code in includes won't be at the top of the page and might be being called after xcart.

Also, CMSB uses the default connection, so if you wanted to close that before including any x-cart code you could do that with this line:
mysql_close(); // php function

And if needed to reconnect to the CMSB database and set it as the default you can do that like this:
connectToMySQL(); // cmsb function

And I think you can get the current link like this:
$link = mysql_connect();

You might want to look through the mysql functions and see what's possible:
http://www.php.net/manual/en/function.mysql-connect.php

So even if you aren't able to have all your CMSB code that loads records at the top of each page then perhaps with that code you could get it to work?

Hope that helps! Let me know how it goes.
Dave Edis - Senior Developer
interactivetools.com