Here are my notes. I wanted to attach them as a Word file since the formatting will probably get messed up with cut and paste but the file's 171kb. You can email me at jade "at" edufone.com and I'll email you the attachment.
There may have been other things I could have done to make it simpler so if anyone has other ideas, please let me know.
The table at the top shows all of the files that I changed. The messy notes follow and they show what I changed. Most of those notes haven't yet made it into the table so you'll want to consult both the table and the notes.
jdl
File modified Change
store/includes/modules/create_account.php telephone number must be exactly 10 digits
store/includes/modules/pages/checkout_success/header.php
store/includes/functions/html_output.php Added function, zen_get_carrier_list
store/includes/functions/functions_lookups.php copied function get_countries() to get_carriers()
store/includes/templates/myTemplates/templates/tpl_modules_create_account.php
Added code to display list of carriers
store/admin/includes/functions/general.php zen_cfg_pull_down_carrier_list_none
store/includes/modules/pages/create_account/jscript_form_check.php
check_select("carrier", "", "<?php echo ENTRY_CARRIER_ERROR; ?>");
store/includes/form_check.js.php check_select("carrier", "", "<?php echo ENTRY_CARRIER_ERROR; ?>");
store/includes/templates/myTemplate/tpl_modules_checkout_new_address.php added phone number and carrier
store\includes\templates\myTemplate\templates\tpl_account_edit_default.php When user edits his account info, add carrier
store\includes\modules\pages\account_edit\header_php.php carrier will be including in the fields array;
telephone number must be exactly 10 digits
includes\languages\english.php carrier labels and telephone format
includes\languages\spanish.php
Note: Changing the jscript to do the error checking didn’t seem to make any difference so I’m not even sure if that code is called. Thus the server side error checking seemed to be the only error checking that was triggered when I tested the code.
Changes that I made to the zen_cart code (and that I’ll need to incorporate into upgrades):
- To create the code on checkout_success and send the sms text message to user:
a. Added 6 fields to zen_orders_products table:
ALTER TABLE zen_orders_products ADD code VARCHAR( 20 ) NOT NULL AFTER products_id ,
ADD downloaded TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0' AFTER code ,
ADD cntTries SMALLINT( 4 ) UNSIGNED NOT NULL DEFAULT '0' AFTER downloaded ,
ADD t_lastAccessed TIMESTAMP NULL AFTER cntTries ;
ADD t_ordered TIMESTAMP NULL AFTER t_lastAccessed ;
ADD t_downloaded TIMESTAMP NULL AFTER t_ordered ;
b. modified store/includes/modules/pages/checkout_success/header.php
- SQL for text messaging:
SELECT customers_telephone, sms
FROM zen_customers, carrier
WHERE customers_id =2
AND zen_customers.carrier_id = carrier.carrier_id
c. Added carrier table:
CREATE TABLE carrier (
carrier_id int(11) NOT NULL auto_increment,
countries_id int(11) NOT NULL default '0',
name varchar(30) NOT NULL default '',
sms varchar(30) NOT NULL default '',
PRIMARY KEY (carrier_id)
) TYPE=MyISAM AUTO_INCREMENT=1 ;
d. Added 4 US carriers that support java apps to the table.
e. Modified the customers table to add the carrier_id. Looked through store/admin functionality. There doesn’t appear to be any way to use this interface to add customer details—only to turn them off.
- To add carrier to registration information:
a. Added function, zen_get_carrier_list, to store/includes/functions/html_output.php:
/*
-
Creates a pull-down list of carriers
*/
function zen_get_carrier_list($name, $selected = '', $parameters = '') {
$carriers_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));
$carriers = zen_get_carriers();
for ($i=0, $n=sizeof($carriers); $i<$n; $i++) {
$carriers_array[] = array('id' => $carriers[$i]['carrier_id'], 'text' => $carriers[$i]['name']);
}
return zen_draw_pull_down_menu($name, $carriers_array, $selected, $parameters);
}
b. Modified store/includes/functions/functions_lookups.php by copying function get_countries() to get_carriers()
c. Modified these 2 documents to change the text displayed “Additional Contact Details” to “Phone Number of Your Mobile Device (required to download mobile applications):
- F:\htdocs\edufone\store\includes\languages\english.php
- F:\htdocs\edufone\store\includes\languages\spanish.php
d. Also added carrier label to the above documents
Changes to templates that should stay between releases:
e. Added code to display list of carriers: store/includes/templates/myTemplates/templates/tpl_modules_create_account.php
f. Couldn’t find a way to add carrier to customer details, thus add to db table directly:
SELECT *
FROM zen_configuration
WHERE configuration_key LIKE '%SHOW_CREATE_ACCOUNT_DEFAULT_COUNTRY%'
LIMIT 0 , 30
Thus I can add, SHOW_CREATE_ACCOUNT_DEFAULT_CARRIER, to zen_configuration file and give it the configuration_group_id of 5.
g. configuration_id of country is 128. Thus, I’ll copy its values to a new configuration
INSERT INTO zen_configuration ( configuration_id , configuration_title , configuration_key , configuration_value , configuration_description , configuration_group_id , sort_order , last_modified , date_added , use_function , set_function )
VALUES (
NULL , 'Create Account Default Carrier ID', 'SHOW_CREATE_ACCOUNT_DEFAULT_CARRIER', '1', 'Set Create Account Default Carrier ID to:<br />Default is 1', '5', '6', NULL , '0001-01-01 00:00:00', 'zen_get_carrier_name', 'zen_cfg_pull_down_carrier_list_none('
);
Carrier configuration id = 503
h. Modified this file to add zen_cfg_pull_down_carrier_list_none function.
zen_cfg_pull_down_country_list_none
/home/content/b/e/a/bearBud2206/html/store/admin/includes/functions/general.php
Line #903 : function zen_cfg_pull_down_country_list_none($country_id, $key = '') {
??? This file also has other country functions such as function zen_get_country_name($country_id) , and function zen_get_country_name_cfg(). I’m not adding those for carrier yet—see if I need them. They’re used on the admin side.
i. Modified verification code in 2 places:
- /home/content/b/e/a/bearBud2206/html/store/includes/modules/pages/create_account/jscript_form_check.php
Line #128 : check_select("country", "", "<?php echo ENTRY_COUNTRY_ERROR; ?>");
to add similar verification for carrier.
- store/includes/form_check.js.php:
check_select("carrier", "", "<?php echo ENTRY_CARRIER_ERROR; ?>");
Now deal with updates. If the user needs to change his phone number/carrier.
j. When checking out, let the user change them:
added phone number and carrier to: store/includes/templates/myTemplate/tpl_modules_checkout_new_address.php
k. When user edits his account info, add carrier: https://www.edufone.com/store/index.php?main_page=account_edit. Copy to myTemplates/templates and modify: F:\htdocs\edufone\store\includes\templates\myTemplate\templates\tpl_account_edit_default.php
Problem with this code, unexpected ,:
<!--highlight the user's carrier-->
<label class="inputLabel" for="carrier"><?php echo ENTRY_CARRIER; ?></label>
<?php
$selected_carrier = ($_POST['carrier']) ? $account->fields['carrier_id'], 'id="carrier"') . (zen_not_null(ENTRY_CARRIER_TEXT) ? '<span class="alert">' . ENTRY_CARRIER_TEXT . '</span>': '');
?>
But w/o this code, the user’s changes are not saved to the db.
l. Also modified this file, F:\htdocs\edufone\store\includes\modules\pages\account_edit\header_php.php so the carrier will be including in the fields array:
[fields] => Array
(
[customers_gender] => f
[customers_firstname] => Jade
[customers_lastname] => Lindquist
[customers_dob] => 0001-01-01 00:00:00
[customers_email_address] => [email protected]
[customers_telephone] => 5122807711
[customers_fax] =>
[customers_email_format] => HTML
[customers_referral] =>
)
Didn’t have time to find code to set user’s current carrier selection. Will do that later.
Problem, when creating new account, carrier is set to default vs. the one the user selected.
Editing this file, fixed it: store/includes/modules/create_account.php