Replies: 6 comments 13 replies
-
Comments/questions, in no particular order:
|
Beta Was this translation helpful? Give feedback.
-
What about having the Perhaps the As far as the "granular" suggestion, the |
Beta Was this translation helpful? Give feedback.
-
Should the |
Beta Was this translation helpful? Give feedback.
-
I'm also not liking the class' presumption about zencart/includes/classes/Customer.php Lines 732 to 734 in 83fa36e Shouldn't that 'dob' value be part of the submitted |
Beta Was this translation helpful? Give feedback.
-
Just to throw a curve ball in here |
Beta Was this translation helpful? Give feedback.
-
Does this entirely solve the "staleness" problem though? I would think that core code would need to be changed to actually ask for less-stale details, else the NoCache approach is pointless. |
Beta Was this translation helpful? Give feedback.
-
Customer.php Class
The current (zc158a) version of
includes/classes/Customer.php
is a good start at encapsulating various customer-related functions for common use, but there are a couple of issues with its current implementation:$db
methods , the additional processing is unnecessary for much of its use. For example, thezen_get_customers_address_primary
instantiates the class solely to retrieve theid
associated with the customer's primary address-book entry.data
property. For example, if the class is instantiated by a script and that script updates an element of the customer's database-related information, further use of class methods by that script could return "stale" data.customers_id
contains valid information — which is not necessarily valid.Note: These changes would be used as the basis for updating the class in support of the Wholesale Pricing addition.
Proposed Changes
Performance
__construct
method to take an optional(bool)$load_all_data
input (which defaults totrue
for downward-compatibility). The value is stored as a class property for subsequent use by theload
method.load
method to inspect the class'(bool)$loadAllData
property to see whether all information, e.g. the full address-book, should be gathered or whether only the basecustomers
andcustomers_info
tables' data should be gathered.setLoadAllData
method so that a class user can modify the processing flag post-instantiation.Data Staleness
$db->ExecuteNoCache
instead of$db->Execute
for all queries. While this will affect performance, it will ensure data integrity.Guest-customer Interactions
Current In-Core Users of the Class
admin/customers.php
Uses the
Customer
class for form-related data-gathering and some of its actions. Performs direct database updates outside of the class when an admin has edited a customer's information.includes/functions/functions_customer.php
The majority of the functions instantiate the class simply to retrieve a specific customer value.
includes/modules/checkout_address_book.php
Uses the class to gather the various address-book records associated with the currently logged-in customer.
includes/modules/create_account.php
Uses the class to
create
a customer's account and, if successful,login
that customer.includes/modules/pages/account/header_php.php
Uses the class to gather the currently-logged-in customer's most recent orders.
includes/modules/pages/account_history/header_php.php
Uses the class to gather the currently-logged-in customer's full order history.
includes/modules/pages/account_history_info/header_php.php
Uses the class to ensure that the currently-loaded order is one placed by the currently-logged-in customer.
includes/modules/pages/address_book/header_php.php
Uses the class to gather all the currently-logged-in customer's formatted address-book entries.
includes/modules/pages/login/header_php.php
Uses the class to ensure that the page's form's email address is associated with a customer account and, if so, uses the
login
method to log the customer into the site's storefront.Beta Was this translation helpful? Give feedback.
All reactions