Post by robster » Thu Feb 06, 2014 9:21 pm

When registering for an account the address he gives is automatically set as default, however there are times when he will add a second address and set that to default address. If he then deletes that address there is no longer a default address set.

Is there a way to either alert customer that he does not have a default address set or indeed a better way would be to automatically set the orginal address back to default.

Rob

I know my place...!


User avatar
Active Member

Posts

Joined
Tue Jul 13, 2010 8:08 pm
Location - North Yorkshire, UK

Post by MarketInSG » Sat Feb 08, 2014 6:14 pm

you can add an if else statement.

Code: Select all

if (!$this->customer->getAddressId()) { //....
} 


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by robster » Sat Feb 08, 2014 9:57 pm

@MarketInSG

Thanks for the reply, I assume that the statement you are suggesting there is not complete? ALso where would I place this code please?

Robster

I know my place...!


User avatar
Active Member

Posts

Joined
Tue Jul 13, 2010 8:08 pm
Location - North Yorkshire, UK

Post by MarketInSG » Tue Feb 11, 2014 3:01 pm

That statement is good enough to add any text you wish to display if they do not have a default address. You can just add it directly to your template.


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by comprido » Sat Jun 21, 2014 1:58 pm

I´m having similar problem after a ZenCart migration. Although the default address is correctly set, zone_id in adddress table lost the old city value.

Now I want to show a message in payment_address.tpl just for users where default address have zone_id = '0':

<?php if ($addresses) { ?>
<div class="advice">Please review your address before continue. <br/>Visit <a href="/index.php?route=account/address">your address book</a>, push EDIT link and check that all the information is correct.</div><br />
<?php } ?>

How may I use your code?
It´s possible to make this link redirect directly to this address?, just like:

Code: Select all

/index.php?route=account/address/update&address_id='.$address_id.'
Something like:
<?php if ($address['zone'] == '0') { ?><div class="advice">Si era cliente de nuestra antigua tienda y este es su primer pedido, debería actualizar su dirección antes de seguir. <br/>Visite <a href="/index.php?route=account/address/update&address_id=<?php echo $address['address_id']; ?>">su libreta de direcciones</a>, pulse EDITAR y compruebe todos los datos que aparecen en el formulario.</div><br />
<?php } ?>
Thanks in advance!

Pedro Martin - websitesbuilder.com.au
Checkout my free extensions: https://www.opencart.com/index.php?rout ... r=comprido


User avatar
New member

Posts

Joined
Mon Sep 10, 2012 11:46 pm

Post by comprido » Sat Jun 21, 2014 3:18 pm

Solved with payment_address.tpl, at the very top of the file, PASTE:

Code: Select all

<?php if ($addresses) { ?>
<?php foreach ($addresses as $address) { ?>
<?php if ($address['zone'] == '') { ?>    
<div class="advice">We have found <strong>a data error</strong>, please, <a href="/index.php?route=account/address/update&address_id=<?php echo $address['address_id']; ?>">update your address</a> before continue.</div><br />
<?php } ?>
<?php } ?>
Thanks.

Pedro Martin - websitesbuilder.com.au
Checkout my free extensions: https://www.opencart.com/index.php?rout ... r=comprido


User avatar
New member

Posts

Joined
Mon Sep 10, 2012 11:46 pm
Who is online

Users browsing this forum: No registered users and 5 guests