Latest News: (loading..)

Archived

This topic is now archived and is closed to further replies.

TommyBerlin

Add new infopage

15 posts in this topic

The Version 3 is much different then the osCommerce before. So I tell you, how to get other pages into this.

 

First I define the language-files for the main content. Copy your definition to /includes/languages/en_EN.xml:

<definition>
  <key>breadcrumb_about_us</key>
  <value><![CDATA[About Us]]></value>
  <group>info</group>
</definition>

 <definition>
  <key>info_about_us_heading</key>
  <value><![CDATA[About Us]]></value>
  <group>info</group>
</definition>

<definition>
  <key>about_us</key>
  <value><![CDATA[Hier comes your text (you can use html) About US.]]></value>
  <group>info</group>
</definition>

To ceep the structure off Haralds programming I've copied it right under the definitions off the shipping -module (lines 1297, 1342, 1382). You can also copy it at the End of the file befor the last

  </definitions>
</language>

 

For the link in the information-box open /includes/languages/de_DE/modules/boxes/information.xml and put in the definition:

<definition>
  <key>box_information_about_us</key>
  <value><![CDATA[About Us]]></value>
  <group>modules-boxes</group>
</definition>

Now you can upload this files and import them with your admin-tool (Confiuration->Languages->Import->new records only)

 

Now we need the about_us.php! Make this file and copy it to the directory /includes/content/info

<?php
/*
New file: abuot_us.php
 $Id: password.php 64 2005-03-12 16:36:16Z hpdl $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2005 osCommerce

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License v2 (1991)
 as published by the Free Software Foundation.
*/

 class osC_Info_About_us extends osC_Template {

/* Private variables */

var $_module = 'about_us',
	$_group = 'info',
	$_page_title,
	$_page_contents = 'info_about_us.php',
	$_page_image = 'table_background_specials.gif';

/* Class constructor */

function osC_Info_About_us() {
  global $osC_Services, $osC_Language, $osC_Breadcrumb;

  $this->_page_title = $osC_Language->get('info_about_us_heading');

  if ($osC_Services->isStarted('breadcrumb')) {
	$osC_Breadcrumb->add($osC_Language->get('breadcrumb_about_us'), osc_href_link(FILENAME_INFO, $this->_module));
  }
}
 }
?>

When you read this code, you recognize that we need a file to get the content. Make a file called info_about_us.php and copy it to the direction /templates/default/content/info:

<?php
/*
New file: info_about_us.php
 $Id: $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2006 osCommerce

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License v2 (1991)
 as published by the Free Software Foundation.
*/
?>

<?php echo osc_image(DIR_WS_IMAGES . $osC_Template->getPageImage(), $osC_Template->getPageTitle(), HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT, 'id="pageIcon"'); ?>

<h1><?php echo $osC_Template->getPageTitle(); ?></h1>

<p><?php echo $osC_Language->get('about_us'); ?></p>

<div class="submitFormButtons" style="text-align: right;">
 <?php echo osc_link_object(osc_href_link(FILENAME_INFO), osc_draw_image_button('button_continue.gif', $osC_Language->get('button_continue'))); ?>
</div>

Everything good so far, we only need the links to our new site. Open the file /includes/modules/boxes/information.php and put the link where ever you like:

'  <li>' . osc_link_object(osc_href_link(FILENAME_INFO, 'about_us'), $osC_Language->get('box_information_about_us')) . '</li>' .

and open this file /templates/default/content/info/info.php and copy another link:

<li><?php echo osc_link_object(osc_href_link(FILENAME_INFO, 'about_us'), $osC_Language->get('box_information_about_us')); ?></li>

 

Thats all!

 

Regards Tommy

thouccaft likes this

Share this post


Link to post
Share on other sites

Thanks for the GREAT info. One last question, How do I get the new page to show up on the sitemap?

 

I followed the instructions, all is functioning well, but when I look at sitemap, the About us page does not appear. Do you have any suggestions?

 

Thanks!

Share this post


Link to post
Share on other sites

Yes a really useful post - enabled me to understand much of how OSC3.0 is structured. Thanks.

 

Site map can be amended at templates -> default -> content -> info -> info_sitemap.php

 

Just add the following line somewhere between lines 41 and 47

 

<li><?php echo osc_link_object(osc_href_link(FILENAME_INFO, 'about us'), $osC_Language->get('box_information_about_us')); ?></li>

 

 

Julie

Share this post


Link to post
Share on other sites
If you'll wait and get the proper way to add a page to version 3. You will probably be able to edit the text in Admin like the rest of the site rather then editing a file you shouldn't be editing.

 

http://forums.oscommerce.com/index.php?s=&...t&p=1381333

You think that this isn't a proper way to add a page? Once you importet your new language definitions you can edit the text in Admin like the others...

 

Regards Tommy

Share this post


Link to post
Share on other sites
You think that this isn't a proper way to add a page? Once you importet your new language definitions you can edit the text in Admin like the others...

 

Regards Tommy

 

 

When you tell them to use html in the xml file no I don't think it is the right way. You do not state that is can be done in the admin. You posted this before Harald corrected your post on how to edit the pages on the 18th so why would I think a post you made before the date that you were given the correct info on how to edit your text to be correct.

 

When the project leader says and I quote

The XML file should never be edited by hand.

 

Kind regards,

 

Who should I belive someone with 23 posts or the developer.

 

The post wasn't meant to be an attack against you. I am sorry it came across that way. Your abilities may allow you to change what ever you want to and be able to keep it working. The new people that can only copy and paste what their given will not be able to fix what you gave them if it doesn't work when the core code is finalized. With out the core code being done the newbies shouldn't even be looking at changing code let alone with an improper way to do it. I think it is great that you are working on a translation already but let the project team do their job. The how to is coming when the core is finished.

Share this post


Link to post
Share on other sites

While I am new with v3 and not to long with previous release, I found the information presented very usable.

 

As far as whether you should or shouldn't be making these changes, I believe this is the BEST way to get a feel for how the system works. If changes are made, I can easily adapt, recreate the info, etc.

 

On with my new question/suggestion:

 

Looks like 99% of the multiple files editted are identical. Perhaps we could pass a variable to a php shell program whiuch could load an array with the appropriate variables heading, breadcrum, boxinfo content, etc , and generate the required page. That way only one "infoPage" template could exist in info and template sections. If it could be written to load these from the database, it would allow changing templates without problems.

 

Is something similar to this being considered for the final products?

 

Would this make a good add-on?

 

Is there anything simi;lar to this available?

Share this post


Link to post
Share on other sites
While I am new with v3 and not to long with previous release, I found the information presented very usable.

 

As far as whether you should or shouldn't be making these changes, I believe this is the BEST way to get a feel for how the system works. If changes are made, I can easily adapt, recreate the info, etc.

 

On with my new question/suggestion:

 

Looks like 99% of the multiple files editted are identical. Perhaps we could pass a variable to a php shell program whiuch could load an array with the appropriate variables heading, breadcrum, boxinfo content, etc , and generate the required page. That way only one "infoPage" template could exist in info and template sections. If it could be written to load these from the database, it would allow changing templates without problems.

 

Is something similar to this being considered for the final products?

 

Would this make a good add-on?

 

Is there anything simi;lar to this available?

 

 

Perhaps, if there had been some documentation of the "standard" way to do things this type of exchange wouldn't be necessary in the first place. Sheesh.

Share this post


Link to post
Share on other sites
You think that this isn't a proper way to add a page? Once you importet your new language definitions you can edit the text in Admin like the others...

 

Regards Tommy

 

Tommy,

 

So adding a new page to the cart isn't a good idea right now? We should just wait until the core team explains the proper way to do it?

Share this post


Link to post
Share on other sites
We should just wait until the core team explains the proper way to do it?

 

You don't must use "my way". Just wait and don't take part on the development... ;)

 

Regards Tommy

Share this post


Link to post
Share on other sites
The Version 3 is much different then the osCommerce before. So I tell you, how to get other pages into this.

 

First I define the language-files for the main content. Copy your definition to /includes/languages/en_EN.xml:

<definition>
  <key>breadcrumb_about_us</key>
  <value><![CDATA[About Us]]></value>
  <group>info</group>
</definition>

 <definition>
  <key>info_about_us_heading</key>
  <value><![CDATA[About Us]]></value>
  <group>info</group>
</definition>

<definition>
  <key>about_us</key>
  <value><![CDATA[Hier comes your text (you can use html) About US.]]></value>
  <group>info</group>
</definition>

to ceep the structure off Haralds programming I've copied it right under the definitions off the shipping -module (lines 1297, 1342, 1382). You can also copy it at the End of the file befor the last

  </definitions>
</language>

 

For the link in the information-box open /includes/languages/de_DE/modules/boxes/information.xml and put in the definition:

<definition>
  <key>box_information_about_us</key>
  <value><![CDATA[About Us]]></value>
  <group>modules-boxes</group>
</definition>

Now you can upload this files and import them with your admin-tool (Confiuration->Languages->Import->new records only)

 

Now we need the about_us.php! Make this file and copy it to the directory /includes/content/info

<?php
/*
New file: abuot_us.php
 $Id: password.php 64 2005-03-12 16:36:16Z hpdl $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2005 osCommerce

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License v2 (1991)
 as published by the Free Software Foundation.
*/

 class osC_Info_About_us extends osC_Template {

/* Private variables */

var $_module = 'about_us',
	$_group = 'info',
	$_page_title,
	$_page_contents = 'info_about_us.php',
	$_page_image = 'table_background_specials.gif';

/* Class constructor */

function osC_Info_About_us() {
  global $osC_Services, $osC_Language, $osC_Breadcrumb;

  $this->_page_title = $osC_Language->get('info_about_us_heading');

  if ($osC_Services->isStarted('breadcrumb')) {
	$osC_Breadcrumb->add($osC_Language->get('breadcrumb_about_us'), osc_href_link(FILENAME_INFO, $this->_module));
  }
}
 }
?>

When you read this code, you recognize that we need a file to get the content. Make a file called info_about_us.php and copy it to the direction /templates/default/content/info:

<?php
/*
New file: info_about_us.php
 $Id: $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2006 osCommerce

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License v2 (1991)
 as published by the Free Software Foundation.
*/
?>

<?php echo osc_image(DIR_WS_IMAGES . $osC_Template->getPageImage(), $osC_Template->getPageTitle(), HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT, 'id="pageIcon"'); ?>

<h1><?php echo $osC_Template->getPageTitle(); ?></h1>

<p><?php echo $osC_Language->get('about_us'); ?></p>

<div class="submitFormButtons" style="text-align: right;">
 <?php echo osc_link_object(osc_href_link(FILENAME_INFO), osc_draw_image_button('button_continue.gif', $osC_Language->get('button_continue'))); ?>
</div>

Everything good so far, we only need the links to our new site. Open the file /includes/modules/boxes/information.php and put the link where ever you like:

'  <li>' . osc_link_object(osc_href_link(FILENAME_INFO, 'about_us'), $osC_Language->get('box_information_about_us')) . '</li>' .

and open this file /templates/default/content/info/info.php and copy another link:

<li><?php echo osc_link_object(osc_href_link(FILENAME_INFO, 'about_us'), $osC_Language->get('box_information_about_us')); ?></li>

 

Thats all!

 

Regards Tommy

 

 

Man I'm glad that you posted this. I have been trying to find a good way do add a new info/details page for quite some time. I have figured out a couple of ways, but none as good as this.

Share this post


Link to post
Share on other sites

Thanks, but I'm disappointed about putting a link into my Quotation! :angry: :angry: :angry:

 

Regards Tommy

Share this post


Link to post
Share on other sites

Thanks, but I'm disappointed about putting a link into my Quotation! :angry: :angry: :angry:

 

Regards Tommy

 

 

none of this whole topic makes any sense to me. for starters, i have the latest version of the cart, but my includes/english direcotry didnt come with ANY .xml files, just all php, so what are you guys talking about?!?!

Share this post


Link to post
Share on other sites

none of this whole topic makes any sense to me. for starters, i have the latest version of the cart, but my includes/english direcotry didnt come with ANY .xml files, just all php, so what are you guys talking about?!?!

 

If you read the full thread, you will see they are talking about the unstable and not to be used version 3. This is still being developed. You are safe with using version 2.3.1

Share this post


Link to post
Share on other sites