Creare nuove pagine

Questo forum è dedicato alle discussioni riguardanti le contribution per osCommerce

Moderatore: mod Generali

decibel83
membro Junior
membro Junior
Messaggi: 29
Iscritto il: 30/01/2005, 1:00
Località: USA

Creare nuove pagine

Messaggio da decibel83 »

Ciao a tutti,
come si può creare nuove pagine all'interno di osCommerce (ad esempio "chi siamo", "informazioni sugli ordini", "informazioni sulle spedizioni", ecc.)?

Grazie mille!
Ciao
axel
membro Junior
membro Junior
Messaggi: 11
Iscritto il: 10/04/2005, 0:00
Contatta:

Messaggio da axel »

prova questo io l'ho provato e funziona benissimo




March 28, 2005








Main Menu
• New User Signup
• Home

Options
• osCDox Guide
• Forum
• Web Links
• Live Chat Rooms
• Advertise
• Reference Books






Members Online
MEMBERS ONLINE


You are an anonymous user. You can register for free by clicking here


User name


Password


Remember me









Exercise 4 Boxes: Adding New Boxes


Adding New Boxes, Links and Pages
We will now look into adding our own custom boxes, as well as adding/changing links, pages and graphics to boxes. In addition, we will learn how to add items to the columns, outside of the actual boxes. All of these modifications are fairly easy to perform, but they are not entirely intuitive (understatement!).
Making a New Box
Let’s jump right in. The files involved are: /catalog/includes :
1. column_left.php
2. column_right.php
/catalog/includes/boxes : ALL files in this directory

Open /catalog/includes/boxes/information.php in a text editor and save it as /catalog/includes/boxes/test.php.
Then in column_left.php, add this line:
require(DIR_WS_BOXES . 'test.php');
directly below this line:
require(DIR_WS_BOXES . 'information.php');
Save column_left.php to your server, and reload the main catalog page in your browser. You will now see two information boxes on the left. The second one we just added with one line of code. That is the easy part.


Changing Links and Text : Customizing your new box and adding new pages
The next step is to customize that box, and to do it, we need to modify a few more files. I want to change the title bar of our new box, as well as make links to new, custom pages that I will also create. This process is a bit more clunky than it should be, but we will have to make due. Here we go!
For this example, I will be creating four links to pages called testpage1.php, testpage2.php testpage3.php, and testpage4.php in the new information block we created in the previous step.
I am using the original shipping.php files as my base template. Use this example to familiarize yourself with the procedure. The process is the same for other blocks, you just need to identify the proper files to copy and modify. Confused? Good. Read on…
----
Open the following files in WordPad or some other text editor that will not modify code without you telling it to, and will allow you to search and replace:
/catalog/includes/filenames.php
/catalog/includes/languages/english.php
/catalog/includes/languages/english/shipping.php
/catalog/shipping.php
/catalog/includes/boxes/test.php

In the file /catalog/includes/filenames.php, find the section marked define filenames used in the project. In this section, copy any one of the file definitions, and paste it to a new line, just after the one you copied. Now you need to modify the newly pasted line to point to testpage1 See the example below:
Copy the first file definition listed:
define('FILENAME_ACCOUNT', 'account.php');
Then paste this on a new line immediately following it, four times. Create four new define statements as follows:
define('FILENAME_TESTPAGE1', 'testpage1.php');
define('FILENAME_TESTPAGE2', 'testpage2.php');
define('FILENAME_TESTPAGE3', 'testpage3.php');
define('FILENAME_TESTPAGE4', 'testpage4.php');
Now, save /catalog/includes/filenames.php. This is the step that creates the filename definitions so that osCommerce can build links.

Next, in the file /catalog/includes/languages/english.php, find the section marked information box text. Copy the entire section and paste it below the original section.
Change the section to look like this:
// information box text in includes/boxes/test.php
define('BOX_HEADING_TEST', 'Test Box');
define('BOX_TEST_LINK1', 'Test Link 1');
define('BOX_TEST_LINK2', 'Test Link 2');
define('BOX_TEST_LINK3', 'Test Link 3');
define('BOX_TEST_LINK4', 'Test Link 4');
Save /catalog/includes/languages/english.php. This step creates the link text that will go into each new link you create.

In the file /catalog/includes/languages/english/shipping.php edit the following:
define('NAVBAR_TITLE', 'Shipping & Returns');
define('HEADING_TITLE', 'Shipping & Returns');
define('TEXT_INFORMATION', 'Enter your shipping info here');
To look like this:
define('NAVBAR_TITLE', 'Test Page 1');
define('HEADING_TITLE', 'Test Page 1');
define('TEXT_INFORMATION', 'This is an added sample page');
Save as /catalog/includes/languages/english/testpage1.php
Repeat the above steps three more times, creating testpage2, testpage3, and testpage4. This is the step that actually creates the text that will be on each of your new pages, and in the process, creates four new files.

In the file: /catalog/shipping.php using the replace feature of you text editor
Replace this FILENAME_SHIPPING
With this FILENAME_TESTPAGE1
Save As /catalog/testpage1.php
Repeat this three more times, changing FILENAME_TESTPAGE1 to FILENAME_TESTPAGE2, FILENAME_TESTPAGE3 and FILENAME_TESTPAGE4 and saving as testpage2.php, testpage3.php and testpage4.php. This step creates the actual pages that will be loaded by the links.

Finally, edit the file /catalog/includes/boxes/test.php to look like this:
<?php
$info_box_contents = array();
$info_box_contents[] = array('align' => 'left',
'text' => BOX_HEADING_TEST
);
new infoBoxHeading($info_box_contents, false, false);
$info_box_contents = array();
$info_box_contents[] = array('align' => 'left',
'text' => '<a href="' . tep_href_link
(FILENAME_TESTPAGE1, '', 'NONSSL') . '">' . BOX_TEST_LINK1 . '</a><br>' .
'<a href="' . tep_href_link
(FILENAME_TESTPAGE2, '', 'NONSSL') . '">' . BOX_TEST_LINK2 . '</a><br>' .
'<a href="' . tep_href_link
(FILENAME_TESTPAGE3, '', 'NONSSL') . '">' . BOX_TEST_LINK3 . '</a><br>' .
'<a href="' . tep_href_link
(FILENAME_TESTPAGE4, '', 'NONSSL') . '">' . BOX_TEST_LINK4 . '</a>'
This changes the text that is output in the browser. You are finished editing files at this point. Make sure you upload the files to the proper directories, as some of them have the same filenames. View your catalog in your browser and the new links should show up in your new block! See the example below.


Table of Contents:

Last edited on November 11, 2003. RecentChanges | FindPage | | LikePages

Page locked | PageHistory | Diff

DebugInfo









All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest © 2002-2005 by OSCdox
decibel83
membro Junior
membro Junior
Messaggi: 29
Iscritto il: 30/01/2005, 1:00
Località: USA

Messaggio da decibel83 »

Si, ma ci deve essere una contribution, installata tra l'altro nel Pack di Simona, che permette di creare nuove pagine direttamente dal pannello di amministrazione, modificando le pagine con un editor HTML WYSIWYG.

Ciao!
Avatar utente
ricman
membro Senior
membro Senior
Messaggi: 477
Iscritto il: 22/04/2004, 0:00
Località: Italy - Toscana

Messaggio da ricman »

Secondo me fai prima con un paio di Copia/Icolla.
Prendi una pagina (come i pagamenti,spedizioni...) la duplichi, gli cambi nome e la definisci nel filname.php. Poi gli crei la traduzione nell'italiano (sempre di copia/incolla personalizzando solo le traduz...
E' abbastanza semplice...
--
ricman
Avatar utente
Cattivik
membro Junior
membro Junior
Messaggi: 48
Iscritto il: 25/01/2005, 1:00
Località: ita

Messaggio da Cattivik »

ricman ha scritto:Secondo me fai prima con un paio di Copia/Icolla.
Prendi una pagina (come i pagamenti,spedizioni...) la duplichi, gli cambi nome e la definisci nel filname.php. Poi gli crei la traduzione nell'italiano (sempre di copia/incolla personalizzando solo le traduz...
E' abbastanza semplice...
per me no :( :( (i'm tordo)
decibel83
membro Junior
membro Junior
Messaggi: 29
Iscritto il: 30/01/2005, 1:00
Località: USA

Messaggio da decibel83 »

ricman ha scritto:Secondo me fai prima con un paio di Copia/Icolla.
Prendi una pagina (come i pagamenti,spedizioni...) la duplichi, gli cambi nome e la definisci nel filname.php. Poi gli crei la traduzione nell'italiano (sempre di copia/incolla personalizzando solo le traduz...
E' abbastanza semplice...
Hai mai utilizzato il pack di Simona?
Non puoi dire che è più semplice e veloce così... :shock:

Ciao!
sara75
membro Regular
membro Regular
Messaggi: 199
Iscritto il: 18/06/2004, 0:00
Località: Torino- Brescia
Contatta:

Messaggio da sara75 »

Potresti provare questo.
Ciao
Sara
Immagine
Prima regola: Fai un backup prima di modificare il codice.
Seconda regola: Ti sei ricordato di fare un backup ?
Avatar utente
ricman
membro Senior
membro Senior
Messaggi: 477
Iscritto il: 22/04/2004, 0:00
Località: Italy - Toscana

Messaggio da ricman »

decibel83 ha scritto: Hai mai utilizzato il pack di Simona?
Non puoi dire che è più semplice e veloce così... :shock:
Io USO il pack di Simona... e le pagine le creo con il copia/incolla che spiegavo...
C'è anche un altro modo col suo pack? Ho visto la presenza di un editor html ma preferisco toccare personalmente il codice (non perchè sono bravo ma per cercare di imparare qualcosa!! :wink: )
--
ricman
Avatar utente
Cattivik
membro Junior
membro Junior
Messaggi: 48
Iscritto il: 25/01/2005, 1:00
Località: ita

Messaggio da Cattivik »

ricman ha scritto: Poi gli crei la traduzione nell'italiano (sempre di copia/incolla personalizzando solo le traduz...
E' abbastanza semplice...
solo che non capisco questo ....

dove ?
Avatar utente
ricman
membro Senior
membro Senior
Messaggi: 477
Iscritto il: 22/04/2004, 0:00
Località: Italy - Toscana

Messaggio da ricman »

Cattivik ha scritto:
ricman ha scritto: Poi gli crei la traduzione nell'italiano (sempre di copia/incolla personalizzando solo le traduz...
E' abbastanza semplice...
solo che non capisco questo ....
dove ?
Metti che copi/incolli un file tipo "privacy.php" e lo chiami, ad esempio, "pagamenti.php"...

Noterai che le prime righe (dopo i commenti) sono:

Codice: Seleziona tutto

  require('includes/application_top.php');

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRIVACY);

  $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_PRIVACY));
che nel file pagamenti.php diventeranno:

Codice: Seleziona tutto

  require('includes/application_top.php');

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PAGAMENTI);

  $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_PAGAMENTI));
Ti torna?... ok... ora devi dargli il contenuto (in italiano) quindi vai su
includes/languages/italian
e copi/incolli privacy.php in pagamenti.php. A questo punto avrai 3 voci (o più... a seconda di quale file avevi copiato)

Codice: Seleziona tutto

define('NAVBAR_TITLE', 'Pagamenti');
define('HEADING_TITLE', 'Pagamenti e modalità');
define('TEXT_INFORMATION', 'Testo testo testo testo testo testo');
Fatto!!! :wink:
--
ricman
revolver
membro Junior
membro Junior
Messaggi: 25
Iscritto il: 07/01/2005, 1:00
Località: ita
Contatta:

Messaggio da revolver »

ricman ha scritto:
Cattivik ha scritto:
ricman ha scritto: Poi gli crei la traduzione nell'italiano (sempre di copia/incolla personalizzando solo le traduz...
E' abbastanza semplice...
solo che non capisco questo ....
dove ?
Metti che copi/incolli un file tipo "privacy.php" e lo chiami, ad esempio, "pagamenti.php"...

Noterai che le prime righe (dopo i commenti) sono:

Codice: Seleziona tutto

  require('includes/application_top.php');

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRIVACY);

  $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_PRIVACY));
che nel file pagamenti.php diventeranno:

Codice: Seleziona tutto

  require('includes/application_top.php');

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PAGAMENTI);

  $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_PAGAMENTI));
Ti torna?... ok... ora devi dargli il contenuto (in italiano) quindi vai su
includes/languages/italian
e copi/incolli privacy.php in pagamenti.php. A questo punto avrai 3 voci (o più... a seconda di quale file avevi copiato)

Codice: Seleziona tutto

define('NAVBAR_TITLE', 'Pagamenti');
define('HEADING_TITLE', 'Pagamenti e modalità');
define('TEXT_INFORMATION', 'Testo testo testo testo testo testo');
Fatto!!! :wink:

scusate la mia ignoranza, ma mi da questo errore potete aiutarmi ? dove sbaglio? ciao grazie :oops:

Warning: main(includes/languages/italian/FILENAME_PAGAMENTI): failed to open stream: No such file or directory in /web/htdocs/www.autuorimodellismo.it/home/pagamenti.php on line 15

Fatal error: main(): Failed opening required 'includes/languages/italian/FILENAME_PAGAMENTI' (include_path='.:/php/lib/php/') in /web/htdocs/www.autuorimodellismo.it/home/pagamenti.php on line 15
Avatar utente
ricman
membro Senior
membro Senior
Messaggi: 477
Iscritto il: 22/04/2004, 0:00
Località: Italy - Toscana

Messaggio da ricman »

revolver ha scritto:scusate la mia ignoranza, ma mi da questo errore potete aiutarmi ? dove sbaglio? ciao grazie :oops:

Warning: main(includes/languages/italian/FILENAME_PAGAMENTI): failed to open stream: No such file or directory in /web/htdocs/www.autuorimodellismo.it/home/pagamenti.php on line 15

Fatal error: main(): Failed opening required 'includes/languages/italian/FILENAME_PAGAMENTI' (include_path='.:/php/lib/php/') in /web/htdocs/www.autuorimodellismo.it/home/pagamenti.php on line 15
Bene... sei a buon punto... Come dicevo qualche post sopra ...e la definisci nel filname.php ovvero: vai in includes/filename.php e aggiungi questo:

Codice: Seleziona tutto

define('FILENAME_PAGAMENTI', 'pagamenti.php');
Fatto davvero stavolta!! :wink: :wink:
--
ricman
Avatar utente
Jerrymat
membro Baby
membro Baby
Messaggi: 65
Iscritto il: 19/04/2005, 14:24

ciao

Messaggio da Jerrymat »

ciao, ho fatto le operazioni da te elencate,per crere la pagina chi siamo la pagina mi funziona correttamente ma ancora non si vede nella lista delle pagine informazioni dove ci sono le atre pagine privacy, condizioni d'uso etc...
Mi potresti dire in cosa ho sbagliato?
Ciao e grazie
Avatar utente
ricman
membro Senior
membro Senior
Messaggi: 477
Iscritto il: 22/04/2004, 0:00
Località: Italy - Toscana

Re: ciao

Messaggio da ricman »

Jerrymat ha scritto: ancora non si vede nella lista delle pagine informazioni dove ci sono le atre pagine privacy, condizioni d'uso etc...
Mi potresti dire in cosa ho sbagliato?
Non hai sbagliato niente...
Adesso devi solo andare nel file column_left (o right, a seconda di dove hai deciso di metterlo) e richiamarlo lì. Se ti riesce bene... altrimenti ti potrò aiutare domattina dal pc sul quale posso vedere un po' di codice.

fammi sapere
ciao
--
ricman
Avatar utente
Jerrymat
membro Baby
membro Baby
Messaggi: 65
Iscritto il: 19/04/2005, 14:24

ciao

Messaggio da Jerrymat »

Preferisco aspettare anche perchè ho visto che ci sono vari file con quel nome, aspetto tue notizie. grazie
Rispondi