Version Notes
First stable release
Download this release
Release Info
Developer | Anna Grieve |
Extension | Adestra_MFSubscriptions |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Adestra/MFSubscriptions/Block/Account/Checkout/Billing.php +14 -0
- app/code/community/Adestra/MFSubscriptions/Block/Account/Checkout/Review.php +7 -0
- app/code/community/Adestra/MFSubscriptions/Block/Account/Customer/Register.php +14 -0
- app/code/community/Adestra/MFSubscriptions/Block/Account/Customer/Subscriptions.php +23 -0
- app/code/community/Adestra/MFSubscriptions/Block/Adminhtml/Customer/Edit/Tab/Subscriptions.php +125 -0
- app/code/community/Adestra/MFSubscriptions/Block/Adminhtml/Customer/Edit/Tab/Subscriptions/Form.php +43 -0
- app/code/community/Adestra/MFSubscriptions/Block/Adminhtml/Customer/Edit/Tabs.php +23 -0
- app/code/community/Adestra/MFSubscriptions/Block/Adminhtml/Lists.php +12 -0
- app/code/community/Adestra/MFSubscriptions/Block/Adminhtml/Lists/Edit.php +32 -0
- app/code/community/Adestra/MFSubscriptions/Block/Adminhtml/Lists/Edit/Form.php +134 -0
- app/code/community/Adestra/MFSubscriptions/Block/Adminhtml/Lists/Grid.php +135 -0
- app/code/community/Adestra/MFSubscriptions/Block/Adminhtml/Renderer/Checkbox.php +13 -0
- app/code/community/Adestra/MFSubscriptions/Block/Adminhtml/Renderer/Number.php +13 -0
- app/code/community/Adestra/MFSubscriptions/Block/Adminhtml/Renderer/Status.php +13 -0
- app/code/community/Adestra/MFSubscriptions/Block/Adminhtml/Renderer/Type.php +13 -0
- app/code/community/Adestra/MFSubscriptions/Block/Adminhtml/Renderer/Website.php +17 -0
- app/code/community/Adestra/MFSubscriptions/Helper/Data.php +514 -0
- app/code/community/Adestra/MFSubscriptions/Model/Admin.php +19 -0
- app/code/community/Adestra/MFSubscriptions/Model/Adminhtml/Customer/Edit.php +59 -0
- app/code/community/Adestra/MFSubscriptions/Model/Adminhtml/Validate.php +30 -0
- app/code/community/Adestra/MFSubscriptions/Model/Customer/Observer.php +58 -0
- app/code/community/Adestra/MFSubscriptions/Model/List.php +10 -0
- app/code/community/Adestra/MFSubscriptions/Model/Mysql4/List.php +10 -0
- app/code/community/Adestra/MFSubscriptions/Model/Mysql4/Lists/Collection.php +8 -0
- app/code/community/Adestra/MFSubscriptions/Model/Mysql4/Setup.php +9 -0
- app/code/community/Adestra/MFSubscriptions/Model/Resource/List.php +10 -0
- app/code/community/Adestra/MFSubscriptions/Model/Resource/Lists/Collection.php +8 -0
- app/code/community/Adestra/MFSubscriptions/Model/Resource/Setup.php +9 -0
- app/code/community/Adestra/MFSubscriptions/controllers/Adminhtml/MessagefocuslistsController.php +140 -0
- app/code/community/Adestra/MFSubscriptions/controllers/IndexController.php +13 -0
- app/code/community/Adestra/MFSubscriptions/controllers/ManageController.php +46 -0
- app/code/community/Adestra/MFSubscriptions/controllers/OnepageController.php +70 -0
- app/code/community/Adestra/MFSubscriptions/etc/adminhtml.xml +36 -0
- app/code/community/Adestra/MFSubscriptions/etc/config.xml +178 -0
- app/code/community/Adestra/MFSubscriptions/etc/system.xml +118 -0
- app/code/community/Adestra/MFSubscriptions/sql/mfsubscriptions_setup/mysql4-install-0.0.2.php +56 -0
- app/design/adminhtml/default/default/layout/mfsubscriptions.xml +32 -0
- app/design/frontend/base/default/layout/mfsubscriptions.xml +30 -0
- app/design/frontend/base/default/template/mfsubscriptions/checkout/form/billing.phtml +38 -0
- app/design/frontend/base/default/template/mfsubscriptions/customer/form/register.phtml +21 -0
- app/design/frontend/base/default/template/mfsubscriptions/customer/form/subscriptions.phtml +74 -0
- app/design/frontend/default/default/template/customer/account/dashboard/info.phtml +90 -0
- app/design/frontend/default/default/template/customer/account/dashboard/info_EE.phtml +90 -0
- app/design/frontend/default/default/template/customer/form/register.phtml +182 -0
- app/design/frontend/default/default/template/persistent/checkout/onepage/billing.phtml +232 -0
- app/design/frontend/default/default/template/persistent/customer/form/register.phtml +187 -0
- app/etc/modules/Adestra_MFSubscriptions.xml +9 -0
- js/adestra/mfsubscriptions/adminhtml.js +49 -0
- package.xml +18 -0
app/code/community/Adestra/MFSubscriptions/Block/Account/Checkout/Billing.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Adestra_MFSubscriptions_Block_Account_Checkout_Billing extends Mage_Customer_Block_Account_Dashboard // Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
$this->setTemplate('mfsubscriptions/checkout/form/billing.phtml');
|
8 |
+
parent::__construct();
|
9 |
+
}
|
10 |
+
|
11 |
+
|
12 |
+
}
|
13 |
+
|
14 |
+
?>
|
app/code/community/Adestra/MFSubscriptions/Block/Account/Checkout/Review.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Adestra_MFSubscriptions_Block_Account_Checkout_Review extends Mage_Core_Block_Template // Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
|
5 |
+
}
|
6 |
+
|
7 |
+
?>
|
app/code/community/Adestra/MFSubscriptions/Block/Account/Customer/Register.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Adestra_MFSubscriptions_Block_Account_Customer_Register extends Mage_Customer_Block_Account_Dashboard // Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
$this->setTemplate('mfsubscriptions/customer/form/register.phtml');
|
8 |
+
parent::__construct();
|
9 |
+
}
|
10 |
+
|
11 |
+
|
12 |
+
}
|
13 |
+
|
14 |
+
?>
|
app/code/community/Adestra/MFSubscriptions/Block/Account/Customer/Subscriptions.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Adestra_MFSubscriptions_Block_Account_Customer_Subscriptions extends Mage_Customer_Block_Account_Dashboard // Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setTemplate('mfsubscriptions/customer/form/subscriptions.phtml');
|
9 |
+
}
|
10 |
+
|
11 |
+
public function getIsSubscribed()
|
12 |
+
{
|
13 |
+
return $this->getSubscriptionObject()->isSubscribed();
|
14 |
+
}
|
15 |
+
|
16 |
+
public function getAction()
|
17 |
+
{
|
18 |
+
return $this->getUrl('*/*/save');
|
19 |
+
}
|
20 |
+
|
21 |
+
}
|
22 |
+
|
23 |
+
?>
|
app/code/community/Adestra/MFSubscriptions/Block/Adminhtml/Customer/Edit/Tab/Subscriptions.php
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Adminhtml customer action tab
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
class Adestra_MFSubscriptions_Block_Adminhtml_Customer_Edit_Tab_Subscriptions extends Mage_Adminhtml_Block_Widget_Form
|
8 |
+
{
|
9 |
+
|
10 |
+
|
11 |
+
protected function _prepareForm()
|
12 |
+
{
|
13 |
+
|
14 |
+
//$form = new Varien_Data_Form();
|
15 |
+
$form = new Varien_Data_Form(array(
|
16 |
+
'id' => 'edit_form',
|
17 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
18 |
+
'method' => 'post',
|
19 |
+
'enctype' => 'multipart/form-data'
|
20 |
+
)
|
21 |
+
);
|
22 |
+
|
23 |
+
$customer = Mage::registry('current_customer');
|
24 |
+
|
25 |
+
$form->setHtmlIdPrefix('_subscription_lists');
|
26 |
+
$form->setFieldNameSuffix('subscription_lists');
|
27 |
+
|
28 |
+
$contact = NULL;
|
29 |
+
$subscribed_lists = NULL;
|
30 |
+
$fieldset = $form->addFieldset('subscriptions_form', array('legend'=>$this->__('Email Subscriptions')));
|
31 |
+
|
32 |
+
// only display form for existing customers as conflict with website scope.
|
33 |
+
if($customer->getId()) {
|
34 |
+
$contact = Mage::helper('mfsubscriptions')->getMFContactFromCustomer($customer);
|
35 |
+
$subscribed_lists = Mage::helper('mfsubscriptions')->getMFSubscribedLists($contact);
|
36 |
+
foreach (Mage::helper('mfsubscriptions')->getActiveLists($customer) as $list) {
|
37 |
+
if ($list->getStatus()) {
|
38 |
+
$config = array(
|
39 |
+
'label' => $list->getDescription(),
|
40 |
+
'required' => FALSE,
|
41 |
+
'name' => $list->getListId(),
|
42 |
+
'onclick' => 'mfSubscribe(this.checked); this.value = this.checked ? 1 : 0;',
|
43 |
+
'value' => '0',
|
44 |
+
'checked' => FALSE,
|
45 |
+
'class' => 'mf-subscribe'
|
46 |
+
);
|
47 |
+
|
48 |
+
if ($list->getAutomaticSub()) $config['label'] = $list->getDescription() .' [Automatic] ';
|
49 |
+
if ($list->getDefaultSub()) $config['label'] = $list->getDescription().' [Default] ';
|
50 |
+
|
51 |
+
// Subscribe lists only
|
52 |
+
if ($list->type == 1) {
|
53 |
+
if ($customer->getId()) {
|
54 |
+
if (array_search($list->getListId(),$subscribed_lists) !== FALSE) {
|
55 |
+
$config['checked'] = TRUE;
|
56 |
+
$config['value'] = '1';
|
57 |
+
}
|
58 |
+
}
|
59 |
+
else {
|
60 |
+
if ($list->getAutomaticSub() && !$config['checked']) {
|
61 |
+
$config['checked'] = TRUE;
|
62 |
+
$config['value'] = '1';
|
63 |
+
}
|
64 |
+
|
65 |
+
if ($list->getDefaultSub() && !$config['checked']) {
|
66 |
+
$config['checked'] = TRUE;
|
67 |
+
$config['value'] = '1';
|
68 |
+
}
|
69 |
+
}
|
70 |
+
$fieldset->addField($list->getListId(), 'checkbox', $config);
|
71 |
+
}
|
72 |
+
|
73 |
+
// Unsubscribe all lists only.
|
74 |
+
elseif ($list->type == 0) {
|
75 |
+
$config['class'] = 'mf-unsubscribe';
|
76 |
+
$config['onclick'] = 'mfUnsubscribeAll(this.checked); this.value = this.checked ? 1 : 0;';
|
77 |
+
$config['name'] = $list->getUnsubListId();
|
78 |
+
if ($customer->getId()) {
|
79 |
+
if(Mage::helper('mfsubscriptions')->adestra_unsublist_check($customer->email,$list->getUnsubListId())) {
|
80 |
+
$config['checked'] = TRUE;
|
81 |
+
$config['value'] = '1';
|
82 |
+
}
|
83 |
+
}
|
84 |
+
$fieldset->addField($list->getUnsubListId(), 'checkbox', $config);
|
85 |
+
}
|
86 |
+
|
87 |
+
}
|
88 |
+
}
|
89 |
+
}
|
90 |
+
else {
|
91 |
+
$config = array(
|
92 |
+
'label' => 'Subscriptions are availble after the customer is added.',
|
93 |
+
'name' => 'addcustomer',
|
94 |
+
);
|
95 |
+
$fieldset->addField('add', 'label', $config);
|
96 |
+
}
|
97 |
+
|
98 |
+
|
99 |
+
|
100 |
+
$this->setForm($form);
|
101 |
+
return parent::_prepareForm();
|
102 |
+
}
|
103 |
+
|
104 |
+
public function getTabTitle()
|
105 |
+
{
|
106 |
+
return Mage::helper('mfsubscriptions')->__('Email Subscriptions');
|
107 |
+
}
|
108 |
+
|
109 |
+
public function canShowTab()
|
110 |
+
{
|
111 |
+
return true;
|
112 |
+
}
|
113 |
+
|
114 |
+
public function getTabUrl()
|
115 |
+
{
|
116 |
+
return $this->getUrl('*/*/edit', array('_current' => true));
|
117 |
+
}
|
118 |
+
|
119 |
+
public function isHidden()
|
120 |
+
{
|
121 |
+
return false;
|
122 |
+
}
|
123 |
+
|
124 |
+
}
|
125 |
+
?>
|
app/code/community/Adestra/MFSubscriptions/Block/Adminhtml/Customer/Edit/Tab/Subscriptions/Form.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Adestra_MFSubscriptions_Block_Adminhtml_Customer_Edit_Tab_Subscriptions_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Initialize block
|
7 |
+
*/
|
8 |
+
public function __construct()
|
9 |
+
{
|
10 |
+
parent::__construct();
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Initialize form
|
15 |
+
*
|
16 |
+
* @return Mage_Adminhtml_Block_Customer_Edit_Tab_Subscriptions_Form
|
17 |
+
*/
|
18 |
+
public function initForm()
|
19 |
+
{
|
20 |
+
$form = new Varien_Data_Form();
|
21 |
+
$form->setHtmlIdPrefix('_subscriptions');
|
22 |
+
$form->setFieldNameSuffix('subscriptions');
|
23 |
+
|
24 |
+
$customer = Mage::registry('current_customer');
|
25 |
+
|
26 |
+
/** @var $customerForm Mage_Customer_Model_Form */
|
27 |
+
// $customerForm = Mage::getModel('customer/form');
|
28 |
+
// $customerForm->setEntity($customer)
|
29 |
+
// ->setFormCode('adminhtml_customer')
|
30 |
+
// ->initDefaultValues();
|
31 |
+
|
32 |
+
$fieldset = $form->addFieldset('base_fieldset', array(
|
33 |
+
'legend' => Mage::helper('mfsubscriptions')->__('Email Subscriptions')
|
34 |
+
));
|
35 |
+
|
36 |
+
|
37 |
+
|
38 |
+
//$form->setValues($customer->getData());
|
39 |
+
$this->setForm($form);
|
40 |
+
return $this;
|
41 |
+
}
|
42 |
+
|
43 |
+
}
|
app/code/community/Adestra/MFSubscriptions/Block/Adminhtml/Customer/Edit/Tabs.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Adestra_MFSubscriptions_Block_Adminhtml_Customer_Edit_Tabs extends Mage_Adminhtml_Block_Customer_Edit_Tabs
|
4 |
+
{
|
5 |
+
protected function _prepareLayout()
|
6 |
+
{
|
7 |
+
//$config = Mage::helper('mfsubscriptions')->getConfigData(array('enabled'));
|
8 |
+
if (Mage::getStoreConfig('adestra/mfsubscriptions/enabled')) {
|
9 |
+
|
10 |
+
$customer = Mage::registry('current_customer');
|
11 |
+
if ($customer->getId()) {
|
12 |
+
$this->addTab('chart', array(
|
13 |
+
'label' => Mage::helper('mfsubscriptions')->__('Email Subscriptions'),
|
14 |
+
'content' => $this->getLayout()->createBlock('mfsubscriptions/adminhtml_customer_edit_tab_subscriptions')->toHtml(),
|
15 |
+
));
|
16 |
+
}
|
17 |
+
return parent::_prepareLayout();
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
}
|
22 |
+
|
23 |
+
|
app/code/community/Adestra/MFSubscriptions/Block/Adminhtml/Lists.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Adestra_MFSubscriptions_Block_Adminhtml_Lists extends Mage_Adminhtml_Block_Widget_Grid_Container
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
$this->_blockGroup = 'mfsubscriptions';
|
8 |
+
$this->_controller = 'adminhtml_lists';
|
9 |
+
$this->_headerText = $this->__('MessageFocus Lists');
|
10 |
+
parent::__construct();
|
11 |
+
}
|
12 |
+
}
|
app/code/community/Adestra/MFSubscriptions/Block/Adminhtml/Lists/Edit.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Adestra_MFSubscriptions_Block_Adminhtml_Lists_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Init class
|
6 |
+
*/
|
7 |
+
public function __construct()
|
8 |
+
{
|
9 |
+
$this->_blockGroup = 'mfsubscriptions';
|
10 |
+
$this->_controller = 'adminhtml_lists';
|
11 |
+
|
12 |
+
parent::__construct();
|
13 |
+
|
14 |
+
$this->_updateButton('save', 'label', $this->__('Save List'));
|
15 |
+
$this->_updateButton('delete', 'label', $this->__('Delete List'));
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Get Header text
|
20 |
+
*
|
21 |
+
* @return string
|
22 |
+
*/
|
23 |
+
public function getHeaderText()
|
24 |
+
{
|
25 |
+
if (Mage::registry('mfsubscriptions')->getListId()) {
|
26 |
+
return $this->__('Edit List');
|
27 |
+
}
|
28 |
+
else {
|
29 |
+
return $this->__('New List');
|
30 |
+
}
|
31 |
+
}
|
32 |
+
}
|
app/code/community/Adestra/MFSubscriptions/Block/Adminhtml/Lists/Edit/Form.php
ADDED
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Adestra_MFSubscriptions_Block_Adminhtml_Lists_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Init class
|
6 |
+
*/
|
7 |
+
public function __construct()
|
8 |
+
{
|
9 |
+
parent::__construct();
|
10 |
+
|
11 |
+
$this->setId('mfsubscriptions_lists_form');
|
12 |
+
$this->setTitle($this->__('List Details'));
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Setup form fields for inserts/updates
|
17 |
+
*
|
18 |
+
* return Mage_Adminhtml_Block_Widget_Form
|
19 |
+
*/
|
20 |
+
protected function _prepareForm()
|
21 |
+
{
|
22 |
+
$model = Mage::registry('mfsubscriptions');
|
23 |
+
|
24 |
+
$form = new Varien_Data_Form(array(
|
25 |
+
'id' => 'edit_form',
|
26 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
27 |
+
'method' => 'post'
|
28 |
+
));
|
29 |
+
|
30 |
+
$fieldset = $form->addFieldset('base_fieldset', array(
|
31 |
+
'legend' => Mage::helper('mfsubscriptions')->__('List Details'),
|
32 |
+
'class' => 'fieldset-normal',
|
33 |
+
));
|
34 |
+
|
35 |
+
if ($model->getId()) {
|
36 |
+
$fieldset->addField('id', 'hidden', array(
|
37 |
+
'name' => 'id',
|
38 |
+
));
|
39 |
+
}
|
40 |
+
|
41 |
+
$websites = Mage::app()->getWebsites();
|
42 |
+
$options = array('0' => 'Please select');
|
43 |
+
foreach ($websites as $website) {
|
44 |
+
$options[$website->getId()] = $website->getName();
|
45 |
+
}
|
46 |
+
$fieldset->addField('scope_id', 'select', array(
|
47 |
+
'name' => 'scope_id',
|
48 |
+
'label' => Mage::helper('mfsubscriptions')->__('Website'),
|
49 |
+
'title' => Mage::helper('mfsubscriptions')->__('Website'),
|
50 |
+
'required' => true,
|
51 |
+
'values' => $options,
|
52 |
+
'class' => 'validate-website',
|
53 |
+
));
|
54 |
+
|
55 |
+
$fieldset->addField('type', 'select', array(
|
56 |
+
'name' => 'type',
|
57 |
+
'label' => Mage::helper('mfsubscriptions')->__('List type'),
|
58 |
+
'title' => Mage::helper('mfsubscriptions')->__('List type'),
|
59 |
+
'values' => array(1 => 'Subscribe', 0 => 'Unsubscribe all'),
|
60 |
+
'value' => 1,
|
61 |
+
'onchange' => 'mfChangeListType(this.value)',
|
62 |
+
'required' => true,
|
63 |
+
));
|
64 |
+
|
65 |
+
$fieldset->addField('description', 'text', array(
|
66 |
+
'name' => 'description',
|
67 |
+
'label' => Mage::helper('mfsubscriptions')->__('List description'),
|
68 |
+
'title' => Mage::helper('mfsubscriptions')->__('List description'),
|
69 |
+
'required' => true,
|
70 |
+
));
|
71 |
+
|
72 |
+
$fieldset->addField('list_id', 'text', array(
|
73 |
+
'name' => 'list_id',
|
74 |
+
'label' => Mage::helper('mfsubscriptions')->__('List ID'),
|
75 |
+
'title' => Mage::helper('mfsubscriptions')->__('List ID'),
|
76 |
+
//'required' => true,
|
77 |
+
'class' => 'validate-number',
|
78 |
+
));
|
79 |
+
|
80 |
+
$fieldset->addField('unsub_list_id', 'text', array(
|
81 |
+
'name' => 'unsub_list_id',
|
82 |
+
'label' => Mage::helper('mfsubscriptions')->__('Unsub list ID'),
|
83 |
+
'title' => Mage::helper('mfsubscriptions')->__('Unsub list ID'),
|
84 |
+
'required' => false,
|
85 |
+
'class' => 'validate-number',
|
86 |
+
));
|
87 |
+
|
88 |
+
$fieldset->addField('field', 'text', array(
|
89 |
+
'name' => 'field',
|
90 |
+
'label' => Mage::helper('mfsubscriptions')->__('Field'),
|
91 |
+
'title' => Mage::helper('mfsubscriptions')->__('Field'),
|
92 |
+
'required' => false,
|
93 |
+
));
|
94 |
+
|
95 |
+
$fieldset->addField('default_sub', 'select', array(
|
96 |
+
'name' => 'default_sub',
|
97 |
+
'label' => Mage::helper('mfsubscriptions')->__('Subscribed as default'),
|
98 |
+
'title' => Mage::helper('mfsubscriptions')->__('Subscribed as default'),
|
99 |
+
'values' => array(0 => 'No', 1 => 'Yes'),
|
100 |
+
'required' => false,
|
101 |
+
));
|
102 |
+
|
103 |
+
$fieldset->addField('automatic_sub', 'select', array(
|
104 |
+
'name' => 'automatic_sub',
|
105 |
+
'label' => Mage::helper('mfsubscriptions')->__('Automatic subscription'),
|
106 |
+
'title' => Mage::helper('mfsubscriptions')->__('Automatic subscription'),
|
107 |
+
'values' => array(0 => 'No', 1 => 'Yes'),
|
108 |
+
'required' => false,
|
109 |
+
));
|
110 |
+
|
111 |
+
$fieldset->addField('status', 'select', array(
|
112 |
+
'name' => 'status',
|
113 |
+
'label' => Mage::helper('mfsubscriptions')->__('Status'),
|
114 |
+
'title' => Mage::helper('mfsubscriptions')->__('Status'),
|
115 |
+
'values' => array(1 => 'Active', 0 => 'Inactive'),
|
116 |
+
'required' => false,
|
117 |
+
));
|
118 |
+
$fieldset->addField('position', 'text', array(
|
119 |
+
'name' => 'position',
|
120 |
+
'label' => Mage::helper('mfsubscriptions')->__('Position'),
|
121 |
+
'title' => Mage::helper('mfsubscriptions')->__('Position'),
|
122 |
+
'required' => false,
|
123 |
+
'class' => 'validate-number',
|
124 |
+
));
|
125 |
+
|
126 |
+
$data = $model->getData();
|
127 |
+
if (!isset($data['type'])) $data['type'] = 1;
|
128 |
+
if (!isset($data['status'])) $data['status'] = 1;
|
129 |
+
$form->setValues($data);
|
130 |
+
$form->setUseContainer(true);
|
131 |
+
$this->setForm($form);
|
132 |
+
return parent::_prepareForm();
|
133 |
+
}
|
134 |
+
}
|
app/code/community/Adestra/MFSubscriptions/Block/Adminhtml/Lists/Grid.php
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Adestra_MFSubscriptions_Block_Adminhtml_Lists_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
|
9 |
+
// Set some defaults for our grid
|
10 |
+
$this->setDefaultSort('id');
|
11 |
+
$this->setId('mfsubscriptions_lists_grid');
|
12 |
+
$this->setDefaultDir('asc');
|
13 |
+
$this->setSaveParametersInSession(true);
|
14 |
+
}
|
15 |
+
|
16 |
+
protected function _getCollectionClass()
|
17 |
+
{
|
18 |
+
// This is the model we are using for the grid
|
19 |
+
return 'mfsubscriptions/lists_collection';
|
20 |
+
}
|
21 |
+
|
22 |
+
protected function _prepareCollection()
|
23 |
+
{
|
24 |
+
// Get and set our collection for the grid
|
25 |
+
$collection = Mage::getResourceModel($this->_getCollectionClass());
|
26 |
+
$this->setCollection($collection);
|
27 |
+
|
28 |
+
return parent::_prepareCollection();
|
29 |
+
}
|
30 |
+
|
31 |
+
protected function _prepareColumns()
|
32 |
+
{
|
33 |
+
// Add the columns that should appear in the grid
|
34 |
+
//$websites = Mage::app()->getWebsites();
|
35 |
+
foreach (Mage::app()->getWebsites() as $website) {
|
36 |
+
$options[$website->getId()] = $website->getName();
|
37 |
+
}
|
38 |
+
$this->addColumn('website',
|
39 |
+
array(
|
40 |
+
'header'=> $this->__('Website'),
|
41 |
+
'index' => 'scope_id',
|
42 |
+
'type' => 'options',
|
43 |
+
'renderer' => new Adestra_MFSubscriptions_Block_Adminhtml_Renderer_Website(),
|
44 |
+
'options' => $options
|
45 |
+
)
|
46 |
+
);
|
47 |
+
$this->addColumn('type',
|
48 |
+
array(
|
49 |
+
'header'=> $this->__('List type'),
|
50 |
+
'index' => 'type',
|
51 |
+
'renderer' => new Adestra_MFSubscriptions_Block_Adminhtml_Renderer_Type(),
|
52 |
+
'type' => 'options',
|
53 |
+
'options' => array(1 => 'Subscribe', 0 => 'Unsubscribe All')
|
54 |
+
)
|
55 |
+
);
|
56 |
+
$this->addColumn('description',
|
57 |
+
array(
|
58 |
+
'header'=> $this->__('List description'),
|
59 |
+
'index' => 'description'
|
60 |
+
)
|
61 |
+
);
|
62 |
+
$this->addColumn('list_id',
|
63 |
+
array(
|
64 |
+
'header'=> $this->__('List ID'),
|
65 |
+
'index' => 'list_id',
|
66 |
+
'renderer' => new Adestra_MFSubscriptions_Block_Adminhtml_Renderer_Number()
|
67 |
+
)
|
68 |
+
);
|
69 |
+
$this->addColumn('unsub_list_id',
|
70 |
+
array(
|
71 |
+
'header'=> $this->__('Unsub list ID'),
|
72 |
+
'index' => 'unsub_list_id',
|
73 |
+
'renderer' => new Adestra_MFSubscriptions_Block_Adminhtml_Renderer_Number()
|
74 |
+
)
|
75 |
+
);
|
76 |
+
$this->addColumn('field',
|
77 |
+
array(
|
78 |
+
'header'=> $this->__('Field'),
|
79 |
+
'index' => 'field'
|
80 |
+
)
|
81 |
+
);
|
82 |
+
$this->addColumn('default_sub',
|
83 |
+
array(
|
84 |
+
'header'=> $this->__('Subscribed as default'),
|
85 |
+
'index' => 'default_sub',
|
86 |
+
'renderer' => new Adestra_MFSubscriptions_Block_Adminhtml_Renderer_Checkbox()
|
87 |
+
)
|
88 |
+
);
|
89 |
+
$this->addColumn('automatic_sub',
|
90 |
+
array(
|
91 |
+
'header'=> $this->__('Automatic subscription'),
|
92 |
+
'index' => 'automatic_sub',
|
93 |
+
'renderer' => new Adestra_MFSubscriptions_Block_Adminhtml_Renderer_Checkbox()
|
94 |
+
)
|
95 |
+
);
|
96 |
+
$this->addColumn('status',
|
97 |
+
array(
|
98 |
+
'header'=> $this->__('Status'),
|
99 |
+
'index' => 'status',
|
100 |
+
'renderer' => new Adestra_MFSubscriptions_Block_Adminhtml_Renderer_Status(),
|
101 |
+
'type' => 'options',
|
102 |
+
'options' => array(1 => 'Active', 0 => 'Inactive')
|
103 |
+
)
|
104 |
+
);
|
105 |
+
$this->addColumn('position',
|
106 |
+
array(
|
107 |
+
'header'=> $this->__('Position'),
|
108 |
+
'index' => 'position',
|
109 |
+
'width' => 15,
|
110 |
+
)
|
111 |
+
);
|
112 |
+
$this->addColumn('action_edit', array(
|
113 |
+
'header' => $this->__('Action'),
|
114 |
+
'width' => 15,
|
115 |
+
'sortable' => false,
|
116 |
+
'filter' => false,
|
117 |
+
'type' => 'action',
|
118 |
+
'getter' => 'getId',
|
119 |
+
'actions' => array(
|
120 |
+
array(
|
121 |
+
'url' => array('base'=> '*/*/edit'),
|
122 |
+
'caption' => $this->__('Edit'),
|
123 |
+
'field' => 'id'
|
124 |
+
),
|
125 |
+
)
|
126 |
+
));
|
127 |
+
return parent::_prepareColumns();
|
128 |
+
}
|
129 |
+
|
130 |
+
public function getRowUrl($row)
|
131 |
+
{
|
132 |
+
// This is where our row data will link to
|
133 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
134 |
+
}
|
135 |
+
}
|
app/code/community/Adestra/MFSubscriptions/Block/Adminhtml/Renderer/Checkbox.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Adestra_MFSubscriptions_Block_Adminhtml_Renderer_Checkbox extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
4 |
+
{
|
5 |
+
public function render(Varien_Object $row)
|
6 |
+
{
|
7 |
+
$value = $row->getData($this->getColumn()->getIndex());
|
8 |
+
if ($value > 0) return 'Yes';
|
9 |
+
else return 'No';
|
10 |
+
}
|
11 |
+
}
|
12 |
+
|
13 |
+
?>
|
app/code/community/Adestra/MFSubscriptions/Block/Adminhtml/Renderer/Number.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Adestra_MFSubscriptions_Block_Adminhtml_Renderer_Number extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
4 |
+
{
|
5 |
+
public function render(Varien_Object $row)
|
6 |
+
{
|
7 |
+
$value = $row->getData($this->getColumn()->getIndex());
|
8 |
+
if ($value > 0) return $value;
|
9 |
+
else return '';
|
10 |
+
}
|
11 |
+
}
|
12 |
+
|
13 |
+
?>
|
app/code/community/Adestra/MFSubscriptions/Block/Adminhtml/Renderer/Status.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Adestra_MFSubscriptions_Block_Adminhtml_Renderer_Status extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
4 |
+
{
|
5 |
+
public function render(Varien_Object $row)
|
6 |
+
{
|
7 |
+
$value = $row->getData($this->getColumn()->getIndex());
|
8 |
+
if ($value > 0) return 'Active';
|
9 |
+
else return 'Inactive';
|
10 |
+
}
|
11 |
+
}
|
12 |
+
|
13 |
+
?>
|
app/code/community/Adestra/MFSubscriptions/Block/Adminhtml/Renderer/Type.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Adestra_MFSubscriptions_Block_Adminhtml_Renderer_Type extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
4 |
+
{
|
5 |
+
public function render(Varien_Object $row)
|
6 |
+
{
|
7 |
+
$value = $row->getData($this->getColumn()->getIndex());
|
8 |
+
if ($value == 1) return 'Subscribe';
|
9 |
+
else if ($value == 0) return 'Unsubscribe all';
|
10 |
+
}
|
11 |
+
}
|
12 |
+
|
13 |
+
?>
|
app/code/community/Adestra/MFSubscriptions/Block/Adminhtml/Renderer/Website.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Adestra_MFSubscriptions_Block_Adminhtml_Renderer_Website extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
4 |
+
{
|
5 |
+
public function render(Varien_Object $row)
|
6 |
+
{
|
7 |
+
$website_id = $row->getData($this->getColumn()->getIndex());
|
8 |
+
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
|
9 |
+
$select = $read->select();
|
10 |
+
$select->from('core_website', 'name')
|
11 |
+
->where('website_id = ?', $website_id);
|
12 |
+
$name = $read->fetchOne($select);
|
13 |
+
return $name;
|
14 |
+
}
|
15 |
+
}
|
16 |
+
|
17 |
+
?>
|
app/code/community/Adestra/MFSubscriptions/Helper/Data.php
ADDED
@@ -0,0 +1,514 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Adestra_MFSubscriptions_Helper
|
4 |
+
*/
|
5 |
+
|
6 |
+
class Adestra_MFSubscriptions_Helper_Data extends Mage_Core_Helper_Abstract{
|
7 |
+
|
8 |
+
|
9 |
+
function adestra_xmlrpc_endpoint() {
|
10 |
+
$config = array('accountid','apiendpoint','apiusername','apipassword','enabled');
|
11 |
+
$config = Mage::helper('mfsubscriptions')->getConfigData($config);
|
12 |
+
$endpoint = parse_url($config['apiendpoint']);
|
13 |
+
$url = $endpoint['scheme'] . '://';
|
14 |
+
$url .= $config['accountid'].'.';
|
15 |
+
$url .= $config['apiusername'].':';
|
16 |
+
$url .= $config['apipassword'].'@';
|
17 |
+
$url .= $endpoint['host'].$endpoint['path'];
|
18 |
+
return $url;
|
19 |
+
}
|
20 |
+
|
21 |
+
function adestra_call($method, $arguments = array()) {
|
22 |
+
|
23 |
+
try {
|
24 |
+
$url = $this->adestra_xmlrpc_endpoint();
|
25 |
+
$client = new Zend_XmlRpc_Client($url);
|
26 |
+
$debug = Mage::getStoreConfig('adestra/mfsubscriptions/debug');
|
27 |
+
if ($debug) {
|
28 |
+
Mage::Log('Adestra method: '.$method);
|
29 |
+
Mage::Log('Arguments: ');
|
30 |
+
Mage::Log($arguments);
|
31 |
+
}
|
32 |
+
$result = $client->call($method,$arguments);
|
33 |
+
if ($debug) {
|
34 |
+
Mage::Log('Result: ');
|
35 |
+
Mage::Log($result);
|
36 |
+
}
|
37 |
+
|
38 |
+
} catch(Exception $e) {
|
39 |
+
|
40 |
+
Mage::Log($e->getMessage());
|
41 |
+
Mage::Log($e->getCode());
|
42 |
+
$result = FALSE;
|
43 |
+
if(Mage::getSingleton('admin/session')->isLoggedIn()) {
|
44 |
+
Mage::getSingleton('adminhtml/session')->addError('The XML-RPC server returned this response. Code: '.$e->getCode().'<br />Message: '.var_export($e->getMessage(),TRUE));
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
return $result;
|
49 |
+
}
|
50 |
+
|
51 |
+
|
52 |
+
|
53 |
+
/*
|
54 |
+
** Adestra API calls
|
55 |
+
** See: http://new.adestra.com/doc/page/current/index/api
|
56 |
+
*/
|
57 |
+
function adestra_get_core_table($id=NULL) {
|
58 |
+
if (!$id) {
|
59 |
+
$id = $this->getConfigData(array('coretableid'));
|
60 |
+
}
|
61 |
+
$table = $this->adestra_call('coreTable.get',$id);
|
62 |
+
return $table;
|
63 |
+
}
|
64 |
+
|
65 |
+
function adestra_get_workspace($id=NULL) {
|
66 |
+
if (!$id) {
|
67 |
+
$id = $this->getConfigData(array('coretableid'));
|
68 |
+
}
|
69 |
+
$workspace = $this->adestra_call('workspace.get',$id);
|
70 |
+
return $workspace;
|
71 |
+
}
|
72 |
+
|
73 |
+
function adestra_fetch_contacts($table_id = NULL, $data_table_ids = array(), $paging_args = NULL) {
|
74 |
+
if ($table_id === NULL) {
|
75 |
+
$table_id = variable_get_value('adestra_default_table_id');
|
76 |
+
}
|
77 |
+
$contacts = $this->adestra_call('contact.all', array($table_id, $data_table_ids, $paging_args));
|
78 |
+
return $contacts;
|
79 |
+
}
|
80 |
+
|
81 |
+
function adestra_fetch_contact($id, $data_table_ids = NULL) {
|
82 |
+
$contact = $this->adestra_call('contact.get', array($id, $data_table_ids));
|
83 |
+
return $contact;
|
84 |
+
}
|
85 |
+
|
86 |
+
function adestra_fetch_contact_lists($id) {
|
87 |
+
$list_ids = $this->adestra_call('contact.lists', array($id));
|
88 |
+
return $list_ids;
|
89 |
+
}
|
90 |
+
|
91 |
+
function adestra_search_contacts($table_id = NULL, $search_args, $data_table_ids = NULL, $paging_args = NULL) {
|
92 |
+
if ($table_id === NULL) {
|
93 |
+
$table_id = variable_get_value('adestra_default_table_id');
|
94 |
+
}
|
95 |
+
$contacts = $this->adestra_call('contact.search', array($table_id, $search_args, $data_table_ids, $paging_args));
|
96 |
+
return $contacts;
|
97 |
+
}
|
98 |
+
|
99 |
+
function adestra_create_contact($table_id = NULL, $contact_data, $dedupe_field = NULL) {
|
100 |
+
if ($table_id === NULL) {
|
101 |
+
$table_id = variable_get_value('adestra_default_table_id');
|
102 |
+
}
|
103 |
+
$contact_id = $this->adestra_call('contact.create', array((integer)$table_id, $contact_data, $dedupe_field));
|
104 |
+
return $contact_id;
|
105 |
+
}
|
106 |
+
|
107 |
+
function adestra_update_contact($contact_id, $contact_data) {
|
108 |
+
$contact_id = $this->adestra_call('contact.update', array($contact_id, $contact_data));
|
109 |
+
return $contact_id;
|
110 |
+
}
|
111 |
+
|
112 |
+
function adestra_subscribe_contact($contact_id, $list_id) {
|
113 |
+
$result = $this->adestra_call('contact.addList', array($contact_id, $list_id));
|
114 |
+
return $result;
|
115 |
+
}
|
116 |
+
|
117 |
+
function adestra_subscribe_contact_multiple($contact_id, $list_ids = array(), $unsub_list_ids = array()) {
|
118 |
+
if (!empty($list_ids) || !empty($unsub_list_ids)) {
|
119 |
+
$result = $this->adestra_call('contact.subscribe', array($contact_id, array_values($list_ids), array_values($unsub_list_ids)));
|
120 |
+
return $result;
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
function adestra_unsubscribe_contact($contact_id, $list_id) {
|
125 |
+
$result = $this->adestra_call('contact.removeList', array($contact_id, $list_id));
|
126 |
+
return $result;
|
127 |
+
}
|
128 |
+
function adestra_unsubscribe_contact_multiple($contact_id, $list_ids = array(), $unsub_list_ids = array()) {
|
129 |
+
if (!empty($list_ids) || !empty($unsub_list_ids)) {
|
130 |
+
$result = $this->adestra_call('contact.unsubscribe', array($contact_id, array_values($list_ids), array_values($unsub_list_ids)));
|
131 |
+
return $result;
|
132 |
+
}
|
133 |
+
}
|
134 |
+
|
135 |
+
function adestra_import_contacts($contact_id, $data_file_url, $options) {
|
136 |
+
$result = $this->adestra_call('contact.import', array($contact_id, $data_file_url, $options));
|
137 |
+
return $result;
|
138 |
+
}
|
139 |
+
|
140 |
+
function adestra_send_email($contact, $campaign_id, $transaction_data) {
|
141 |
+
$result = $this->adestra_call('contact.transactional', array($contact, $campaign_id, $transaction_data));
|
142 |
+
return $result;
|
143 |
+
}
|
144 |
+
|
145 |
+
function adestra_fetch_list($id) {
|
146 |
+
$list = $this->adestra_call('list.get', array($id));
|
147 |
+
return $list;
|
148 |
+
}
|
149 |
+
|
150 |
+
function adestra_fetch_lists($paging_args = NULL) {
|
151 |
+
$lists = $this->adestra_call('list.all', array($paging_args));
|
152 |
+
return $lists;
|
153 |
+
}
|
154 |
+
|
155 |
+
function adestra_search_lists($search_args, $paging_args = NULL) {
|
156 |
+
$lists = $this->adestra_call('list.search', array($search_args, $paging_args));
|
157 |
+
return $lists;
|
158 |
+
}
|
159 |
+
|
160 |
+
function adestra_create_list($create_args) {
|
161 |
+
$lists = $this->adestra_call('list.create', array($create_args));
|
162 |
+
return $lists;
|
163 |
+
}
|
164 |
+
|
165 |
+
function adestra_update_list($id, $update_args) {
|
166 |
+
$result = $this->adestra_call('list.update', array($id, $update_args));
|
167 |
+
return $result;
|
168 |
+
}
|
169 |
+
|
170 |
+
function adestra_fetch_ubsublist($id) {
|
171 |
+
$list = $this->adestra_call('unsubList.get', array($id));
|
172 |
+
return $list;
|
173 |
+
}
|
174 |
+
|
175 |
+
function adestra_unsublist_add_address($email,$unsub_list_id) {
|
176 |
+
$result = $this->adestra_call('unsubList.addAddress', array($email,$unsub_list_id));
|
177 |
+
return $result;
|
178 |
+
}
|
179 |
+
|
180 |
+
function adestra_unsublist_remove_address($email,$unsub_list_id) {
|
181 |
+
$result = $this->adestra_call('unsubList.removeAddress', array($email,$unsub_list_id));
|
182 |
+
return $result;
|
183 |
+
}
|
184 |
+
|
185 |
+
function adestra_unsublist_check($email,$unsub_list_id) {
|
186 |
+
$result = $this->adestra_call('unsubList.check', array($email,$unsub_list_id));
|
187 |
+
return $result;
|
188 |
+
}
|
189 |
+
|
190 |
+
function adestra_unsublist_check_all($email) {
|
191 |
+
$result = $this->adestra_call('unsubList.checkAll', array($email));
|
192 |
+
return $result;
|
193 |
+
}
|
194 |
+
|
195 |
+
/*
|
196 |
+
**********************************
|
197 |
+
**********************************
|
198 |
+
*/
|
199 |
+
|
200 |
+
|
201 |
+
// helper fuction to fetch config data value for correct website scope.
|
202 |
+
function getConfigData($config,$website_id = NULL) {
|
203 |
+
if (!$website_id) $website_id = Mage::app()->getWebsite()->getId();
|
204 |
+
if($website_id == 0) {
|
205 |
+
$code = Mage::App()->getRequest()->getParam('website');
|
206 |
+
$websites = Mage::app()->getWebsites();
|
207 |
+
foreach ($websites as $website) {
|
208 |
+
if ($website->getCode() == $code) { $website_id = $website->getId(); }
|
209 |
+
}
|
210 |
+
}
|
211 |
+
|
212 |
+
if (is_array($config)) {
|
213 |
+
$config_array = array();
|
214 |
+
foreach ($config as $key => $value) {
|
215 |
+
$config_array[$value] = Mage::app()->getWebsite($website_id)->getConfig('adestra/mfsubscriptions/'.$value,$website_id);
|
216 |
+
if ($value == 'accountid') $config_array['accountid'] = str_replace(' ','_',$config_array['accountid']);
|
217 |
+
}
|
218 |
+
return $config_array;
|
219 |
+
}
|
220 |
+
else return array();
|
221 |
+
|
222 |
+
}
|
223 |
+
|
224 |
+
// Helper function to get core table ID.
|
225 |
+
function getCoreTableId($website_id) {
|
226 |
+
if (!$website_id) $website_id = Mage::app()->getWebsite()->getId();
|
227 |
+
return Mage::app()->getWebsite($website_id)->getConfig('adestra/mfsubscriptions/coretableid',$website_id);
|
228 |
+
}
|
229 |
+
|
230 |
+
// Helper function to retrieve customer contact
|
231 |
+
// take first contact from list.
|
232 |
+
// @param $customer - Magento customer object
|
233 |
+
function getMFContactFromCustomer($customer) {
|
234 |
+
$contact = NULL;
|
235 |
+
if ($customer->getId()) {
|
236 |
+
$core_table_id = $this->getCoreTableId($customer->getWebsiteId());
|
237 |
+
$search_args = new stdClass();
|
238 |
+
$search_args->email = $customer->getEmail();
|
239 |
+
$result = $this->adestra_search_contacts($core_table_id, $search_args);
|
240 |
+
if (count($result)) if ($result[0]['id']) $contact = array_shift($result);
|
241 |
+
}
|
242 |
+
return $contact;
|
243 |
+
}
|
244 |
+
|
245 |
+
// Helper function to create/update MessageFocus contact
|
246 |
+
function updateMFContact($customer_id) {
|
247 |
+
if (!$customer_id) {
|
248 |
+
return false;
|
249 |
+
}
|
250 |
+
|
251 |
+
$customer = Mage::getModel('customer/customer')->load($customer_id);
|
252 |
+
$config = array('coretableid','coretablefieldsmapping');
|
253 |
+
$config = $this->getConfigData($config,$customer->getWebsiteId());
|
254 |
+
$core_table_id = $config['coretableid'];
|
255 |
+
$core_table_fields = explode("\n",$config['coretablefieldsmapping']);
|
256 |
+
|
257 |
+
$contact_data = new stdClass();
|
258 |
+
$contact_data->email = $customer->email;
|
259 |
+
$default_billing = NULL;
|
260 |
+
$default_shipping = NULL;
|
261 |
+
foreach($core_table_fields as $field) {
|
262 |
+
$mapping = explode("|",$field);
|
263 |
+
$mage_field = explode('.',$mapping[0]);
|
264 |
+
$mf_field = $mapping[1];
|
265 |
+
if ($mage_field[0] == 'account') {
|
266 |
+
if ($mage_field[1] == 'gender') $customer_value = $customer->getAttribute('gender')->getSource()->getOptionText($customer->getGender());
|
267 |
+
elseif ($mage_field[1] == 'dob') $customer_value = substr($customer->getDob(),0,10);
|
268 |
+
else $customer_value = $customer->{$mage_field[1]};
|
269 |
+
|
270 |
+
if (!empty($customer_value)) {
|
271 |
+
$contact_data->{$mf_field} = $customer_value;
|
272 |
+
}
|
273 |
+
}
|
274 |
+
if ($mage_field[0] == 'billing_address') {
|
275 |
+
if (!$default_billing) $default_billing = Mage::getModel('customer/address')->load($customer->default_billing);
|
276 |
+
|
277 |
+
if ($mage_field[1] == 'street1') $customer_value = $default_billing->getStreet1();
|
278 |
+
elseif ($mage_field[1] == 'street2') $customer_value = $default_billing->getStreet2();
|
279 |
+
else $customer_value = $default_billing->getData($mage_field[1]);
|
280 |
+
|
281 |
+
if (!empty($customer_value)) {
|
282 |
+
$contact_data->{$mf_field} = $customer_value;
|
283 |
+
}
|
284 |
+
}
|
285 |
+
if ($mage_field[0] == 'shipping_address') {
|
286 |
+
if (!$default_shipping) $default_shipping = Mage::getModel('customer/address')->load($customer->default_shipping);
|
287 |
+
|
288 |
+
if ($mage_field[1] == 'street1') $customer_value = $default_billing->getStreet1();
|
289 |
+
elseif ($mage_field[1] == 'street2') $customer_value = $default_billing->getStreet2();
|
290 |
+
else $customer_value = $default_billing->getData($mage_field[1]);
|
291 |
+
|
292 |
+
if (!empty($customer_value)) {
|
293 |
+
$contact_data->{$mf_field} = $customer_value;
|
294 |
+
}
|
295 |
+
}
|
296 |
+
}
|
297 |
+
|
298 |
+
$contact = $this->getMFContactFromCustomer($customer);
|
299 |
+
if (isset($contact['id'])) {
|
300 |
+
$this->adestra_update_contact($contact['id'],$contact_data);
|
301 |
+
return $contact['id'];
|
302 |
+
}
|
303 |
+
else {
|
304 |
+
return $this->adestra_create_contact($core_table_id,$contact_data);
|
305 |
+
}
|
306 |
+
|
307 |
+
}
|
308 |
+
|
309 |
+
public function getMFSubscribedLists($contact) {
|
310 |
+
$subscribed_lists = array();
|
311 |
+
if (isset($contact['id'])) {
|
312 |
+
$subscribed_lists = $this->adestra_fetch_contact_lists($contact['id']);
|
313 |
+
}
|
314 |
+
return $subscribed_lists;
|
315 |
+
}
|
316 |
+
|
317 |
+
public function getActiveLists($customer = NULL, $subscription_only = FALSE) {
|
318 |
+
if (!$customer) $website_id = Mage::app()->getStore()->getWebsiteId();
|
319 |
+
else $website_id = $customer->getWebsiteId();
|
320 |
+
|
321 |
+
$collection = Mage::getResourceModel('mfsubscriptions/lists_collection')
|
322 |
+
->addFieldToFilter('scope_id',$website_id)
|
323 |
+
->addFieldToFilter('status',1)
|
324 |
+
->addOrder('position','asc');
|
325 |
+
if ($subscription_only) $collection->addFieldToFilter('type',1);
|
326 |
+
return $collection;
|
327 |
+
}
|
328 |
+
|
329 |
+
public function getAutomaticLists($customer = NULL) {
|
330 |
+
if (!$customer) $website_id = Mage::app()->getStore()->getWebsiteId();
|
331 |
+
else $website_id = $customer->getWebsiteId();
|
332 |
+
|
333 |
+
$collection = Mage::getResourceModel('mfsubscriptions/lists_collection')
|
334 |
+
->addFieldToFilter('scope_id',$website_id)
|
335 |
+
->addFieldToFilter('status',1)
|
336 |
+
->addFieldToFilter('type',1)
|
337 |
+
->addFieldToFilter('automatic_sub',1)
|
338 |
+
->addOrder('position','acs');
|
339 |
+
return $collection;
|
340 |
+
}
|
341 |
+
|
342 |
+
public function getNonAutomaticLists($customer = NULL) {
|
343 |
+
if (!$customer) $website_id = Mage::app()->getStore()->getWebsiteId();
|
344 |
+
else $website_id = $customer->getWebsiteId();
|
345 |
+
|
346 |
+
$collection = Mage::getResourceModel('mfsubscriptions/lists_collection')
|
347 |
+
->addFieldToFilter('scope_id',$website_id)
|
348 |
+
->addFieldToFilter('status',1)
|
349 |
+
->addFieldToFilter('type',1)
|
350 |
+
->addFieldToFilter('automatic_sub',0)
|
351 |
+
->addOrder('position','asc');
|
352 |
+
return $collection;
|
353 |
+
}
|
354 |
+
|
355 |
+
// Helper function to update contact field set to TRUE/FALSE
|
356 |
+
public function updateMFContactFieldsBoolean($contact_id,$fields = array()) {
|
357 |
+
if (!$contact_id) return FALSE;
|
358 |
+
$contact_data = new stdClass();
|
359 |
+
foreach($fields as $name => $value) {
|
360 |
+
if ($value == TRUE) $contact_data->{$name} = TRUE;
|
361 |
+
else $contact_data->{$name} = FALSE;
|
362 |
+
}
|
363 |
+
|
364 |
+
return $this->adestra_update_contact($contact_id,$contact_data);
|
365 |
+
|
366 |
+
}
|
367 |
+
|
368 |
+
public function updateMFSubscriptions($contact_id, $customer, $subscribe_lists = array()) {
|
369 |
+
|
370 |
+
if (!$contact_id) return FALSE;
|
371 |
+
if (!$customer) return FALSE;
|
372 |
+
|
373 |
+
$subscribed_to_lists = array();
|
374 |
+
$unsubscribe_from_lists = array();
|
375 |
+
$unsub_add_lists = array();
|
376 |
+
$unsub_remove_lists = array();
|
377 |
+
$unsub_all_remove_lists = array();
|
378 |
+
$unsub_all_add_lists = array();
|
379 |
+
$boolean_fields = array();
|
380 |
+
$subscription_lists = $this->getActiveLists($customer);
|
381 |
+
|
382 |
+
// Build array of list IDs to subscribe to.
|
383 |
+
foreach($subscribe_lists as $key => $value) {
|
384 |
+
if ($value == 1) $subscribed_to_lists[] = $key;
|
385 |
+
}
|
386 |
+
|
387 |
+
// Build array of list IDs to subscribe from and
|
388 |
+
// build array ubsub list IDs and
|
389 |
+
// build array of fields with subscribe to
|
390 |
+
// Remove unsub all list ids from subscribe to lists
|
391 |
+
// Add to unsub all lists where found.
|
392 |
+
foreach($subscription_lists as $list) {
|
393 |
+
|
394 |
+
if($this->isSubscribeList($list->type)) { // Subscribe list type
|
395 |
+
if (in_array($list->getListId(),$subscribed_to_lists) === TRUE) { // Subscribe to list.
|
396 |
+
if ($list->getField()) $boolean_fields[$list->getField()] = 1; // TRUE
|
397 |
+
if ($list->getUnsubListId()) $unsub_remove_lists[] = $list->getUnsubListId();
|
398 |
+
}
|
399 |
+
else { // Unsubscribe from list
|
400 |
+
$unsubscribe_from_lists[] = $list->getListId();
|
401 |
+
if ($list->getUnsubListId()) $unsub_add_lists[] = $list->getUnsubListId();
|
402 |
+
if ($list->getField()) $boolean_fields[$list->getField()] = 0; // FALSE
|
403 |
+
}
|
404 |
+
|
405 |
+
}
|
406 |
+
elseif(!$this->isSubscribeList($list->type)) { // Unsubscribe all list
|
407 |
+
|
408 |
+
if (in_array($list->getUnsubListId(),$subscribed_to_lists) === TRUE) { // Subscribe to list.
|
409 |
+
unset($subscribed_to_lists[array_search($list->getUnsubListId(),$subscribed_to_lists,TRUE)]);
|
410 |
+
$unsub_all_add_lists[] = $list->getUnsubListId();
|
411 |
+
}
|
412 |
+
else {
|
413 |
+
$unsub_all_remove_lists[] = $list->getUnsubListId();
|
414 |
+
}
|
415 |
+
|
416 |
+
|
417 |
+
}
|
418 |
+
|
419 |
+
//Mage::Log($subscribed_to_lists);
|
420 |
+
// // Set up unsubscribe process.
|
421 |
+
// if (in_array($tmp_list_id,$subscribed_to_lists) !== TRUE) {
|
422 |
+
// if($this->isSubscribeList($list->type)) { // Subscribe list
|
423 |
+
// $unsubscribe_from_lists[] = $list->getListId();
|
424 |
+
// if ($list->getUnsubListId()) $unsub_add_lists[] = $list->getUnsubListId();
|
425 |
+
// if ($list->getField()) $boolean_fields[$list->getField()] = 0; // FALSE
|
426 |
+
// //if ($list->getUnsubListId() > 0) $unsub_all_remove_lists[] = $list->getUnsubListId();
|
427 |
+
// }
|
428 |
+
// elseif(!$this->isSubscribeList($list->type)) { // Unsubscribe all list
|
429 |
+
// $unsub_all_remove_lists[] = $list->getUnsubListId();
|
430 |
+
//
|
431 |
+
// }
|
432 |
+
// }
|
433 |
+
// // Set up subscribe process.
|
434 |
+
// else {
|
435 |
+
// if($this->isSubscribeList($list->type)) { // Subscribe list
|
436 |
+
// if ($list->getField()) $boolean_fields[$list->getField()] = 1; // TRUE
|
437 |
+
// if ($list->getUnsubListId()) $unsub_remove_lists[] = $list->getUnsubListId();
|
438 |
+
// }
|
439 |
+
// elseif(!$this->isSubscribeList($list->type)) { // Unsubscribe all list
|
440 |
+
// unset($subscribed_to_lists[$list->getUnsubListId()]);
|
441 |
+
// $unsub_all_add_lists[] = $list->getUnsubListId();
|
442 |
+
// }
|
443 |
+
//
|
444 |
+
// }
|
445 |
+
|
446 |
+
|
447 |
+
}
|
448 |
+
|
449 |
+
// Subscribe user to lists
|
450 |
+
if (!empty($subscribed_to_lists)) {
|
451 |
+
$this->adestra_subscribe_contact_multiple($contact_id,$subscribed_to_lists, $unsub_remove_lists);
|
452 |
+
}
|
453 |
+
|
454 |
+
// Unsubscribe user from lists
|
455 |
+
if (!empty($unsubscribe_from_lists)) {
|
456 |
+
$this->adestra_unsubscribe_contact_multiple($contact_id,$unsubscribe_from_lists, $unsub_add_lists);
|
457 |
+
}
|
458 |
+
|
459 |
+
// update boolean contact fields
|
460 |
+
if (!empty($boolean_fields)) {
|
461 |
+
$this->updateMFContactFieldsBoolean($contact_id,$boolean_fields);
|
462 |
+
}
|
463 |
+
|
464 |
+
// Remove from Unsub All Lists
|
465 |
+
foreach($unsub_all_remove_lists as $unsub_list_id) {
|
466 |
+
$this->adestra_unsublist_remove_address($customer->email,$unsub_list_id);
|
467 |
+
}
|
468 |
+
// Add to Unsub All Lists
|
469 |
+
foreach($unsub_all_add_lists as $unsub_list_id) {
|
470 |
+
$this->adestra_unsublist_add_address($customer->email,$unsub_list_id);
|
471 |
+
}
|
472 |
+
|
473 |
+
}
|
474 |
+
|
475 |
+
// Fetch list of user subscribed lists.
|
476 |
+
// Note list in Magento must be active.
|
477 |
+
public function getUserAccountSubscribedLists($contact,$customer = NULL) {
|
478 |
+
|
479 |
+
if (!isset($contact['id'])) return array();
|
480 |
+
|
481 |
+
if (!$customer) $website_id = Mage::app()->getStore()->getWebsiteId();
|
482 |
+
else $website_id = $customer->getWebsiteId();
|
483 |
+
|
484 |
+
$subscribed_lists = array();
|
485 |
+
$mf_subscribed_lists = $this->adestra_fetch_contact_lists($contact['id']);
|
486 |
+
$subscription_lists = Mage::getResourceModel('mfsubscriptions/lists_collection')
|
487 |
+
->addFieldToFilter('scope_id',$website_id)
|
488 |
+
->addFieldToFilter('status',1)
|
489 |
+
->addFieldToFilter('automatic_sub',0)
|
490 |
+
->addOrder('position','desc');
|
491 |
+
|
492 |
+
foreach($subscription_lists as $list) {
|
493 |
+
if (array_search($list->list_id,$mf_subscribed_lists)!==FALSE) $subscribed_lists[] = $list->description;
|
494 |
+
}
|
495 |
+
|
496 |
+
return $subscribed_lists;
|
497 |
+
|
498 |
+
|
499 |
+
|
500 |
+
}
|
501 |
+
|
502 |
+
public function isMFSubscriptionsEnabled() {
|
503 |
+
return Mage::getStoreConfig('adestra/mfsubscriptions/enabled')?TRUE:FALSE;
|
504 |
+
}
|
505 |
+
|
506 |
+
// Is Subscribe or Unsubscribe All list.
|
507 |
+
public function isSubscribeList($type) {
|
508 |
+
if ($type == 1) return TRUE;
|
509 |
+
else return FALSE;
|
510 |
+
}
|
511 |
+
|
512 |
+
|
513 |
+
|
514 |
+
}
|
app/code/community/Adestra/MFSubscriptions/Model/Admin.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Adestra_MFSubscriptions_Model
|
4 |
+
*/
|
5 |
+
|
6 |
+
class Adestra_MFSubscriptions_Model_Admin extends Mage_Core_Model_Config_Data {
|
7 |
+
|
8 |
+
public function _afterSave() {
|
9 |
+
|
10 |
+
|
11 |
+
$html = '<pre>';
|
12 |
+
$html = var_export($_POST,TRUE);
|
13 |
+
$html .= '<pre>';
|
14 |
+
Mage::getSingleton('adminhtml/session')->addNotice('This is my error message.'.$html);
|
15 |
+
|
16 |
+
return parent::_afterSave();
|
17 |
+
}
|
18 |
+
|
19 |
+
}
|
app/code/community/Adestra/MFSubscriptions/Model/Adminhtml/Customer/Edit.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Adestra_MFSubscriptions_Model_Adminhtml_Customer_Edit {
|
4 |
+
|
5 |
+
|
6 |
+
public function saveCustomer(Varien_Event_Observer $observer) {
|
7 |
+
|
8 |
+
// Save customer check/update Adestra MF email subscriptions.
|
9 |
+
Mage::Log('OLD: '.__FUNCTION__);
|
10 |
+
|
11 |
+
// $event = $observer->getEvent();
|
12 |
+
// if (Mage::getStoreConfig('adestra/mfsubscriptions/enabled')) {
|
13 |
+
// //if (isset($_POST['subscription_lists'])) {
|
14 |
+
//
|
15 |
+
// $customer = Mage::registry('current_customer');
|
16 |
+
// $contact_id = Mage::helper('mfsubscriptions')->updateMFContact($customer->getId()); // create or update contact
|
17 |
+
//
|
18 |
+
// // Contact exists.
|
19 |
+
// if (isset($contact_id)) {
|
20 |
+
//
|
21 |
+
// //$subscribed_lists = Mage::helper('mfsubscriptions')->adestra_fetch_contact_lists($contact['id']);
|
22 |
+
// $subscribed_to_lists = array();
|
23 |
+
// $unsubscribe_from_lists = array();
|
24 |
+
// $unsub_lists = array();
|
25 |
+
// if (isset($_POST['subscription_lists'])) {
|
26 |
+
// foreach($_POST['subscription_lists'] as $key => $value) {
|
27 |
+
// $subscribed_to_lists[] = $key;
|
28 |
+
// }
|
29 |
+
// }
|
30 |
+
//
|
31 |
+
// $collection = Mage::getResourceModel('mfsubscriptions/lists_collection')
|
32 |
+
// ->addFieldToFilter('scope_id',$customer->getWebsiteId())
|
33 |
+
// ->addFieldToFilter('status',1);
|
34 |
+
//
|
35 |
+
// foreach($collection as $list) {
|
36 |
+
// if (in_array($list->getListId(),$subscribed_to_lists) !== TRUE) {
|
37 |
+
// $unsubscribe_from_lists[] = $list->getListId();
|
38 |
+
// }
|
39 |
+
// if ($list->getUnsubListId()) $unsub_lists[] = $list->getUnsubListId();
|
40 |
+
// }
|
41 |
+
//
|
42 |
+
// // Subscribe user to lists
|
43 |
+
// if (!empty($subscribed_to_lists)) {
|
44 |
+
// Mage::helper('mfsubscriptions')->adestra_subscribe_contact_multiple($contact_id,$subscribed_to_lists, $unsub_lists);
|
45 |
+
// }
|
46 |
+
//
|
47 |
+
// // Unsubscribe user from lists
|
48 |
+
// if (!empty($unsubscribe_from_lists)) {
|
49 |
+
// Mage::helper('mfsubscriptions')->adestra_unsubscribe_contact_multiple($contact_id,$unsubscribe_from_lists, $unsub_lists);
|
50 |
+
// }
|
51 |
+
//
|
52 |
+
// }
|
53 |
+
// //}
|
54 |
+
//
|
55 |
+
// }
|
56 |
+
|
57 |
+
}
|
58 |
+
|
59 |
+
}
|
app/code/community/Adestra/MFSubscriptions/Model/Adminhtml/Validate.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Adestra_MFSubscriptions_Model_Adminhtml_Validate {
|
4 |
+
|
5 |
+
|
6 |
+
public function mfApiCheck(Varien_Event_Observer $observer) {
|
7 |
+
|
8 |
+
// Adestra login details and return workspace name for core tale ID.
|
9 |
+
|
10 |
+
$event = $observer->getEvent();
|
11 |
+
if (isset($_POST['config_state']['adestra_mfsubscriptions'])) {
|
12 |
+
|
13 |
+
$config = array('enabled');
|
14 |
+
$config = Mage::helper('mfsubscriptions')->getConfigData($config);
|
15 |
+
if($config['enabled']) {
|
16 |
+
|
17 |
+
$core_table = Mage::helper('mfsubscriptions')->adestra_get_core_table();
|
18 |
+
if ($core_table['id']) {
|
19 |
+
Mage::getSingleton('adminhtml/session')->addNotice('Successfully connected to MessageFocus: '.$core_table['name']);
|
20 |
+
}
|
21 |
+
|
22 |
+
}
|
23 |
+
|
24 |
+
}
|
25 |
+
|
26 |
+
|
27 |
+
}
|
28 |
+
|
29 |
+
}
|
30 |
+
|
app/code/community/Adestra/MFSubscriptions/Model/Customer/Observer.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Adestra_MFSubscriptions_Model_Customer_Observer {
|
5 |
+
|
6 |
+
|
7 |
+
public function saveCustomer(Varien_Event_Observer $observer) {
|
8 |
+
|
9 |
+
// Save customer: check/update Adestra MF subscription account.
|
10 |
+
if (Mage::getStoreConfig('adestra/mfsubscriptions/enabled')) {
|
11 |
+
$post_data = Mage::app()->getRequest()->getPost();
|
12 |
+
|
13 |
+
//$customer = Mage::registry('current_customer');
|
14 |
+
$customer = $observer->getEvent()->getCustomer();
|
15 |
+
$contact_id = Mage::helper('mfsubscriptions')->updateMFContact($customer->getId()); // create or update contact
|
16 |
+
|
17 |
+
}
|
18 |
+
}
|
19 |
+
|
20 |
+
|
21 |
+
public function subscribeCustomer(Varien_Event_Observer $observer) {
|
22 |
+
|
23 |
+
// Save customer: update Adestra MF subscriptions.
|
24 |
+
if (Mage::getStoreConfig('adestra/mfsubscriptions/enabled')) {
|
25 |
+
|
26 |
+
$customer = $observer->getEvent()->getCustomer();
|
27 |
+
$post_data = Mage::app()->getRequest()->getPost();
|
28 |
+
$contact = Mage::helper('mfsubscriptions')->getMFContactFromCustomer($customer);
|
29 |
+
Mage::Log(__FUNCTION__);
|
30 |
+
|
31 |
+
// Contact exists && subscription lists available.
|
32 |
+
if (isset($contact['id']) && isset($post_data['subscription_lists'])) {
|
33 |
+
Mage::helper('mfsubscriptions')->updateMFSubscriptions($contact['id'],$customer, $post_data['subscription_lists']);
|
34 |
+
}
|
35 |
+
|
36 |
+
}
|
37 |
+
|
38 |
+
}
|
39 |
+
|
40 |
+
public function checkoutSubscribeCustomer(Varien_Event_Observer $observer) {
|
41 |
+
|
42 |
+
// Save customer: update Adestra MF subscriptions.
|
43 |
+
if (Mage::getStoreConfig('adestra/mfsubscriptions/enabled')) {
|
44 |
+
|
45 |
+
$order = $observer->getEvent()->getOrder();
|
46 |
+
$customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
|
47 |
+
$post_data = Mage::app()->getRequest()->getPost();
|
48 |
+
$contact = Mage::helper('mfsubscriptions')->getMFContactFromCustomer($customer);
|
49 |
+
|
50 |
+
// Contact exists && subscription lists available.
|
51 |
+
if (isset($contact['id']) && isset($post_data['subscription_lists'])) {
|
52 |
+
Mage::helper('mfsubscriptions')->updateMFSubscriptions($contact['id'],$customer, $post_data['subscription_lists']);
|
53 |
+
}
|
54 |
+
|
55 |
+
}
|
56 |
+
|
57 |
+
}
|
58 |
+
}
|
app/code/community/Adestra/MFSubscriptions/Model/List.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Adestra_MFSubscriptions_Model_List extends Mage_Core_Model_Abstract {
|
4 |
+
protected function _construct()
|
5 |
+
{
|
6 |
+
$this->_init('mfsubscriptions/list');
|
7 |
+
}
|
8 |
+
}
|
9 |
+
|
10 |
+
?>
|
app/code/community/Adestra/MFSubscriptions/Model/Mysql4/List.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Adestra_MFSubscriptions_Model_Mysql4_List extends Mage_Core_Model_Mysql4_Abstract {
|
4 |
+
protected function _construct()
|
5 |
+
{
|
6 |
+
$this->_init('mfsubscriptions/list', 'id');
|
7 |
+
}
|
8 |
+
}
|
9 |
+
|
10 |
+
?>
|
app/code/community/Adestra/MFSubscriptions/Model/Mysql4/Lists/Collection.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Adestra_MFSubscriptions_Model_Resource_Lists_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
3 |
+
{
|
4 |
+
protected function _construct()
|
5 |
+
{
|
6 |
+
$this->_init('mfsubscriptions/list');
|
7 |
+
}
|
8 |
+
}
|
app/code/community/Adestra/MFSubscriptions/Model/Mysql4/Setup.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Adestra_MFSubscriptions_Model_Mysql4_Setup extends Mage_Core_Model_Mysql4_Setup {
|
4 |
+
|
5 |
+
|
6 |
+
}
|
7 |
+
|
8 |
+
|
9 |
+
?>
|
app/code/community/Adestra/MFSubscriptions/Model/Resource/List.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Adestra_MFSubscriptions_Model_Resource_List extends Mage_Core_Model_Resource_Db_Abstract {
|
4 |
+
protected function _construct()
|
5 |
+
{
|
6 |
+
$this->_init('mfsubscriptions/list', 'id');
|
7 |
+
}
|
8 |
+
}
|
9 |
+
|
10 |
+
?>
|
app/code/community/Adestra/MFSubscriptions/Model/Resource/Lists/Collection.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Adestra_MFSubscriptions_Model_Resource_Lists_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
3 |
+
{
|
4 |
+
protected function _construct()
|
5 |
+
{
|
6 |
+
$this->_init('mfsubscriptions/list');
|
7 |
+
}
|
8 |
+
}
|
app/code/community/Adestra/MFSubscriptions/Model/Resource/Setup.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Adestra_MFSubscriptions_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup {
|
4 |
+
|
5 |
+
|
6 |
+
}
|
7 |
+
|
8 |
+
|
9 |
+
?>
|
app/code/community/Adestra/MFSubscriptions/controllers/Adminhtml/MessagefocuslistsController.php
ADDED
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Adestra_MFSubscriptions_Adminhtml_MessagefocuslistsController extends Mage_Adminhtml_Controller_Action
|
3 |
+
{
|
4 |
+
public function indexAction()
|
5 |
+
{
|
6 |
+
// Let's call our initAction method which will set some basic params for each action
|
7 |
+
$this->_initAction()
|
8 |
+
->renderLayout();
|
9 |
+
}
|
10 |
+
|
11 |
+
public function newAction()
|
12 |
+
{
|
13 |
+
// We just forward the new action to a blank edit form
|
14 |
+
$this->_forward('edit');
|
15 |
+
}
|
16 |
+
|
17 |
+
public function editAction()
|
18 |
+
{
|
19 |
+
$this->_initAction();
|
20 |
+
|
21 |
+
// Get id if available
|
22 |
+
$id = $this->getRequest()->getParam('id');
|
23 |
+
$model = Mage::getModel('mfsubscriptions/list');
|
24 |
+
|
25 |
+
if ($id) {
|
26 |
+
// Load record
|
27 |
+
$model->load($id);
|
28 |
+
|
29 |
+
// Check if record is loaded
|
30 |
+
if (!$model->getId()) {
|
31 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('This list no longer exists.'));
|
32 |
+
$this->_redirect('*/*/');
|
33 |
+
|
34 |
+
return;
|
35 |
+
}
|
36 |
+
}
|
37 |
+
|
38 |
+
$this->_title($model->getId() ? $model->getDescription() : $this->__('New List'));
|
39 |
+
|
40 |
+
$data = Mage::getSingleton('adminhtml/session')->getMessagefocuslistData(true);
|
41 |
+
if (!empty($data)) {
|
42 |
+
$model->setData($data);
|
43 |
+
}
|
44 |
+
|
45 |
+
Mage::register('mfsubscriptions', $model);
|
46 |
+
|
47 |
+
$this->_initAction()
|
48 |
+
->_addBreadcrumb($id ? $this->__('Edit List') : $this->__('New List'), $id ? $this->__('Edit List') : $this->__('New List'))
|
49 |
+
->_addContent($this->getLayout()->createBlock('mfsubscriptions/adminhtml_lists_edit')->setData('action', $this->getUrl('*/*/save')))
|
50 |
+
->renderLayout();
|
51 |
+
}
|
52 |
+
|
53 |
+
public function saveAction()
|
54 |
+
{
|
55 |
+
if ($postData = $this->getRequest()->getPost()) {
|
56 |
+
$model = Mage::getSingleton('mfsubscriptions/list');
|
57 |
+
$model->setData($postData);
|
58 |
+
|
59 |
+
try {
|
60 |
+
if ($model->status) {
|
61 |
+
|
62 |
+
$collection = Mage::getResourceModel('mfsubscriptions/lists_collection')
|
63 |
+
->addFieldToFilter('status',1)
|
64 |
+
->addFieldToFilter('list_id',$model->getListId())
|
65 |
+
->addFieldToFilter('scope_id',$model->getScopeId())
|
66 |
+
->addFieldToFilter('id',array("neq"=>$model->getId()));
|
67 |
+
if ($collection->count() > 0) {
|
68 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('List ID '.$model->getListId().' already exists for the same website. Please try again or set to inactive.'));
|
69 |
+
$this->_redirect('*/*/');
|
70 |
+
return;
|
71 |
+
}
|
72 |
+
|
73 |
+
if ($model->type == 1) $list = Mage::helper('mfsubscriptions')->adestra_fetch_list($model->getListId());
|
74 |
+
else if ($model->type == 0) $list = Mage::helper('mfsubscriptions')->adestra_fetch_ubsublist($model->getUnsubListId());
|
75 |
+
if (isset($list['name'])) {
|
76 |
+
Mage::getSingleton('adminhtml/session')->addNotice('Successfully configured MessageFocus list: '.$list['name']);
|
77 |
+
}
|
78 |
+
else {
|
79 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Could not connect to MessageFocus list ID: '.$model->getListId().'. Please try again or set to inactive.'));
|
80 |
+
$this->_redirect('*/*/');
|
81 |
+
return;
|
82 |
+
}
|
83 |
+
|
84 |
+
}
|
85 |
+
|
86 |
+
$model->save();
|
87 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The list has been saved.'));
|
88 |
+
$this->_redirect('*/*/');
|
89 |
+
return;
|
90 |
+
}
|
91 |
+
catch (Mage_Core_Exception $e) {
|
92 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
93 |
+
}
|
94 |
+
catch (Exception $e) {
|
95 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('An error occurred while saving this list.'));
|
96 |
+
}
|
97 |
+
$this->_redirectReferer();
|
98 |
+
return;
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
public function deleteAction()
|
103 |
+
{
|
104 |
+
$this->_initAction();
|
105 |
+
if ($id = $this->getRequest()->getParam('id')) {
|
106 |
+
try {
|
107 |
+
$model = Mage::getModel('mfsubscriptions/list');
|
108 |
+
$model->setId($id);
|
109 |
+
$model->delete();
|
110 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('mfsubscriptions')->__('The list has been deleted.'));
|
111 |
+
$this->_redirect('*/*/');
|
112 |
+
return;
|
113 |
+
}
|
114 |
+
catch (Exception $e) {
|
115 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
116 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
117 |
+
return;
|
118 |
+
}
|
119 |
+
}
|
120 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Unable to find the list to delete.'));
|
121 |
+
$this->_redirect('*/*/');
|
122 |
+
}
|
123 |
+
|
124 |
+
public function messageAction()
|
125 |
+
{
|
126 |
+
$data = Mage::getModel('mfsubscriptions/list')->load($this->getRequest()->getParam('id'));
|
127 |
+
echo $data->getContent();
|
128 |
+
}
|
129 |
+
|
130 |
+
|
131 |
+
protected function _initAction()
|
132 |
+
{
|
133 |
+
$this->loadLayout()
|
134 |
+
->_setActiveMenu('adestra/messagefocuslists')
|
135 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__("MessageFocus List Manager"), Mage::helper('adminhtml')->__("MessageFocus List Manager"));
|
136 |
+
$this->getLayout()->getBlock('head')->setTitle($this->__('Manage MessageFocus List / Adestra / Magento Admin'));
|
137 |
+
return $this;
|
138 |
+
}
|
139 |
+
|
140 |
+
}
|
app/code/community/Adestra/MFSubscriptions/controllers/IndexController.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Adestra_MFSubscriptions_IndexController extends Mage_Core_Controller_Front_Action {
|
4 |
+
|
5 |
+
public function indexAction() {
|
6 |
+
$this->_forward('manage');
|
7 |
+
|
8 |
+
}
|
9 |
+
|
10 |
+
}
|
11 |
+
|
12 |
+
|
13 |
+
?>
|
app/code/community/Adestra/MFSubscriptions/controllers/ManageController.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Adestra_MFSubscriptions_ManageController extends Mage_Core_Controller_Front_Action {
|
4 |
+
|
5 |
+
public function indexAction() {
|
6 |
+
|
7 |
+
if( !Mage::getSingleton('customer/session')->isLoggedIn() ) {
|
8 |
+
Mage::getSingleton('customer/session')->authenticate($this);
|
9 |
+
return;
|
10 |
+
}
|
11 |
+
|
12 |
+
$this->loadLayout();
|
13 |
+
$navigationBlock = $this->getLayout()->getBlock('customer_account_navigation');
|
14 |
+
if ($navigationBlock) {
|
15 |
+
$navigationBlock->setActive('mfsubscriptions/manage/index');
|
16 |
+
}
|
17 |
+
|
18 |
+
$this->renderLayout();
|
19 |
+
}
|
20 |
+
|
21 |
+
public function saveAction() {
|
22 |
+
|
23 |
+
if( !Mage::getSingleton('customer/session')->isLoggedIn() ) {
|
24 |
+
Mage::getSingleton('customer/session')->authenticate($this);
|
25 |
+
return;
|
26 |
+
}
|
27 |
+
|
28 |
+
if ($post_data = $this->getRequest()->getPost()) {
|
29 |
+
|
30 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
31 |
+
$contact_id = $post_data['contact_id'];
|
32 |
+
if (!isset($post_data['subscription_lists'])) $post_data['subscription_lists'] = array();
|
33 |
+
Mage::helper('mfsubscriptions')->updateMFSubscriptions($contact_id, $customer, $post_data['subscription_lists']);
|
34 |
+
|
35 |
+
Mage::getSingleton('core/session')->addNotice('Successfully updated subscription lists.');
|
36 |
+
|
37 |
+
}
|
38 |
+
|
39 |
+
$this->_redirect('*/*/index');
|
40 |
+
return;
|
41 |
+
}
|
42 |
+
|
43 |
+
}
|
44 |
+
|
45 |
+
|
46 |
+
?>
|
app/code/community/Adestra/MFSubscriptions/controllers/OnepageController.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once 'Mage/Checkout/controllers/OnepageController.php';
|
4 |
+
|
5 |
+
class Adestra_MFSubscriptions_OnepageController extends Mage_Checkout_OnepageController
|
6 |
+
|
7 |
+
{
|
8 |
+
|
9 |
+
/**
|
10 |
+
|
11 |
+
* Rewrite checkout subscriber subscription changes
|
12 |
+
|
13 |
+
*/
|
14 |
+
|
15 |
+
/**
|
16 |
+
* save checkout billing address
|
17 |
+
*/
|
18 |
+
public function saveBillingAction()
|
19 |
+
{
|
20 |
+
if ($this->_expireAjax()) {
|
21 |
+
return;
|
22 |
+
}
|
23 |
+
if ($this->getRequest()->isPost()) {
|
24 |
+
|
25 |
+
$mf_subscription_data = $this->getRequest()->getPost('mf_subscription_lists', array());
|
26 |
+
$mf_subscription_id = $this->getRequest()->getPost('mf_subscription_id');
|
27 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
28 |
+
if (isset($mf_subscription_id) && isset($mf_subscription_data)) {
|
29 |
+
Mage::helper('mfsubscriptions')->updateMFSubscriptions($mf_subscription_id,$customer, $mf_subscription_data);
|
30 |
+
}
|
31 |
+
|
32 |
+
//Mage::Log(__FUNCTION__);
|
33 |
+
//Mage::Log($mf_subscription_data);
|
34 |
+
|
35 |
+
$data = $this->getRequest()->getPost('billing', array());
|
36 |
+
$customerAddressId = $this->getRequest()->getPost('billing_address_id', false);
|
37 |
+
|
38 |
+
if (isset($data['email'])) {
|
39 |
+
$data['email'] = trim($data['email']);
|
40 |
+
}
|
41 |
+
$result = $this->getOnepage()->saveBilling($data, $customerAddressId);
|
42 |
+
|
43 |
+
if (!isset($result['error'])) {
|
44 |
+
/* check quote for virtual */
|
45 |
+
if ($this->getOnepage()->getQuote()->isVirtual()) {
|
46 |
+
$result['goto_section'] = 'payment';
|
47 |
+
$result['update_section'] = array(
|
48 |
+
'name' => 'payment-method',
|
49 |
+
'html' => $this->_getPaymentMethodsHtml()
|
50 |
+
);
|
51 |
+
} elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {
|
52 |
+
$result['goto_section'] = 'shipping_method';
|
53 |
+
$result['update_section'] = array(
|
54 |
+
'name' => 'shipping-method',
|
55 |
+
'html' => $this->_getShippingMethodsHtml()
|
56 |
+
);
|
57 |
+
|
58 |
+
$result['allow_sections'] = array('shipping');
|
59 |
+
$result['duplicateBillingInfo'] = 'true';
|
60 |
+
} else {
|
61 |
+
$result['goto_section'] = 'shipping';
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
|
70 |
+
}
|
app/code/community/Adestra/MFSubscriptions/etc/adminhtml.xml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<menu>
|
4 |
+
<adestra translate="title" module="mfsubscriptions">
|
5 |
+
<title>Adestra</title>
|
6 |
+
<sort_order>100</sort_order>
|
7 |
+
<children>
|
8 |
+
<mfsubscriptions>
|
9 |
+
<title>Account Settings</title>
|
10 |
+
<sort_order>1</sort_order>
|
11 |
+
<action>adminhtml/system_config/edit/section/adestra</action>
|
12 |
+
</mfsubscriptions>
|
13 |
+
<messagefocuslist>
|
14 |
+
<title>MessageFocus Lists</title>
|
15 |
+
<sort_order>1</sort_order>
|
16 |
+
<action>adminhtml/messagefocuslists</action>
|
17 |
+
</messagefocuslist>
|
18 |
+
</children>
|
19 |
+
</adestra>
|
20 |
+
</menu>
|
21 |
+
<acl>
|
22 |
+
<resources>
|
23 |
+
<admin>
|
24 |
+
<children>
|
25 |
+
<adestra translate="title" module="mfsubscriptions">
|
26 |
+
<title>Adestra MessageFocus</title>
|
27 |
+
<sort_order>1</sort_order>
|
28 |
+
</adestra>
|
29 |
+
</children>
|
30 |
+
</admin>
|
31 |
+
</resources>
|
32 |
+
</acl>
|
33 |
+
</config>
|
34 |
+
|
35 |
+
|
36 |
+
|
app/code/community/Adestra/MFSubscriptions/etc/config.xml
ADDED
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Adestra_MFSubscriptions>
|
5 |
+
<version>0.0.9</version>
|
6 |
+
</Adestra_MFSubscriptions>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<helpers>
|
10 |
+
<mfsubscriptions>
|
11 |
+
<class>Adestra_MFSubscriptions_Helper</class>
|
12 |
+
</mfsubscriptions>
|
13 |
+
</helpers>
|
14 |
+
<blocks>
|
15 |
+
<mfsubscriptions>
|
16 |
+
<class>Adestra_MFSubscriptions_Block</class>
|
17 |
+
</mfsubscriptions>
|
18 |
+
<adminhtml>
|
19 |
+
<rewrite>
|
20 |
+
<customer_edit_tabs>Adestra_MFSubscriptions_Block_Adminhtml_Customer_Edit_Tabs</customer_edit_tabs>
|
21 |
+
</rewrite>
|
22 |
+
</adminhtml>
|
23 |
+
</blocks>
|
24 |
+
|
25 |
+
<models>
|
26 |
+
<mfsubscriptions>
|
27 |
+
<class>Adestra_MFSubscriptions_Model</class>
|
28 |
+
<resourceModel>mfsubscriptions_resource</resourceModel>
|
29 |
+
<!-- <resourceModel>mfsubscriptions_resource_eva_mysql4</resourceModel>
|
30 |
+
--> </mfsubscriptions>
|
31 |
+
<mfsubscriptions_resource>
|
32 |
+
<class>Adestra_MFSubscriptions_Model_Resource</class>
|
33 |
+
<entities>
|
34 |
+
<list>
|
35 |
+
<table>mfsubscriptions_lists</table>
|
36 |
+
</list>
|
37 |
+
</entities>
|
38 |
+
</mfsubscriptions_resource>
|
39 |
+
<mfsubscriptions_resource_eva_mysql4>
|
40 |
+
<class>Adestra_MFSubscriptions_Model_Mysql4</class>
|
41 |
+
<entities>
|
42 |
+
<list>
|
43 |
+
<table>mfsubscriptions_lists</table>
|
44 |
+
</list>
|
45 |
+
</entities>
|
46 |
+
</mfsubscriptions_resource_eva_mysql4>
|
47 |
+
</models>
|
48 |
+
<events>
|
49 |
+
<controller_action_postdispatch_adminhtml_system_config_save>
|
50 |
+
<observers>
|
51 |
+
<subscription_admin_check>
|
52 |
+
<class>mfsubscriptions/adminhtml_validate</class>
|
53 |
+
<method>mfApiCheck</method>
|
54 |
+
</subscription_admin_check>
|
55 |
+
</observers>
|
56 |
+
</controller_action_postdispatch_adminhtml_system_config_save>
|
57 |
+
<adminhtml_customer_save_after>
|
58 |
+
<observers>
|
59 |
+
<customer_admin_edit>
|
60 |
+
<!-- <class>mfsubscriptions/adminhtml_customer_edit</class>
|
61 |
+
<method>saveCustomer</method>
|
62 |
+
-->
|
63 |
+
<class>mfsubscriptions/customer_observer</class>
|
64 |
+
<method>subscribeCustomer</method>
|
65 |
+
</customer_admin_edit>
|
66 |
+
</observers>
|
67 |
+
</adminhtml_customer_save_after>
|
68 |
+
<customer_register_success>
|
69 |
+
<observers>
|
70 |
+
<customer_subscribe>
|
71 |
+
<class>mfsubscriptions/customer_observer</class>
|
72 |
+
<method>subscribeCustomer</method>
|
73 |
+
</customer_subscribe>
|
74 |
+
</observers>
|
75 |
+
</customer_register_success>
|
76 |
+
<customer_save_after>
|
77 |
+
<observers>
|
78 |
+
<customer_save>
|
79 |
+
<class>mfsubscriptions/customer_observer</class>
|
80 |
+
<method>saveCustomer</method>
|
81 |
+
</customer_save>
|
82 |
+
</observers>
|
83 |
+
</customer_save_after>
|
84 |
+
<checkout_type_onepage_save_order_after>
|
85 |
+
<observers>
|
86 |
+
<customer_subscribe>
|
87 |
+
<class>mfsubscriptions/customer_observer</class>
|
88 |
+
<method>checkoutSubscribeCustomer</method>
|
89 |
+
</customer_subscribe>
|
90 |
+
</observers>
|
91 |
+
</checkout_type_onepage_save_order_after>
|
92 |
+
</events>
|
93 |
+
<resources>
|
94 |
+
<mfsubscriptions_setup>
|
95 |
+
<setup>
|
96 |
+
<module>Adestra_MFSubscriptions</module>
|
97 |
+
<class>Adestra_MFSubscriptions_Model_Resource_Setup</class>
|
98 |
+
</setup>
|
99 |
+
</mfsubscriptions_setup>
|
100 |
+
</resources>
|
101 |
+
|
102 |
+
</global>
|
103 |
+
<frontend>
|
104 |
+
<layout>
|
105 |
+
<updates>
|
106 |
+
<mfsubscriptions>
|
107 |
+
<file>mfsubscriptions.xml</file>
|
108 |
+
</mfsubscriptions>
|
109 |
+
</updates>
|
110 |
+
</layout>
|
111 |
+
|
112 |
+
<routers>
|
113 |
+
<mfsubscriptions>
|
114 |
+
<use>standard</use>
|
115 |
+
<args>
|
116 |
+
<module>Adestra_MFSubscriptions</module>
|
117 |
+
<frontName>mfsubscriptions</frontName>
|
118 |
+
</args>
|
119 |
+
</mfsubscriptions>
|
120 |
+
<checkout>
|
121 |
+
<args>
|
122 |
+
<modules>
|
123 |
+
<!-- <Adestra_MFSubscriptions before="Mage_Checkout">Adestra_MFSubscriptions</Adestra_MFSubscriptions>
|
124 |
+
--> </modules>
|
125 |
+
</args>
|
126 |
+
</checkout>
|
127 |
+
</routers>
|
128 |
+
</frontend>
|
129 |
+
<default>
|
130 |
+
<adestra>
|
131 |
+
<mfsubscriptions>
|
132 |
+
<accountid>0</accountid>
|
133 |
+
</mfsubscriptions>
|
134 |
+
<mfsubscriptions>
|
135 |
+
<apiendpoint>https://new.adestra.com/api/xmlrpc/</apiendpoint>
|
136 |
+
</mfsubscriptions>
|
137 |
+
</adestra>
|
138 |
+
</default>
|
139 |
+
<adminhtml>
|
140 |
+
<acl>
|
141 |
+
<resources>
|
142 |
+
<admin>
|
143 |
+
<children>
|
144 |
+
<system>
|
145 |
+
<children>
|
146 |
+
<config>
|
147 |
+
<children>
|
148 |
+
<adestra>
|
149 |
+
<title>Adestra settings</title>
|
150 |
+
</adestra>
|
151 |
+
</children>
|
152 |
+
</config>
|
153 |
+
</children>
|
154 |
+
</system>
|
155 |
+
</children>
|
156 |
+
</admin>
|
157 |
+
</resources>
|
158 |
+
</acl>
|
159 |
+
<layout>
|
160 |
+
<updates>
|
161 |
+
<adestra_mfsubscriptions>
|
162 |
+
<file>mfsubscriptions.xml</file>
|
163 |
+
</adestra_mfsubscriptions>
|
164 |
+
</updates>
|
165 |
+
</layout>
|
166 |
+
</adminhtml>
|
167 |
+
<admin>
|
168 |
+
<routers>
|
169 |
+
<adminhtml>
|
170 |
+
<args>
|
171 |
+
<modules>
|
172 |
+
<mfsubscriptions after="Mage_Adminhtml">Adestra_MFSubscriptions_Adminhtml</mfsubscriptions>
|
173 |
+
</modules>
|
174 |
+
</args>
|
175 |
+
</adminhtml>
|
176 |
+
</routers>
|
177 |
+
</admin>
|
178 |
+
</config>
|
app/code/community/Adestra/MFSubscriptions/etc/system.xml
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<adestra translate="label">
|
5 |
+
<label>Adestra</label>
|
6 |
+
<tab>general</tab>
|
7 |
+
<frontend_type>text</frontend_type>
|
8 |
+
<sort_order>2000</sort_order>
|
9 |
+
<show_in_default>1</show_in_default>
|
10 |
+
<show_in_website>1</show_in_website>
|
11 |
+
<show_in_store>0</show_in_store>
|
12 |
+
<groups>
|
13 |
+
<!-- Subscription Group -->
|
14 |
+
<mfsubscriptions translate="label" module="mfsubscriptions">
|
15 |
+
<label>MessageFocus Subscription</label>
|
16 |
+
<frontend_type>text</frontend_type>
|
17 |
+
<sort_order>-200</sort_order>
|
18 |
+
<show_in_default>1</show_in_default>
|
19 |
+
<show_in_website>1</show_in_website>
|
20 |
+
<show_in_store>0</show_in_store>
|
21 |
+
<expanded>1</expanded>
|
22 |
+
<fields>
|
23 |
+
<enabled translate="label">
|
24 |
+
<label>Enabled</label>
|
25 |
+
<frontend_type>select</frontend_type>
|
26 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
27 |
+
<sort_order>1</sort_order>
|
28 |
+
<show_in_default>1</show_in_default>
|
29 |
+
<show_in_website>1</show_in_website>
|
30 |
+
<show_in_store>0</show_in_store>
|
31 |
+
</enabled>
|
32 |
+
<accountid translate="label">
|
33 |
+
<label>Account Name</label>
|
34 |
+
<frontend_type>text</frontend_type>
|
35 |
+
<sort_order>2</sort_order>
|
36 |
+
<show_in_default>1</show_in_default>
|
37 |
+
<show_in_website>1</show_in_website>
|
38 |
+
<show_in_store>0</show_in_store>
|
39 |
+
</accountid>
|
40 |
+
<apiusername translate="label">
|
41 |
+
<label>API Username</label>
|
42 |
+
<!-- <backend_model>mfsubscriptions/admin</backend_model>
|
43 |
+
--> <frontend_type>text</frontend_type>
|
44 |
+
<sort_order>3</sort_order>
|
45 |
+
<show_in_default>1</show_in_default>
|
46 |
+
<show_in_website>1</show_in_website>
|
47 |
+
<show_in_store>0</show_in_store>
|
48 |
+
</apiusername>
|
49 |
+
<apipassword translate="label">
|
50 |
+
<label>API Password</label>
|
51 |
+
<frontend_type>password</frontend_type>
|
52 |
+
<sort_order>4</sort_order>
|
53 |
+
<show_in_default>1</show_in_default>
|
54 |
+
<show_in_website>1</show_in_website>
|
55 |
+
<show_in_store>0</show_in_store>
|
56 |
+
<comment><![CDATA[Note: passwords containing special characters such as @ & # may cuase problems connecting to MessageFocus]]></comment>
|
57 |
+
</apipassword>
|
58 |
+
<apiendpoint translate="label">
|
59 |
+
<label>API XML-RPC End Point</label>
|
60 |
+
<frontend_type>text</frontend_type>
|
61 |
+
<sort_order>5</sort_order>
|
62 |
+
<show_in_default>1</show_in_default>
|
63 |
+
<show_in_website>1</show_in_website>
|
64 |
+
<show_in_store>0</show_in_store>
|
65 |
+
</apiendpoint>
|
66 |
+
<coretableid translate="label">
|
67 |
+
<label>Default Core Table ID</label>
|
68 |
+
<frontend_type>text</frontend_type>
|
69 |
+
<sort_order>6</sort_order>
|
70 |
+
<show_in_default>1</show_in_default>
|
71 |
+
<show_in_website>1</show_in_website>
|
72 |
+
<show_in_store>0</show_in_store>
|
73 |
+
</coretableid>
|
74 |
+
<coretablefieldsmapping translate="label">
|
75 |
+
<label>Core Table Field Mapping</label>
|
76 |
+
<frontend_type>textarea</frontend_type>
|
77 |
+
<sort_order>7</sort_order>
|
78 |
+
<rows>5</rows>
|
79 |
+
<show_in_default>1</show_in_default>
|
80 |
+
<show_in_website>1</show_in_website>
|
81 |
+
<show_in_store>0</show_in_store>
|
82 |
+
<comment><![CDATA[MessageFocus additional core fields mapping. Use the format {magento_field}|{message_focus_field} and one field mapping per line e.g. account.firstname|first_name. Additional Magento fields include: prefix, firstname, lastname, company]]></comment>
|
83 |
+
</coretablefieldsmapping>
|
84 |
+
<enableregister translate="label">
|
85 |
+
<label>Enable Register Subscription</label>
|
86 |
+
<frontend_type>select</frontend_type>
|
87 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
88 |
+
<sort_order>8</sort_order>
|
89 |
+
<show_in_default>1</show_in_default>
|
90 |
+
<show_in_website>1</show_in_website>
|
91 |
+
<show_in_store>0</show_in_store>
|
92 |
+
</enableregister>
|
93 |
+
<enablecheckout translate="label">
|
94 |
+
<label>Enable Checkout Subscription</label>
|
95 |
+
<frontend_type>select</frontend_type>
|
96 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
97 |
+
<sort_order>9</sort_order>
|
98 |
+
<show_in_default>1</show_in_default>
|
99 |
+
<show_in_website>1</show_in_website>
|
100 |
+
<show_in_store>0</show_in_store>
|
101 |
+
</enablecheckout>
|
102 |
+
<debug translate="label">
|
103 |
+
<label>Debug</label>
|
104 |
+
<frontend_type>select</frontend_type>
|
105 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
106 |
+
<sort_order>10</sort_order>
|
107 |
+
<show_in_default>1</show_in_default>
|
108 |
+
<show_in_website>1</show_in_website>
|
109 |
+
<show_in_store>0</show_in_store>
|
110 |
+
<comment><![CDATA[Writes conversion data to system.log.]]></comment>
|
111 |
+
</debug>
|
112 |
+
</fields>
|
113 |
+
<comment><![CDATA[Enter global options for MessageFocus Subscription.]]></comment>
|
114 |
+
</mfsubscriptions>
|
115 |
+
</groups>
|
116 |
+
</adestra>
|
117 |
+
</sections>
|
118 |
+
</config>
|
app/code/community/Adestra/MFSubscriptions/sql/mfsubscriptions_setup/mysql4-install-0.0.2.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
$table = $installer->getConnection()->newTable($installer->getTable('mfsubscriptions/list'))
|
6 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
7 |
+
'auto_increment' => true,
|
8 |
+
'unsigned' => true,
|
9 |
+
'nullable' => false,
|
10 |
+
'primary' => true,
|
11 |
+
'identity' => true,
|
12 |
+
), 'ID')
|
13 |
+
->addColumn('list_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
14 |
+
'unsigned' => true,
|
15 |
+
'nullable' => false,
|
16 |
+
), 'List ID')
|
17 |
+
->addColumn('scope_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
18 |
+
'unsigned' => true,
|
19 |
+
'nullable' => false,
|
20 |
+
), 'Website Scope ID')
|
21 |
+
->addColumn('unsub_list_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
22 |
+
'unsigned' => true,
|
23 |
+
'nullable' => false,
|
24 |
+
), 'Unsub list ID')
|
25 |
+
->addColumn('description', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
|
26 |
+
'nullable' => false,
|
27 |
+
), 'List decription')
|
28 |
+
->addColumn('field', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
|
29 |
+
'nullable' => true,
|
30 |
+
), 'Data table field')
|
31 |
+
->addColumn('default_sub', Varien_Db_Ddl_Table::TYPE_BOOLEAN, 1, array(
|
32 |
+
'nullable' => false,
|
33 |
+
'default' => 0,
|
34 |
+
), 'Subscribed as default')
|
35 |
+
->addColumn('automatic_sub', Varien_Db_Ddl_Table::TYPE_BOOLEAN, 1, array(
|
36 |
+
'nullable' => false,
|
37 |
+
'default' => 0,
|
38 |
+
), 'Automatic subscription')
|
39 |
+
->addColumn('status', Varien_Db_Ddl_Table::TYPE_BOOLEAN, 1, array(
|
40 |
+
'nullable' => false,
|
41 |
+
'default' => 0,
|
42 |
+
), 'Status active/inactive')
|
43 |
+
->addColumn('type', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
44 |
+
'nullable' => false,
|
45 |
+
'default' => 1,
|
46 |
+
), 'List type: 1 = list, 0 = Unsubscribe all')
|
47 |
+
->addColumn('position', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
48 |
+
'unsigned' => true,
|
49 |
+
'nullable' => false,
|
50 |
+
), 'List position (ascending)');
|
51 |
+
//->setComment('Adestra MessageFocus Subscription list table');
|
52 |
+
$installer->getConnection()->createTable($table);
|
53 |
+
$installer->endSetup();
|
54 |
+
|
55 |
+
|
56 |
+
?>
|
app/design/adminhtml/default/default/layout/mfsubscriptions.xml
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<layout>
|
3 |
+
<adminhtml_messagefocuslists_index>
|
4 |
+
<reference name="content">
|
5 |
+
<!-- We also reference our block by namespacename_modulename/adminhtml_controllername, and name it uniquely -->
|
6 |
+
<block type="mfsubscriptions/adminhtml_lists" name="mfsubscriptions.lists" />
|
7 |
+
</reference>
|
8 |
+
</adminhtml_messagefocuslists_index>
|
9 |
+
|
10 |
+
<adminhtml_messagefocuslists_edit>
|
11 |
+
<reference name="head">
|
12 |
+
<action method="addJs"><script>adestra/mfsubscriptions/adminhtml.js</script></action>
|
13 |
+
</reference>
|
14 |
+
</adminhtml_messagefocuslists_edit>
|
15 |
+
<adminhtml_customer_edit>
|
16 |
+
<reference name="head">
|
17 |
+
<action method="addJs"><script>adestra/mfsubscriptions/adminhtml.js</script></action>
|
18 |
+
</reference>
|
19 |
+
</adminhtml_customer_edit>
|
20 |
+
|
21 |
+
<!-- <adminhtml_customer_edit>
|
22 |
+
<reference name="customer_edit_tabs">
|
23 |
+
<action method="addTab"><name>customer_edit_tab_subscriptions</name><block>mfsubscriptions/adminhtml_customer_edit_tab_subscriptions</block></action>
|
24 |
+
</reference>
|
25 |
+
</adminhtml_customer_edit>-->
|
26 |
+
|
27 |
+
<!-- <adminhtml_customer_newsletter>
|
28 |
+
<remove name="admin.customer.newsletter.grid" />
|
29 |
+
</adminhtml_customer_newsletter>
|
30 |
+
-->
|
31 |
+
|
32 |
+
</layout>
|
app/design/frontend/base/default/layout/mfsubscriptions.xml
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<customer_account>
|
4 |
+
<reference name="customer_account_navigation">
|
5 |
+
<action method="addLink" translate="label" module="mfsubscriptions"><name>mfsubscriptions</name><path>mfsubscriptions/manage/index</path><label>Newsletter Subscriptions</label></action>
|
6 |
+
<remove name="customer_account_dashboard_newsletter" />
|
7 |
+
<action method="addLink"><name>newsletter</name><path></path><label></label></action> <!-- removes default Mage Newsletter link -->
|
8 |
+
</reference>
|
9 |
+
</customer_account>
|
10 |
+
|
11 |
+
<mfsubscriptions_manage_index translate="label">
|
12 |
+
<update handle="customer_account"/>
|
13 |
+
<label>Customer My Account Newsletter Subscriptions</label>
|
14 |
+
<reference name="my.account.wrapper">
|
15 |
+
<block type="mfsubscriptions/account_customer_subscriptions" name="customer_newsletter">
|
16 |
+
<block type="page/html_wrapper" name="customer.subscriptions.form.before" as="form_before" translate="label">
|
17 |
+
<label>Newsletter Subscription Form Before</label>
|
18 |
+
<action method="setMayBeInvisible"><value>1</value></action>
|
19 |
+
</block>
|
20 |
+
</block>
|
21 |
+
</reference>
|
22 |
+
</mfsubscriptions_manage_index>
|
23 |
+
|
24 |
+
<!-- <checkout_onepage_review translate="label">
|
25 |
+
<reference name="checkout.onepage.review.info.items.after">
|
26 |
+
<block type="mfsubscriptions/account_checkout_review" output="toHtml" name="mfsubscriptions.review" template="mfsubscriptions/checkout/form/review.phtml"/>
|
27 |
+
</reference>
|
28 |
+
</checkout_onepage_review>
|
29 |
+
-->
|
30 |
+
</layout>
|
app/design/frontend/base/default/template/mfsubscriptions/checkout/form/billing.phtml
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
<?php if (Mage::getStoreConfig('adestra/mfsubscriptions/enabled')) : ?>
|
3 |
+
<?php if (Mage::getStoreConfig('adestra/mfsubscriptions/enablecheckout')) : ?>
|
4 |
+
<?php $customer = Mage::getSingleton('customer/session')->getCustomer(); ?>
|
5 |
+
<?php $contact = Mage::helper('mfsubscriptions')->getMFContactFromCustomer($customer); ?>
|
6 |
+
<?php if (empty($contact['id'])) $contact = Mage::helper('mfsubscriptions')->updateMFContact($customer->getId()); // customer does not exists so create it.?>
|
7 |
+
<?php $visible_lists = Mage::helper('mfsubscriptions')->getNonAutomaticLists(); ?>
|
8 |
+
<?php $automatic_lists = Mage::helper('mfsubscriptions')->getAutomaticLists(); ?>
|
9 |
+
<?php $subscribed_lists = Mage::helper('mfsubscriptions')->getMFSubscribedLists($contact); ?>
|
10 |
+
<?php if (count($visible_lists) > 0) : ?>
|
11 |
+
<div id="mfsubscriptions" class="fieldset">
|
12 |
+
<h2 class="legend"><?php echo $this->__('Email Subscriptions') ?></h2>
|
13 |
+
<ul class="form-list" id="subscription-lists">
|
14 |
+
<?php foreach ($visible_lists as $list) { ?>
|
15 |
+
<?php if (array_search($list->getListId(),$subscribed_lists) !== FALSE) $subscribed = TRUE; else $subscribed = FALSE; ?>
|
16 |
+
<li class="control"><input type="checkbox" name="mf_subscription_lists[<?php echo $list->getListId(); ?>]" id="<?php echo $list->getListId(); ?>" value="<?php echo $subscribed?'1':'0'; ?>" <?php echo $subscribed?'checked':''; ?> title="<?php echo $list->getDescription() ?>"<?php if($this->getIsSubscribed()): ?> checked="checked"<?php endif; ?> onclick="this.value = this.checked ? 1 : 0;" class="checkbox subscription-list" /><label for="subscription"><?php echo $list->getDescription() ?></label></li>
|
17 |
+
<?php } ?>
|
18 |
+
</ul>
|
19 |
+
</div>
|
20 |
+
<?php endif; ?>
|
21 |
+
<?php foreach ($automatic_lists as $list) { ?>
|
22 |
+
<input type="hidden" class="subscription-list" name="mf_subscription_lists[<?php echo $list->getListId(); ?>]" id="<?php echo $list->getListId(); ?>" value="1"/>
|
23 |
+
<?php } ?>
|
24 |
+
<input type="hidden" name="mf_subscription_id" value="<?php echo $contact['id'] ?>" />
|
25 |
+
<?php endif; ?>
|
26 |
+
<?php endif; ?>
|
27 |
+
<?php if(!Mage::getSingleton('customer/session')->isLoggedIn()) : ?>
|
28 |
+
<script type="text/javascript">
|
29 |
+
Event.observe('login:guest', 'click', function() {
|
30 |
+
$('mfsubscriptions').hide();
|
31 |
+
});
|
32 |
+
Event.observe('login:register', 'click', function() {
|
33 |
+
$('mfsubscriptions').show();
|
34 |
+
});
|
35 |
+
if ($('login:guest').checked=true) { $('mfsubscriptions').hide(); }
|
36 |
+
if ($('login:register').checked=true) { $('mfsubscriptions').show(); }
|
37 |
+
</script>
|
38 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/mfsubscriptions/customer/form/register.phtml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
<?php if (Mage::getStoreConfig('adestra/mfsubscriptions/enabled')) : ?>
|
3 |
+
<?php if (Mage::getStoreConfig('adestra/mfsubscriptions/enableregister')) : ?>
|
4 |
+
<?php $visible_lists = Mage::helper('mfsubscriptions')->getNonAutomaticLists(); ?>
|
5 |
+
<?php $automatic_lists = Mage::helper('mfsubscriptions')->getAutomaticLists(); ?>
|
6 |
+
<?php if (count($visible_lists) > 0) : ?>
|
7 |
+
<div class="fieldset">
|
8 |
+
<h2 class="legend"><?php echo $this->__('Email Subscriptions') ?></h2>
|
9 |
+
<ul class="form-list">
|
10 |
+
<?php foreach ($visible_lists as $list) { ?>
|
11 |
+
<?php if ($list->getDefaultSub()) $subscribed = TRUE; else $subscribed = FALSE; ?>
|
12 |
+
<li class="control"><input type="checkbox" name="subscription_lists[<?php echo $list->getListId(); ?>]" id="<?php echo $list->getListId(); ?>" value="<?php echo $subscribed?'1':'0'; ?>" <?php echo $subscribed?'checked':''; ?> title="<?php echo $list->getDescription() ?>"<?php if($this->getIsSubscribed()): ?> checked="checked"<?php endif; ?> onclick="this.value = this.checked ? 1 : 0;" class="checkbox" /><label for="subscription"><?php echo $list->getDescription() ?></label></li>
|
13 |
+
<?php } ?>
|
14 |
+
</ul>
|
15 |
+
</div>
|
16 |
+
<?php endif; ?>
|
17 |
+
<?php foreach ($automatic_lists as $list) { ?>
|
18 |
+
<input type="hidden" name="subscription_lists[<?php echo $list->getListId(); ?>]" id="<?php echo $list->getListId(); ?>" value="1"/>
|
19 |
+
<?php } ?>
|
20 |
+
<?php endif; ?>
|
21 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/mfsubscriptions/customer/form/subscriptions.phtml
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
<div class="page-title">
|
3 |
+
<h1><?php echo $this->__('Email Subscriptions') ?></h1>
|
4 |
+
</div>
|
5 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
6 |
+
<?php echo $this->getChildHtml('form_before')?>
|
7 |
+
<?php $customer = Mage::getSingleton('customer/session')->getCustomer(); ?>
|
8 |
+
<?php $contact = Mage::helper('mfsubscriptions')->getMFContactFromCustomer($customer); ?>
|
9 |
+
<?php if (empty($contact['id'])) $contact = Mage::helper('mfsubscriptions')->updateMFContact($customer->getId()); // customer does not exists so create it.?>
|
10 |
+
<?php $subscribed_lists = Mage::helper('mfsubscriptions')->getMFSubscribedLists($contact); ?>
|
11 |
+
<?php $subscription_lists = Mage::helper('mfsubscriptions')->getActiveLists($customer); ?>
|
12 |
+
|
13 |
+
<?php if (count($subscription_lists)) : ?>
|
14 |
+
<form action="<?php echo $this->getAction() ?>" method="post" id="form-validate">
|
15 |
+
<input type="hidden" name="contact_id" value="<?php echo $contact['id'] ?>" />
|
16 |
+
<div class="fieldset">
|
17 |
+
<?php echo $this->getBlockHtml('formkey')?>
|
18 |
+
<h2 class="legend"><?php echo $this->__('Email Subscriptions') ?></h2>
|
19 |
+
<ul class="form-list">
|
20 |
+
<?php $visible_lists = 0; ?>
|
21 |
+
<?php foreach ($subscription_lists as $list) { ?>
|
22 |
+
<?php if (Mage::helper('mfsubscriptions')->isSubscribeList($list->type)) : ?>
|
23 |
+
<?php if (array_search($list->getListId(),$subscribed_lists) !== FALSE) $subscribed = TRUE; else $subscribed = FALSE; ?>
|
24 |
+
<?php if (!$list->getAutomaticSub()) : ?>
|
25 |
+
<li class="control"><input type="checkbox" name="subscription_lists[<?php echo $list->getListId(); ?>]" id="<?php echo $list->getListId(); ?>" value="<?php echo $subscribed?'1':'0'; ?>" <?php echo $subscribed?'checked':''; ?> title="<?php echo $list->getDescription() ?>" onclick="mfSubscribe(this.checked); this.value = this.checked ? 1 : 0;" class="checkbox mf-subscribe" /><label for="subscription"><?php echo $list->getDescription() ?></label></li>
|
26 |
+
<?php $visible_lists++; ?>
|
27 |
+
<?php else : ?>
|
28 |
+
<input type="hidden" class="mf-subscribe" name="subscription_lists[<?php echo $list->getListId(); ?>]" id="<?php echo $list->getListId(); ?>" value="<?php echo $subscribed?1:0; ?>"/>
|
29 |
+
<?php endif; ?>
|
30 |
+
<?php else : ?>
|
31 |
+
<?php if (Mage::helper('mfsubscriptions')->adestra_unsublist_check($customer->email,$list->getUnsubListId())) $unsubscribed = TRUE; else $unsubscribed = FALSE; ?>
|
32 |
+
<li class="control"><input type="checkbox" name="subscription_lists[<?php echo $list->getUnsubListId(); ?>]" id="<?php echo $list->getUnsubListId(); ?>" value="<?php echo $unsubscribed?'1':'0'; ?>" <?php echo $unsubscribed?'checked':''; ?> title="<?php echo $list->getDescription() ?>" onclick="mfUnsubscribeAll(this.checked); this.value = this.checked ? 1 : 0;" class="checkbox mf-unsubscribe" /><label for="subscription"><?php echo $list->getDescription() ?></label></li>
|
33 |
+
<?php $visible_lists++; ?>
|
34 |
+
<?php endif; ?>
|
35 |
+
<?php } ?>
|
36 |
+
</ul>
|
37 |
+
<?php if ($visible_lists == 0) : ?>
|
38 |
+
<p><?php echo $this->__('You have no email subscription lists.') ?></p>
|
39 |
+
<?php endif; ?>
|
40 |
+
</div>
|
41 |
+
<div class="buttons-set">
|
42 |
+
<p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>« </small><?php echo $this->__('Back') ?></a></p>
|
43 |
+
<button type="submit" title="<?php echo $this->__('Save') ?>" class="button"><span><span><?php echo $this->__('Save') ?></span></span></button>
|
44 |
+
</div>
|
45 |
+
</form>
|
46 |
+
<?php /* Extensions placeholder */ ?>
|
47 |
+
<script type="text/javascript">
|
48 |
+
//<![CDATA[
|
49 |
+
var dataForm = new VarienForm('form-validate', true);
|
50 |
+
|
51 |
+
function mfUnsubscribeAll(checked) {
|
52 |
+
if (checked) {
|
53 |
+
var subscribeLists = $$('.mf-subscribe');
|
54 |
+
subscribeLists.each(function(list) {
|
55 |
+
list.checked = false;
|
56 |
+
list.value = 0;
|
57 |
+
});
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
61 |
+
function mfSubscribe(checked) {
|
62 |
+
if (checked) {
|
63 |
+
var unSubscribeLists = $$('.mf-unsubscribe');
|
64 |
+
unSubscribeLists.each(function(list) {
|
65 |
+
list.checked = false;
|
66 |
+
});
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
//]]>
|
71 |
+
</script>
|
72 |
+
<?php else : ?>
|
73 |
+
<p><?php echo $this->__('You have no email subscription lists.') ?></p>
|
74 |
+
<?php endif; ?>
|
app/design/frontend/default/default/template/customer/account/dashboard/info.phtml
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<div class="col2-set">
|
28 |
+
<div class="col-1">
|
29 |
+
<div class="box">
|
30 |
+
<div class="box-title">
|
31 |
+
<h3><?php echo $this->__('Contact Information') ?></h3>
|
32 |
+
<a href="<?php echo $this->getUrl('customer/account/edit') ?>"><?php echo $this->__('Edit') ?></a>
|
33 |
+
</div>
|
34 |
+
<div class="box-content">
|
35 |
+
<p>
|
36 |
+
<?php echo $this->htmlEscape($this->getCustomer()->getName()) ?><br />
|
37 |
+
<?php echo $this->htmlEscape($this->getCustomer()->getEmail()) ?><br />
|
38 |
+
<a href="<?php echo $this->getChangePasswordUrl() ?>"><?php echo $this->__('Change Password') ?></a>
|
39 |
+
</p>
|
40 |
+
</div>
|
41 |
+
</div>
|
42 |
+
</div>
|
43 |
+
<?php if( Mage::helper('mfsubscriptions')->isMFSubscriptionsEnabled() ): ?>
|
44 |
+
<div class="col-2">
|
45 |
+
<div class="box">
|
46 |
+
<div class="box-title">
|
47 |
+
<h3><?php echo Mage::helper('mfsubscriptions')->__('Email Subscriptions') ?></h3>
|
48 |
+
<a href="<?php echo $this->getUrl('mfsubscriptions/manage') ?>"><?php echo $this->__('Edit') ?></a>
|
49 |
+
</div>
|
50 |
+
<div class="box-content">
|
51 |
+
<?php $customer = Mage::getSingleton('customer/session')->getCustomer(); ?>
|
52 |
+
<?php $contact = Mage::helper('mfsubscriptions')->getMFContactFromCustomer($customer); ?>
|
53 |
+
<?php $subscribed_lists = Mage::helper('mfsubscriptions')->getUserAccountSubscribedLists($contact,$customer); ?>
|
54 |
+
|
55 |
+
|
56 |
+
<p>
|
57 |
+
<?php if( !empty($subscribed_lists) ): ?>
|
58 |
+
<ul>
|
59 |
+
<?php foreach($subscribed_lists as $list_name) { ?>
|
60 |
+
<?php echo '<li>'.$list_name.'</li>'; ?>
|
61 |
+
<?php } ?>
|
62 |
+
</ul>
|
63 |
+
<?php else: ?>
|
64 |
+
<?php echo $this->__('You currently do not have any email subscriptions.') ?>
|
65 |
+
<?php endif; ?>
|
66 |
+
</p>
|
67 |
+
</div>
|
68 |
+
</div>
|
69 |
+
<?php /* Extensions placeholder */ ?>
|
70 |
+
<?php echo $this->getChildHtml('customer.account.dashboard.info.extra')?>
|
71 |
+
</div>
|
72 |
+
<?php else : ?>
|
73 |
+
<?php if( $this->isNewsletterEnabled() ): ?>
|
74 |
+
<div class="col-2">
|
75 |
+
<div class="box">
|
76 |
+
<h3 class="box-title"><?php echo $this->__('Newsletters') ?> <span class="separator">|</span> <a href="<?php echo $this->getUrl('newsletter/manage') ?>"><?php echo $this->__('Edit') ?></a></h3>
|
77 |
+
<p class="box-content">
|
78 |
+
<?php if( $this->getIsSubscribed() ): ?>
|
79 |
+
<?php echo $this->__("You are currently subscribed to 'General Subscription'.") ?>
|
80 |
+
<?php else: ?>
|
81 |
+
<?php echo $this->__('You are currently not subscribed to any newsletter.') ?>
|
82 |
+
<?php endif; ?>
|
83 |
+
</p>
|
84 |
+
</div>
|
85 |
+
<?php /* Extensions placeholder */ ?>
|
86 |
+
<?php echo $this->getChildHtml('customer.account.dashboard.info.extra')?>
|
87 |
+
</div>
|
88 |
+
<?php endif; ?>
|
89 |
+
<?php endif; ?>
|
90 |
+
</div>
|
app/design/frontend/default/default/template/customer/account/dashboard/info_EE.phtml
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<div class="col2-set">
|
28 |
+
<div class="col-1">
|
29 |
+
<div class="info-box">
|
30 |
+
<div class="box-title">
|
31 |
+
<h3><?php echo $this->__('Contact Information') ?></h3>
|
32 |
+
<a href="<?php echo $this->getUrl('customer/account/edit') ?>"><?php echo $this->__('Edit') ?></a>
|
33 |
+
</div>
|
34 |
+
<div class="box-content">
|
35 |
+
<p>
|
36 |
+
<?php echo $this->htmlEscape($this->getCustomer()->getName()) ?><br />
|
37 |
+
<?php echo $this->htmlEscape($this->getCustomer()->getEmail()) ?><br />
|
38 |
+
<a href="<?php echo $this->getChangePasswordUrl() ?>"><?php echo $this->__('Change Password') ?></a>
|
39 |
+
</p>
|
40 |
+
</div>
|
41 |
+
</div>
|
42 |
+
</div>
|
43 |
+
<?php if( Mage::helper('mfsubscriptions')->isMFSubscriptionEnabled() ): ?>
|
44 |
+
<div class="col-2">
|
45 |
+
<div class="info-box">
|
46 |
+
<div class="info-box-title">
|
47 |
+
<h3><?php echo Mage::helper('mfsubscriptions')->__('Email Subscriptions') ?></h3>
|
48 |
+
<a href="<?php echo $this->getUrl('mfsubscriptions/manage') ?>"><?php echo $this->__('Edit') ?></a>
|
49 |
+
</div>
|
50 |
+
<div class="box-content">
|
51 |
+
<?php $customer = Mage::getSingleton('customer/session')->getCustomer(); ?>
|
52 |
+
<?php $contact = Mage::helper('mfsubscriptions')->getMFContactFromCustomer($customer); ?>
|
53 |
+
<?php $subscribed_lists = Mage::helper('mfsubscriptions')->getUserAccountSubscribedLists($contact,$customer); ?>
|
54 |
+
|
55 |
+
|
56 |
+
<p>
|
57 |
+
<?php if( !empty($subscribed_lists) ): ?>
|
58 |
+
<ul>
|
59 |
+
<?php foreach($subscribed_lists as $list_name) { ?>
|
60 |
+
<?php echo '<li>'.$list_name.'</li>'; ?>
|
61 |
+
<?php } ?>
|
62 |
+
</ul>
|
63 |
+
<?php else: ?>
|
64 |
+
<?php echo $this->__('You currently do not have any email subscriptions.') ?>
|
65 |
+
<?php endif; ?>
|
66 |
+
</p>
|
67 |
+
</div>
|
68 |
+
</div>
|
69 |
+
<?php /* Extensions placeholder */ ?>
|
70 |
+
<?php echo $this->getChildHtml('customer.account.dashboard.info.extra')?>
|
71 |
+
</div>
|
72 |
+
<?php else : ?>
|
73 |
+
<?php if( $this->isNewsletterEnabled() ): ?>
|
74 |
+
<div class="col-2">
|
75 |
+
<div class="info-box">
|
76 |
+
<h3 class="box-title"><?php echo $this->__('Newsletters') ?> <span class="separator">|</span> <a href="<?php echo $this->getUrl('newsletter/manage') ?>"><?php echo $this->__('Edit') ?></a></h3>
|
77 |
+
<p class="box-content">
|
78 |
+
<?php if( $this->getIsSubscribed() ): ?>
|
79 |
+
<?php echo $this->__("You are currently subscribed to 'General Subscription'.") ?>
|
80 |
+
<?php else: ?>
|
81 |
+
<?php echo $this->__('You are currently not subscribed to any newsletter.') ?>
|
82 |
+
<?php endif; ?>
|
83 |
+
</p>
|
84 |
+
</div>
|
85 |
+
<?php /* Extensions placeholder */ ?>
|
86 |
+
<?php echo $this->getChildHtml('customer.account.dashboard.info.extra')?>
|
87 |
+
</div>
|
88 |
+
<?php endif; ?>
|
89 |
+
<?php endif; ?>
|
90 |
+
</div>
|
app/design/frontend/default/default/template/customer/form/register.phtml
ADDED
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php
|
28 |
+
/**
|
29 |
+
* Create account form template
|
30 |
+
*
|
31 |
+
* @var $this Mage_Customer_Block_Form_Register
|
32 |
+
*/
|
33 |
+
?>
|
34 |
+
<div class="account-create">
|
35 |
+
<div class="page-title">
|
36 |
+
<h1><?php echo $this->__('Create an Account') ?></h1>
|
37 |
+
</div>
|
38 |
+
<?php echo $this->getChildHtml('form_fields_before')?>
|
39 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
40 |
+
<?php /* Extensions placeholder */ ?>
|
41 |
+
<?php echo $this->getChildHtml('customer.form.register.extra')?>
|
42 |
+
<form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="form-validate">
|
43 |
+
<div class="fieldset">
|
44 |
+
<input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
|
45 |
+
<input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
|
46 |
+
<h2 class="legend"><?php echo $this->__('Personal Information') ?></h2>
|
47 |
+
<ul class="form-list">
|
48 |
+
<li class="fields">
|
49 |
+
<?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->setForceUseCustomerAttributes(true)->toHtml() ?>
|
50 |
+
</li>
|
51 |
+
<li>
|
52 |
+
<label for="email_address" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
|
53 |
+
<div class="input-box">
|
54 |
+
<input type="text" name="email" id="email_address" value="<?php echo $this->escapeHtml($this->getFormData()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
|
55 |
+
</div>
|
56 |
+
</li>
|
57 |
+
<?php /* Adestra MF Subscription Extension */ ?>
|
58 |
+
<?php /* Adestra MF Subscription Extension */ ?>
|
59 |
+
<?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
|
60 |
+
<?php if ($_dob->isEnabled()): ?>
|
61 |
+
<li><?php echo $_dob->setDate($this->getFormData()->getDob())->toHtml() ?></li>
|
62 |
+
<?php endif ?>
|
63 |
+
<?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
|
64 |
+
<?php if ($_taxvat->isEnabled()): ?>
|
65 |
+
<li><?php echo $_taxvat->setTaxvat($this->getFormData()->getTaxvat())->toHtml() ?></li>
|
66 |
+
<?php endif ?>
|
67 |
+
<?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
|
68 |
+
<?php if ($_gender->isEnabled()): ?>
|
69 |
+
<li><?php echo $_gender->setGender($this->getFormData()->getGender())->toHtml() ?></li>
|
70 |
+
<?php endif ?>
|
71 |
+
</ul>
|
72 |
+
</div>
|
73 |
+
<?php if($this->getShowAddressFields()): ?>
|
74 |
+
<div class="fieldset">
|
75 |
+
<input type="hidden" name="create_address" value="1" />
|
76 |
+
<h2 class="legend"><?php echo $this->__('Address Information') ?></h2>
|
77 |
+
<ul class="form-list">
|
78 |
+
<li class="fields">
|
79 |
+
<div class="field">
|
80 |
+
<label for="company"><?php echo $this->__('Company') ?></label>
|
81 |
+
<div class="input-box">
|
82 |
+
<input type="text" name="company" id="company" value="<?php echo $this->escapeHtml($this->getFormData()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
|
83 |
+
</div>
|
84 |
+
</div>
|
85 |
+
<div class="field">
|
86 |
+
<label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
|
87 |
+
<div class="input-box">
|
88 |
+
<input type="text" name="telephone" id="telephone" value="<?php echo $this->escapeHtml($this->getFormData()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" />
|
89 |
+
</div>
|
90 |
+
</div>
|
91 |
+
</li>
|
92 |
+
<?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
|
93 |
+
<li class="wide">
|
94 |
+
<label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
|
95 |
+
<div class="input-box">
|
96 |
+
<input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getFormData()->getStreet(1)) ?>" title="<?php echo $this->__('Street Address') ?>" id="street_1" class="input-text <?php echo $_streetValidationClass ?>" />
|
97 |
+
</div>
|
98 |
+
</li>
|
99 |
+
<?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
|
100 |
+
<?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
|
101 |
+
<li class="wide">
|
102 |
+
<div class="input-box">
|
103 |
+
<input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getFormData()->getStreet($_i)) ?>" title="<?php echo $this->__('Street Address %s', $_i) ?>" id="street_<?php echo $_i ?>" class="input-text <?php echo $_streetValidationClass ?>" />
|
104 |
+
</div>
|
105 |
+
</li>
|
106 |
+
<?php endfor; ?>
|
107 |
+
<li class="fields">
|
108 |
+
<div class="field">
|
109 |
+
<label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
|
110 |
+
<div class="input-box">
|
111 |
+
<input type="text" name="city" value="<?php echo $this->escapeHtml($this->getFormData()->getCity()) ?>" title="<?php echo $this->__('City') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="city" />
|
112 |
+
</div>
|
113 |
+
</div>
|
114 |
+
<div class="field">
|
115 |
+
<label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
|
116 |
+
<div class="input-box">
|
117 |
+
<select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
|
118 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
119 |
+
</select>
|
120 |
+
<script type="text/javascript">
|
121 |
+
//<![CDATA[
|
122 |
+
$('region_id').setAttribute('defaultValue', "<?php echo $this->getFormData()->getRegionId() ?>");
|
123 |
+
//]]>
|
124 |
+
</script>
|
125 |
+
<input type="text" id="region" name="region" value="<?php echo $this->escapeHtml($this->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
|
126 |
+
</div>
|
127 |
+
</div>
|
128 |
+
</li>
|
129 |
+
<li class="fields">
|
130 |
+
<div class="field">
|
131 |
+
<label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
|
132 |
+
<div class="input-box">
|
133 |
+
<input type="text" name="postcode" value="<?php echo $this->escapeHtml($this->getFormData()->getPostcode()) ?>" title="<?php echo $this->__('Zip/Postal Code') ?>" id="zip" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
|
134 |
+
</div>
|
135 |
+
</div>
|
136 |
+
<div class="field">
|
137 |
+
<label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
|
138 |
+
<div class="input-box">
|
139 |
+
<?php echo $this->getCountryHtmlSelect() ?>
|
140 |
+
</div>
|
141 |
+
</div>
|
142 |
+
</li>
|
143 |
+
</ul>
|
144 |
+
<input type="hidden" name="default_billing" value="1" />
|
145 |
+
<input type="hidden" name="default_shipping" value="1" />
|
146 |
+
</div>
|
147 |
+
<?php endif; ?>
|
148 |
+
<div class="fieldset">
|
149 |
+
<h2 class="legend"><?php echo $this->__('Login Information') ?></h2>
|
150 |
+
<ul class="form-list">
|
151 |
+
<li class="fields">
|
152 |
+
<div class="field">
|
153 |
+
<label for="password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
|
154 |
+
<div class="input-box">
|
155 |
+
<input type="password" name="password" id="password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
|
156 |
+
</div>
|
157 |
+
</div>
|
158 |
+
<div class="field">
|
159 |
+
<label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
|
160 |
+
<div class="input-box">
|
161 |
+
<input type="password" name="confirmation" title="<?php echo $this->__('Confirm Password') ?>" id="confirmation" class="input-text required-entry validate-cpassword" />
|
162 |
+
</div>
|
163 |
+
</div>
|
164 |
+
</li>
|
165 |
+
<?php echo $this->getChildHtml('form.additional.info'); ?>
|
166 |
+
</ul>
|
167 |
+
</div>
|
168 |
+
<div class="buttons-set">
|
169 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
170 |
+
<p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>" class="back-link"><small>« </small><?php echo $this->__('Back') ?></a></p>
|
171 |
+
<button type="submit" title="<?php echo $this->__('Submit') ?>" class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button>
|
172 |
+
</div>
|
173 |
+
</form>
|
174 |
+
<script type="text/javascript">
|
175 |
+
//<![CDATA[
|
176 |
+
var dataForm = new VarienForm('form-validate', true);
|
177 |
+
<?php if($this->getShowAddressFields()): ?>
|
178 |
+
new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
|
179 |
+
<?php endif; ?>
|
180 |
+
//]]>
|
181 |
+
</script>
|
182 |
+
</div>
|
app/design/frontend/default/default/template/persistent/checkout/onepage/billing.phtml
ADDED
@@ -0,0 +1,232 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
/** @var Mage_Checkout_Block_Onepage_Billing $this */
|
27 |
+
?>
|
28 |
+
<form id="co-billing-form" action="">
|
29 |
+
<fieldset>
|
30 |
+
<ul class="form-list">
|
31 |
+
<?php if ($this->customerHasAddresses()): ?>
|
32 |
+
<li class="wide">
|
33 |
+
<label for="billing-address-select"><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></label>
|
34 |
+
<div class="input-box">
|
35 |
+
<?php echo $this->getAddressesHtmlSelect('billing') ?>
|
36 |
+
</div>
|
37 |
+
</li>
|
38 |
+
<?php endif; ?>
|
39 |
+
<li id="billing-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif; ?>>
|
40 |
+
<fieldset>
|
41 |
+
<input type="hidden" name="billing[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id" />
|
42 |
+
<ul>
|
43 |
+
<li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress()->getFirstname() ? $this->getAddress() : $this->getQuote()->getCustomer())->setForceUseCustomerRequiredAttributes(!$this->isCustomerLoggedIn())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?></li>
|
44 |
+
<li class="fields">
|
45 |
+
<div class="field">
|
46 |
+
<label for="billing:company"><?php echo $this->__('Company') ?></label>
|
47 |
+
<div class="input-box">
|
48 |
+
<input type="text" id="billing:company" name="billing[company]" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
|
49 |
+
</div>
|
50 |
+
</div>
|
51 |
+
<?php if(!$this->isCustomerLoggedIn()): ?>
|
52 |
+
<div class="field">
|
53 |
+
<label for="billing:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
|
54 |
+
<div class="input-box">
|
55 |
+
<input type="text" name="billing[email]" id="billing:email" value="<?php echo $this->escapeHtml($this->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
|
56 |
+
</div>
|
57 |
+
</div>
|
58 |
+
<?php endif; ?>
|
59 |
+
</li>
|
60 |
+
<?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
|
61 |
+
<li class="wide">
|
62 |
+
<label for="billing:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
|
63 |
+
<div class="input-box">
|
64 |
+
<input type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" class="input-text <?php echo $_streetValidationClass ?>" />
|
65 |
+
</div>
|
66 |
+
</li>
|
67 |
+
<?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
|
68 |
+
<?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
|
69 |
+
<li class="wide">
|
70 |
+
<div class="input-box">
|
71 |
+
<input type="text" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" class="input-text <?php echo $_streetValidationClass ?>" />
|
72 |
+
</div>
|
73 |
+
</li>
|
74 |
+
<?php endfor; ?>
|
75 |
+
<?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
|
76 |
+
<li class="wide">
|
77 |
+
<label for="billing:vat_id"><?php echo $this->__('VAT Number') ?></label>
|
78 |
+
<div class="input-box">
|
79 |
+
<input type="text" id="billing:vat_id" name="billing[vat_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()) ?>" title="<?php echo $this->__('VAT Number') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
|
80 |
+
</div>
|
81 |
+
</li>
|
82 |
+
<?php endif; ?>
|
83 |
+
<li class="fields">
|
84 |
+
<div class="field">
|
85 |
+
<label for="billing:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
|
86 |
+
<div class="input-box">
|
87 |
+
<input type="text" title="<?php echo $this->__('City') ?>" name="billing[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="billing:city" />
|
88 |
+
</div>
|
89 |
+
</div>
|
90 |
+
<div class="field">
|
91 |
+
<label for="billing:region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
|
92 |
+
<div class="input-box">
|
93 |
+
<select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
|
94 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
95 |
+
</select>
|
96 |
+
<script type="text/javascript">
|
97 |
+
//<![CDATA[
|
98 |
+
$('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
|
99 |
+
//]]>
|
100 |
+
</script>
|
101 |
+
<input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
|
102 |
+
</div>
|
103 |
+
</div>
|
104 |
+
</li>
|
105 |
+
<li class="fields">
|
106 |
+
<div class="field">
|
107 |
+
<label for="billing:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
|
108 |
+
<div class="input-box">
|
109 |
+
<input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
|
110 |
+
</div>
|
111 |
+
</div>
|
112 |
+
<div class="field">
|
113 |
+
<label for="billing:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
|
114 |
+
<div class="input-box">
|
115 |
+
<?php echo $this->getCountryHtmlSelect('billing') ?>
|
116 |
+
</div>
|
117 |
+
</div>
|
118 |
+
</li>
|
119 |
+
<li class="fields">
|
120 |
+
<div class="field">
|
121 |
+
<label for="billing:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
|
122 |
+
<div class="input-box">
|
123 |
+
<input type="text" name="billing[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="billing:telephone" />
|
124 |
+
</div>
|
125 |
+
</div>
|
126 |
+
<div class="field">
|
127 |
+
<label for="billing:fax"><?php echo $this->__('Fax') ?></label>
|
128 |
+
<div class="input-box">
|
129 |
+
<input type="text" name="billing[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" id="billing:fax" />
|
130 |
+
</div>
|
131 |
+
</div>
|
132 |
+
</li>
|
133 |
+
<?php if(!$this->isCustomerLoggedIn()): ?>
|
134 |
+
|
135 |
+
<?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
|
136 |
+
<?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
|
137 |
+
<?php if ($_dob->isEnabled() || $_gender->isEnabled()): ?>
|
138 |
+
<li class="fields">
|
139 |
+
<?php if ($_dob->isEnabled()): ?>
|
140 |
+
<div class="field">
|
141 |
+
<?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
|
142 |
+
</div>
|
143 |
+
<?php endif; ?>
|
144 |
+
<?php if ($_gender->isEnabled()): ?>
|
145 |
+
<div class="field">
|
146 |
+
<?php echo $_gender->setGender($this->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
|
147 |
+
</div>
|
148 |
+
<?php endif ?>
|
149 |
+
</li>
|
150 |
+
<?php endif ?>
|
151 |
+
|
152 |
+
<?php if ($this->isTaxvatEnabled()):?>
|
153 |
+
<li><?php echo $this->getTaxvatHtml() ?></li>
|
154 |
+
<?php endif; ?>
|
155 |
+
|
156 |
+
<li class="fields" id="register-customer-password">
|
157 |
+
<div class="field">
|
158 |
+
<label for="billing:customer_password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
|
159 |
+
<div class="input-box">
|
160 |
+
<input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
|
161 |
+
</div>
|
162 |
+
</div>
|
163 |
+
<div class="field">
|
164 |
+
<label for="billing:confirm_password" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
|
165 |
+
<div class="input-box">
|
166 |
+
<input type="password" name="billing[confirm_password]" title="<?php echo $this->__('Confirm Password') ?>" id="billing:confirm_password" class="input-text required-entry validate-cpassword" />
|
167 |
+
</div>
|
168 |
+
</div>
|
169 |
+
</li>
|
170 |
+
<?php echo $this->getChildHtml('persistent.remember.me'); ?>
|
171 |
+
<?php endif; ?>
|
172 |
+
<?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
|
173 |
+
<li class="control">
|
174 |
+
<input type="checkbox" name="billing[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="billing:save_in_address_book" onchange="if(window.shipping) shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="billing:save_in_address_book"><?php echo $this->__('Save in address book') ?></label>
|
175 |
+
</li>
|
176 |
+
<?php else:?>
|
177 |
+
<li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>
|
178 |
+
<?php endif; ?>
|
179 |
+
<?php echo $this->getChildHtml('form.additional.info'); ?>
|
180 |
+
</ul>
|
181 |
+
<?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
|
182 |
+
</fieldset>
|
183 |
+
</li>
|
184 |
+
<?php if ($this->canShip()): ?>
|
185 |
+
<li class="control">
|
186 |
+
<input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_yes" value="1"<?php if ($this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->__('Ship to this address') ?>" onclick="$('shipping:same_as_billing').checked = true;" class="radio" /><label for="billing:use_for_shipping_yes"><?php echo $this->__('Ship to this address') ?></label></li>
|
187 |
+
<li class="control">
|
188 |
+
<input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_no" value="0"<?php if (!$this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->__('Ship to different address') ?>" onclick="$('shipping:same_as_billing').checked = false;" class="radio" /><label for="billing:use_for_shipping_no"><?php echo $this->__('Ship to different address') ?></label>
|
189 |
+
</li>
|
190 |
+
<?php endif; ?>
|
191 |
+
</ul>
|
192 |
+
|
193 |
+
|
194 |
+
<?php /*** Adestra MF Subscription Extension ***/ ?>
|
195 |
+
<?php echo $this->getLayout()->createBlock('mfsubscriptions/account_checkout_billing')->toHtml(); ?>
|
196 |
+
<?php /*** Adestra MF Subscription Extension ***/ ?>
|
197 |
+
|
198 |
+
<?php if (!$this->canShip()): ?>
|
199 |
+
<input type="hidden" name="billing[use_for_shipping]" value="1" />
|
200 |
+
<?php endif; ?>
|
201 |
+
<div class="buttons-set" id="billing-buttons-container">
|
202 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
203 |
+
<button type="button" title="<?php echo $this->__('Continue') ?>" class="button" onclick="billing.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
|
204 |
+
<span class="please-wait" id="billing-please-wait" style="display:none;">
|
205 |
+
<img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
|
206 |
+
</span>
|
207 |
+
</div>
|
208 |
+
</fieldset>
|
209 |
+
</form>
|
210 |
+
<script type="text/javascript">
|
211 |
+
//<![CDATA[
|
212 |
+
var billing = new Billing('co-billing-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveBilling') ?>');
|
213 |
+
var billingForm = new VarienForm('co-billing-form');
|
214 |
+
|
215 |
+
//billingForm.setElementsRelation('billing:country_id', 'billing:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
|
216 |
+
$('billing-address-select') && billing.newAddress(!$('billing-address-select').value);
|
217 |
+
|
218 |
+
var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'billing:postcode');
|
219 |
+
if ($('onepage-guest-register-button')) {
|
220 |
+
Event.observe($('onepage-guest-register-button'), 'click', function(event) {
|
221 |
+
var billingRememberMe = $('co-billing-form').select('#remember-me-box');
|
222 |
+
if (billingRememberMe.length > 0) {
|
223 |
+
if ($('login:guest') && $('login:guest').checked) {
|
224 |
+
billingRememberMe[0].hide();
|
225 |
+
} else if ($('login:register') && ($('login:register').checked || $('login:register').type == 'hidden')) {
|
226 |
+
billingRememberMe[0].show();
|
227 |
+
}
|
228 |
+
}
|
229 |
+
});
|
230 |
+
}
|
231 |
+
//]]>
|
232 |
+
</script>
|
app/design/frontend/default/default/template/persistent/customer/form/register.phtml
ADDED
@@ -0,0 +1,187 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php
|
28 |
+
/**
|
29 |
+
* Create account form template
|
30 |
+
*
|
31 |
+
* @see app/design/frontend/base/default/template/customer/form/register.phtml
|
32 |
+
*/
|
33 |
+
/** @var $this Mage_Customer_Block_Form_Register */
|
34 |
+
?>
|
35 |
+
<div class="account-create">
|
36 |
+
<div class="page-title">
|
37 |
+
<h1><?php echo $this->__('Create an Account') ?></h1>
|
38 |
+
</div>
|
39 |
+
<?php echo $this->getChildHtml('form_fields_before')?>
|
40 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
41 |
+
<form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="form-validate">
|
42 |
+
<div class="fieldset">
|
43 |
+
<input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
|
44 |
+
<input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
|
45 |
+
<h2 class="legend"><?php echo $this->__('Personal Information') ?></h2>
|
46 |
+
<ul class="form-list">
|
47 |
+
<li class="fields">
|
48 |
+
<?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->setForceUseCustomerAttributes(true)->toHtml() ?>
|
49 |
+
</li>
|
50 |
+
<li>
|
51 |
+
<label for="email_address" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
|
52 |
+
<div class="input-box">
|
53 |
+
<input type="text" name="email" id="email_address" value="<?php echo $this->escapeHtml($this->getFormData()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
|
54 |
+
</div>
|
55 |
+
</li>
|
56 |
+
<?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
|
57 |
+
<?php if ($_dob->isEnabled()): ?>
|
58 |
+
<li><?php echo $_dob->setDate($this->getFormData()->getDob())->toHtml() ?></li>
|
59 |
+
<?php endif ?>
|
60 |
+
<?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
|
61 |
+
<?php if ($_taxvat->isEnabled()): ?>
|
62 |
+
<li><?php echo $_taxvat->setTaxvat($this->getFormData()->getTaxvat())->toHtml() ?></li>
|
63 |
+
<?php endif ?>
|
64 |
+
<?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
|
65 |
+
<?php if ($_gender->isEnabled()): ?>
|
66 |
+
<li><?php echo $_gender->setGender($this->getFormData()->getGender())->toHtml() ?></li>
|
67 |
+
<?php endif ?>
|
68 |
+
</ul>
|
69 |
+
</div>
|
70 |
+
<?php /*** Adestra MF Subscription Extension ***/ ?>
|
71 |
+
<?php echo $this->getLayout()->createBlock('mfsubscriptions/account_customer_register')->toHtml(); ?>
|
72 |
+
<?php /*** Adestra MF Subscription Extension ***/ ?>
|
73 |
+
<?php if($this->getShowAddressFields()): ?>
|
74 |
+
<div class="fieldset">
|
75 |
+
<input type="hidden" name="create_address" value="1" />
|
76 |
+
<h2 class="legend"><?php echo $this->__('Address Information') ?></h2>
|
77 |
+
<ul class="form-list">
|
78 |
+
<li class="fields">
|
79 |
+
<div class="field">
|
80 |
+
<label for="company"><?php echo $this->__('Company') ?></label>
|
81 |
+
<div class="input-box">
|
82 |
+
<input type="text" name="company" id="company" value="<?php echo $this->escapeHtml($this->getFormData()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
|
83 |
+
</div>
|
84 |
+
</div>
|
85 |
+
<div class="field">
|
86 |
+
<label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
|
87 |
+
<div class="input-box">
|
88 |
+
<input type="text" name="telephone" id="telephone" value="<?php echo $this->escapeHtml($this->getFormData()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" />
|
89 |
+
</div>
|
90 |
+
</div>
|
91 |
+
</li>
|
92 |
+
<?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
|
93 |
+
<li class="wide">
|
94 |
+
<label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
|
95 |
+
<div class="input-box">
|
96 |
+
<input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getFormData()->getStreet(1)) ?>" title="<?php echo $this->__('Street Address') ?>" id="street_1" class="input-text <?php echo $_streetValidationClass ?>" />
|
97 |
+
</div>
|
98 |
+
</li>
|
99 |
+
<?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
|
100 |
+
<?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
|
101 |
+
<li class="wide">
|
102 |
+
<div class="input-box">
|
103 |
+
<input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getFormData()->getStreet($_i)) ?>" title="<?php echo $this->__('Street Address %s', $_i) ?>" id="street_<?php echo $_i ?>" class="input-text <?php echo $_streetValidationClass ?>" />
|
104 |
+
</div>
|
105 |
+
</li>
|
106 |
+
<?php endfor; ?>
|
107 |
+
<li class="fields">
|
108 |
+
<div class="field">
|
109 |
+
<label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
|
110 |
+
<div class="input-box">
|
111 |
+
<input type="text" name="city" value="<?php echo $this->escapeHtml($this->getFormData()->getCity()) ?>" title="<?php echo $this->__('City') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="city" />
|
112 |
+
</div>
|
113 |
+
</div>
|
114 |
+
<div class="field">
|
115 |
+
<label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
|
116 |
+
<div class="input-box">
|
117 |
+
<select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
|
118 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
119 |
+
</select>
|
120 |
+
<script type="text/javascript">
|
121 |
+
//<![CDATA[
|
122 |
+
$('region_id').setAttribute('defaultValue', "<?php echo $this->getFormData()->getRegionId() ?>");
|
123 |
+
//]]>
|
124 |
+
</script>
|
125 |
+
<input type="text" id="region" name="region" value="<?php echo $this->escapeHtml($this->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
|
126 |
+
</div>
|
127 |
+
</div>
|
128 |
+
</li>
|
129 |
+
<li class="fields">
|
130 |
+
<div class="field">
|
131 |
+
<label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
|
132 |
+
<div class="input-box">
|
133 |
+
<input type="text" name="postcode" value="<?php echo $this->escapeHtml($this->getFormData()->getPostcode()) ?>" title="<?php echo $this->__('Zip/Postal Code') ?>" id="zip" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
|
134 |
+
</div>
|
135 |
+
</div>
|
136 |
+
<div class="field">
|
137 |
+
<label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
|
138 |
+
<div class="input-box">
|
139 |
+
<?php echo $this->getCountryHtmlSelect() ?>
|
140 |
+
</div>
|
141 |
+
</div>
|
142 |
+
</li>
|
143 |
+
</ul>
|
144 |
+
<input type="hidden" name="default_billing" value="1" />
|
145 |
+
<input type="hidden" name="default_shipping" value="1" />
|
146 |
+
</div>
|
147 |
+
<?php endif; ?>
|
148 |
+
<div class="fieldset">
|
149 |
+
<h2 class="legend"><?php echo $this->__('Login Information') ?></h2>
|
150 |
+
<ul class="form-list">
|
151 |
+
<li class="fields">
|
152 |
+
<div class="field">
|
153 |
+
<label for="password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
|
154 |
+
<div class="input-box">
|
155 |
+
<input type="password" name="password" id="password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
|
156 |
+
</div>
|
157 |
+
</div>
|
158 |
+
<div class="field">
|
159 |
+
<label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
|
160 |
+
<div class="input-box">
|
161 |
+
<input type="password" name="confirmation" title="<?php echo $this->__('Confirm Password') ?>" id="confirmation" class="input-text required-entry validate-cpassword" />
|
162 |
+
</div>
|
163 |
+
</div>
|
164 |
+
</li>
|
165 |
+
<?php echo $this->getChildHtml('form.additional.info'); ?>
|
166 |
+
<?php echo $this->getChildHtml('persistent.remember.me'); ?>
|
167 |
+
</ul>
|
168 |
+
<?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
|
169 |
+
</div>
|
170 |
+
<div class="buttons-set">
|
171 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
172 |
+
<p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>" class="back-link"><small>« </small><?php echo $this->__('Back') ?></a></p>
|
173 |
+
<button type="submit" title="<?php echo $this->__('Submit') ?>" class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button>
|
174 |
+
</div>
|
175 |
+
<?php if (Mage::helper('checkout')->isContextCheckout()): ?>
|
176 |
+
<input name="context" type="hidden" value="checkout" />
|
177 |
+
<?php endif; ?>
|
178 |
+
</form>
|
179 |
+
<script type="text/javascript">
|
180 |
+
//<![CDATA[
|
181 |
+
var dataForm = new VarienForm('form-validate', true);
|
182 |
+
<?php if($this->getShowAddressFields()): ?>
|
183 |
+
new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
|
184 |
+
<?php endif; ?>
|
185 |
+
//]]>
|
186 |
+
</script>
|
187 |
+
</div>
|
app/etc/modules/Adestra_MFSubscriptions.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Adestra_MFSubscriptions>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Adestra_MFSubscriptions>
|
8 |
+
</modules>
|
9 |
+
</config>
|
js/adestra/mfsubscriptions/adminhtml.js
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
if (Validation) {
|
3 |
+
Validation.addAllThese([
|
4 |
+
|
5 |
+
['validate-website', 'Please select a website.', function(v) {
|
6 |
+
return ((v != "0"));
|
7 |
+
}],
|
8 |
+
|
9 |
+
['validate-number', 'Please enter a valid number in this field.', function(v) {
|
10 |
+
return Validation.get('IsEmpty').test(v) || (!isNaN(parseNumber(v)) && !/^\s+$/.test(parseNumber(v)));
|
11 |
+
}],
|
12 |
+
|
13 |
+
]);
|
14 |
+
}
|
15 |
+
|
16 |
+
function mfUnsubscribeAll(checked) {
|
17 |
+
if (checked) {
|
18 |
+
var subscribeLists = $$('.mf-subscribe');
|
19 |
+
subscribeLists.each(function(list) {
|
20 |
+
list.checked = false;
|
21 |
+
});
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
function mfSubscribe(checked) {
|
26 |
+
if (checked) {
|
27 |
+
var unSubscribeLists = $$('.mf-unsubscribe');
|
28 |
+
unSubscribeLists.each(function(list) {
|
29 |
+
list.checked = false;
|
30 |
+
});
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
function mfChangeListType(val) {
|
35 |
+
if (val == 1) { // subscribe
|
36 |
+
if(!$('list_id').hasClassName('required-entry')) $('list_id').toggleClassName('required-entry');
|
37 |
+
$('list_id').value = '';
|
38 |
+
if($('unsub_list_id').hasClassName('required-entry')) $('unsub_list_id').toggleClassName('required-entry');
|
39 |
+
$('unsub_list_id').value = '';
|
40 |
+
|
41 |
+
}
|
42 |
+
else if (val == 0) { // unsubscribe
|
43 |
+
if(!$('unsub_list_id').hasClassName('required-entry')) $('unsub_list_id').toggleClassName('required-entry');
|
44 |
+
$('list_id').value = '';
|
45 |
+
if($('list_id').hasClassName('required-entry')) $('list_id').toggleClassName('required-entry');
|
46 |
+
$('unsub_list_id').value = '';
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Adestra_MFSubscriptions</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>GNU General Public License (GPL)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Adestra MessageFocus Subscriptions extension.</summary>
|
10 |
+
<description>Adestra MessageFocus Subscriptions extension. Includes integration for customer subscriptions to MessageFocus lists.</description>
|
11 |
+
<notes>First stable release</notes>
|
12 |
+
<authors><author><name>Anna Grieve</name><user>Adestra</user><email>integrations@adestra.com</email></author></authors>
|
13 |
+
<date>2014-03-27</date>
|
14 |
+
<time>10:33:21</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Adestra"><dir name="MFSubscriptions"><dir name="Block"><dir name="Account"><dir name="Checkout"><file name="Billing.php" hash="70b80466feb367ef023ba17424f4222d"/><file name="Review.php" hash="ffb452eba0804e26812160555693ff93"/></dir><dir name="Customer"><file name="Register.php" hash="488d2e344b3c07b3a6827dab18574914"/><file name="Subscriptions.php" hash="116f902195fab0642b8fe8b0d01657fd"/></dir></dir><dir name="Adminhtml"><dir name="Customer"><dir name="Edit"><dir name="Tab"><dir name="Subscriptions"><file name="Form.php" hash="c74d81e2aefa2a0ade667027aec57cc2"/></dir><file name="Subscriptions.php" hash="ab09967f5bd1bb744e128defe91b55ab"/></dir><file name="Tabs.php" hash="937a90023729e364ce514f1d4f719f30"/></dir></dir><dir name="Lists"><dir name="Edit"><file name="Form.php" hash="85fa643915d3b4b2bff090e1ab3b8ce2"/></dir><file name="Edit.php" hash="28be22b495fda47814c94bc11886d46f"/><file name="Grid.php" hash="6b12bf157498647d82ed90d7f43f50e2"/></dir><file name="Lists.php" hash="508bc4af1f09df93865091269a04b491"/><dir name="Renderer"><file name="Checkbox.php" hash="4b109e351f394d82ceb5f7adf4a6bae7"/><file name="Number.php" hash="d2ae4d17cbb99d65d60b5e7dd3b59780"/><file name="Status.php" hash="785fc97fce7a68dadc5163a04c8dd773"/><file name="Type.php" hash="6287fded3613393ffbdd15846409462a"/><file name="Website.php" hash="ae2e3785f99e6beb3f4bb21dafb73456"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="30318ce83c890ebc7175aa87bd4403aa"/></dir><dir name="Model"><file name="Admin.php" hash="d2128771137237a41022ce2467206537"/><dir name="Adminhtml"><dir name="Customer"><file name="Edit.php" hash="2532b4ea11b091a1d13e6b53e9d66dec"/></dir><file name="Validate.php" hash="29a9c608676f459f363eb61157944ee6"/></dir><dir name="Customer"><file name="Observer.php" hash="6fea492b56bbcea9ac5b898608825d81"/></dir><file name="List.php" hash="b652eaba18e19a868553b2a88a35ccff"/><dir name="Mysql4"><file name="List.php" hash="d974f4616b8b47f4abb1ba924a807e26"/><dir name="Lists"><file name="Collection.php" hash="f143a9c8bfb0bf550c0baed586bd5db1"/></dir><file name="Setup.php" hash="5fecb59f9adb84c9e321e0eb19ce1189"/></dir><dir name="Resource"><file name="List.php" hash="ec4241a34c7c82a246734233dbcea735"/><dir name="Lists"><file name="Collection.php" hash="0a3aa49286dca543b8547a50f02b9ddb"/></dir><file name="Setup.php" hash="96867be8b65d7d88e139bb79a5301f0d"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="MessagefocuslistsController.php" hash="b30be84ba88737c18984b5a11d2de65a"/></dir><file name="IndexController.php" hash="cc27eb1ec43000f8d78a9f60cf5cba1b"/><file name="ManageController.php" hash="9fc98d22912b7e45ebf58b3d6c8435e7"/><file name="OnepageController.php" hash="e23b129d0f24d889c086c13c24bddaa6"/></dir><dir name="etc"><file name="adminhtml.xml" hash="2ca31ba6259a034cf32fe6f5ba2c48ea"/><file name="config.xml" hash="ba030ea881aac09d59e4a298fc104718"/><file name="system.xml" hash="2cabf3f2c0fae49b97cc1a1ccb135446"/></dir><dir name="sql"><dir name="mfsubscriptions_setup"><file name="mysql4-install-0.0.2.php" hash="ef0453b695a6f4f26ea881ef825ad914"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="mfsubscriptions.xml" hash="c798ed97390b12d635baf166d2b15ead"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="mfsubscriptions.xml" hash="e3557811e4f7b23cbff5707d304db415"/></dir><dir name="template"><dir name="mfsubscriptions"><dir name="checkout"><dir name="form"><file name="billing.phtml" hash="57ef101878d8de166df5d1282c542028"/></dir></dir><dir name="customer"><dir name="form"><file name="register.phtml" hash="608236ed50d06ff51459a207046ebcb3"/><file name="subscriptions.phtml" hash="eccec3ec0fa7bdb321f30b625176edff"/></dir></dir></dir></dir></dir></dir><dir name="default"><dir name="default"><dir name="template"><dir name="persistent"><dir name="checkout"><dir name="onepage"><file name="billing.phtml" hash="29a0d4de4aa03d968c4ec78a85845376"/></dir></dir><dir name="customer"><dir name="form"><file name="register.phtml" hash="704a1c6ddeb42164643e53520883819e"/></dir></dir></dir><dir name="customer"><dir name="account"><dir name="dashboard"><file name="info.phtml" hash="29ef5e56995a515a4f398b4ac25fe42c"/><file name="info_EE.phtml" hash="263b1961a2a56ad31b427ae1ba4dc2cd"/></dir></dir><dir name="form"><file name="register.phtml" hash="83392b6a97248be074029332276e945a"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Adestra_MFSubscriptions.xml" hash="a66c5cc5cb332d4224e0710c06168082"/></dir></target><target name="mageweb"><dir name="js"><dir name="adestra"><dir name="mfsubscriptions"><file name="adminhtml.js" hash="2b95bc6b7c6f53c5837c798b724c24da"/></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.5</min><max>1.8</max></package></required></dependencies>
|
18 |
+
</package>
|