This is the support thread for Company Name after Customer Name mod about to be uploaded to plugins.
Printable View
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?
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;
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