Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2008
    Location
    DownUnder, overlooking South Pole.
    Posts
    976
    Plugin Contributions
    6

    Default Company Name after Customer Name (instead of before)

    Back in 2008, Dr Byte kindly provided a solution to display the company name after the customer name.

    Code:
    1. Edit /includes/functions/functions_customers.php. Around line 108 you'll see code that looks like this. Add the additional code as shown:
    Code:
    
        if ( (ACCOUNT_COMPANY == 'true') && (zen_not_null($company))  && !strpos($fmt, '$company') ) {
          $address_out = $company . $cr . $address_out;
        }
    
    2. Using phpMyAdmin, open the "address_format" table, and edit the value in the address_format column for address_format_id record #2 by adding $cr$company right after $lastname
    
    That will affect all addresses for all customers whose country's standard address formatting is set to address_format_id #2 (USA is set to use #2 by default).
    As discussed in this closed thread:
    https://www.zen-cart.com/showthread....d-Company-Name


    The code works but with one small problem, that if no company name is provided, a blank line will appear between the customer name and the address, which does not look good.

    Having spent much of the day trying to fix this problem, I now seek help to remove the blank line when no company name is provided.

    Thanks

  2. #2
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,379
    Plugin Contributions
    9

    Default Re: Company Name after Customer Name (instead of before)

    Played with this on a local installation (zc 1.5.3).

    I need to stress that I have NOT implemented DrByte's second part of the solution - the part which talks about editing the "address_format" table in phpMyAdmin.

    I changed this

    PHP Code:
        if ( (ACCOUNT_COMPANY == 'true') && (zen_not_null($company)) ) { 
          
    $address_out $company $cr $address_out
        } 
    to this

    PHP Code:
        if ( (ACCOUNT_COMPANY == 'true') && (zen_not_null($company))  && !strpos($fmt'$company') ) {
          
    $address_out $company $cr $address_out;
        } elseif ( (
    ACCOUNT_COMPANY == 'true') && (zen_not_null($company)) ) { 
          
    $address_out $company $cr $address_out
        } 
    I placed test orders with company name specified and company name not specified - no errors reported.

    Suggest you try this ONLY on a local installation but not on a live store.

    I could be totally off course - but worth a try.

    Frank

  3. #3
    Join Date
    Sep 2008
    Location
    DownUnder, overlooking South Pole.
    Posts
    976
    Plugin Contributions
    6

    Default Re: Company Name after Customer Name (instead of before)

    Thanks Frank, but your suggestion did not seem to do anything different.

    One solution I am working on atm is duplicating the address_book table rows (6 in 151, 7 in 153), and including the $company$cr after the customer names in the 7 copied rows. All I need to do is to devise an IF statement that if a company name exists, then use the number of the address format for the customer country +7. So for Australia, instead of row 7 being used, row 14 will be used if a company name exists. Have not had great success with this as yet, but have not played with it since the weekend.

    Off topic, I went to your demo site and was mildly disappointed that no login was available to see how you handled the various My Account pages. I am currently working towards including ABN, GST, GST exemption code inputs associated with the company name and a few other fixes pertinent to Aust conditions, although very much tailored to my peculiar fluid/responsive template.

    Cheers

  4. #4
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,379
    Plugin Contributions
    9

    Default Re: Company Name after Customer Name (instead of before)

    Quote Originally Posted by dw08gm View Post
    Thanks Frank, but your suggestion did not seem to do anything different.
    Yeah, can't work because $cr$company inserts a carriage return and then the company name. If the company name is non-existent then we are getting a blank line .....

    Quote Originally Posted by dw08gm View Post
    One solution I am working on atm is duplicating the address_book table rows (6 in 151, 7 in 153), and including the $company$cr after the customer names in the 7 copied rows. All I need to do is to devise an IF statement that if a company name exists, then use the number of the address format for the customer country +7. So for Australia, instead of row 7 being used, row 14 will be used if a company name exists. Have not had great success with this as yet, but have not played with it since the weekend.
    Please let us know how this pans out.

    Quote Originally Posted by dw08gm View Post
    Off topic, I went to your demo site and was mildly disappointed that no login was available to see how you handled the various My Account pages....
    I didn't grant access to the admin because I am using this demo site for some other mod testing. Too much time involved restricting all the different configs to a demo admin. Sorry about that...

    Cheers / Frank

 

 

Similar Threads

  1. v154 Company Name after Customer Name Support
    By dw08gm in forum All Other Contributions/Addons
    Replies: 8
    Last Post: 24 Aug 2015, 07:08 AM
  2. Company name before name??
    By bottyz in forum Managing Customers and Orders
    Replies: 7
    Last Post: 5 Jul 2010, 11:18 PM
  3. Paypal RETURN TO shows my real name instead of company name
    By tuanle55 in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 28 Jul 2008, 03:47 AM
  4. Company name vs Customer name at registration
    By sanji in forum Managing Customers and Orders
    Replies: 4
    Last Post: 28 Jan 2008, 10:57 AM
  5. Customer/Company Name Length
    By seanscully in forum Managing Customers and Orders
    Replies: 1
    Last Post: 10 Aug 2006, 09:43 AM

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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR