Post by Johnathan » Fri Jun 25, 2010 11:44 pm

For my site, I use this modification to make the customer's default address bold in their address book:

IN:

Code: Select all

/catalog/view/theme/YOURTHEME/template/account/addresses.tpl
REPLACE:

Code: Select all

<td><?php echo $result['address']; ?></td>
WITH:

Code: Select all

<td>
<?php if ($this->customer->getAddressId() == $result['address_id']) { ?>
  <span style="font-weight: bold"><?php echo $result['address']; ?></span>
<?php } else { ?>
  <?php echo $result['address']; ?>
<?php } ?>
</td>
I propose this is added to the core, so that customer's can tell which address is their default. I realize using "$this->customer->getAddressId()" in the template isn't best form, but Q or Daniel can probably figure out where to put it. Also, the language file should be changed:

IN:

Code: Select all

/catalog/language/english/account/address.php
REPLACE:

Code: Select all

Address Book Entries
WITH:

Code: Select all

Address Book Entries (default in bold)

Image
Image Image Image Image


User avatar
Global Moderator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by Moel » Sat Feb 16, 2019 5:56 am

Hopefully you are still active in this topic.

How to implement this in opencart 3.0.2.0 ?

Newbie

Posts

Joined
Sat Feb 16, 2019 5:48 am

Post by Johnathan » Sat Feb 16, 2019 11:44 pm

In OpenCart 3.0 versions:

Code: Select all

IN:
/catalog/controller/account/address.php

AFTER:
$results = $this->model_account_address->getAddresses();

ADD:
$data['default_address'] = $this->customer->getAddressId();

Code: Select all

IN:
/catalog/view/theme/YOURTHEME/template/account/address_list.twig

REPLACE:
<td class="text-left">{{ result.address }}</td>

WITH:
<td class="text-left">
{% if result.address_id == default_address %}<b>{% endif %}
{{ result.address }}
{% if result.address_id == default_address %}</b>{% endif %}
</td>

Image
Image Image Image Image


User avatar
Global Moderator

Posts

Joined
Fri Dec 18, 2009 3:08 am

Who is online

Users browsing this forum: No registered users and 10 guests