Full service web hosting, great prices and support. Starts at $1.99/month!
Results 1 to 6 of 6

Thread: Company line of customer address

  1. #1
    afthrscomputers
    Guest


    Default Company line of customer address

    Company line of address (anywhere in store or order emails) cannot be moved...

    What is displayed:
    BK Transport (Company)
    Steven Jackson Jnr (Name)
    1236 new street
    Elk Grove
    HI 94534
    United States

    What is required:
    Steven Jackson Jnr (Name)
    BK Transport (Company)
    1236 new street
    Elk Grove
    HI 94534
    United States

    Adding $company to address_format @ sql database results in:
    BK Transport (Company)
    Steven Jackson Jnr (Name)
    BK Transport (Company)
    1236 new street
    Elk Grove
    HI 94534
    United States


    Help ! ? ! ?

    Many Thanks,
    Matt

  2. #2
    jpf
    Guest


    Default RE: Company line of customer address

    Yes it can be moved - don't add a feild in MYSQL.
    Find the code in the TEMPLATE directory and move it.

    Like in create_account.tpl.php

    Line 80....
    <?php
    if (ACCOUNT_COMPANY == 'true') {
    ....
    <?php
    }
    ?>
    (line 109)
    MOVE to say line 44 would move the company name above the name...

    Now email are much the same - find the code and move it....

    Not sure which email your thinking of but a search for the unique text (for just that email) in the language files will get you the variable - find the varible in the site you found the code you need to look at...

    Good Luck

  3. #3
    afthrscomputers
    Guest


    Default

    Thanks for your reply jpf but i think you have missed my point... I shall explain a bit more..

    Pic 1 - Correct layout, how it should be displayed on all account/checkout pages and order emails...


    Pic 2 - Address layout puts the Company -ABOVE- the First Name, not below it as desired...


    Pic 3 - Order email puts the Company above the First Name again...


    I have searched and searched with UltraEdit and moved snippits of code everywhere but still no luck. Starting to go grey over this one as i have had no trouble customising any of my stores before.

    Thanks
    Matt

  4. #4
    jpf
    Guest


    Default

    Yes your right.... it call a fuction from general.php called: tep_address_format

    In that fuction generated the address format...modify the fuction...

    Code:
      function tep_address_format($address_format_id, $address, $html, $boln, $eoln) {
        $address_format_query = tep_db_query("select address_format as format from " . TABLE_ADDRESS_FORMAT . " where address_format_id = '" . (int)$address_format_id . "'");
        $address_format = tep_db_fetch_array($address_format_query);
    
        $company = tep_output_string_protected($address['company']);
        if (isset($address['firstname']) && tep_not_null($address['firstname'])) {
          $firstname = tep_output_string_protected($address['firstname']);
          $lastname = tep_output_string_protected($address['lastname']);
        } elseif (isset($address['name']) && tep_not_null($address['name'])) {
          $firstname = tep_output_string_protected($address['name']);
          $lastname = '';
        } else {
          $firstname = '';
          $lastname = '';
        }
        $street = tep_output_string_protected($address['street_address']);
        $suburb = tep_output_string_protected($address['suburb']);
    to
    Code:
      function tep_address_format($address_format_id, $address, $html, $boln, $eoln) {
        $address_format_query = tep_db_query("select address_format as format from " . TABLE_ADDRESS_FORMAT . " where address_format_id = '" . (int)$address_format_id . "'");
        $address_format = tep_db_fetch_array($address_format_query);
    
        if (isset($address['firstname']) && tep_not_null($address['firstname'])) {
          $firstname = tep_output_string_protected($address['firstname']);
          $lastname = tep_output_string_protected($address['lastname']);
        } elseif (isset($address['name']) && tep_not_null($address['name'])) {
          $firstname = tep_output_string_protected($address['name']);
          $lastname = '';
        } else {
          $firstname = '';
          $lastname = '';
        }
        $company = tep_output_string_protected($address['company']);
        $street = tep_output_string_protected($address['street_address']);
        $suburb = tep_output_string_protected($address['suburb']);
    Good Luck

  5. #5
    afthrscomputers
    Guest


    Default

    Thanks again jpf.

    I had previously edited "general.php" (using UltraEdit search) as per your recommendation before my last-gasp post here.

    Heres what i have now....

    =
    Company ABOVE Name in 'general.php' results in:
    BK Transport
    Steven Jackson
    1236 new street
    (3 lines, wrong)

    =
    Company BELOW Name in 'general.php' results in:
    BK Transport
    Steven Jackson
    1236 new street
    (3 lines, no change)

    =
    Commented ( // ) Company in 'general.php' results in:
    Steven Jackson
    1236 new street
    (2 lines, nothing displayed)

    =
    Adding '$company' to 'address_format' @ sql results in:
    BK Transport
    Steven Jackson
    BK Transport
    1236 new street
    (4 lines, duplicate entry)

    =
    Adding '$company' to 'address_format' @ sql and commented company line:
    Steven Jackson

    1236 new street
    (3 lines, blank line NOT a typo.)

    =
    The SQL line from 'address_format'.
    Code:
    $firstname $lastname$cr$streets$cr$city$cr$state $postcode$cr$country
    Lines 432->465 of 'general.php'.
    Code:
    // Return a formatted address
    // TABLES: address_format
    function tep_address_format($address_format_id, $address, $html, $boln, $eoln) { 
        $address_format_query = tep_db_query("select address_format as format from " . TABLE_ADDRESS_FORMAT . " where address_format_id = '" . (int)$address_format_id . "'"); 
        $address_format = tep_db_fetch_array($address_format_query); 
    
        if (isset($address['firstname']) && tep_not_null($address['firstname'])) { 
          $firstname = tep_output_string_protected($address['firstname']); 
          $lastname = tep_output_string_protected($address['lastname']); 
        } elseif (isset($address['name']) && tep_not_null($address['name'])) { 
          $firstname = tep_output_string_protected($address['name']); 
          $lastname = ''; 
        } else { 
          $firstname = ''; 
          $lastname = ''; 
        } 
        $company = tep_output_string_protected($address['company']); 
        $street = tep_output_string_protected($address['street_address']); 
        $suburb = tep_output_string_protected($address['suburb']);
        $city = tep_output_string_protected($address['city']);
        $state = tep_output_string_protected($address['state']);
        if (isset($address['country_id']) && tep_not_null($address['country_id'])) {
          $country = tep_get_country_name($address['country_id']);
    
          if (isset($address['zone_id']) && tep_not_null($address['zone_id'])) {
            $state = tep_get_zone_code($address['country_id'], $address['zone_id'], $state);
          }
        } elseif (isset($address['country']) && tep_not_null($address['country'])) {
          $country = tep_output_string_protected($address['country']);
        } else {
          $country = '';
        }
        $postcode = tep_output_string_protected($address['postcode']);
        $zip = $postcode;
    Thanks again, Matt

  6. #6
    jpf
    Guest


    Default

    Okay delve a lot more and followed the code/fuctions.....

    Address is setup as in your ADMIN setting, ONLY 4 options - all NOT including company name......

    Option 1: Add another format
    SQL:
    insert into address_format (address_format_id, address_format, address_summary) values ('5', '$firstname $lastname$cr$company$cr$streets$cr$city, $postcode$cr$statecomma$country', '$city / $country');

    and remove/comment out in general.php line 527-529
    // if ( (ACCOUNT_COMPANY == 'true') && (tep_not_null($company)) ) {
    // $address = $company . $cr . $address;
    // }

    Works????

    Option 2: Change just general.php line 527-529 to---

    if ( (ACCOUNT_COMPANY == 'true') && (tep_not_null($company)) ) {
    // $address = $company . $cr . $address;
    $address = $firstname . $lastname . $cr . $company . $cr . $streets . $cr . $city . ", " . $statecomma . $postcode . $cr . $country;
    }

    Which should work to produce...

    Steven Jackson
    BK Transport
    1236 new street
    MyState, ST
    12345
    Farfarawaycountry


    What a pain in the a$$....

Similar Threads

  1. customer address required only
    By ogilirca in forum osCmax v2 Customization/Mods
    Replies: 4
    Last Post: 01-02-2007, 11:24 AM
  2. customer cannot edit address
    By battleaxe in forum osCommerce 2.2 Modification Help
    Replies: 0
    Last Post: 09-08-2005, 03:27 AM
  3. The ship to address is missing for the customer
    By shawnfunn in forum osCommerce 2.2 Installation Help
    Replies: 0
    Last Post: 02-08-2005, 02:32 PM
  4. Adding a second street address line?
    By uli in forum osCommerce 2.2 Modification Help
    Replies: 1
    Last Post: 08-12-2004, 05:33 AM
  5. Address book address line ordering
    By Anonymous in forum osCmax v1.7 Discussion
    Replies: 2
    Last Post: 11-29-2003, 05:54 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •