Help needed - missing 'name'

Open to all! Ask other shopowners for help.
Post Reply
Xpajun
Contributor
Posts: 187
Joined: Thu Mar 04, 2021 1:18 pm
Phoenix Version: v1.0.9.0
Has thanked: 3 times
Been thanked: 6 times

Help needed - missing 'name'

Post 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
Current Store is now running 1.0.9.0 - php 8.2.18
Now working on taking a short rest :D - php 8.2.18


Join The Code Co-op to get access to your library in the Code Co-op Forum
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Help needed - missing 'name'

Post 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");
Xpajun
Contributor
Posts: 187
Joined: Thu Mar 04, 2021 1:18 pm
Phoenix Version: v1.0.9.0
Has thanked: 3 times
Been thanked: 6 times

Re: Help needed - missing 'name'

Post 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
Current Store is now running 1.0.9.0 - php 8.2.18
Now working on taking a short rest :D - php 8.2.18


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply