Elxis CMS Forum

Support => Technical support => Topic started by: StefanSultanov on July 03, 2011, 21:35:36

Title: Modify eshop register form
Post by: StefanSultanov on July 03, 2011, 21:35:36
Can one modify the eshop register and order forms?

I have built www.ofis-promo-tehnika.com a web shop.
I need to modify the order form and the register form altogether to suit the needs of the client according to Bulgarian laws.

1. Company name
2. State/Country
3. City
4. Address of registration
5. Number Field / Bulstat
6. VAT Tax Number
7. A persons 3 names / MOL

Right now I need to add 3 fields more when the order comes from a company.
Any hinting?

Thanks in advance!
Title: Re: Modify eshop register form
Post by: datahell on July 04, 2011, 19:01:18
The easiest way to do so is by putting those information into the order's comments area. This way you wont have to modify other pages or the database.

HTML form:
Code: [Select]
<input type="text" name="x1" value ="" />
<input type="text" name="x2" value ="" />
<input type="text" name="x3" value ="" />

After submit, append the values of these fields into the comments area. Sample:

Code: [Select]
$comments = mosGetParam($_POST, 'comments', '');
$order->comments = $eshop->makesafe($comments, 0);

$order->comments.= 'Extra field 1: '.$_POST['x1']."\n";
$order->comments.= 'Extra field 2: '.$_POST['x2']."\n";
$order->comments.= 'Extra field 3: '.$_POST['x3']."\n";
Title: Re: Modify eshop register form
Post by: StefanSultanov on July 05, 2011, 09:53:51
Hm!
Thanks

This is difficult enough for me.

Where should I find the code to modify? Which file?

I wonder what is the long way to do that :)

Title: Re: Modify eshop register form
Post by: datahell on July 05, 2011, 14:42:59
This is the easy way. You dont want to know the hard way...
Title: Re: Modify eshop register form
Post by: StefanSultanov on July 06, 2011, 17:26:12
So here I found the fields that are present on the order form.
Quote
<tr>
            <td width="35%"><?php echo $eshop->lng->COMPANYTITLE; ?></td>
            <td><input type="text" name="bcompany" id="bcompany" class="eshoplongbox" title="<?php echo $eshop->lng->COMPANYTITLE; ?>" value="<?php echo $row->bcompany; ?>" /></td>
         </tr>
         <tr>
            <td><?php echo $eshop->lng->COMPANYACTIV; ?></td>
            <td><input type="text" name="bcompanyactiv" id="bcompanyactiv" class="eshoplongbox" title="<?php echo $eshop->lng->COMPANYACTIV; ?>" value="<?php echo $row->bcompanyactiv; ?>" /></td>
         </tr>
         <tr>
            <td><?php echo $eshop->lng->AFM; ?></td>
            <td><input type="text" name="bafm" id="bafm" class="eshopbox" dir="ltr" title="<?php echo $eshop->lng->AFM; ?>" value="<?php echo $row->bafm; ?>" /></td>
         </tr>
         <tr>
            <td><?php echo $eshop->lng->IRS; ?></td>
            <td><input type="text" name="birs" id="birs" class="eshopbox" dir="ltr" title="<?php echo $eshop->lng->IRS; ?>" value="<?php echo $row->birs; ?>" /></td>
         </tr>

Now I need to add 2 more fields to those. Am I right?
I suppose I need to modify the database to make room for the data.
And from there I need to modify the order display in eshop backend to reuse the submitted info. 2 or 3 fields more.
Can you tell me, will this work and am I missing something?

Thanks!
Title: Re: Modify eshop register form
Post by: datahell on July 06, 2011, 17:56:34
Up to the HTML you are correct. But don't modify the database. The way I told you (save these information in the comments area) is much more easy to do. The comments area is a text field and can store what ever information you wish. Don't create new database columns because you will have to modify much more things than those you said.