Page 1 of 1

Help needed - missing 'name'

Posted: Sat Sep 04, 2021 7:45 pm
by Xpajun
Originally posted this on the community forum not realising that posting here may get a better result - thanks for the tip @heatherbell
What's happening:
I'm not getting the customer's name showing on the order edit or the invoice or packing slip pages - the customer's name is inserted in the orders database and will show on the inatial Orders page. the address block containing the various customer's detail is showing but without the customer's name

My understanding is that the address block is created in admin>classes>order.php where the details for it are selected from the database by this query:

Code: Select all

      $order_query = tep_db_query("SELECT * FROM orders WHERE orders_id = " . (int)$order_id);
      $order = tep_db_fetch_array($order_query);
and then the address block is formed like so:

Code: Select all

      $this->customer = [
        'id' => $order['customers_id'],
        'name' => $order['customers_name'],
        'company' => $order['customers_company'],
        'street_address' => $order['customers_street_address'],
        'suburb' => $order['customers_suburb'],
        'city' => $order['customers_city'],
        'postcode' => $order['customers_postcode'],
        'state' => $order['customers_state'],
        'country' => ['title' => $order['customers_country']],
        'format_id' => $order['customers_address_format_id'],
        'telephone' => $order['customers_telephone'],
        'email_address' => $order['customers_email_address'],
      ];

      $this->delivery = [
        'name' => trim($order['delivery_name']),
        'company' => $order['delivery_company'],
        'street_address' => $order['delivery_street_address'],
        'suburb' => $order['delivery_suburb'],
        'city' => $order['delivery_city'],
        'postcode' => $order['delivery_postcode'],
        'state' => $order['delivery_state'],
        'country' => [ 'title' => $order['delivery_country']],
        'format_id' => $order['delivery_address_format_id']];

      if (empty($this->delivery['name']) && empty($this->delivery['street_address'])) {
        $this->delivery = false;
      }

      $this->billing = [
        'name' => $order['billing_name'],
        'company' => $order['billing_company'],
        'street_address' => $order['billing_street_address'],
        'suburb' => $order['billing_suburb'],
        'city' => $order['billing_city'],
        'postcode' => $order['billing_postcode'],
        'state' => $order['billing_state'],
        'country' => ['title' => $order['billing_country']],
        'format_id' => $order['billing_address_format_id'],
      ];

and then transfered to admin>orders.php here:

Code: Select all

            <tr>
              <td>
                <p><?php echo $address->format($order->customer, 1, '', '<br>'); ?></p>
                <p><?php echo $order->customer['telephone'] . '<br>' . '<a href="mailto:' . $order->customer['email_address'] . '"><u>' . $order->customer['email_address'] . '</u></a>'; ?></p>
              </td>
              <td><p><?php echo $address->format($order->delivery, 1, '', '<br>'); ?></p></td>
              <td><p><?php echo $address->format($order->billing, 1, '', '<br>'); ?></p></td>
            </tr>
But I get everything except the 'name'

Image

Re: Help needed - missing 'name'

Posted: Sat Sep 04, 2021 9:19 pm
by ecartz
A missing name is usually caused by incorrect entries in the address_format table. From the 1.0.5.1 update:

Code: Select all

UPDATE address_format SET address_format = REPLACE(address_format, "$firstname $lastname", "$name");

Re: Help needed - missing 'name'

Posted: Sun Sep 05, 2021 7:01 am
by Xpajun
ecartz wrote: Sat Sep 04, 2021 9:19 pm A missing name is usually caused by incorrect entries in the address_format table. From the 1.0.5.1 update:

Code: Select all

UPDATE address_format SET address_format = REPLACE(address_format, "$firstname $lastname", "$name");
One missing line.... Thank you Matt - very much appreciated