X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Static page simulation. Search engine improvements (https://forum.x-cart.com/showthread.php?t=10128)

fernando 10-31-2004 10:43 AM

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

Gijs 10-31-2004 10:54 PM

Hi Fernando,

Works like a dream ... now !

First you have to check if the Rewrite module is loaded with Apache otherwise you'll get an internal server error.

Check at this section:
Quote:

# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Please read the file README.DSO in the Apache 1.3 distribution for more
# details about the DSO mechanism and run `apache -l' for the list of already
# built-in (statically linked and thus always available) modules in your Apache
# binary.

Personnally I would add categories and thumbs as well.

Nice Mod :wink:

Gijs

fernando 10-31-2004 11:05 PM

Good point. I'll update the mod so that it'll include all categories. I just finished a new mod so that customers will be able to see all the first-level sub-categories within the main category they're browsing. I'll post it here over the next few days ;) You can check it out @ my site.

Cheers,

Gijs 11-01-2004 12:08 AM

Re: Static page simulation. Search engine improvements
 
Quote:

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


I don't know what a hidden link is :?: :oops:

In CSS you could do the following and ... I hope this is not what you call a hiddenlink :lol:
Code:

.HiddenUrl {
        COLOR: #fbf6ce; TEXT-DECORATION: none;
}
.HiddenUrl:link {
        COLOR: #fbf6ce; TEXT-DECORATION: none;
}
.HiddenUrl:visited {
        COLOR: #fbf6ce; TEXT-DECORATION: none;
}
.HiddenUrl:hover {
        COLOR: #fbf6ce; TEXT-DECORATION: none;
}
.HiddenUrl:active  {
        COLOR: #fbf6ce; TEXT-DECORATION: none;


Match COLOR to the background colour of where you put the hyperlink (f.e. in bottom.tpl)
When hoovering you'll notice the "hand cursor" showing up for the rest it will be invisible.

<a class="HiddenUrl" href="mycatalog.html>Catalog</a>

xcell67 11-03-2004 12:44 AM

awesome mod

FYI, people using 3.5 and lower need to change

func_display("SEO_listing.tpl", $smarty);

to

$smarty->display("SEO_listing.tpl");

in mycatalog.php for this to work.

AJ-UKRS 11-12-2004 10:23 AM

Very nice mod... but can this be done in even a slightly better way...

shop is on domain1.com

but a page is generated on domain2.com and domain3.com etc

this way the all links can be put on the back of many high rank domains...

a suggestion...!

maybe a xml feed?

aop 11-15-2004 06:30 PM

Hi guys;
I'm running version 3.2.2, and I don't even have HTML Catalog feature.
This Mod seems can be very usable for me.
Any idea if would work in this old version 3.2.2 ?
Appreciate any help !
Thanks :)

PhilJ 11-23-2004 03:48 PM

Great mod - thank you - very versatile too. How can I display it within the xcart template?

fernando 11-23-2004 04:53 PM

Hi. I actually created it with search engines in mind, so applying a template wasn't of too much use. Maybe someone else will care to comment on this?

Regards

PhilJ 11-24-2004 05:05 AM

It's ok, I've found a way round it, thanks again.

Gijs 11-24-2004 05:42 AM

Hi PhilJ,

Quote:

Originally Posted by PhilJ
It's ok, I've found a way round it, thanks again.


Cool ! Could you share this with us ?

Thanks in advance

Gijs

PhilJ 11-24-2004 06:31 AM

I didn't actually manage to get it into the x-cart template :oops: I wish there was a tutorial on how to do so.

I actually used the mod to show a list of all products in stock, which opens up in a remote control popup window.

Just change the db query to

Code:

$qry = "SELECT * FROM " . $sql_tbl["products"] . " where forsale='Y' AND avail>0 ";

and change the hyperlink to the product


GM 12-18-2004 05:27 PM

Nice Mod! This has great potential! :D

Zaja 12-19-2004 05:31 AM

If you want product thumbs in listing:

skin/SEO_listing.tpl

Code:

{* Smarty Template SEO_listing.tpl  by Fernando Borcel. MascotasMexico.com 2004/10/31 *}
{foreach from=$products item=v key=k}


{$products[$k].product}
 
{$products[$k].descr}
 
[img]{if $full_url}{$http_location}{else}{$xcart_web_dir}{/if}/image.php?productid={$products[$k].productid}[/img]

{/foreach}


Demo: http://www.7dana.com/shop/all_products.html

Also, make your mycatalog.html(all_products.html) a valid HTML, spiders appreciate this.
http://validator.w3.org/check?uri=http://www.7dana.com/shop/all_products.html

aop 12-20-2004 09:56 AM

Hi there;
I'm in the process to upgrade from 3.2.2 to 4.x.x and one of the reason of my upgrading was the access to "HTML Catalog" feature, which I didn't have on 3.2.2. All my efforts are pointed to Search engines specially Google ( I have very good results on MSN, Yahoo, etc but terrible on Google).
Well, my simple question is if this Mod "simulating a static page" is the same thing ( do the same job ) of HTML Catalog; if not which would be better, or maybe I can use both and improve my position on Search Engines, etc.
Appreciate any help !
Thanks
Aldo

jimskodi 12-28-2004 08:11 AM

does this replace the html catalog or ?
 
Can we use this and the html catalog that is created? I would like to have it for all of my subcategories, did you ever get that finnished?

and when I add or change an item is it automatically updated or what do I have to do to run it if anything?

I want to install this soon. Jim

GM 01-04-2005 01:37 PM

This mod is great but needs a little work. If you click through a link and go to a product lets say http://www.mysite.com/catalog/big_fat_widget_1.html (using html pages) and then try to add the product to cart you will be redirected to http://www.mysite.com/catalog/big_fat_widget_1cart.php?mode=add is there a workaround for this?

markwhoo 01-04-2005 02:27 PM

Quote:

Originally Posted by GM
This mod is great but needs a little work. If you click through a link and go to a product lets say http://www.mysite.com/catalog/big_fat_widget_1.html (using html pages) and then try to add the product to cart you will be redirected to http://www.mysite.com/catalog/big_fat_widget_1cart.php?mode=add is there a workaround for this?


I think this mod was written more for spider effect than function effect.

The way it is laid out, it would so just that successfully.

If you just want to list all products add thumbs and use for listing for a single order type sheet, then you are talking about the need for function for the end user? or quick list for admin use?

There is another thread right now doing just that for an end user use...

markwhoo 01-05-2005 08:04 PM

So Fernando, Gijs Tell me,

Which of the two methods are really the best for spidering.

The one fernando came up with first or the one that PhilJ came up with.

Reason I ask is Fernandos goes nowhere to link to nothing, just shows products and info. So how effective is this?

Second PhilJ's goes to the php files, which HTML is best for spidering.

Which of these two methods will really do the best job. Maybe I am issing something here.

Do I try to duplicate the files and make them both and watch the logs or what?

Anyone have thoughts on this?

GM 01-05-2005 09:34 PM

I got it... if you put your full URL in the link full list of stuff
it WORKS!!!! 8O

jimskodi 01-06-2005 08:45 AM

What about the way lite commerce handles this
 
In lite commerce you have a product showcase Organizer - free add on where you can tell what 3 styles to show to the public.

list, table or icon.

table - would be the way to go.

If you change it to table it gives you the title - price and buy it now.

so if you switch to this table and create a catalog with it and then switch back to the icon option you then have static pages which are just words and they can order. How do we get this on x-cart gold? is it possible?

http://www.litecommerce.com/addon.html?addon=showcase

and what if we gave the customer the option to switch between all 3 choices.. it would make browsing your website a littel more fun, convienent, like they are in control of the shopping experience.

B00MER 01-18-2005 12:07 PM

Nice modification :D

I tweaked it some. Added a different link on the image to help with SEO, along with adding the usual html/body junk. H3 used on product titles, style sheet of xcart used in case someone does click through. I also changed the sql query to return the latest added products to keep events current with search engine findings. I also corrected a bug if a product title had a /w to shorten with, the cart would break. :idea:

skin1/SEO_listing.html:
Code:

{ config_load file="$skin_config" }
<html>
<head>
<title>{$lng.txt_site_title} {$lng.txt_subtitle_home}</title>
{ include file="meta.tpl" }
<link rel="stylesheet" href="{$SkinDir}/{#CSSFile#}">
</head>
<body LEFTMARGIN=0 TOPMARGIN=0 RIGHTMARGIN=0 BOTTOMMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>

{* Smarty Template SEO_listing.tpl  by Fernando Borcel. MascotasMexico.com 2004/10/31 *}
{foreach from=$products item=v key=k}



<h3>{$products[$k].product}</h3>
{if $products[$k].descr}{$products[$k].descr}{else}{$products[$k].fulldescr}{/if}
 
[img]{if $full_url}{$http_location}{else}{$xcart_web_dir}{/if}/image.php?productid={$products[$k].productid}[/img]
 
<hr size=1>
</p>
{/foreach}

</body>
</html>


customer/listing.php:
Code:

<?php

/* Search Engine Enhancement by Fernando Borcel. MascotasMexico.com */

require "./auth.php";

$qry = "SELECT * FROM " . $sql_tbl["products"] . " where forsale='Y' order by add_date DESC";
$result = db_query($qry);

$products = array();

while ($result_row = db_fetch_array($result)) {
  $products[] = $result_row;
}


$smarty->assign("products",$products);
$smarty->display("SEO_listing.tpl", $smarty);

?>


.htaccess file:
Code:

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


Keep in mind this store was running off the main public_html/ directory, and not a sub directory like xcart/

so my links is example.com/customer/listing.html

Kudos! 8)

GM 01-18-2005 12:52 PM

You still da' BOSS BOOMER! By the way, hows Baby BOOMER coming along? :D

PDI 01-28-2005 12:29 PM

Boomer,

I tried your mod, but it doesn't seem to be working.

When I go to www.mysite.com/customer/listing.html, I get the following error:
Quote:

Warning: main(./auth.php): failed to open stream: No such file or directory in /home/mysite/public_html/customer/listing.php on line 5

Warning: main(./auth.php): failed to open stream: No such file or directory in /home/mysite/public_html/customer/listing.php on line 5

Fatal error: main(): Failed opening required './auth.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/mysite/public_html/customer/listing.php on line 5
My x-cart is also installed in the root public_html directory, so it should work the same for me as it does for you.
Also, the original mod in this thread said to create "SEO_listing.tpl" but your mod says "SEO_listing.html." Was this an oversight/typo on your part, or should it really by .html?
Any ideas?
Thanks!

GM 01-28-2005 08:20 PM

Hi PDI, it's supposed to be .tpl and it goes in skin1/customer/ not in www/customer also, are you on a shared server? Because sometimes with a shared server (and only with certain scripts) you have to set up "full paths" ie. home/yourdomain/www/ . I know, because I've had to do this with some scripts.

nfc5382 01-29-2005 09:49 AM

excellent, thanks!

abbieroad 02-02-2005 05:55 PM

Quote:

Originally Posted by fernando
Good point. I'll update the mod so that it'll include all categories. I just finished a new mod so that customers will be able to see all the first-level sub-categories within the main category they're browsing. I'll post it here over the next few days ;) You can check it out @ my site.

Cheers,


Hey Fernando...did you ever post this mod for the sub-categories? If not, it would be great if you could do so...

Thanks!

mrbiggles 02-06-2005 07:06 PM

Hello
Thanks for the above mod, I finally worked out how to do it last night. Once I had it completed I tried the following link as suggested by someone else.

http://validator.w3.org/check?uri=http://www.creydall.com/coby/mycatalog.html

and recieved 977 errors which means it is not 4.01 compliant.
Is this a major problem? and will I still get search engines sniffing around and picking up the page.
Is there somewhere that will make it complient like a shareware filter that will adjust the format.
Regards Adam

GM 02-06-2005 07:33 PM

google, msn and yahoo will all index it.

mrbiggles 02-06-2005 07:36 PM

One less thing to worry about
thanks for the reply.
Regards Adam

GM 02-13-2005 01:59 PM

I forgot to mention... it will take about 6-8 months to see your site anywhere pleasing on google if you are in a highly competitive category. (google sandbox) I built a super seo mod that put me at the top of msn for a ton of gold jewelry and diamond keywords with the highest competition being 126,000,000 but google hasn't picked me up yet. :roll:

andyng 03-01-2005 10:36 PM

Static page simulation. Search engine improvements
 
Hi Ferrando,

I have tried your mod and it works great.

However, would you mind to made the listing mod sorted by ascending order?


Andy
X-cart V. 4.7.0

andyng 03-01-2005 10:57 PM

Static page simulation. Search engine improvements
 
Hi Ferrando,

I have made the change of the mod which can display the listing by ascending order.

Andy

fernando 03-03-2005 12:45 PM

For those asking for the mod to look integrated with x-cart look and feel, and sorted output, you can use the following code:

Replace SEO_listing.php with:

Code:

<?php

require "./auth.php";
require $xcart_dir."/include/categories.php";

$qry = "SELECT * FROM " . $sql_tbl["products"] . " where forsale='Y' order by product";
$result = db_query($qry);

$products = array();

while ($result_row = db_fetch_array($result)) {
  $products[] = $result_row;
}

$smarty->assign("main","SEO_listing");
$smarty->assign("products",$products);
func_display("customer/home.tpl", $smarty);

?>


Open skin1/customer/home_main.tpl. Go to the very end and look for:

Code:

{else}
{include file="common_templates.tpl"}
{/if}


Before that, add:

Code:

{elseif $main eq "SEO_listing"}
{include file="SEO_listing.tpl"}


Lastly, replace skin1/SEO_listing.tpl with:

Code:

{* Smarty Template by Fernando Borcel. MascotasMexico.com 2004/10/31 *}

{capture name="productslist"}
Enter the store


{foreach from=$products item=v key=k}
 

{$products[$k].product}

  {$products[$k].descr}</p>
{/foreach}


Enter the store


{/capture}

{include file="dialog.tpl" title="Products" content=$smarty.capture.productslist extra="width=100%"}


.htaccess should include the code: (remember to change /xcarthome with the web directory that your store is at, e.g. /xcart.

Options -Indexes

Code:

RewriteEngine on
Options +FollowSymlinks
RewriteBase /
RewriteRule ^(.*)-pid-([0-9]+)\.html$ /xcarthome/product.php?productid=$2 [L]
RewriteRule ^(.*)list.html$ /xcarthome/SEO_listing.php [L]


To invoke the script, call http://your.store.com/xcarthome/list.html

I didn't get around printing the categories too. Maybe I'll hack my own site map mod to handle some mod rewrite in the same manner as this products listing.

andyng 03-03-2005 06:56 PM

Static page simulation. Search engine improvements
 
Hi fernando,

I have tried you new mod which works fine and wonderful.

Many thank for your effort and share with us.

Regards,

Andy

moza 03-17-2005 06:47 PM

I tried to get this code to working but everytime I tried I got error on this line:

Quote:

Originally Posted by fernando
while ($result_row = db_fetch_array($result)) {


The error message is like this:
Parse error: parse error, unexpected T_VARIABLE in /Applications/MAMP/htdocs/test_001/xcart_412/customer/listing.php on line 13

I have checked everything, and still get this error, I am testing with 4.012 and also I have tried with 3.7 and other versions and same result.

I put files in the same folder that you mentioned here in this page.
What do you think would be the cause of this error.

Regards,
Moza

hooter 03-17-2005 06:55 PM

Quote:

Originally Posted by moza
I tried to get this code to working but everytime I tried I got error on this line:

Quote:

Originally Posted by fernando
while ($result_row = db_fetch_array($result)) {


The error message is like this:
Parse error: parse error, unexpected T_VARIABLE in /Applications/MAMP/htdocs/test_001/xcart_412/customer/listing.php on line 13


Check for a missing close bracket } and/or one too many

fernando 03-17-2005 07:07 PM

Quote:

Originally Posted by moza
The error message is like this:
Parse error: parse error, unexpected T_VARIABLE in /Applications/MAMP/htdocs/test_001/xcart_412/customer/listing.php on line 13


Hi, I would try and copy the code for listing.php from scratch, it seems that there might be some line(s) missing on the code you copied.

moza 03-17-2005 07:16 PM

Thanks for prompt respond,

Quote:

Originally Posted by hooter
Check for a missing close bracket } and/or one too many


This is the code that I am using:

Code:

<?php

 /* Search Engine Enhancement by Fernando Borcel. MascotasMexico.com */

 require "./auth.php";

 $qry = "SELECT * FROM " . $sql_tbl["products"] . " where forsale='Y' order by add_date DESC";
 $result = db_query($qry);

 $products = array();

 while ($result_row = db_fetch_array($result)) {
 б═ $products[] = $result_row;
 }


 $smarty->assign("products",$products);
 $smarty->display("SEO_listing.tpl", $smarty);

 ?>


mrbiggles 03-17-2005 07:22 PM

This is my code and it seems to work for me

Code:

<?php

require "./auth.php";
require $xcart_dir."/include/categories.php";

$qry = "SELECT * FROM " . $sql_tbl["products"] . " where forsale='Y' order by product";
$result = db_query($qry);

$products = array();

while ($result_row = db_fetch_array($result)) {
  $products[] = $result_row;
}

$smarty->assign("main","SEO_listing");
$smarty->assign("products",$products);
func_display("customer/home.tpl", $smarty);

?>


Regards Adam


All times are GMT -8. The time now is 07:02 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.