| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Fake Real Static HTML Product Pages | ||||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||||
|
|||||||||
Fake Real Static HTML Product Pages
Fake Real Static HTML Product Pages
Jon Peters Written: Tuesday, March 23, 2004 ---------------------------------------------------- This mod will allow you to access your current pages as read from your database with a url like: http://www.yourstore.com/product/productid/ The productid will be the productid for the product you want to view. It does not require any database changes, or any compiling or creation of actual html pages. ---------------------------------------------------- DO NOT START THIS PROCESS WITHOUT READING STEP 8 FIRST!!!!!!!!!!!!!!!!!!!!!!! -> It's not fun! Be sure to know your full path to the files, and substitute it everywhere below where it says /full/path/to/files/ WARNING: This mod is a LOT of work, and takes knowledge of your store and it's inner workings to install. If you are expecting a complete list of steps here to fully integrate this, do not attempt this mod. Changes will need to be made specifically to your version of x-cart. We have a very customized version of an earlier version of x-cart, so I've tried to make these instructions more applied to the generic x-cart, but changes will be needed for your particular installation. I believe this will only work on apache servers. Be sure to back up, and don't blame me if your installation messes up, cause it works for me. LAST WARNING: This is meant as a guideline, not a step-by-step process!!! Got it? Ok, lets proceed... ---------------------------------------------------- ################################## # STEP 1 # ################################## By default, x-cart and smarty are setup to use directory structures which use includes with ./ and ../ We need to change this. Lets start by editing our config.php Backup config.php first!!! --------------------------- Find all areas such as these: Code:
and change them to: Code:
Find: Code:
Change to: Code:
Find: Code:
Change to: Code:
Find: Code:
Change to: Code:
UPLOAD AND MAKE SURE YOUR SITE STILL WORKS. IF IT DOESN'T, REUPLOAD FROM BACKUP AND TRY AGAIN. ################################## # STEP 2 # ################################## Download smarty.php and rename to smarty_staticpages.php Open smarty_staticpages.php Find: Code:
Change to: Code:
Find: Code:
Change to: Code:
Upload smarty_staticpages.php to the same folder as your smarty.php (which should be a directory level lower than your customer folder). ################################## # STEP 3 # ################################## Download your product.php and rename it to staticproduct.php At the very top of it (after the <? of course) put: NOTE: BE SURE TO EDIT THE $redirecturl VARIABLE. Code:
Still in staticproduct.php, change all references of Code:
to: Code:
Change all references of Code:
to: Code:
Change the include of smarty.php to instead include the file we upload earlier. Change: Code:
To: Code:
Change your smarty display to use a full path. I've changed smarty display paths so many times I don't remember what the original was, I think it was: Code:
Change it to: Code:
Save, Close and Upload to the same folder as product.php ################################## # STEP 4 # ################################## If you have an .htaccess file in your root directory (the directory that the customer folder resides in, not inside the customer folder) then edit it. Otherwise create a new .htaccess In it put: Code:
Upload it. ################################## # STEP 5 # ################################## Log in to telnet or ssh, whatever you use to connect via shell. This part is very important, it's creating a symlink between your pretend product folder and your staticproduct.php Change to your root directory (again, the directory that the customer folder resides in, not inside the customer folder) and type: Code:
(That's a lower case L) ################################## # STEP 6 # ################################## Open up your /customer/auth.php file Change all references of Code:
to: Code:
Upload it. ################################## # STEP 7 # ################################## Open up a static url with a valid productid such as: http://www.yourstore.com/product/productid/ NOTE: You must have a trailing slash after the productid. The productid variable is the same as normally passed through product.php?productid=whatever i.e. http://www.yourstore.com/product/productid/ ################################## # STEP 8 # ################################## You'll now be able to view your product, with 1 problem. All the links on this page are going to be referenced to the folder it's in, which is now wrong. When we were calling it from /customer/product.php?productid= we could use a link such as home.php to return to the store. Now we can't. We need to change everything to call /customer/filename.php instead. This includes all the links, the image.php's, form action's, etc. This is very tricky, as many links are hidden in module template files, and so forth. Only the links called from this current page will need to be changed, not your entire store, however some modules currently turned off, will also need to be changed when turned on, so you'll want to find them in advance. Here's a few templates to change for sure. Code:
Code:
You should now be able to refresh your static page and have images. Code:
Code:
If you have a search form or search links, those need changing. Bestsellers module /skin1/Modules/giftcertificates/gc_menu.tpl /skin1/Modules/Recommended_Products/recommends.tpl Reviews Module Upselling Products Module /skin1/Modules/Wishlist/wishlist.tpl /skin1/customer/menu_cart.pl /skin1/customer/main/product.tpl -------------------------------- LOGIN ISSUES -------------------------------- Check your auth.tpl and your authbox.tpl and log in and out on your static pages to make sure it works. I created seperate auth_store.tpl and authbox_store.tpl and changed the ../include/login.php reference and the <a href links. You'll probably have to edit your /include/login.php file as well as there are a lot of ../ references. If you have issues, rename your default login.php to login_staticpages.php call that from your auth_store.pl and authbox_store.tpl and hardcode all the header locations. I edited my staticpages.php to smarty assign redirect as product/$productid/ and then edited my login_staticpages.php to send error pages, etc. to /customer/... and direct logins and logouts to remain on this same static page. -------------------------------- CONCLUSION -------------------------------- Not a fun mod to implement, but it's very effective and saves lots of updates and compiling. |
|||||||||
#2
|
|||||||||
|
|||||||||
Note also, that this only reads the last folder, so you can fake a .html file after it, filled with keywords.
i.e. http://www.domain.com/product/1/fake_file_name_here.html http://www.domain.com/product/1/other_fake_name.html Will both load the same product. You can then build a .html name from the product title. I use: {$products[product].product|escape} |
|||||||||
#3
|
|||||||||
|
|||||||||
Very nice mod, anyone undertaking it though remember it will affect your future upgrade patches and make them a nightmare to implement (prepare for lots of coffee and lots of patching by hand) so only do it if your very confident with the system and have a cart you don't intend on upgrading very often.
Remember to BACK UP your site properly before undertaking a mod like the one above. We use a very similar method in a CMS we've been developing for another project. It's one area where apache servers come in very useful
__________________
Groovico Used by X-carters the world over: Marketing Manager Pro Bundle For X-cart Featured Product Manager for X-cart Feed manager pro for X-cart http://www.firetanksoftware.com Celebrating 7 Years of providing quality X-cart Add ons and X-cart Mods for x-cart 3.X to X-cart 4.4.X |
|||||||||
#4
|
|||||||||
|
|||||||||
Whew, one helluva a mod you got there. Looks interesting enough, haven't gotten a chance to implement it but may sometime soon. Only thing I'd like to add is if your good enough with regular expressions you could use apache mod_rewrite and setup rules for easy urls, like:
www.example.com/xcart/customer/product/34 34 being the product ID. Which is good for search engines especially, that and it just looks nicer. Anyhow, thanks for sharing the hard efforts!
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart. |
|||||||||
#5
|
|||||||||
|
|||||||||
very imressive mod!
but for search engines it alwasy better to have keywords in the URL. in that matter HTML catalogue works better because it allow you to include keywords in the product title.
__________________
CartTemplates | ASF Design Inc ~~~ CartTemplates.com | XCart Design - Custom design or Choose from thousands of templates that can be integrated with X-Cart. tel: +1 (416) 410-9995 |
|||||||||
#6
|
|||||||||
|
|||||||||
Quote:
The mod above has that, note the use of the productname.html portion which you can effectively configure for anything. You can be very creative with stuff like this as it can be taken many many stages further. Just because a site looks static these days, doesn't mean it is. You can make an html site look like it's php, php look like it's html, php look like it's asp. You can be really funny and force apache to parse .asp files as php, do a global file rename on everything in the x-cart install, and change all .php extentions to .asp and confuse the world into thinking there's an asp version of x-cart! I've seen some systems where the extension is changed to .m so you have no idea what the system is running on.
__________________
Groovico Used by X-carters the world over: Marketing Manager Pro Bundle For X-cart Featured Product Manager for X-cart Feed manager pro for X-cart http://www.firetanksoftware.com Celebrating 7 Years of providing quality X-cart Add ons and X-cart Mods for x-cart 3.X to X-cart 4.4.X |
|||||||||
#7
|
|||||||||
|
|||||||||
yep! I know that.
I actualy running similar thing on asfdesign.com in knowledge base url looks like there are directories, when the fact is, / being parsed and replaces with ? / and = when needed... what people won't do just to get to top of search engines
__________________
CartTemplates | ASF Design Inc ~~~ CartTemplates.com | XCart Design - Custom design or Choose from thousands of templates that can be integrated with X-Cart. tel: +1 (416) 410-9995 |
|||||||||
#8
|
|||||||||
|
|||||||||
Thanks for the feedback.
MOD REWRITE Mod rewrite can be server intensive, so I wanted to stay away from it. UPGRADES For people who want to install this and keep their x-cart upgrades manageable, I would just backup all the files you change now. When you upgrade, revert to the backed up files, do the upgrade, and then reapply this mod. Probably faster to reapply this mod than to spend time with .diff's KEYWORDS As mentioned, you can put keywords in the .html file name which can be anything. If you wanted to increase key words, you can always modify this (as mentioned you can be as creative as you wish) to add a secondary folder, so that you have http://www.domain.com/product/FAKE_KEYWORD_FOLDER/PRODUCTID/key_words_here_too.html |
|||||||||
#9
|
|||||||
|
|||||||
Hi Jon,
Great work on this mod. I think I got everything right up until step 7. I used the program Putty to connect via SSH and went to my directory that holds my customer folder. I then entered the command: ln customer/staticproduct.php product but then I get this message ln: 'product': File exists Does this mean the command worked and I just did not edit the pages correctly in the previous steps or do I need to enter a different command? Thanks. |
|||||||
#10
|
|||||||||
|
|||||||||
Can you type: pwd
And tell me what your current path is? It either means your working from the wrong path, or that you have a product folder already. The product folder can't exist, because it's going to become a faked folder. If you have an empty product folder below your customer directory, delete it, if you need the folder, you'll have to use a different name, like item. Then substitute "item" for "product" in your URLs. i.e. http://www.yourstore.com/item/productid/ |
|||||||||
|
|||
X-Cart forums © 2001-2020
|