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

    Default Company Name after Customer Name Support

    This is the support thread for Company Name after Customer Name mod about to be uploaded to plugins.

  2. #2
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Company Name after Customer Name Support

    While I understand that someone wanted to inject the company name for their specific site (I've read yaseent's thread), I'm having trouble understanding why one would want to do this universally.

    1. What's the specific business problem this is designed to solve?

    2. Is it really necessary to touch the address_format table at all? I mean, since you've injected the $injectCompany thing into *every* address format, why touch the database at all instead of just leaving it entirely in PHP?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

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

    Default Re: Company Name after Customer Name Support

    Quote Originally Posted by DrByte View Post
    While I understand that someone wanted to inject the company name for their specific site (I've read yaseent's thread), I'm having trouble understanding why one would want to do this universally.

    1. What's the specific business problem this is designed to solve?
    In normal business practice (at least in Commonwealth countries) addresses go from least to greatest scope - perfectly logical to me.

    Quote Originally Posted by DrByte View Post
    2. Is it really necessary to touch the address_format table at all? I mean, since you've injected the $injectCompany thing into *every* address format, why touch the database at all instead of just leaving it entirely in PHP?
    I am no expert in coding and am happy with what I have done. The issue has been raised several times over the years and as far as I am concerned has not been adequately resolved. If and when someone provides a better solution, I would be happy to adopt it.

    Thanks

  4. #4
    Join Date
    Dec 2013
    Location
    Maine
    Posts
    77
    Plugin Contributions
    0

    Default Re: Company Name after Customer Name Support

    Quote Originally Posted by dw08gm View Post
    In normal business practice (at least in Commonwealth countries) addresses go from least to greatest scope - perfectly logical to me.



    I am no expert in coding and am happy with what I have done. The issue has been raised several times over the years and as far as I am concerned has not been adequately resolved. If and when someone provides a better solution, I would be happy to adopt it.

    Thanks
    I may be wrong in my interpretation of Dr. Byte's second question, but it seems he is saying that you, yourself have already provided your "better solution" in the PHP code so that modifying the database at all is redundant and unnecessary.

    Mal

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

    Default Re: Company Name after Customer Name Support

    Altering the Db is the only solution I have been able to find that works properly.

    I remain open to a better solution.

  6. #6
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,401
    Plugin Contributions
    87

    Default Re: Company Name after Customer Name Support

    The only alternate solution that I came up with requires modification of the zen_address_format function, present in both (sigh) /YOUR_ADMIN/includes/functions/functions_customer.php and /includes/functions/functions_customer.php. Towards the end of each function, find this block:
    Code:
        $fmt = $address_format->fields['format'];
        eval("\$address_out = \"$fmt\";");
    
        if ( (ACCOUNT_COMPANY == 'true') && (zen_not_null($company)) ) {
          $address_out = $company . $cr . $address_out;
        }
    
        return $address_out;
    and change by simply reordering the lines, to:
    Code:
       $fmt = $address_format->fields['format'];
       if (ACCOUNT_COMPANY == 'true' && zen_not_null ($company)) {
          $fmt = str_replace ('$lastname$cr', '$lastname$cr$company$cr', $fmt);
        }
        eval("\$address_out = \"$fmt\";");
        
        return $address_out;
    Last edited by lat9; 9 Aug 2015 at 02:39 PM. Reason: Forgot return statement!

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

    Default Re: Company Name after Customer Name Support

    Many Thanks Lat9

    I tested your code and it works.

    I shall upload a new version of the mod.

    Cheers

  8. #8
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,401
    Plugin Contributions
    87

    Default Re: Company Name after Customer Name Support

    No problem! I'm a big fan of minimizing core-file changes when it comes to plugins.

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

    Default Re: Company Name after Customer Name Support


 

 

Similar Threads

  1. v151 Company Name after Customer Name (instead of before)
    By dw08gm in forum General Questions
    Replies: 3
    Last Post: 8 Oct 2014, 11:42 AM
  2. Prepend Customer Details Company Name
    By David2376 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 4 May 2009, 12:47 PM
  3. 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
  4. Company Name on customer sign up
    By bjraines in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 27 Nov 2006, 07:40 PM
  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