This is the support thread for Company Name after Customer Name mod about to be uploaded to plugins.
This is the support thread for Company Name after Customer Name mod about to be uploaded to plugins.
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.
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
Altering the Db is the only solution I have been able to find that works properly.
I remain open to a better solution.
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:
and change by simply reordering the lines, to: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;
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!
Many Thanks Lat9
I tested your code and it works.
I shall upload a new version of the mod.
Cheers
No problem! I'm a big fan of minimizing core-file changes when it comes to plugins.
Version 2 now available at
https://www.zen-cart.com/downloads.php?do=file&id=2019
Bookmarks