Jump to content



Photo
- - - - -

Add new infopage


This topic has been archived. This means that you cannot reply to this topic.
14 replies to this topic

#1   TommyBerlin

TommyBerlin
  • Members
  • 58 posts

Posted 17 March 2009 - 17:12

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

#2   sts098

sts098
  • Members
  • 7 posts

Posted 22 March 2009 - 14:01

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!

#3   jjsacn

jjsacn
  • Members
  • 10 posts

Posted 22 March 2009 - 14:51

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

#4   Bushmaster

Bushmaster
  • Members
  • 456 posts

Posted 23 March 2009 - 08:09

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.oscomm...&...t&p=1381333

Edited by Bushmaster, 23 March 2009 - 08:12.


#5   TommyBerlin

TommyBerlin
  • Members
  • 58 posts

Posted 23 March 2009 - 10:11

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.oscomm...&...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

#6   Bushmaster

Bushmaster
  • Members
  • 456 posts

Posted 23 March 2009 - 16:52

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.

#7   sts098

sts098
  • Members
  • 7 posts

Posted 27 March 2009 - 18:34

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?

#8   Nimitz_1061

Nimitz_1061
  • Members
  • 182 posts

Posted 04 April 2009 - 23:49

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.

#9   bradybarrows

bradybarrows
  • Members
  • 215 posts

Posted 18 April 2009 - 02:37

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?

#10   TommyBerlin

TommyBerlin
  • Members
  • 58 posts

Posted 18 April 2009 - 13:11

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... /wink.gif' class='bbc_emoticon' alt=';)' />

Regards Tommy

#11   mattb348

mattb348
  • Members
  • 22 posts

Posted 30 June 2009 - 07:38

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.

Edited by Jan Zonjee, 08 September 2009 - 19:32.


#12   TommyBerlin

TommyBerlin
  • Members
  • 58 posts

Posted 30 June 2009 - 18:12

Thanks, but I'm disappointed about putting a link into my Quotation! /mad.gif' class='bbc_emoticon' alt=':angry:' /> /mad.gif' class='bbc_emoticon' alt=':angry:' /> /mad.gif' class='bbc_emoticon' alt=':angry:' />

Regards Tommy

Edited by TommyBerlin, 30 June 2009 - 18:13.


#13   eastcoastsupremacy

eastcoastsupremacy
  • Members
  • 24 posts

Posted 14 October 2009 - 14:42

Thanks, but I'm disappointed about putting a link into my Quotation! /mad.gif' class='bbc_emoticon' alt=':angry:' /> /mad.gif' class='bbc_emoticon' alt=':angry:' /> /mad.gif' class='bbc_emoticon' alt=':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?!?!

#14   tnsporting90

tnsporting90
  • Members
  • 5 posts

Posted 25 June 2012 - 10:31

A lot of thanks for sharing this.

#15   14steve14

14steve14
  • Members
  • 3,503 posts

Posted 26 June 2012 - 07:45

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
REMEMBER BACKUP, BACKUP AND BACKUP

Don't take life too seriously. no one gets out alive anyway