Announcement:Materials and articles for ProductCart 5 can be found at our brand new support center.

Create an account to edit articles | See Formatting Syntax for Wiki syntax | We look forward to your contribution!

Creating custom Store Map page that uses your store's true (dynamic) header and footer

Applicability

The content of this article apply to the Store Map feature up to January 2011. In January of 2011 an update was released for the feature that solves the issues described in this article. The update was posted on the “Just In” section of the ProductCart technical support page.

Technical Issues

Problem: When you chose to generate your Store Map from the control panel, and you want to include your header and footer, you may get errors generating the file, or you may have dynamic content in your header or footer which you don't want rendered into static content (for example, tha AJAX-driven “Searching… Please Wait.” message display on page load). You might also run into pesky design issues by having your static store map page (StoreMap.html) saved to your /catalog/ folder.

Solution: Use the code below to create a custom page that will read your store map file into your true hearder.asp and footer.asp store interface.

Technical Note: Beause the StoreMap.html file is saved as a UNICODE file, Server Side Includes can't be used to include this file, nor can FileSystemObject be used to read the file. The solution is to use XMLHTTTP to read the file.

Basic Code

  • Create a blank, ASP page in your favorite HTML editor
  • Save it in the “pc” folder of your store (create a local directory structure on your desktop that mimics your online store)
  • Open the file and paste the following code in it
    <% response.Buffer=true %>
    <!--#include file="../includes/settings.asp"-->
    <!--#include file="../includes/storeconstants.asp"--> 
    <!--#include file="../includes/opendb.asp"-->
    <!--#include file="../includes/languages.asp"-->
    <!--#include file="../includes/currencyformatinc.asp"-->
    <!--#include file="../includes/stringfunctions.asp"-->
    <!--#include file="pcStartSession.asp"-->
    <!--#include file="header.asp"-->
    <% Dim rs, connTemp, query %>
    <%
    Function writeStoreMap()
    Dim strFullURL,strRelURL,objXMLHttp
    
    ' Build the fully qualified URL for the store map page:
    strRelURL=Request.ServerVariables("PATH_INFO")
    strRelURL=Replace(LCase(strRelURL),"productcart/pc/","")
    strRelURL=mid(strRelURL,1,InStrRev(strRelURL,"/")-1)
    If UCase(Trim(Request.ServerVariables("HTTPS")))="OFF" then
    	strFullURL="http://" & Request.ServerVariables("HTTP_HOST") & pcSecurityPath & "/catalog/StoreMap.html"
    Else
    	strFullURL="https://" & Request.ServerVariables("HTTP_HOST") & pcSecurityPath & "/catalog/StoreMap.html"
    End if
    
    ' Use XMLHTTP to read the contents (as the StoreMap.html file is saved in UNICODE, so SSI and FileSystemObject can't be used)
    Set objXMLHttp = Server.CreateObject("msxml2.serverXMLHTTP")
    objXMLHttp.Open "GET", strFullURL, False
    objXMLHttp.Send
    If objXmlHttp.status<>404 Then
    	writeStoreMap=filterResponse(CStr(objXMLHttp.responseText))
    Else
    	writeStoreMap="Store Map temporarily unavailable."
    End If
    Set objXMLHttp = NOTHING
    End Function
    
    Function filterResponse(strResponse)
    	' Strip out unwanted HTML tags:
    	strResponse=Replace(strResponse,"<html>" & VBCrLf,"")
    	strResponse=Replace(strResponse,"<head>" & VBCrLf,"")
    	strResponse=Replace(strResponse,"<title>Store Map</title>" & VBCrLf,"")
    	strResponse=Replace(strResponse,"</head>" & VBCrLf,"")
    	strResponse=Replace(strResponse,"<body>" & VBCrLf,"")
    	strResponse=Replace(strResponse,"<h3><b>Store Map</b></h3>" & VBCrLf,"")
    	strResponse=Replace(strResponse,"</body>" & VBCrLf,"")
    	strResponse=Replace(strResponse,"<html>" & VBCrLf,"")
    
    	filterResponse=strResponse
    End Function
    %>
    	<div id="pcMain">
    	<table class="pcMainTable">
    		<tr>
    			<td>
    			<h1>Store Map</h1>
    			</td>
    		</tr>
    		<tr>
    			<td>
    			<%=writeStoreMap%>
    			</td>
    		</tr>
    	</table>
    	</div>
    <!--#include file="footer.asp"-->

  • Save the page with whichever name you wish to use for it (e.g. store-map.asp) and upload it to the “pc” folder on your Web server.
  • Regenerate your Store Map in your control panel without including the header and footer.

You can now easily add content to your Store Map page here as well! For example, say you want to add the rest of your site's pages that aren't generated by the control panel tool. You could simply add your HTML for that like so:

	<div id="pcMain">
	<table class="pcMainTable">
		<tr>
			<td>
			<h1>Site Map</h1>
			</td>
		</tr>
		<tr>
			<td>
			<ul><li>Useful Links
				<ul>
					<li><a href="home.asp">Home Page</a></li>
					<li><a href="showbestsellers.asp">Best Sellers</a></li>
					<li><a href="shownewarrivals.asp">New Arrivals</a></li>
					<li><a href="showspecials.asp">Specials</a></li>
					<li><a href="showfeatured.asp">Featured Products</a></li>
					<li><a href="search.asp">Advanced Search</a></li>
					<li><a href="viewcategories.asp">Browse Catalog</a></li>
					<li><a href="Checkout.asp?cmode=1">My Account</a></li>
					<li><a href="contact.asp">Contact Us</a></li>
				</ul>
			</li></ul>
			</td>
		</tr>
		<tr>
			<td>
			<%=writeStoreMap%>
			</td>
		</tr>
	</table>
	</div>

contributed by Sean Connors of Web Merchant Services


QR Code
QR Code Creating custom Store Map page that uses your store&#039;s true (dynamic) header and footer (generated for current page)