Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Adding additional pages

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #11  
Old 11-11-2002, 09:47 AM
 
Cybro Cybro is offline
 

Advanced Member
  
Join Date: Nov 2002
Location: UK
Posts: 30
 

Default

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.
__________________
Regards

Graham

Site in Progress...
(Version 3.2.2 Gold)
Reply With Quote
  #12  
Old 11-12-2002, 02:09 AM
 
syddos syddos is offline
 

eXpert
  
Join Date: Sep 2002
Location: London, England, UK
Posts: 259
 

Default

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,
__________________
Syddos

Nothing is impossible, We just don't know how to do it ........Yet!

Xcart 4.1.X PRO (Testing Platform: winXP Pro)
Perl 5.8.7 (win32)
WINAMP 1.6.3 (win32 server package. Includes the following)
- phpMyAdmin v2.8.03
- MySql 5.0.21
- Apache 2.0.55 (win32)
- php 5.1.4
- SQLitemanager 1.2.0
Reply With Quote
  #13  
Old 11-12-2002, 04:42 AM
 
Cybro Cybro is offline
 

Advanced Member
  
Join Date: Nov 2002
Location: UK
Posts: 30
 

Default

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?
__________________
Regards

Graham

Site in Progress...
(Version 3.2.2 Gold)
Reply With Quote
  #14  
Old 11-14-2002, 10:39 AM
 
greggo greggo is offline
 

Member
  
Join Date: Oct 2002
Posts: 22
 

Default 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
Reply With Quote
  #15  
Old 11-14-2002, 02:58 PM
 
syddos syddos is offline
 

eXpert
  
Join Date: Sep 2002
Location: London, England, UK
Posts: 259
 

Default

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,
__________________
Syddos

Nothing is impossible, We just don't know how to do it ........Yet!

Xcart 4.1.X PRO (Testing Platform: winXP Pro)
Perl 5.8.7 (win32)
WINAMP 1.6.3 (win32 server package. Includes the following)
- phpMyAdmin v2.8.03
- MySql 5.0.21
- Apache 2.0.55 (win32)
- php 5.1.4
- SQLitemanager 1.2.0
Reply With Quote
  #16  
Old 11-26-2002, 08:24 AM
 
designfinger designfinger is offline
 

Newbie
  
Join Date: Nov 2002
Location: UK
Posts: 5
 

Default 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!!! )
Reply With Quote
  #17  
Old 11-26-2002, 10:23 AM
 
chris chris is offline
 

Senior Member
  
Join Date: Sep 2002
Location: UK
Posts: 145
 

Default 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
__________________
Chris
some carts at v4.4.5 security patched on a hardened managed unix server
Reply With Quote
  #18  
Old 03-15-2003, 06:17 AM
 
tcatrainer tcatrainer is offline
 

Advanced Member
  
Join Date: Nov 2002
Location: LI, NY
Posts: 50
 

Default 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%"}
Reply With Quote
  #19  
Old 03-16-2003, 04:49 PM
 
Darren Darren is offline
 

Member
  
Join Date: Dec 2002
Posts: 19
 

Default

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.
Reply With Quote
  #20  
Old 03-20-2003, 12:56 PM
  hzellers's Avatar 
hzellers hzellers is offline
 

Senior Member
  
Join Date: Mar 2003
Location: Cortland, New York
Posts: 106
 

Default

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
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


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

   

 
X-Cart forums © 2001-2020