Post by gladiator » Mon Jan 11, 2010 12:25 pm

I want to "enable" this feature in Admin under options but before I do I would like to make the postcode be a "required" field to fill out due to being in the US.

Can someone tell me where and what file to edit as well as what lines to add or change?

Thanks

http://www.gladiatorlighting.com


User avatar
New member

Posts

Joined
Wed Aug 12, 2009 1:26 pm

Post by ssjal » Tue Jan 12, 2010 3:09 pm

You have to make changes in 3 files to make postcode required in guest checkout

1.)
goto catalog > language > english > checkout > guest.php

Here enter postcode error flag message text:-
$_['error_postcode'] = 'Enter Postcode';

2.)
goto catalog > controller > checkout > guest.php

Find: private function validate()
here enter following code to make validation check:-

if ((strlen(utf8_decode($this->request->post['postcode'])) < 1)) {
$this->error['postcode'] = $this->language->get('error_postcode');
}

Then Find the error display blocks on the page and add the following code to show error message:-

if (isset($this->error['postcode'])) {
$this->data['error_postcode'] = $this->error[postcode'];
} else {
$this->data['error_postcode'] = '';
}

3.)
goto catalog > view > theme > default > template > checkout > guest.tpl
Find code block:-
<tr>
<td><?php echo $entry_postcode; ?></td>
<td><input type="text" name="postcode" value="<?php echo $postcode; ?>" onblur="getMethods();" /></td>
</tr>
Replace it with:-
<tr>
<td><?php echo $entry_postcode; ?></td>
<td><input type="text" name="postcode" value="<?php echo $postcode; ?>" onblur="getMethods();" />
<?php if ($error_postcode) { ?>
<span class="error"><?php echo $error_postcode; ?></span>
<?php } ?>
</td>
</tr>

Hope this will help you.

New member

Posts

Joined
Thu Sep 17, 2009 4:45 pm

Post by Qphoria » Tue Jan 12, 2010 8:11 pm

Almost all Forums have code tags... You think it'd be commonly known by now

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by gladiator » Tue Jan 12, 2010 10:31 pm

I did all the code but how do you make the "red" asterisk show up next to "postcode"?

http://www.gladiatorlighting.com


User avatar
New member

Posts

Joined
Wed Aug 12, 2009 1:26 pm

Post by MWYS » Tue Jan 12, 2010 10:44 pm

gladiator wrote:I did all the code but how do you make the "red" asterisk show up next to "postcode"?
3.)
goto catalog > view > theme > default > template > checkout > guest.tpl

This code should be the following (opposed to the code above)

Code: Select all

<tr>
<td><span class="required">*</span> <?php echo $entry_postcode; ?></td>
<td><input type="text" name="postcode" value="<?php echo $postcode; ?>" onblur="getMethods();" />
<?php if ($error_postcode) { ?>
<span class="error"><?php echo $error_postcode; ?></span>
<?php } ?>
</td>
</tr>

New member

Posts

Joined
Wed Oct 21, 2009 9:04 pm

Post by gladiator » Tue Jan 12, 2010 10:50 pm

Sweet thanks!

http://www.gladiatorlighting.com


User avatar
New member

Posts

Joined
Wed Aug 12, 2009 1:26 pm

Post by vkaltchev » Tue Aug 10, 2010 2:46 am

In reply to SSJL

it should be this on 2.)

if (isset($this->error['postcode'])) {
$this->data['error_postcode'] = $this->error['postcode'];
} else {
$this->data['error_postcode'] = '';
}

New member

Posts

Joined
Fri Apr 16, 2010 11:02 am

Post by mrdan » Sat Aug 14, 2010 3:36 am

Where in Admin can guest checkout be enabled?

Newbie

Posts

Joined
Sat Aug 14, 2010 3:21 am

Post by i2Paq » Sat Aug 14, 2010 3:52 am

mrdan wrote:Where in Admin can guest checkout be enabled?
BO -> System -> Settings -> Option Tab: Guest Checkout:

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands
Who is online

Users browsing this forum: No registered users and 100 guests