This is not a bug. You are deliberately screwing up your data. There's no way AFAIK for this to happen organically unless you're attacking your own database.
This is not a bug. You are deliberately screwing up your data. There's no way AFAIK for this to happen organically unless you're attacking your own database.
That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.
To put it another way, there is no expectation that every customer would have the same address_book_id. The issue to try to understand is how did they all end up the same?
So see, if the data was all wrong, then yes the queries against it and other associated code would work unexpectedly. As such there does not actually appear to be a problem with the code in that area unless an operation while using it changes the value for all customers to a single value.
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
Hi
I will re-create the scenario I experienced on a test server using the same data (which I have backup up from live site) and report back.
I noticed that when this happened there were quite a few logs complaining about htmlspecialcharacters and pointing to classes>customer.php...lines 791,811,830 and 847.
Dax - Maybe we should be trying to figure out what we have in common that ate both our databases about the same time. Did you recently switch to square? Did you install lat9's access blocker? Do you host on liquid web? What have you done recently that maybe I did too and am not thinking about?
Hi Gothstone
I recently switched to Square. That would appear to be the common denominator.
Also, before correcting my database I saved the customer and address book tables. Reviewing those there is one entry where the customer ID is missing from the address_book table sequence. That missing ID happened when the database went haywire. They hadn't purchased anything so the Square module wasn't triggered.
Still at a loss what happened.
Yes, it is a bug.
In classes/Customers.php around line 354:
THIS UPDATE STATEMENT CHANGES DEFAULT ADDRESS BOOK ID OF ALL CUSTOMERS, SINCE THERE IS NO WHERE STATEMENT!PHP Code:
protected function setDefaultAddressBookId(int $id)
{
global $db;
$sql = "UPDATE " . TABLE_CUSTOMERS . " SET customers_default_address_id=" . (int)$id;
$db->Execute($sql);
$this->data['customers_default_address_id'] = (int)$id;
}
This is a bug in Zen Cart 1.5.8/1.5.8a which was fixed in Zen Cart 2.0.0.
Credit to @marco-pm for fixing this!
https://github.com/zencart/zencart/pull/5687
And credit to @zamzom for tracking this down - I had long since forgotten this issue.
That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.
Bookmarks