X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Adding additional pages (https://forum.x-cart.com/showthread.php?t=479)

mekro 10-30-2002 07:23 AM

Adding additional pages
 
Hi all

I'm a little new to all this :oops: and have just started so what i would like to know is:

How can i add additional php pages to the script, i will be using it for things like full news page, partner page etc etc.

If anyone can help me in this i would appricate it :D .

Thanks
Kirk

ArmyNavy 10-30-2002 11:33 AM

Me, too. I'll need to add a number of extra pages.

Thanks. :)

Jeannie 10-30-2002 11:44 AM

Maybe this idea is too simplistic for your needs but could you just add some html pages for your "extra pages"?

ArmyNavy 10-31-2002 03:26 AM

Hi Jeannie

Yes, you could, but would they retain the session id?

What I'm concerned about is having the page parsed by the cart so that the shopping session is preserved.

Thanks. :)

Ian 10-31-2002 04:11 AM

Try the FAQ in the members area of X-Cart. It is explained there how to add additional pages.

Hope that helps
Ian
:D

ArmyNavy 10-31-2002 04:22 AM

Thanks, Ian. :)

Here it is:

Quote:

Q: I want to add aditional text page to X-cart where I can place some additional info about my site, how it can be done?
A: 1. First you have to edit template customer/home.tpl

Create new menu item that will point to your page, you can put it for example after help menu section (the code between HTML comments):

{ include file="help.tpl" }

<table border=0 cellPadding=5 cellSpacing=0 width=100%>
<tr><td colspan=2 class="TableLeftElements">
About us
</td></tr>
</table>

</td>
<td width=20> </td>
<td valign=top>



Then add selector which will diplay your About Us template in the center of the cart:



{if $smarty.get.mode eq "subscribed"}
{include file="main/subscribe_confirmation.tpl"}


{elseif $smarty.get.mode eq "about_us"}
{include file="main/about_us.tpl"}


{elseif $smarty.get.mode eq "unsubscribed"}
{include file="main/unsubscribe_confirmation.tpl"}

2. Then create About Us template that will be displayed in the center, create file skin1/main/about_us.tpl and put the following lines there:

{ include file="location.tpl" last_location="About Us"}
{capture name=dialog}
Put your about us text here...
{/capture}
{ include file="dialog.tpl" title="Information about our company" content=$smarty.capture.dialog extra="width=1 00%"}

Jeannie 10-31-2002 06:31 AM

So you're saying that unless the additional pages are generated by xcart that the session id is not preserved? If there are cart contents they are removed if the shopper ventures off to html pages under the same domain or other sites? I thought the cart stayed in tact until the browser was closed. :?

chris 10-31-2002 08:49 AM

I think there is another way
 
I had this problem with fcart and the developers told me to add this code snippet at the top of the page - I believe it will also work for xcart. The idea is that it preserves your session id when moving outside xcart as such - it certainly works for fcart

Code:

<? session_register("id") ?>

Insert that snippet at the top of your standard html page and then rename your page filesomething.php

Hope this helps

quote for today: get on your bike !!

ice 11-03-2002 12:37 PM

Re: Additing Additional Pages
 
Where does this code snipet actually go...on what page...

Does it go on the home.tpl


Then add selector which will diplay your About Us template in the center of the cart:



{if $smarty.get.mode eq "subscribed"}
{include file="main/subscribe_confirmation.tpl"}


{elseif $smarty.get.mode eq "about_us"}
{include file="main/about_us.tpl"}


{elseif $smarty.get.mode eq "unsubscribed"}
{include file="main/unsubscribe_confirmation.tpl"}

syddos 11-08-2002 01:11 AM

Hi Ice,

you would put the code at the top of your HTML FILE as follows.

<? session_register("id") ?>
<HTML>
<HEAD>
<TITLE>Page title</TITLE>
</HEAD>
<BODY>

-------- body code here --------

</BODY>
</HTML>

Change the file extension from "filename.htm or html", to "filename.php"

Regards,

Cybro 11-11-2002 09:47 AM

Quote:

Q: I want to add aditional text page to X-cart where I can place some additional info about my site, how it can be done?
A: 1. First you have to edit template customer/home.tpl

Create new menu item that will point to your page, you can put it for example after help menu section (the code between HTML comments):

{ include file="help.tpl" }

<table border=0 cellPadding=5 cellSpacing=0 width=100%>
<tr><td colspan=2 class="TableLeftElements">
About us
</td></tr>
</table>

</td>
<td width=20> </td>
<td valign=top>


Ok, so I added:
Quote:


<table border=0 cellPadding=5 cellSpacing=0 width=100%>
<tr><td colspan=2 class="TableLeftElements">
About us
</td></tr>
</table>

(the code between HTML comments)

Quote:

Then add selector which will diplay your About Us template in the center of the cart:


{if $smarty.get.mode eq "subscribed"}
{include file="main/subscribe_confirmation.tpl"}


{elseif $smarty.get.mode eq "about_us"}
{include file="main/about_us.tpl"}


{elseif $smarty.get.mode eq "unsubscribed"}
{include file="main/unsubscribe_confirmation.tpl"}

Where does this code go?
I'm using version 3.2.1 and I see no reference to
Quote:


{if $smarty.get.mode eq "subscribed"}
{include file="main/subscribe_confirmation.tpl"}
to add the code between HTML comments.

syddos 11-12-2002 02:09 AM

Quote:

Originally Posted by Graham
Where does this code go?
I'm using version 3.2.1 and I see no reference to
Quote:

{if $smarty.get.mode eq "subscribed"}
{include file="main/subscribe_confirmation.tpl"}

to add the code between HTML comments.


You can ignore the above code, if it's not in your home.tpl. I think in your version of xcart, the above code is located in the common_templates.tpl file. It's not required for your "About Us.tpl" page.

Regards,

Cybro 11-12-2002 04:42 AM

Quote:

Originally Posted by syddos
You can ignore the above code, if it's not in your home.tpl. I think in your version of xcart, the above code is located in the common_templates.tpl file. It's not required for your "About Us.tpl" page.

Regards,


Thanks, syddos :) :)
You gave me a push in the right direction. The code was in skin1/customer/home_main.tpl

So if I'm correct for those using version 3.2.1 and are confused on how to add additional text pages, here's a clearer description than the one in the member account FAQ:

Quote:

Create a new menu item in customer/home.tpl that will point to your page, you can put it for example after help menu section (the code between HTML comments):

{ include file="help.tpl" }

<table border=0 cellPadding=5 cellSpacing=0 width=100%>
<tr><td colspan=2 class="TableLeftElements">
About us
</td></tr>
</table>

</td>
<td width=20></td>
<td valign=top>



Then add selector in skin1/customer/home_main.tpl which will display your About Us template in the center of the cart:


{if $smarty.get.mode eq "subscribed"}
{include file="main/subscribe_confirmation.tpl"}


{elseif $smarty.get.mode eq "about_us"}
{include file="main/about_us.tpl"}


{elseif $smarty.get.mode eq "unsubscribed"}
{include file="main/unsubscribe_confirmation.tpl"}

2. Then create About Us template that will be displayed in the center, create file skin1/main/about_us.tpl and put the following lines there:

{ include file="location.tpl" last_location="About Us"}
{capture name=dialog}
Put your about us text here...
{/capture}
{ include file="dialog.tpl" title="Information about our company" content=$smarty.capture.dialog extra="width=100%"}


This works for text fine, but now all I need to do is work out how to include php pages such as a php helpdesk :?

Any ideas? :wink:

greggo 11-14-2002 10:39 AM

Adding PHP to pages
 
So I'm with Graham, this is great for adding plain old text, but what if that text is data-driven? Is there any way to call data from a database and display it on cart pages :?:

syddos 11-14-2002 02:58 PM

Hi,

I had this problem when I first set eyes on xcart, and tried my first mod, (August 2002), I quickly discovered that the include "../include/get_language.php"; statement in some php files is responsible for transferring text from the database to your web pages.

WARNING! This file should only be called (included once) within any single web page request, otherwise you will get faults with messages like headers already started in ...../some other file

Example.
Quote:

Originally Posted by contents of auth.php
$current_area="C";

include "../include/partner_info.php";

include "../customer/referer.php";

include "../include/check_useraccount.php";

include "../include/get_language.php";

include "../customer/minicart.php";

include "../include/atracking.php";

if($active_modules["Subscriptions"]) {
if ($login) {
include "../modules/Subscriptions/get_subscription_info.php";
$smarty->assign("user_subscription", is_user_subscribed($login));
}
}

$smarty->assign("redirect","customer");


Quote:

Originally Posted by contents of home.php
$Id: home.php,v 1.28 2002/09/03 11:58:26 zorg Exp $
#

require "../smarty.php";
require "../config.php";
@include "./https.php";
require "./auth.php";


require "../include/categories.php";

if (!empty($cat))
require "./products.php";

require "./featured_products.php";

if($active_modules["Bestsellers"])
include "../modules/Bestsellers/bestsellers.php";

if(!empty($current_category)) $location = $category_location;
#
# Assign Smarty variables and show template
#

$smarty->assign("main","catalog");
$smarty->assign("location",$location);
$smarty->display("customer/home.tpl");
#


You will notice that home.php includes or requires auth.php, and that none of the files in auth.php is repeated in home.php.

One thing I not tried yet, is to see if the order in which the require file.php or include/file.php matters.

My website home page (not xcart home page) is generated by the xcart smarty/php code, and uses the xcart SQL database to store text and graphics. I also added a new $usertype of "V" (Visitor), with a "Enter Store" link from the website home page to xcart /customer/home page.

One other note: My development site (not the one in the "member websites") has only one original xcart element on the page ("search/categories"), all other elements are accessed by links, I had to write php files to sit between my link and the called php files. Why? The called smarty and php files assigned variables etc to the elements, and expected these elements to already be on the page, with assigned variables storing data to be passed to the called php file. When the elements were not found, smarty would produce error after error.

I'm no smarty/php expert, however when I need to do something, I learn just what code (smarty/php) I need to do the job, or copy an existing php function, change the arguments for my job and use that. I have been programming in JavaScript for some years, so I do understand a lot of the php code, it's smarty that normally trips me up.


Regards,

designfinger 11-26-2002 08:24 AM

About us page..... can't get it to work
 
Hi,
can anyone help me. I've tried and tried desperately to get the about us page to work as per:

************************************************** **********
Q: I want to add aditional text page to X-cart where I can place some additional info about my site, how it can be done?
A: 1. First you have to edit template customer/home.tpl

Create new menu item that will point to your page, you can put it for example after help menu section (the code between HTML comments):

{ include file="help.tpl" }

<table border=0 cellPadding=5 cellSpacing=0 width=100%>
<tr><td colspan=2 class="TableLeftElements">
About us
</td></tr>
</table>

</td>
<td width=20> </td>
<td valign=top>



Then add selector which will diplay your About Us template in the center of the cart:



{if $smarty.get.mode eq "subscribed"}
{include file="main/subscribe_confirmation.tpl"}


{elseif $smarty.get.mode eq "about_us"}
{include file="main/about_us.tpl"}


{elseif $smarty.get.mode eq "unsubscribed"}
{include file="main/unsubscribe_confirmation.tpl"}

2. Then create About Us template that will be displayed in the center, create file skin1/main/about_us.tpl and put the following lines there:

{ include file="location.tpl" last_location="About Us"}
{capture name=dialog}
Put your about us text here...
{/capture}
{ include file="dialog.tpl" title="Information about our company" content=$smarty.capture.dialog extra="width=1 00%"}
************************************************** *********

I've edited the code in home.tpl and home_main.tpl as specified, and i have created a file "about_us.tpl" in folder skin1/main/about_us.tpl.

All i'm getting is:

"Parse error: parse error in /home/folder/public_html/V2/Cart/templates_c/N17/N1714041693/0.php on line 12"

on the home page and the about us link refuses to work.

What's wrong with it? Is there a typo error in the information given in the FAQ?

I can't seem to be able to change the file CHMOD settings through CuteFTP either from 666 to 777. Does anyone else find this?


I hope someone can help me,
many thanks in advance,

Mark ("Frustrated Carter!!! :-( )

chris 11-26-2002 10:23 AM

CHMOD & cuteftp
 
Hi Mark,
I am sorry I just do not have the time to sort out your main problem but as I use cuteftp it would be churlish of me if I did not at least answer this side for you.

CHMOD will only work if the server permits you to make chmod changes - pls contact your host as I have never found any problems with cuteftp and I have used various versions from 2.4 to 4.2 without this problem.

Sorry I could not help you with your main problem - but I am sure one of the other members will go to your assistance.

If you have not heard anything further by the end of the day then pm me and I will try and sort it out.

Chris

tcatrainer 03-15-2003 06:17 AM

some more notes on static pages multiple langauges
 
Instead of modifing customer/home.tpl You can add the links to the skin1/help.tpl


This avoids what looks like a
(but is actually the <table>)

You can also, I assume, make a label in langauges on the provider section so the label for this section changes with the language. But your content on those pages will be in the language you wrote it in. I am thinking you could
add a text in languages for each file you create

ex about_us.tpl would contain
Code:

{ include file="location.tpl" last_location="About Us"}
{capture name=dialog}

{$lng.txt_about_us}
    # I believe this is teh correct syntax
    # but will need to match whatever you call the content.

{/capture} { include file="dialog.tpl" title="About Us" content=$smarty.capture.dialog
extra="width=100%"}


Darren 03-16-2003 04:49 PM

I make several pages and use the following method.
You can modify the page names (ie., information.tpl) to whatever you want, but it will probably be easier the first time to do it exactly as I show so it won't be so confusing.

Here it is step by step:

1. Make a copy of help.tpl and call it information.tpl
2. Open the new information.tpl and change each link that has
"help.php?section" to "home.php?mode"
3. Change each word/phrase after the "=" sign to whatever your topic is for that link. For instance, here is one of my links.
Code:

<a href="home.php?mode=whatis">

4. Next, go ahead and put your language label there even though you haven't set it up in the language area.
For instance, one of mine is
Code:

{$lng.lbl_whatisabattery}

5. Your entire new link should look like this:


6. Enter as many links as you need after the
, but write down the word you used for the mode and also the label tag. You will need that info and it will save you from having to go back and forth.

7. Go to the language link in the admin menu, select English (if that's your primary language), and add each new label. Hint: you have to scroll down to the bottom of the page. :) Doublecheck your entries to avoid problems.

8. Next, go to your ./customer/main directory and make a new file including the extension ".tpl". For mine, I made one called whatis.tpl

9. Open up each new file. It should be totally blank.

Put this:


Code:

{ include file="location.tpl" last_location="What is a Battery"}
{capture name=dialog}
{$lng.txt_whatis}
    {/capture} { include file="dialog.tpl" title="What is a Battery?" content=$smarty.capture.dialog
extra="width=100%"} 


See where it says "last_location=What is a Battery"? That is what will show up in the location text that is present on each customer page.

Where it says "title="What is a Battery?" will show in the colored dialog box that is also on every customer page.

Both of these can be changed to whatever you decide later.

10. In the code above, you see the {$lng.txt_whatis} ?
That's what we're going to fix next. That is the actual text that smarty pulls from your language text area. I called mine "txt_whatis". You can call yours whatever you want.

So, go BACK to the language link in the admin menu and select English but this time we want to select the "text" pulldown in the Topic listing. Scroll down to add your file name, but be sure it's the exact same name as what is on the .tpl pages you just made. Write each label like "txt_whatis", NOT like this "$lng.txt_whatis . Write your description and value for each txt entry. The value will be all the text you want to show up on the page. HTML is acceptable here.

11. Go to customer/home_main.tpl and add this code for each link/page you just made
Code:

{elseif $smarty.get.mode eq "whatis"}
{include file="customer/main/whatis.tpl"}



12. Finally, the last thing you need to do is place your new section (information.tpl) on the customer page. Simply go to customer/home.tpl and drop your new section wherever you want it to show. I placed mine just about the Help section, so it looks like this:

Code:

{ include file="information.tpl" }


{ include file="help.tpl" }



That's it. It's actually easier than all this sounds, but I wanted to go step by step to make it easy. The main thing is to make sure you are consistent with what you call things so as to avoid confusion.

I suggest using the exact names as I did just to see how it works and than just go back and change to your likings.

Hope this helps.

hzellers 03-20-2003 12:56 PM

Great stuff and easy to grasp. One question, do you think this is Google-friendly? I know a lot of engines (not necessarily Google) choke on pages with ?'s and some ignore them because they tend to be the calling card of self-replicating pages.

Is there a way to create additional pages that preserve the xCart layout yet do not contain ?'s in the URL? While we'd prefer to have .html pages, we're concerned about preserving the session so that carts don't disappear.

It's quite a balance between usability and search engine consideration, so any insight would be great!

Heather

tcatrainer 03-21-2003 01:38 PM

yes I was wondering about how the spiders search these pages
 
Maybe we can modify an HTML catalog page to use for FAQ etc

OR
does the HTML catalog produce these added pages in addition to catalog items?

jlmaz 03-29-2004 02:51 PM

Adding new php section
 
In case it helps anyone else, here are the steps I took to add a new php section called "Articles" to our site. If you notice that I've left out anything critical, please let me know. (I don't know php or smarty, so make no promises that this is correct.) I'm also using a very old version of X-cart (3.1.1.3, customized, that has been combined with one part of 3.3.8.) so your mileage may vary. At any rate...

IN THE SHELL:
- copy customer/help.php to customer/articles.php, make changes on NEW articles.php file
the code needed is:

Code:

require "../smarty.php";
require "../config.php";
@include "./https.php";
require "./auth.php";
require "../include/categories.php";

require "../include/articles.php";

$smarty->display("customer/home.tpl");
?>


- copy include/help.php to include/articles.php, make changes on NEW articles.php file
the code needed is:

Code:

$smarty->assign("main","articles");
$smarty->assign("articles_section",$section);

?>



IN X-CART ADMIN VIEW UNDER LANGUAGES:
- Choose your desired language
- Make sure "Labels" is selected in the "Select topic" dropdown box
- Scroll down to "Add new entry" and add your new entry. (In my case, I added "lbl_supermodels", "Model Releases Aren't Just for Supermodels", and "Model Releases Aren't Just for Supermodels" to the fields)
- Click the "Apply changes" button
- Repeat as necessary for each article you intend to add.


IN X-CART ADMIN VIEW UNDER EDIT TEMPLATES:

- edit common_templates.tpl and add

Code:

{elseif $main eq "articles"}
{include file="articles/index.tpl" section=$articles_section}


(I added it after the help section, but it probably doesn't matter much where you add it.)

- add a new file called articles.tpl

- edit your newly created articles.tpl file and use this:

Code:

<TABLE border=0 cellPadding=5 cellSpacing=0 width=100%>
<TR>
<TD width="26" height=26 class=MenuTitleLine>[img]../{ #ImagesDir# }/dingbats_news.gif[/img]</TD>
<TD class=MenuTitleLine height=26 valign=center width="80%"><font class=TableLeftTitles>Articles</font></TD>
</TR>
<tr><td colspan=2 class="TableLeftElements">
{$lng.lbl_supermodels}

</td></tr>
</table>


(Make changes as needed.)

- add a new directory called articles

- go to the newly created articles directory and within it add a new template file called articles.tpl. The code needed is:

Code:

{capture name=dialog}
<table border=0 cellspacing=0 cellpadding=0 width=100%>
<tr><td colspan="4" valign="top" height="10" class="TableCenterSmallText"></td></tr>
<tr>
<td height="15" class="TableCenterSmallText">
Add whatever text you want here.



{$lng.lbl_supermodels}
</td>
</tr>
</table>
{/capture}
{include file="dialog.tpl" title="Articles" content=$smarty.capture.dialog extra="width=100%"}


(Make changes as needed. You can call your sections anything you like, and can have multiple sections - one per article - just like the help files do.)

- still under the articles directory, add another new template file within it called index.tpl. The code needed in that one is:

Code:

{if $section eq "supermodels"}
{include file="articles/supermodels.tpl"}

{elseif $section eq "article2"}
{include file="articles/article2.tpl"}

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


- Next add as many new template files under the articles directory as you like. (One for each article.) I added one called supermodels.tpl. The basic-code needed for those files is:

Code:



{capture name=dialog}


Content goes here.</p>
{/capture}
{include file="dialog.tpl" title=$lng.lbl_supermodels content=$smarty.capture.dialog extra="width=100%"}


(change lbl name as needed, and edit your articles/index.tpl file as needed to add additional articles)

- Test to make sure it all worked by going to http://www.yoursitename.com/customer/articles.php

- If all is well at this point, make the Articles section visible on the main page of your site by editing customer/home.tpl

In my case, I added:

Code:


{ include file="articles.tpl" }


right after the include for categories

- Test again to make sure it worked correctly by going to the main page of your site.

Happy modifying :)

-Jackie

farvegruppen 05-15-2004 02:28 PM

In 3.7.0 you have the "speed bar". To make a new page tab in the speed bar called "about us", do this:

1. Add selector in skin1/customer/home_main.tpl which will display your About Us template in the center of the cart:


{if $smarty.get.mode eq "subscribed"}
{include file="main/subscribe_confirmation.tpl"}


{elseif $smarty.get.mode eq "about_us"}
{include file="main/about_us.tpl"}


{elseif $smarty.get.mode eq "unsubscribed"}
{include file="main/unsubscribe_confirmation.tpl"}

2. Then create About Us template that will be displayed in the center, create file skin1/main/about_us.tpl and put the following lines there:

{ include file="location.tpl" last_location="About Us"}
{capture name=dialog}
Put your about us text here...
{/capture}
{ include file="dialog.tpl" title="Information about our company" content=$smarty.capture.dialog extra="width=100%"}

3. Go to Administration/Speed bar:
Link titel "About us", URL "home.php?mode=about_us"

Juliann 05-18-2004 12:10 PM

Quote:

Originally Posted by farvegruppen
In 3.7.0 you have the "speed bar". To make a new page tab in the speed bar called "about us", do this:....


farvegruppen-

Thanx so much for the tip! I tried it with 3.7.x and it worked great!!!

Who says you can't build a whole ecommerce site with xcart in 4 days! :) I'll be going live in the 24 hours and now with some great "about us" type pages. I removed my speedbar, so I did steps 1 & 2 and added the appropirate link to my head.tpl.

-Juliann

www.speedniche.com
www.over6racing.com


All times are GMT -8. The time now is 03:58 PM.

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