You are here: The ProductCart Encyclopedia » How To's » Moving the home page to the root directory
Moving the home page to the root directory
Assumptions
This document contains information about how to move the page home.asp to the root directory of your Web site so that your Web site home page can be your ProductCart v3 home page. The following assumptions are used in this section:
- The “productcart” directory has not been renamed. If you have renamed it, no problem. Just adjust the links accordingly.
- The “productcart” directory is in the root. That is, the file home.asp is two levels down from the root and will be moved two levels up. If this is not the case, change some of the links mentioned below so that they are consistent with your directory structure.
An example: You can see an example of the home page moved up 2 levels and renamed “index.asp” here:
- Original location: http://www.earlyimpact.com/demos/apparel/pc/home.asp
- New location: http://www.earlyimpact.com/demos/index.asp
Limitations
For instructions on retaining the use of the AJAX-based product preview feature in the new home page, please refer to this article.
Task List
The following is a list of tasks to be performed. Please make sure you follow these instructions carefully. Please also note that Early Impact does not provide technical support on implementing these code changes.
Move "header.asp" and "footer.asp"
Open “footer.asp” with your HTML editor and save it to the root directory (again, here we are assuming that the root is 2 levels up). The HTML editor will likely recalculate all links automatically for you (e.g. in Dreamweaver, answer yes to the “Update Links?” question).
Do the same with “header.asp”. If you have any images referenced in JavaScript code, the HTML editor will typically not edit those links. Make sure you manually review the code to see if there are any file locations that need to be updated.
Static Navigation
If you are using the “Generate Navigation” feature in the Control Panel, and therefore “header.asp” uses the file “inc_catsmenu.asp”, take the following steps.
- Generate the navigation in the Control Panel using Absolute Links
- Download the files “inc_catsmenu.asp”, “inc_RetailCatMenu.inc”, and “inc_WholeSaleCatMenu.inc” to your desktop
- Open each file with your HTML editor and save it to the root directory
- Edit “header.asp” so that it uses the version of “inc_catsmenu.asp” that you have moved to the root
Move and edit "home.asp"
Open “home.asp” and perform the same task. Here too, all the links will be automatically updated, but since you need to use a header and footer that are in the same directory, you will have to change those include statements back to pointing to header.asp and footer.asp in the same directory (now the root directory).
That is: after the links have been recalculated, do a search for “header.asp” in the file and remove the path that has been added to the file location (e.g. change file=“productcart/pc/header.asp” to file=“header.asp”). Do the same with the locations of the files “footer.asp” and “homeCode.asp”.
Move and edit "homeCode.asp" and related files
Open “homeCode.asp” and perform the same task. All the links will be automatically updated. This file loads a few other files to handle the display of products on the page. You will have to move those files to the root as well, and edit the statements that include them inside “homeCode.asp”. Specifically:
- Open the file “pcShowProductP.asp”, save it two levels up, let the HTML editor recalculate links in it, and then edit “homeCode.asp” so that the previously recalculated link is edited back to point to a local file. That is: file=“productcart/pc/pcShowProductP.asp”, should be edited back to file=“pcShowProductP.asp”
- Do the same for these files: pcShowProductH.asp, pcShowProductL.asp, pcShowProductM.asp
Some of the code that load images on these pages contains variables, and an HTML editor like Dreamweaver does not recalculate links correctly when that is the case. To fix the problem, do the following (if you are not using Dreamweaver, perform the same tasks using your HTML editor):
- Go to the root directory
- Highlight the following 5 files: homeCode.asp, pcShowProductH.asp, pcShowProductL.asp, pcShowProductM.asp, pcShowProductP.asp
- Right click and select 'Edit with Dreamweaver'
- Open the Find & Replace tool (CTRL+F); select “Open Documents” in the “Find In” menu; select “Source Code” in “Search” menu; do a find & replace on the following string:
Find: src="catalog/ Replace with: src="productcart/pc/catalog/ Find: src="<%=rslayout Replace with: src="productcart/pc/<%=rslayout Find: scStoreUseToolTip="1" Replace with: scStoreUseToolTip="2"
Save the 5 files.
Additional Code Changes
home.asp
This last 'Find & Replace' has to do with the fact that moving the AJAX product preview functionality to the root requires too many file changes. For this reason, perform the find and replace and make the following, additional edit to “home.asp”. Open “home.asp” and remove the include statement to the file “inc_PrdCatTip.asp”. Remove that line of code entirely.
homeCode.asp
There are three links that need to be manually updated:
Find: strArray(0,2)="showspecials.asp" Replace with: strArray(0,2)="productcart/pc/showspecials.asp" Find: strArray(1,2)="shownewarrivals.asp" Replace with: strArray(1,2)="productcart/pc/shownewarrivals.asp" Find: strArray(2,2)="showbestsellers.asp" Replace with: strArray(2,2)="productcart/pc/showbestsellers.asp"
Troubleshooting
In all the links above, remember to replace “productcart” with the name of the folder used on your store, in case you have renamed the “productcart” folder.
Images are broken
Make sure you have correctly performed the find & replace mentioned above:
Find: src="catalog/ Replace with: src="productcart/pc/catalog/
Buttons are not shown
Make sure you have correctly performed the find & replace mentioned above:
Find: src="<%=rslayout Replace with: src="productcart/pc/<%=rslayout
JavaScript Errors
If you are getting JavaScript errors on the page:
- Make sure that the following line has been removed completely from home.asp
<!--#include file="inc_PrdCatTip.asp"-->
- Make sure that links to any JavaScript (*.js) file that might be used by your header.asp file has been updated.