[SOLVED] Orders - problem editing template

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
bob_basli
Forum Members
Forum Members
Posts: 189
Joined: Mon Sep 24, 2007 6:18 pm

[SOLVED] Orders - problem editing template

Post by bob_basli »

Hi all,

since I'm not living in the US, I wanted to remove the state-field removed from my template.
So what I did is simple remove all the state-filed references from the Billing template, Order confirm template, customer email and amin email.
When placing an order and filling out the newly created form, after clicking on next following error appears:
The following field is invalid: --Add Me - module:Orders string:state--
Dunno what to do since I can't find anything on the required fields.
What to do next?

Regards,
Arjan

ps: also would like to set the default country to Netherlands instead of US.
How do I do That?
Last edited by bob_basli on Wed Aug 12, 2009 7:36 am, edited 1 time in total.
bob_basli
Forum Members
Forum Members
Posts: 189
Joined: Mon Sep 24, 2007 6:18 pm

Re: Orders - problem editing template

Post by bob_basli »

Hi alle,
does anyone have an idea on this one or am I the only one who wants to change the required fieds?

Hope to hear from ya soon!
Regards,
kurashiki_ben
Forum Members
Forum Members
Posts: 86
Joined: Sun Jul 05, 2009 2:37 am

Re: Orders - problem editing template

Post by kurashiki_ben »

bob_basli wrote: Hi all,

since I'm not living in the US, I wanted to remove the state-field removed from my template.
So what I did is simple remove all the state-filed references from the Billing template, Order confirm template, customer email and amin email.
When placing an order and filling out the newly created form, after clicking on next following error appears:
The following field is invalid: --Add Me - module:Orders string:state--
Dunno what to do since I can't find anything on the required fields.
What to do next?

Regards,
Arjan
Hi Arjan

Try editing the Orders.module.php file

find the following:
function validate_billing_info(&$billing,&$field)

and then comment out the billing state validation like this:

//  if( !isset($billing['state']) || empty($billing['state']) )
//      {
// $field = 'state';
// return false;
//      }

(that way you can put it back later if you ever need it)
ps: also would like to set the default country to Netherlands instead of US.
How do I do That?
I am trying to do this now myself.
I'll let you know if I come up with a solution.

Regards

Ben
jennifer-rose
New Member
New Member
Posts: 3
Joined: Thu Aug 06, 2009 2:51 am

Re: Orders - problem editing template

Post by jennifer-rose »

Hi Arjan
Hi all,

since I'm not living in the US, I wanted to remove the state-field removed from my template.
So what I did is simple remove all the state-filed references from the Billing template, Order confirm template, customer email and amin email.
When placing an order and filling out the newly created form, after clicking on next following error appears:

Quote
The following field is invalid: --Add Me - module:Orders string:state--

Dunno what to do since I can't find anything on the required fields.
What to do next?

Regards,
Arjan
No need to remove {$mod->Lang('state/province')}:* {$input_billing_state}

use {* *}

{*{$mod->Lang('state/province')}:* {$input_billing_state}
*}

then this underneath from Ben purrrrrrrfect
Hi Arjan

Try editing the Orders.module.php file

find the following:
function validate_billing_info(&$billing,&$field)

and then comment out the billing state validation like this:

//  if( !isset($billing['state']) || empty($billing['state']) )
//      {
//  $field = 'state';
//  return false;
//      }

(that way you can put it back later if you ever need it)
Jenn
kurashiki_ben
Forum Members
Forum Members
Posts: 86
Joined: Sun Jul 05, 2009 2:37 am

Re: [SOLVED] Orders - problem editing template

Post by kurashiki_ben »

bob_basli wrote:
ps: also would like to set the default country to Netherlands instead of US.
How do I do That?
I think I found it.

Within the orders module files, open action.default.php

Then find the following around line 750:

Code: Select all

$smarty->assign_by_ref('mod',$this);
if( !empty($status) )
  {
    $smarty->assign('status',$status);
    $smarty->assign('message',$message);
  }
$smarty->assign('formstart',$this->CGCreateFormStart($id, 'default', $returnid, $params));
$smarty->assign('formend',$this->CreateFormEnd());

$smarty->assign('input_billing_first_name', 
		$this->CreateInputText($id, 'billing_first_name', 
				       $billing['first_name'], 30));
$smarty->assign('input_billing_last_name', 
		$this->CreateInputText($id, 'billing_last_name', 
				       $billing['last_name'], 30));
$smarty->assign('input_billing_address1', 
		$this->CreateInputText($id, 'billing_address1', 
				       $billing['address1'], 50));
$smarty->assign('input_billing_address2', $this->CreateInputText($id, 'billing_address2', 
							   $billing['address2'], 50));
$smarty->assign('input_billing_city', $this->CreateInputText($id, 'billing_city', 
						       $billing['city'], 30));
$smarty->assign('input_billing_state', 
		$this->CreateInputStateDropdown($id, 'billing_state', 
			 $billing['state'] != '' ? $billing['state'] : 'AL', false));
$smarty->assign('input_billing_postal', 
		$this->CreateInputText($id, 'billing_postal', $billing['postal'], 20));
$smarty->assign('input_billing_country', 
		$this->CreateInputCountryDropdown($id, 'billing_country', 
			  $billing['country'] != '' ? $billing['country'] : 'US', false));
$smarty->assign('input_billing_phone', 
		$this->CreateInputText($id, 'billing_phone', $billing['phone'], 30));
$smarty->assign('input_billing_fax', 
		$this->CreateInputText($id, 'billing_fax', $billing['fax'], 30));
$smarty->assign('input_billing_email', 
		$this->CreateInputText($id, 'billing_email', $billing['email'], 80));
Go to:

Code: Select all

	$this->CreateInputCountryDropdown($id, 'billing_country', 
			  $billing['country'] != '' ? $billing['country'] : 'US', false));
Change the 'US' part to the code for your country.
E.g. NL for the Netherlands, GB for the United Kingdom.

These codes can be found within the CGExtensions module files, in countries.txt
Incidentally, the functions used to make the countries and states lists can all be found in the CGExtensions module, in the files form_tools.php and CGExtensions.module.php

Regards

Ben

P.s., I found that the length of the email field (80), breaks the page, so you can also easily change 80 at the end of the line:

Code: Select all

$this->CreateInputText($id, 'billing_email', $billing['email'], 80));
to a smaller value.
psy
Power Poster
Power Poster
Posts: 463
Joined: Sat Jan 22, 2005 11:19 am

Re: [SOLVED] Orders - problem editing template

Post by psy »

Another suggestion... simply modify the Billing template as follows:

Code: Select all

<span class="required" style="display:none">{$mod->Lang('state/province')}:* {$input_billing_state}<br /></span>
You'll also have to edit the other templates to ensure it doesn't print out the default state.

This way the field is removed from the (visible) template output while maintaining module integrity so it wont break on upgrades.

hth
psy
SideshowBob
Forum Members
Forum Members
Posts: 80
Joined: Thu Sep 13, 2007 10:50 am

Re: [SOLVED] Orders - problem editing template

Post by SideshowBob »

I used this little bit of jQuery to set the default country, seems better than hacking the php files.

Make sure you load the jQuery library first and the insert this code

Code: Select all

{literal}
<__script__ type="text/javascript">
$(function() {
     field_name = 'ma5380billing_country';
     default_value = 'GB';
     $("select[name='"+field_name+"'] option[value='"+default_value+"']").attr('selected', true);
});
</__script>
{/literal}
Obviously adjust field_name & default_value to suit your needs.

Hope that helps,
Bob
Post Reply

Return to “Modules/Add-Ons”