Forums / Setup & design / Custom Form Fields Hack for eZPublish 3.9.0

Custom Form Fields Hack for eZPublish 3.9.0

Author Message

Seth Shoultes

Tuesday 23 January 2007 4:02:58 pm

I figured it out!!! Yahoooo!!! After much frustration....I came up with a hack to add custom form fields to eZPublish 3.9.0.

***IMPORTANT***
Back up your eZPublish 3.9.0 Installation! Or use a test folder on your server. I have manipulated the main files of my eZPublish installation. Use at your own risk.

The changes are commented throughout the pages of code. The files listed are not in order. In some files, I have commented out some of the $country variables and lines of code. While in other files, I have completely removed the country lines of code all together.

<<<<<<<<-----------------File 1:----------------->>>>>>>>>>>>>>>>

/ezpublish-3.9.0/kernel/shop/userregister.php

     <?php
//
// Created on: <04-Mar-2003 10:22:42 bf>
//
// SOFTWARE NAME: eZ publish
// SOFTWARE RELEASE: 3.9.0
// BUILD VERSION: 17785
// COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS
// SOFTWARE LICENSE: GNU General Public License v2.0
// NOTICE: >
//   This program is free software; you can redistribute it and/or
//   modify it under the terms of version 2.0  of the GNU General
//   Public License as published by the Free Software Foundation.
//
//   This program is distributed in the hope that it will be useful,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   GNU General Public License for more details.
//
//   You should have received a copy of version 2.0 of the GNU General
//   Public License along with this program; if not, write to the Free
//   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
//   MA 02110-1301, USA.
//
//

$http =& eZHTTPTool::instance();
$module =& $Params["Module"];

include_once( 'kernel/common/template.php' );
include_once( 'lib/ezutils/classes/ezhttptool.php' );
include_once( 'kernel/classes/ezbasket.php' );
include_once( 'lib/ezxml/classes/ezxml.php' );
include_once( 'lib/ezutils/classes/ezmail.php' );

$tpl =& templateInit();

if ( $module->isCurrentAction( 'Cancel' ) )
{
    $module->redirectTo( '/shop/basket/' );
    return;
}

$user =& eZUser::currentUser();

$firstName = '';
$lastName = '';
$email = '';
if ( $user->isLoggedIn() )
{
    $userObject = $user->attribute( 'contentobject' );
    $userMap = $userObject->dataMap();
    $firstName = $userMap['first_name']->content();
    $lastName = $userMap['last_name']->content();
    $email = $user->attribute( 'email' );
}

// Initialize variables
$street1 = $street2 = $zip = $place = $state =  $comment = '';


// Check if user has an earlier order, copy order info from that one
$orderList = eZOrder::activeByUserID( $user->attribute( 'contentobject_id' ) );
if ( count( $orderList ) > 0 and  $user->isLoggedIn() )
{
    $accountInfo = $orderList[0]->accountInformation();
	$homePhone = $accountInfo['homePhone'];/*<!--Added by Seth Shoultes on 1-23-07 -->*/
    $street1 = $accountInfo['street1'];
    $street2 = $accountInfo['street2'];
    $zip = $accountInfo['zip'];
    $place = $accountInfo['place'];
    $state = $accountInfo['state'];
	/* $country = $accountInfo['country'];*/
   
}

$tpl->setVariable( "input_error", false );
if ( $module->isCurrentAction( 'Store' ) )
{
    $inputIsValid = true;
    $firstName = $http->postVariable( "FirstName" );
    if ( trim( $firstName ) == "" )
        $inputIsValid = false;
		
    $lastName = $http->postVariable( "LastName" );
    if ( trim( $lastName ) == "" )
        $inputIsValid = false;
		
    $email = $http->postVariable( "EMail" );
    if ( ! eZMail::validate( $email ) )
        $inputIsValid = false;
		
	$homePhone = $http->postVariable( "homePhone" );/*<!--Added by Seth Shoultes on 1-23-07 -->*/
    if ( trim( $homePhone ) == "" )
        $inputIsValid = false;
		
    $street1 = $http->postVariable( "Street1" );
    $street2 = $http->postVariable( "Street2" );
        if ( trim( $street2 ) == "" )
            $inputIsValid = false;

    $zip = $http->postVariable( "Zip" );
    if ( trim( $zip ) == "" )
        $inputIsValid = false;
    $place = $http->postVariable( "Place" );
    if ( trim( $place ) == "" )
        $inputIsValid = false;
    $state = $http->postVariable( "State" );

    $comment = $http->postVariable( "Comment" );

    if ( $inputIsValid == true )
    {
        // Check for validation
        $basket =& eZBasket::currentBasket();

        $db =& eZDB::instance();
        $db->begin();
        $order = $basket->createOrder();

        $doc = new eZDOMDocument( 'account_information' );

        $root = $doc->createElementNode( "shop_account" );
        $doc->setRoot( $root );

        $firstNameNode = $doc->createElementNode( "first-name" );
        $firstNameNode->appendChild( $doc->createTextNode( $firstName ) );
        $root->appendChild( $firstNameNode );

        $lastNameNode = $doc->createElementNode( "last-name" );
        $lastNameNode->appendChild( $doc->createTextNode( $lastName ) );
        $root->appendChild( $lastNameNode );

        $emailNode = $doc->createElementNode( "email" );
        $emailNode->appendChild( $doc->createTextNode( $email ) );
        $root->appendChild( $emailNode );
		
		 $homePhoneNode = $doc->createElementNode( "homePhone" );/*<!--Added by Seth Shoultes on 1-23-07 -->*/
        $homePhoneNode->appendChild( $doc->createTextNode( $homePhone ) );
        $root->appendChild( $homePhoneNode );

        $street1Node = $doc->createElementNode( "street1" );
        $street1Node->appendChild( $doc->createTextNode( $street1 ) );
        $root->appendChild( $street1Node );

        $street2Node = $doc->createElementNode( "street2" );
        $street2Node->appendChild( $doc->createTextNode( $street2 ) );
        $root->appendChild( $street2Node );

        $zipNode = $doc->createElementNode( "zip" );
        $zipNode->appendChild( $doc->createTextNode( $zip ) );
        $root->appendChild( $zipNode );

        $placeNode = $doc->createElementNode( "place" );
        $placeNode->appendChild( $doc->createTextNode( $place ) );
        $root->appendChild( $placeNode );

        $stateNode = $doc->createElementNode( "state" );
        $stateNode->appendChild( $doc->createTextNode( $state ) );
        $root->appendChild( $stateNode );

		/*$countryNode = $doc->createElementNode( "country" );
        $countryNode->appendChild( $doc->createTextNode( $country ) );
        $root->appendChild( $countryNode );*/

       
        $commentNode = $doc->createElementNode( "comment" );
        $commentNode->appendChild( $doc->createTextNode( $comment ) );
        $root->appendChild( $commentNode );

        $order->setAttribute( 'data_text_1', $doc->toString() );
        $order->setAttribute( 'account_identifier', "ez" );

        $order->setAttribute( 'ignore_vat', 0 );

        $order->store();
        $db->commit();
        include_once( 'kernel/shop/classes/ezshopfunctions.php' );
        eZShopFunctions::setPreferredUserCountry( $country );
        eZHTTPTool::setSessionVariable( 'MyTemporaryOrderID', $order->attribute( 'id' ) );

        $module->redirectTo( '/shop/confirmorder/' );
        return;
    }
    else
    {
        $tpl->setVariable( "input_error", true );
    }
}

$tpl->setVariable( "first_name", $firstName );
$tpl->setVariable( "last_name", $lastName );
$tpl->setVariable( "email", $email );
$tpl->setVariable( "homePhone", $homePhone );/*<!--Added by Seth Shoultes on 1-23-07 -->*/
$tpl->setVariable( "street1", $street1 );
$tpl->setVariable( "street2", $street2 );
$tpl->setVariable( "zip", $zip );
$tpl->setVariable( "place", $place );
$tpl->setVariable( "state", $state );
/*$tpl->setVariable( "country", $country );*//*<!--Changed by Seth Shoultes on 1-23-07 -->*/
$tpl->setVariable( "comment", $comment );

$Result = array();
$Result['content'] =& $tpl->fetch( "design:shop/userregister.tpl" );
$Result['path'] = array( array( 'url' => false,
                                'text' => ezi18n( 'kernel/shop', 'Enter account information' ) ) );
?>

 

<<<<<<<<------------------------------File 2: ------------------------------------------>>>>>>>
/ezpublish-3.9.0/design/admin/templates/shop/accounthandlers/html/ez.tpl

 

{* Name. *}
<div class="block">
<label>{'Name'|i18n( 'design/admin/shop/accounthandlers/html/ez' )}:</label>
{let customer_user=fetch( content, object, hash( object_id, $order.user_id ) )}
<a href={$customer_user.main_node.url_alias|ezurl}>{$order.account_information.first_name}&nbsp;{$order.account_information.last_name}</a>
{/let}
</div>

{* Email. *}
<div class="block">
<label>{'Email'|i18n( 'design/admin/shop/accounthandlers/html/ez' )}:</label>
<a href="mailto:{$order.account_information.email}">{$order.account_information.email}</a>
</div>

{* Address. *}
<div class="block">
<fieldset>
<legend>{'Address'|i18n( 'design/admin/shop/accounthandlers/html/ez' )}</legend>

<table class="list" cellspacing="0">
<tr>
    <td>{'Home Phone'|i18n( 'design/admin/shop/accounthandlers/html/ez' )}</td><!--Added by Seth Shoultes on 1-23-07 -->
    <td>{$order.account_information.homePhone}</td>
</tr>
<tr>
    <td>{'Company'|i18n( 'design/admin/shop/accounthandlers/html/ez' )}</td>
    <td>{$order.account_information.street1}</td>
</tr>
<tr>
    <td>{'Street'|i18n( 'design/admin/shop/accounthandlers/html/ez' )}</td>
    <td>{$order.account_information.street2}</td>
</tr>
<tr>
    <td>{'Zip code'|i18n( 'design/admin/shop/accounthandlers/html/ez' )}</td>
    <td>{$order.account_information.zip}</td>
</tr>
<tr>
    <td>{'City'|i18n( 'design/admin/shop/accounthandlers/html/ez' )}</td><!--Changed by Seth Shoultes on 1-23-07 -->
    <td>{$order.account_information.place}</td>
</tr>
<tr>
    <td>{'State'|i18n( 'design/admin/shop/accounthandlers/html/ez' )}</td>
    <td>{$order.account_information.state}</td>
</tr>

</table>

</fieldset>
</div>

 

<<<<<-------------------------------File 3:------------------------------>>>>>>

/ezpublish-3.9.0/design/standard/templates/shop/accounthandlers/html/ez.tpl

{* DO NOT EDIT THIS FILE! Use an override template instead. *}
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td valign="top">
<p>
<b>{"Customer"|i18n("design/standard/shop")}</b>
</p>
<p>
{'Name'|i18n('design/standard/shop')}: {$order.account_information.first_name} {$order.account_information.last_name}<br />
{'Email'|i18n('design/standard/shop')}: {$order.account_information.email}<br />
</p>

</td>
<td valign="top">

<p>
<b>{"Address"|i18n("design/standard/shop")}</b>
</p>
<p>
{'Home Phone'|i18n('design/standard/shop')}: {$order.account_information.homePhone}<br /><!--Added by Seth Shoultes on 1-23-07 -->
{'Company'|i18n('design/standard/shop')}: {$order.account_information.street1}<br />
{'Street'|i18n('design/standard/shop')}: {$order.account_information.street2}<br />
{'Zip'|i18n('design/standard/shop')}: {$order.account_information.zip}<br />
{'City'|i18n('design/standard/shop')}: {$order.account_information.place}<br /><!--Changed by Seth Shoultes on 1-23-07 -->
{'State'|i18n('design/standard/shop')}: {$order.account_information.state}<br />

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

<<<<<<<<-------------------------File 4: ----------------------------->>>>>>>>

/ezpublish-3.9.0/extension/ezwebin/design/ezwebin/templates/shop/userregister.tpl

<div class="box">
<div class="tl"><div class="tr"><div class="br"><div class="bl"><div class="box-content float-break">

<div class="shop-userregister">

<ul>
	<li>1. {"Shopping basket"|i18n("design/ezwebin/shop/userregister")}</li>
	<li class="selected">2. {"Account information"|i18n("design/ezwebin/shop/userregister")}
</li>
	<li>3. {"Confirm order"|i18n("design/ezwebin/shop/userregister")}</li>
</ul>

</div>

</div></div></div></div></div>
</div>

<br />

<div class="box">
<div class="tl"><div class="tr"><div class="br"><div class="bl"><div class="box-content float-break">

<div class="shop-userregister">

<div class="attribute-header">
	<h1 class="long">{"Your account information"|i18n("design/ezwebin/shop/userregister")}</h1>
</div>

{section show=$input_error}
<div class="warning">
<p>
{"Input did not validate, all fields marked with * must be filled in"|i18n("design/ezwebin/shop/userregister")}
</p>
</div>

{/section}
<form method="post" action={"/shop/userregister/"|ezurl}>

<div class="block">
    <div class="element">
    <label>
    {"First name"|i18n("design/ezwebin/shop/userregister")}:*
    </label><div class="labelbreak"></div>
    <input class="halfbox" type="text" name="FirstName" size="20" value="{$first_name|wash}" />
    </div>
    <div class="element">
    <label>
    {"Last name"|i18n("design/ezwebin/shop/userregister")}:*
    </label><div class="labelbreak"></div>
    <input class="halfbox" type="text" name="LastName" size="20" value="{$last_name|wash}" />
    </div>
    <div class="break"></div>
</div>
<br />
<div class="block">
<label>
{"E-mail"|i18n("design/ezwebin/shop/userregister")}:*
</label><div class="labelbreak"></div>
<input class="box" type="text" name="EMail" size="20" value="{$email|wash}" />
</div>
<!--Added by Seth Shoultes on 1-23-07 -->
<div class="block">
<label>
{"Home Phone"|i18n("design/ezwebin/shop/userregister")}:*
</label><div class="labelbreak"></div>
<input class="box" type="text" name="homePhone" size="20" value="{$homePhone|wash}" />
</div>

<div class="block">
<label>
{"Company"|i18n("design/ezwebin/shop/userregister")}:
</label><div class="labelbreak"></div>
<input class="box" type="text" name="Street1" size="20" value="{$street1|wash}" />
</div>

<div class="block">
<label>
{"Street"|i18n("design/ezwebin/shop/userregister")}:*
</label><div class="labelbreak"></div>
<input class="box" type="text" name="Street2" size="20" value="{$street2|wash}" />
</div>

<div class="block">
    <div class="element">
    <label>
    {"Zip"|i18n("design/ezwebin/shop/userregister")}:*
    </label><div class="labelbreak"></div>
    <input class="halfbox" type="text" name="Zip" size="20" value="{$zip|wash}" />
    </div>
    <div class="element">
    <label>
    {"City"|i18n("design/ezwebin/shop/userregister")}:*<!--Changed by Seth Shoultes on 1-23-07 -->
    </label><div class="labelbreak"></div>
    <input class="halfbox" type="text" name="Place" size="20" value="{$place|wash}" />
    </div>
    <div class="break"></div>
</div>
<br/>
<div class="block">
<label>
{"State"|i18n("design/ezwebin/shop/userregister")}:
</label><div class="labelbreak"></div>
<input class="box" type="text" name="State" size="20" value="{$state|wash}" />
</div>
<!--Changed by Seth Shoultes on 1-23-07 -->
<!--<div class="block">
<label>
{"Country"|i18n("design/ezwebin/shop/userregister")}:*
</label><div class="labelbreak"></div>
{include uri='design:shop/country/edit.tpl' select_name='Country' select_size=5 current_val=$country}
</div>-->


<div class="block">
<label>
{"Comment"|i18n("design/ezwebin/shop/userregister")}:
</label><div class="labelbreak"></div>
<textarea name="Comment" cols="80" rows="5">{$comment|wash}</textarea>
</div>


<div class="buttonblock">
    <input class="button" type="submit" name="CancelButton" value="{"Cancel"|i18n('design/ezwebin/shop/userregister')}" />
    <input class="defaultbutton" type="submit" name="StoreButton" value="{"Continue"|i18n( 'design/ezwebin/shop/userregister')}" />
</div>

</form>

<p>
{"All fields marked with * must be filled in."|i18n("design/ezwebin/shop/userregister")}
</p>

</div>

</div></div></div></div></div>
</div>

 

<<<<<<<<-------------------------File 5: ----------------------------->>>>>>>>

/ezpublish-3.9.0/kernel/classes/shopaccounthandlers/ezsimpleshopaccounthandler.php

 

<?php
//
// Definition of eZSimpleShopAccountHandler class
//
// Created on: <13-Feb-2003 09:54:35 bf>
//
// SOFTWARE NAME: eZ publish
// SOFTWARE RELEASE: 3.9.0
// BUILD VERSION: 17785
// COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS
// SOFTWARE LICENSE: GNU General Public License v2.0
// NOTICE: >
//   This program is free software; you can redistribute it and/or
//   modify it under the terms of version 2.0  of the GNU General
//   Public License as published by the Free Software Foundation.
//
//   This program is distributed in the hope that it will be useful,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   GNU General Public License for more details.
//
//   You should have received a copy of version 2.0 of the GNU General
//   Public License along with this program; if not, write to the Free
//   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
//   MA 02110-1301, USA.
//
//

include_once( 'lib/ezxml/classes/ezxml.php' );

class eZSimpleShopAccountHandler
{
    /*!
    */
    function eZSimpleShopAccountHandler()
    {

    }

    /*!
     Will verify that the user has supplied the correct user information.
     Returns true if we have all the information needed about the user.
    */
    function verifyAccountInformation()
    {
        return false;
    }

    /*!
     Redirectes to the user registration page.
    */
    function fetchAccountInformation( &$module )
    {
        $module->redirectTo( '/shop/register/' );
    }

    /*!
     \return custom email for the given order
    */
    function email( $order )
    {
        $xml = new eZXML();
        $xmlDoc =& $order->attribute( 'data_text_1' );
        if( $xmlDoc != null )
        {
            $dom =& $xml->domTree( $xmlDoc );
            $email =& $dom->elementsByName( "email" );
            return $email[0]->textContent();
        }
        else
            return false;
    }

    /*!
     \return custom name for the given order
    */
    function accountName( $order )
    {
        $accountName = "";
        $xml = new eZXML();
        $xmlDoc =& $order->attribute( 'data_text_1' );
        if( $xmlDoc != null )
        {
            $dom =& $xml->domTree( $xmlDoc );
            $firstName = $dom->elementsByName( "first-name" );
            $lastName = $dom->elementsByName( "last-name" );
            $accountName = $firstName[0]->textContent() . " " . $lastName[0]->textContent();
        }
        return $accountName;
    }

    /*!
     \return the account information for the given order
    */
    function accountInformation( $order )
    {
        $xml = new eZXML();
        $xmlDoc =& $order->attribute( 'data_text_1' );
        $dom =& $xml->domTree( $xmlDoc );

        $firstName =& $dom->elementsByName( "first-name" );
        $lastName =& $dom->elementsByName( "last-name" );
        $email =& $dom->elementsByName( "email" );
		$homePhone =& $dom->elementsByName( "homePhone" );/*<!--Added by Seth Shoultes on 1-23-07 -->*/
        $address =& $dom->elementsByName( "address" );

        return array( 'first_name' => $firstName[0]->textContent(),
                      'last_name' => $lastName[0]->textContent(),
                      'email' => $email[0]->textContent(),
					   'homePhone' => $homePhone[0]->textContent(),/*<!--Added by Seth Shoultes on 1-23-07 -->*/
                      'address' => $address[0]->textContent()
                      );
    }
}

?>

 

<<<<<<<<-------------------------File 6: ----------------------------->>>>>>>>

/ezpublish-3.9.0/kernel/classes/shopaccounthandlers/ezusershopaccounthandler.php

<?php
//
// Definition of eZUserShopAccountHandler class
//
// Created on: <04-Mar-2003 09:40:49 bf>
//
// SOFTWARE NAME: eZ publish
// SOFTWARE RELEASE: 3.9.0
// BUILD VERSION: 17785
// COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS
// SOFTWARE LICENSE: GNU General Public License v2.0
// NOTICE: >
//   This program is free software; you can redistribute it and/or
//   modify it under the terms of version 2.0  of the GNU General
//   Public License as published by the Free Software Foundation.
//
//   This program is distributed in the hope that it will be useful,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   GNU General Public License for more details.
//
//   You should have received a copy of version 2.0 of the GNU General
//   Public License along with this program; if not, write to the Free
//   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
//   MA 02110-1301, USA.
//
//

include_once( 'lib/ezxml/classes/ezxml.php' );

class eZUserShopAccountHandler
{
    /*!
    */
    function eZUserShopAccountHandler()
    {

    }

    /*!
     Will verify that the user has supplied the correct user information.
     Returns true if we have all the information needed about the user.
    */
    function verifyAccountInformation()
    {
        return false;
    }

    /*!
     Redirectes to the user registration page.
    */
    function fetchAccountInformation( &$module )
    {
        $module->redirectTo( '/shop/userregister/' );
    }

    /*!
     \return the account information for the given order
    */
    function email( $order )
    {
        $xml = new eZXML();
        $xmlDoc =& $order->attribute( 'data_text_1' );
        if( $xmlDoc != null )
        {
            $dom =& $xml->domTree( $xmlDoc );
            $email =& $dom->elementsByName( "email" );
            return $email[0]->textContent();
        }
        else
            return false;
    }

    /*!
     \return the account information for the given order
    */
    function accountName( $order )
    {
        $accountName = "";
        $xml = new eZXML();
        $xmlDoc =& $order->attribute( 'data_text_1' );
        if( $xmlDoc != null )
        {
            $dom =& $xml->domTree( $xmlDoc );
            $firstName = $dom->elementsByName( "first-name" );
            $lastName = $dom->elementsByName( "last-name" );
            $accountName = $firstName[0]->textContent() . " " . $lastName[0]->textContent();
        }

        return $accountName;
    }

    function accountInformation( $order )
    {
        $xml = new eZXML();
        $xmlDoc =& $order->attribute( 'data_text_1' );
        $dom =& $xml->domTree( $xmlDoc );

        $firstName =& $dom->elementsByName( "first-name" );
        $lastName =& $dom->elementsByName( "last-name" );
        $email =& $dom->elementsByName( "email" );
		$homePhone =& $dom->elementsByName( "homePhone" );/*<!--Added by Seth Shoultes on 1-23-07 -->*/
        $street1 =& $dom->elementsByName( "street1" );
        $street2 =& $dom->elementsByName( "street2" );
        $zip =& $dom->elementsByName( "zip" );
        $place =& $dom->elementsByName( "place" );
        $state =& $dom->elementsByName( "state" );
        $comment =& $dom->elementsByName( "comment" );

        $firstNameText = "";
        if ( is_object( $firstName[0] ) )
            $firstNameText = $firstName[0]->textContent();

        $lastNameText = "";
        if ( is_object( $lastName[0] ) )
            $lastNameText = $lastName[0]->textContent();

        $emailText = "";
        if ( is_object( $email[0] ) )
            $emailText = $email[0]->textContent();
			
        $homePhoneText = "";/*<!--Added by Seth Shoultes on 1-23-07 -->*/
        if ( is_object( $homePhone[0] ) )
            $homePhoneText = $homePhone[0]->textContent();
			
		$street1Text = "";
        if ( is_object( $street1[0] ) )
            $street1Text = $street1[0]->textContent();

        $street2Text = "";
        if ( is_object( $street2[0] ) )
            $street2Text = $street2[0]->textContent();

        $zipText = "";
        if ( is_object( $zip[0] ) )
            $zipText = $zip[0]->textContent();

        $placeText = "";
        if ( is_object( $place[0] ) )
            $placeText = $place[0]->textContent();

        $stateText = "";
        if ( is_object( $state[0] ) )
            $stateText = $state[0]->textContent();

        $commentText = "";
        if ( is_object( $comment[0] ) )
            $commentText = $comment[0]->textContent();

        return array( 'first_name' => $firstNameText,
                      'last_name' => $lastNameText,
                      'email' => $emailText,
					  'homePhone' => $homePhoneText,/*<!--Added by Seth Shoultes on 1-23-07 -->*/
                      'street1' => $street1Text,
                      'street2' => $street2Text,
                      'zip' => $zipText,
                      'place' => $placeText,
                      'state' => $stateText,
                      'comment' => $commentText,
                      );
    }
}

?>

 

<<<<<<<<-------------------------File 7: ----------------------------->>>>>>>>

/ezpublish-3.9.0/kernel/shop/register.php

<?php
//
// Created on: <13-Feb-2003 10:10:35 bf>
//
// SOFTWARE NAME: eZ publish
// SOFTWARE RELEASE: 3.9.0
// BUILD VERSION: 17785
// COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS
// SOFTWARE LICENSE: GNU General Public License v2.0
// NOTICE: >
//   This program is free software; you can redistribute it and/or
//   modify it under the terms of version 2.0  of the GNU General
//   Public License as published by the Free Software Foundation.
//
//   This program is distributed in the hope that it will be useful,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   GNU General Public License for more details.
//
//   You should have received a copy of version 2.0 of the GNU General
//   Public License along with this program; if not, write to the Free
//   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
//   MA 02110-1301, USA.
//
//

$http =& eZHTTPTool::instance();
$module =& $Params["Module"];

include_once( "kernel/common/template.php" );
include_once( 'lib/ezutils/classes/ezhttptool.php' );
include_once( "kernel/classes/ezbasket.php" );
include_once( "lib/ezxml/classes/ezxml.php" );
include_once( "lib/ezutils/classes/ezmail.php" );

$tpl =& templateInit();

if ( $module->isCurrentAction( 'Cancel' ) )
{
    $module->redirectTo( '/shop/basket/' );
    return;
}

$tpl->setVariable( "input_error", false );
if ( $module->isCurrentAction( 'Store' ) )
{
    $inputIsValid = true;
    $firstName = $http->postVariable( "FirstName" );
    if ( trim( $firstName ) == "" )
        $inputIsValid = false;
    $lastName = $http->postVariable( "LastName" );
    if ( trim( $lastName ) == "" )
        $inputIsValid = false;
    $email = $http->postVariable( "EMail" );
    if ( ! eZMail::validate( $email ) )
        $inputIsValid = false;
    $address = $http->postVariable( "Address" );
    if ( trim( $address ) == "" )
        $inputIsValid = false;
    $tpl->setVariable( "first_name", $firstName );
    $tpl->setVariable( "last_name", $lastName );
    $tpl->setVariable( "email", $email );
    $tpl->setVariable( "address", $address );

    if ( $inputIsValid == true )
    {
        // Check for validation
        $basket =& eZBasket::currentBasket();
        $order = $basket->createOrder();

        $doc = new eZDOMDocument( 'account_information' );

        $root = $doc->createElementNode( "shop_account" );
        $doc->setRoot( $root );

        $firstNameNode = $doc->createElementNode( "first-name" );
        $firstNameNode->appendChild( $doc->createTextNode( $firstName ) );
        $root->appendChild( $firstNameNode );

        $lastNameNode = $doc->createElementNode( "last-name" );
        $lastNameNode->appendChild( $doc->createTextNode( $lastName ) );
        $root->appendChild( $lastNameNode );

        $emailNode = $doc->createElementNode( "email" );
        $emailNode->appendChild( $doc->createTextNode( $email ) );
        $root->appendChild( $emailNode );

		$homePhoneNode = $doc->createElementNode( "homePhone" );/*<!--Added by Seth Shoultes on 1-23-07 -->*/
        $homePhoneNode->appendChild( $doc->createTextNode( $homePhone ) );
        $root->appendChild( $homePhoneNode );

        $addressNode = $doc->createElementNode( "address" );
        $addressNode->appendChild( $doc->createTextNode( $address ) );
        $root->appendChild( $addressNode );

        $order->setAttribute( 'data_text_1', $doc->toString() );
        $order->setAttribute( 'account_identifier', "simple" );
        $order->store();

        eZHTTPTool::setSessionVariable( 'MyTemporaryOrderID', $order->attribute( 'id' ) );

        $module->redirectTo( '/shop/confirmorder/' );
        return;
    }
    else
    {
        $tpl->setVariable( "input_error", true );
    }
}

$Result = array();
$Result['content'] =& $tpl->fetch( "design:shop/register.tpl" );
$Result['path'] = array( array( 'url' => false,
                                'text' => ezi18n( 'kernel/shop', 'Enter account information' ) ) );

?>

 

<<<<<<<<-------------------------File 8: ----------------------------->>>>>>>>

/ezpublish-3.9.0/design/standard/templates/shop/accounthandlers/ascii/ez.tpl

{* DO NOT EDIT THIS FILE! Use an override template instead. *}
{"Customer information"|i18n('design/standard/shop')}:
{$order.account_information.first_name} {$order.account_information.last_name}{section show=$order.account_information.street1} ({$order.account_information.street1}){/section}

{"Email"|i18n('design/standard/shop')}:
{$order.account_information.email}

{"Shipping address"|i18n('design/standard/shop')}:
{$order.account_information.street2}
{$order.account_information.zip} {$order.account_information.city}<!--Changed by Seth Shoultes on 1-23-07 -->

{section show=$order.account_information.state}{$order.account_information.state} {/section}{$order.account_information.country}

 

hersnab bottle

Thursday 23 August 2007 8:27:19 am

Hi Seth,
Hope you still use these forums or if someone else can confirm what I'm about to ask.
I've started this thread:

http://ez.no/community/forum/setup_design/changing_default_user_information_in_webshop_noob#msg146962

However it seems you have achieved exactly what I need. I need to change the form fields throughout the ordering system to a UK address format, so 'Zip' become 'Post Code', 'State' becomes 'County' things like that. I have successfully managed to get rid of the need for users to input a country but would like to add a home phone number field like you have.
My question is this: To change all fields like 'Zip' do I just have to go through alll these files and change any reference 'zip' to 'Post code' like you've done here to add a home phone field?
Would that give me the effect I wanted?
I want the order summary to say Post code:yourpostcode and not Zip:youpostcode like it does now. Also in the admin section I would like the order form i have receiced to read correctly and have the correct fields such as 'county' and 'post code' .