// WIP customer

This commit is contained in:
Kevin Granger
2013-07-29 16:16:10 +02:00
parent 2ac6ada03d
commit ae225dce4c
6 changed files with 154 additions and 131 deletions
+17 -31
View File
@@ -31,6 +31,7 @@ class AdminAddressesControllerCore extends AdminController
public function __construct()
{
$this->bootstrap = true;
$this->required_database = true;
$this->required_fields = array('company','address2', 'postcode', 'other', 'phone', 'phone_mobile', 'vat_number', 'dni');
$this->table = 'address';
@@ -54,13 +55,13 @@ class AdminAddressesControllerCore extends AdminController
$this->countries_array[$country['id_country']] = $country['name'];
$this->fields_list = array(
'id_address' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'firstname' => array('title' => $this->l('First Name'), 'width' => 120, 'filter_key' => 'a!firstname'),
'lastname' => array('title' => $this->l('Last Name'), 'width' => 140, 'filter_key' => 'a!lastname'),
'id_address' => array('title' => $this->l('ID'), 'align' => 'center'),
'firstname' => array('title' => $this->l('First Name'), 'filter_key' => 'a!firstname'),
'lastname' => array('title' => $this->l('Last Name'), 'filter_key' => 'a!lastname'),
'address1' => array('title' => $this->l('Address')),
'postcode' => array('title' => $this->l('Zip/Postal Code'), 'align' => 'right', 'width' => 80),
'city' => array('title' => $this->l('City'), 'width' => 150),
'country' => array('title' => $this->l('Country'), 'width' => 100, 'type' => 'select', 'list' => $this->countries_array, 'filter_key' => 'cl!id_country'));
'postcode' => array('title' => $this->l('Zip/Postal Code'), 'align' => 'right'),
'city' => array('title' => $this->l('City')),
'country' => array('title' => $this->l('Country'), 'type' => 'select', 'list' => $this->countries_array, 'filter_key' => 'cl!id_country'));
parent::__construct();
@@ -87,29 +88,26 @@ class AdminAddressesControllerCore extends AdminController
$this->fields_form = array(
'legend' => array(
'title' => $this->l('Addresses'),
'image' => '../img/admin/contact.gif'
'icon' => 'icon-envelope-alt'
),
'input' => array(
array(
'type' => 'text_customer',
'label' => $this->l('Customer'),
'name' => 'id_customer',
'size' => 33,
'required' => false,
),
array(
'type' => 'text',
'label' => $this->l('Identification Number'),
'name' => 'dni',
'size' => 30,
'required' => false,
'desc' => $this->l('DNI / NIF / NIE')
'hint' => $this->l('DNI / NIF / NIE')
),
array(
'type' => 'text',
'label' => $this->l('Address alias'),
'name' => 'alias',
'size' => 33,
'required' => true,
'hint' => $this->l('Invalid characters:').' <>;=#{}'
),
@@ -117,30 +115,26 @@ class AdminAddressesControllerCore extends AdminController
'type' => 'text',
'label' => $this->l('Home phone'),
'name' => 'phone',
'size' => 33,
'required' => false,
),
array(
'type' => 'text',
'label' => $this->l('Mobile phone'),
'name' => 'phone_mobile',
'size' => 33,
'required' => false,
'desc' => Configuration::get('PS_ONE_PHONE_AT_LEAST')? sprintf($this->l('You must register at least one phone number %s'), '<sup>*</sup>') : ''
'hint' => Configuration::get('PS_ONE_PHONE_AT_LEAST')? sprintf($this->l('You must register at least one phone number %s')) : ''
),
array(
'type' => 'textarea',
'label' => $this->l('Other'),
'name' => 'other',
'cols' => 36,
'rows' => 4,
'required' => false,
'hint' => $this->l('Forbidden characters:').' <>;=#{}<span class="hint-pointer">&nbsp;</span>'
),
),
'submit' => array(
'title' => $this->l('Save '),
'class' => 'button'
'class' => 'btn btn-primary'
)
);
$id_customer = (int)Tools::getValue('id_customer');
@@ -172,15 +166,13 @@ class AdminAddressesControllerCore extends AdminController
'type' => 'text',
'label' => $this->l('Company'),
'name' => 'company',
'size' => 33,
'required' => false,
'hint' => $this->l('Invalid characters:').' <>;=#{}<span class="hint-pointer">&nbsp;</span>'
'hint' => $this->l('Invalid characters:').' &lt;&gt;;=#{}'
);
$temp_fields[] = array(
'type' => 'text',
'label' => $this->l('VAT number'),
'name' => 'vat_number',
'size' => 33,
'name' => 'vat_number'
);
}
else if ($addr_field_item == 'lastname')
@@ -197,9 +189,8 @@ class AdminAddressesControllerCore extends AdminController
'type' => 'text',
'label' => $this->l('Last Name'),
'name' => 'lastname',
'size' => 33,
'required' => true,
'hint' => $this->l('Invalid characters:').' 0-9!<>,;?=+()@#"�{}_$%:<span class="hint-pointer">&nbsp;</span>',
'hint' => $this->l('Invalid characters:').' 0-9!&lt;&gt;,;?=+()@#"�{}_$%:',
'default_value' => $default_value,
);
}
@@ -217,9 +208,8 @@ class AdminAddressesControllerCore extends AdminController
'type' => 'text',
'label' => $this->l('First Name'),
'name' => 'firstname',
'size' => 33,
'required' => true,
'hint' => $this->l('Invalid characters:').' 0-9!<>,;?=+()@#"�{}_$%:<span class="hint-pointer">&nbsp;</span>',
'hint' => $this->l('Invalid characters:').' 0-9!&lt;&gt;,;?=+()@#"�{}_$%:',
'default_value' => $default_value,
);
}
@@ -229,7 +219,6 @@ class AdminAddressesControllerCore extends AdminController
'type' => 'text',
'label' => $this->l('Address'),
'name' => 'address1',
'size' => 33,
'required' => true,
);
}
@@ -239,7 +228,6 @@ class AdminAddressesControllerCore extends AdminController
'type' => 'text',
'label' => $this->l('Address').' (2)',
'name' => 'address2',
'size' => 33,
'required' => false,
);
}
@@ -249,7 +237,6 @@ class AdminAddressesControllerCore extends AdminController
'type' => 'text',
'label' => $this->l('Zip/Postal Code'),
'name' => 'postcode',
'size' => 33,
'required' => true,
);
}
@@ -259,7 +246,6 @@ class AdminAddressesControllerCore extends AdminController
'type' => 'text',
'label' => $this->l('City'),
'name' => 'city',
'size' => 33,
'required' => true,
);
}
@@ -274,7 +260,7 @@ class AdminAddressesControllerCore extends AdminController
'options' => array(
'query' => Country::getCountries($this->context->language->id),
'id' => 'id_country',
'name' => 'name',
'name' => 'name'
)
);
$temp_fields[] = array(
@@ -285,7 +271,7 @@ class AdminAddressesControllerCore extends AdminController
'options' => array(
'query' => array(),
'id' => 'id_state',
'name' => 'name',
'name' => 'name'
)
);
}
+12 -15
View File
@@ -28,6 +28,7 @@ class AdminContactsControllerCore extends AdminController
{
public function __construct()
{
$this->bootstrap = true;
$this->table = 'contact';
$this->className = 'Contact';
$this->lang = true;
@@ -36,10 +37,10 @@ class AdminContactsControllerCore extends AdminController
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
$this->fields_list = array(
'id_contact' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'name' => array('title' => $this->l('Title'), 'width' => 130),
'email' => array('title' => $this->l('Email address'), 'width' => 130),
'description' => array('title' => $this->l('Description'), 'width' => 150),
'id_contact' => array('title' => $this->l('ID'), 'align' => 'center'),
'name' => array('title' => $this->l('Title')),
'email' => array('title' => $this->l('Email address')),
'description' => array('title' => $this->l('Description')),
);
parent::__construct();
@@ -50,34 +51,32 @@ class AdminContactsControllerCore extends AdminController
$this->fields_form = array(
'legend' => array(
'title' => $this->l('Contacts'),
'image' => '../img/admin/contact.gif'
'icon' => 'icon-envelope-alt'
),
'input' => array(
array(
'type' => 'text',
'label' => $this->l('Title'),
'name' => 'name',
'size' => 33,
'required' => true,
'lang' => true,
'desc' => $this->l('Contact name (e.g. Customer Support)'),
'hint' => $this->l('Contact name (e.g. Customer Support)'),
),
array(
'type' => 'text',
'label' => $this->l('Email address'),
'name' => 'email',
'size' => 33,
'required' => false,
'desc' => $this->l('Emails will be sent to this address'),
'hint' => $this->l('Emails will be sent to this address'),
),
array(
'type' => 'radio',
'type' => 'switch',
'label' => $this->l('Save messages?'),
'name' => 'customer_service',
'required' => false,
'class' => 't',
'is_bool' => true,
'desc' => $this->l('If enabled, all messages will be saved in the "Customer Service" page under the "Customer" menu.'),
'hint' => $this->l('If enabled, all messages will be saved in the "Customer Service" page under the "Customer" menu.'),
'values' => array(
array(
'id' => 'customer_service_on',
@@ -97,14 +96,12 @@ class AdminContactsControllerCore extends AdminController
'name' => 'description',
'required' => false,
'lang' => true,
'cols' => 36,
'rows' => 5,
'desc' => $this->l('Further information regarding this contact'),
'hint' => $this->l('Further information regarding this contact'),
),
),
'submit' => array(
'title' => $this->l('Save '),
'class' => 'button'
'class' => 'btn btn-primary'
)
);
+24 -33
View File
@@ -34,6 +34,7 @@ class AdminCustomersControllerCore extends AdminController
public function __construct()
{
$this->bootstrap = true;
$this->required_database = true;
$this->required_fields = array('newsletter','optin');
$this->table = 'customer';
@@ -78,12 +79,10 @@ class AdminCustomersControllerCore extends AdminController
$this->fields_list = array(
'id_customer' => array(
'title' => $this->l('ID'),
'align' => 'center',
'width' => 20
'align' => 'center'
),
'id_gender' => array(
'title' => $this->l('Title'),
'width' => 70,
'align' => 'center',
'icon' => $genders_icon,
'orderby' => false,
@@ -92,35 +91,28 @@ class AdminCustomersControllerCore extends AdminController
'filter_key' => 'a!id_gender',
),
'lastname' => array(
'title' => $this->l('Last name'),
'width' => 'auto'
'title' => $this->l('Last name')
),
'firstname' => array(
'title' => $this->l('First Name'),
'width' => 'auto'
'title' => $this->l('First Name')
),
'email' => array(
'title' => $this->l('Email address'),
'width' => 140,
'title' => $this->l('Email address')
),
'age' => array(
'title' => $this->l('Age'),
'width' => 20,
'search' => false,
'align' => 'center'
),
'active' => array(
'title' => $this->l('Enabled'),
'width' => 70,
'align' => 'center',
'active' => 'status',
'type' => 'bool',
'orderby' => false,
'filter_key' => 'a!active',
'orderby' => false
),
'newsletter' => array(
'title' => $this->l('News.'),
'width' => 70,
'align' => 'center',
'type' => 'bool',
'callback' => 'printNewsIcon',
@@ -128,7 +120,6 @@ class AdminCustomersControllerCore extends AdminController
),
'optin' => array(
'title' => $this->l('Opt.'),
'width' => 70,
'align' => 'center',
'type' => 'bool',
'callback' => 'printOptinIcon',
@@ -136,13 +127,11 @@ class AdminCustomersControllerCore extends AdminController
),
'date_add' => array(
'title' => $this->l('Registration'),
'width' => 150,
'type' => 'date',
'align' => 'right'
),
'connect' => array(
'title' => $this->l('Last visit'),
'width' => 100,
'type' => 'datetime',
'search' => false,
'havingFilter' => true
@@ -264,7 +253,7 @@ class AdminCustomersControllerCore extends AdminController
$this->fields_form = array(
'legend' => array(
'title' => $this->l('Customer'),
'image' => '../img/admin/tab-customers.gif'
'icon' => 'icon-user'
),
'input' => array(
array(
@@ -304,7 +293,7 @@ class AdminCustomersControllerCore extends AdminController
'name' => 'passwd',
'size' => 33,
'required' => ($obj->id ? false : true),
'desc' => ($obj->id ? $this->l('Leave this field blank if there\'s no change') : $this->l('Minimum of five characters (only letters and numbers).').' -_')
'hint' => ($obj->id ? $this->l('Leave this field blank if there\'s no change') : $this->l('Minimum of five characters (only letters and numbers).').' -_')
),
array(
'type' => 'birthday',
@@ -317,7 +306,7 @@ class AdminCustomersControllerCore extends AdminController
)
),
array(
'type' => 'radio',
'type' => 'switch',
'label' => $this->l('Status:'),
'name' => 'active',
'required' => false,
@@ -335,10 +324,10 @@ class AdminCustomersControllerCore extends AdminController
'label' => $this->l('Disabled')
)
),
'desc' => $this->l('Enable or disable customer login')
'hint' => $this->l('Enable or disable customer login')
),
array(
'type' => 'radio',
'type' => 'switch',
'label' => $this->l('Newsletter:'),
'name' => 'newsletter',
'required' => false,
@@ -356,10 +345,10 @@ class AdminCustomersControllerCore extends AdminController
'label' => $this->l('Disabled')
)
),
'desc' => $this->l('Customers will receive your newsletter via email.')
'hint' => $this->l('Customers will receive your newsletter via email.')
),
array(
'type' => 'radio',
'type' => 'switch',
'label' => $this->l('Opt in:'),
'name' => 'optin',
'required' => false,
@@ -377,7 +366,7 @@ class AdminCustomersControllerCore extends AdminController
'label' => $this->l('Disabled')
)
),
'desc' => $this->l('Customer will receive your ads via email.')
'hint' => $this->l('Customer will receive your ads via email.')
),
)
);
@@ -395,12 +384,12 @@ class AdminCustomersControllerCore extends AdminController
$this->fields_form['input'] = array_merge($this->fields_form['input'],
array(
array(
'type' => 'group',
'label' => $this->l('Group access:'),
'name' => 'groupBox',
'values' => $groups,
'required' => true,
'desc' => $this->l('Select all the groups that you would like to apply to this customer.')
'type' => 'group',
'label' => $this->l('Group access:'),
'name' => 'groupBox',
'values' => $groups,
'required' => true,
'hint' => $this->l('Select all the groups that you would like to apply to this customer.')
),
array(
'type' => 'select',
@@ -411,8 +400,10 @@ class AdminCustomersControllerCore extends AdminController
'id' => 'id_group',
'name' => 'name'
),
'hint' => $this->l('The group will be as applied by default.'),
'desc' => $this->l('Apply the discount\'s price of this group.')
'hint' => array(
$this->l('The group will be as applied by default.'),
$this->l('Apply the discount\'s price of this group.')
)
)
)
);
+7 -13
View File
@@ -28,6 +28,7 @@ class AdminGendersControllerCore extends AdminController
{
public function __construct()
{
$this->bootstrap = true;
$this->table = 'gender';
$this->className = 'Gender';
$this->lang = true;
@@ -52,17 +53,14 @@ class AdminGendersControllerCore extends AdminController
$this->fields_list = array(
'id_gender' => array(
'title' => $this->l('ID'),
'align' => 'center',
'width' => 25
'align' => 'center'
),
'name' => array(
'title' => $this->l('Name'),
'width' => 'auto',
'filter_key' => 'b!name'
),
'type' => array(
'title' => $this->l('Type'),
'width' => 100,
'orderby' => false,
'type' => 'select',
'list' => array(
@@ -72,15 +70,14 @@ class AdminGendersControllerCore extends AdminController
),
'filter_key' => 'a!type',
'callback' => 'displayGenderType',
'callback_object' => $this,
'callback_object' => $this
),
'image' => array(
'title' => $this->l('Image'),
'align' => 'center',
'image' => 'genders',
'orderby' => false,
'search' => false,
'width' => 40
'search' => false
)
);
@@ -92,7 +89,7 @@ class AdminGendersControllerCore extends AdminController
$this->fields_form = array(
'legend' => array(
'title' => $this->l('Titles'),
'image' => '../img/admin/tab-genders.gif'
'icon' => 'icon-male'
),
'input' => array(
array(
@@ -100,7 +97,6 @@ class AdminGendersControllerCore extends AdminController
'label' => $this->l('Name:'),
'name' => 'name',
'lang' => true,
'size' => 33,
'hint' => $this->l('Invalid characters:').' 0-9!<>,;?=+()@#"�{}_$%:',
'required' => true
),
@@ -138,15 +134,13 @@ class AdminGendersControllerCore extends AdminController
'type' => 'text',
'label' => $this->l('Image Width:'),
'name' => 'img_width',
'size' => 4,
'desc' => $this->l('Image width in pixels. Enter "0" to use the original size.')
'hint' => $this->l('Image width in pixels. Enter "0" to use the original size.')
),
array(
'type' => 'text',
'label' => $this->l('Image Height:'),
'name' => 'img_height',
'size' => 4,
'desc' => $this->l('Image height in pixels. Enter "0" to use the original size.')
'hint' => $this->l('Image height in pixels. Enter "0" to use the original size.')
)
),
'submit' => array(