Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to move the shopping cart from a subdirectory to root?


romantix

Recommended Posts

Hi,

 

Is there a way to move the shopping cart I have installed in a subdirectory (such as /shop) to the root?

 

 

What all is involved in doing this?

 

 

Thanks for your answers,

 

 

Jan

Link to comment
Share on other sites

Hi,

 

Is there a way to move the shopping cart I have installed in a subdirectory (such as /shop) to the root?

What all is involved in doing this?

Thanks for your answers,

Jan

 

you have two choices :

Use a 301 redirect so that if I hit http://www.www.com it redirects to http://www.www.com/shop/

 

But I would recommend moving ths shop/ directory like this :

 

Back up all your files by FTP'ing your shop/ directory locally.

If you have SSH simply type :

cd /

cp -R public_html/shop/ .

if no SSH, then you'll have to upload all your files back up to the root

 

Then just edit your /includes/configure.php and admin/includes/configure.php files

Link to comment
Share on other sites

  • 1 month later...
Then just edit your /includes/configure.php and admin/includes/configure.php files

 

Not meaning to take over the thread but I have to clarify. You're referring to this section correct?

 

define('HTTP_SERVER', 'http://yourdomainname.com'); // eg, http://localhost - should not be empty for productive servers

define('HTTPS_SERVER', 'https://yourdomainname.com'); // eg, https://localhost - should not be empty for productive servers

 

and that would bring me to my next question.....

 

what exactly is changed to this since the catalog is no longer on the sub directory? The cookie path and catalog path still in tact are which has me a bit confused so would they be eliminated as in

 

define('HTTP_COOKIE_PATH', '');

 

or how would something like that be treated?

 

 

Thanks!

Link to comment
Share on other sites

Not meaning to take over the thread but I have to clarify. You're referring to this section correct?

define('HTTP_SERVER', 'http://yourdomainname.com'); // eg, http://localhost - should not be empty for productive servers

define('HTTPS_SERVER', 'https://yourdomainname.com'); // eg, https://localhost - should not be empty for productive servers

 

Actually - not this section.

It's the rest of the file.

 

In the /shop/ exmaple - your configure.php dfile would look like this :

define('DIR_WS_HTTP_CATALOG', '/shop/');

 

in moving the store to the root, you would need to change this to look like this :

define('DIR_WS_HTTP_CATALOG', '/');

 

And this change would need to be in every line that made a reference to the /shop/ directory.

 

what exactly is changed to this since the catalog is no longer on the sub directory? The cookie path and catalog path still in tact are which has me a bit confused so would they be eliminated as in

define('HTTP_COOKIE_PATH', '');

 

You should not have your applicaiton make assumptions.

This will usually work :

define('HTTP_COOKIE_PATH', '');

but you should really be explicit :

define('HTTP_COOKIE_PATH', '/');

or :

define('HTTP_COOKIE_PATH', '/shop/');

 

If you put in a forward slash, then you're being "more" explicit (if that makes sense)

:-D

Link to comment
Share on other sites

  • 3 weeks later...

This is if you are moving to another directory on the same server. In my case I had my OSCommerce instance off of the root named Store. I did not like it and wanted to change it. Here’s how I did it and successfully.

 

Since my directory was Store off of the root. I copied all the subdirectories off of Store to the root. Make all your directories and cd into one of the new directories and use the following

 

cp –p –R ../Store/* .

 

Wait to put all the files directly in the Store directory until you are ready to recreate your database

 

Back your database. Take the .sql file and make any directory changes to that file. For example if your directory is named Store you would want to do search and replace with the word /Store with nothing. Be careful, you can cut more than you want. What I found that I had to do is to copy and paste the sql statement into PHPMyAdmin and run it. I had a problem restoring the database through the admin. However I didn’t try more than once so it was just as easy of copying and pasting as loading through the admin.

 

Then find all occurences of hard coded path in your php files and other files that you might reference.

 

find . -exec grep "Store" {} \; -print | more

 

Open up the php files that have the word Store (probably only configure.php) unless you have have other pluggins you are done and everything should work right.

 

If you do have other pluggins that use a hard coded path then find them and change it. For example if you’ve added paths to other stuff such as FCKeditor then you have to find the path to that and change it as well.

 

find . -exec grep " FCKeditor" {} \; -print | more

 

And fix all the other files. Do the same for any other pluggins or code you’ve modified.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...