View Single Post
  #1  
Old 10-31-2004, 10:43 AM
 
fernando fernando is offline
 

Member
  
Join Date: Oct 2004
Posts: 29
 

Default Static page simulation. Search engine improvements

I wrote a mod that will generate a page which lists all products of the store with its description, simulating a static page. It makes use of Apache Rewrite Engine (mod rewrite).

A page mycatalog.html is dynamically created, and will list the products in the following way:

Name of the first product

Description of the first product

Name of the second product

Description of the second product

and so forth for the whole catalog. You can see it at work in http://mascotasmexico.com/tienda/lista.html (and yes, this is dynamically created)

(thanks Gijs for your help on seeing into template variables, which helped me nail this in relatively short time).

03.03.05 EDIT Please check my newest version of this mod at: http://forum.x-cart.com/viewtopic.php?p=80454#80454

These are the steps to install it (you don't need to change any of the original programs):

1. Create new template skin1/SEO_listing.tpl

Code:
{* Smarty Template by Fernando Borcel. MascotasMexico.com 2004/10/31 *} {foreach from=$products item=v key=k} {$products[$k].product} {$products[$k].descr}</p> {/foreach}

2. Create mycatalog.php on your xcart directory:

Code:
<?php /* Search Engine Enhancement by Fernando Borcel. MascotasMexico.com */ require "./auth.php"; $qry = "SELECT * FROM " . $sql_tbl["products"] . " where forsale='Y'"; $result = db_query($qry); $products = array(); while ($result_row = db_fetch_array($result)) { $products[] = $result_row; } $smarty->assign("products",$products); func_display("SEO_listing.tpl", $smarty); ?>

3. Add the following lines to your .htaccess file on xcart directory, that will map your "html" files to the actual php scripts, without redirecting.

Code:
RewriteEngine on Options +FollowSymlinks RewriteBase / RewriteRule ^(.*)-pid-([0-9]+)\.html$ /xcart/product.php?productid=$2 RewriteRule ^(.*)mycatalog.html$ /xcart/mycatalog.php

(change the /xcart/ directory if your webdir is something else)

4. Add a link somewhere in your customer/home.tpl or wherever you feel like, that might look something like:


Ideally this should not be a hidden link, but you want to place somewhere highly unlikely for users to click on it.

03.03.05 EDIT Please check my newest version of this mod at: http://forum.x-cart.com/viewtopic.php?p=80454#80454

I'd want to hear what you think of this, and if you have any improvements for it (which I'm sure there could be), I would be more than glad to hear from you!!

Regards
__________________
Fernando
Sorry, I\'m not using x-cart anymore, so I am unable to reply to enquiries about modules. Thank you.
Reply With Quote