Version Notes
Install extension and configure at Promotions > Opt It.
Download this release
Release Info
Developer | Technivant |
Extension | Optit |
Version | 1.0.2 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.0.2
- app/code/local/Inchoo/Optit/Block/Adminhtml/System/Config/Field/Keyword.php +39 -0
- app/code/local/Inchoo/Optit/Block/Subscribe.php +10 -0
- app/code/local/Inchoo/Optit/Helper/Data.php +24 -1
- app/code/local/Inchoo/Optit/Model/Observer.php +62 -0
- app/code/local/Inchoo/Optit/Model/Resource/Subscription.php +47 -0
- app/code/local/Inchoo/Optit/Model/Resource/Subscription/Collection.php +55 -0
- app/code/local/Inchoo/Optit/Model/Subscription.php +76 -8
- app/code/local/Inchoo/Optit/Model/System/Config/Source/Message/Keyword.php +20 -0
- app/code/local/Inchoo/Optit/Model/System/Config/Source/Subscription/Interest.php +29 -1
- app/code/local/Inchoo/Optit/controllers/Adminhtml/Optit/MessageController.php +1 -1
- app/code/local/Inchoo/Optit/etc/config.xml +51 -2
- app/code/local/Inchoo/Optit/etc/system.xml +58 -0
- app/code/local/Inchoo/Optit/sql/optit_setup/upgrade-0.1.0-0.1.1.php +143 -0
- app/design/frontend/base/default/layout/optit.xml +9 -0
- app/etc/modules/Inchoo_Optit.xml +3 -0
- package.xml +6 -48
app/code/local/Inchoo/Optit/Block/Adminhtml/System/Config/Field/Keyword.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Inchoo_Optit_Block_Adminhtml_System_Config_Field_Keyword extends
|
5 |
+
Mage_Adminhtml_Block_System_Config_Form_Field
|
6 |
+
{
|
7 |
+
const REQUEST_PARAM_KEYWORD = 'keyword';
|
8 |
+
|
9 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
10 |
+
{
|
11 |
+
$configDataModel = Mage::getSingleton('adminhtml/config_data');
|
12 |
+
$urlParams = array(
|
13 |
+
'section' => $configDataModel->getSection(),
|
14 |
+
'website' => $configDataModel->getWebsite(),
|
15 |
+
'store' => $configDataModel->getStore(),
|
16 |
+
self::REQUEST_PARAM_KEYWORD => '__keyword__',
|
17 |
+
);
|
18 |
+
$urlString = $this->helper('core')
|
19 |
+
->jsQuoteEscape(Mage::getModel('adminhtml/url')->getUrl('*/*/*', $urlParams));
|
20 |
+
$jsString = '
|
21 |
+
$("' . $element->getHtmlId() . '").observe("change", function () {
|
22 |
+
location.href = \'' . $urlString . '\'.replace("__keyword__", this.value);
|
23 |
+
});
|
24 |
+
';
|
25 |
+
|
26 |
+
return parent::_getElementHtml($element) . $this->helper('adminhtml/js')
|
27 |
+
->getScript('document.observe("dom:loaded", function() {' . $jsString . '});');
|
28 |
+
}
|
29 |
+
|
30 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
31 |
+
{
|
32 |
+
$keyword = $this->getRequest()->getParam(self::REQUEST_PARAM_KEYWORD);
|
33 |
+
if ($keyword) {
|
34 |
+
$element->setValue($keyword);
|
35 |
+
}
|
36 |
+
|
37 |
+
return parent::render($element);
|
38 |
+
}
|
39 |
+
}
|
app/code/local/Inchoo/Optit/Block/Subscribe.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Inchoo_Optit_Block_Subscribe extends Mage_Core_Block_Template
|
5 |
+
{
|
6 |
+
public function isOptInEnabled()
|
7 |
+
{
|
8 |
+
return $this->helper('optit')->isCheckoutOptInEnabled();
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Inchoo/Optit/Helper/Data.php
CHANGED
@@ -3,5 +3,28 @@
|
|
3 |
|
4 |
class Inchoo_Optit_Helper_Data extends Mage_Core_Helper_Abstract
|
5 |
{
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
}
|
3 |
|
4 |
class Inchoo_Optit_Helper_Data extends Mage_Core_Helper_Abstract
|
5 |
{
|
6 |
+
const XML_PATH_DEFAULT_KEYWORD = 'promo/optit_checkout/optit_default_keyword';
|
7 |
+
const XML_PATH_DEFAULT_INTERESTS = 'promo/optit_checkout/optit_default_interests';
|
8 |
+
const XML_PATH_CHECKOUT_OPTIT_ENABLED = 'promo/optit_checkout/optit_enable_checkout_subscription';
|
9 |
+
const XML_PATH_CHECKOUT_CRON_MAX_RETRIES = 'promo/optit_checkout/optit_max_cron_retries';
|
10 |
+
|
11 |
+
public function getDefaultKeywordId()
|
12 |
+
{
|
13 |
+
return Mage::getStoreConfig(self::XML_PATH_DEFAULT_KEYWORD);
|
14 |
+
}
|
15 |
+
|
16 |
+
public function getDefaultInterests()
|
17 |
+
{
|
18 |
+
return Mage::getStoreConfig(self::XML_PATH_DEFAULT_INTERESTS);
|
19 |
+
}
|
20 |
+
|
21 |
+
public function isCheckoutOptInEnabled()
|
22 |
+
{
|
23 |
+
return Mage::getStoreConfig(self::XML_PATH_CHECKOUT_OPTIT_ENABLED);
|
24 |
+
}
|
25 |
+
|
26 |
+
public function getMaxRetries()
|
27 |
+
{
|
28 |
+
return Mage::getStoreConfig(self::XML_PATH_CHECKOUT_CRON_MAX_RETRIES);
|
29 |
+
}
|
30 |
}
|
app/code/local/Inchoo/Optit/Model/Observer.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Inchoo_Optit_Model_Observer
|
5 |
+
{
|
6 |
+
/* sales_quote_save_after */
|
7 |
+
public function subscribeMemberToTextNotifications(Varien_Event_Observer $observer)
|
8 |
+
{
|
9 |
+
$post = Mage::app()->getRequest()->getPost();
|
10 |
+
|
11 |
+
if (!isset($post['billing'])) {
|
12 |
+
return;
|
13 |
+
}
|
14 |
+
|
15 |
+
$session = $this->_getSession();
|
16 |
+
$subscribeMe = isset($post['billing']['subscribe_me']) ? $post['billing']['subscribe_me'] : null;
|
17 |
+
$cellphone = isset($post['billing']['cellphone']) ? $post['billing']['cellphone'] : null;
|
18 |
+
$session->setSubscribeMe($subscribeMe);
|
19 |
+
$session->setCustomerCellphone($cellphone);
|
20 |
+
}
|
21 |
+
|
22 |
+
public function subscribeMembers()
|
23 |
+
{
|
24 |
+
if (Mage::helper('optit')->isCheckoutOptInEnabled()) {
|
25 |
+
Mage::getModel('optit/subscription')->getCollection()->subscribeMembers();
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
/* sales_order_place_after */
|
30 |
+
public function enableSubscription(Varien_Event_Observer $observer)
|
31 |
+
{
|
32 |
+
$session = $this->_getSession();
|
33 |
+
if (!$session->getSubscribeMe()) {
|
34 |
+
return;
|
35 |
+
}
|
36 |
+
$keyword = Mage::helper('optit')->getDefaultKeywordId();
|
37 |
+
$quote = $observer->getOrder()->getQuote();
|
38 |
+
$quote->setKeyword($keyword);
|
39 |
+
$quote->setCustomerCellphone($session->getCustomerCellphone());
|
40 |
+
$subscription = Mage::getModel('optit/subscription');
|
41 |
+
$interests = unserialize(Mage::helper('optit')->getDefaultInterests());
|
42 |
+
|
43 |
+
foreach ($interests as $interest) {
|
44 |
+
$quote->setInterest($interest);
|
45 |
+
$subscription->setData(array(
|
46 |
+
'quote' => $quote,
|
47 |
+
))->addToQueue();
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
protected function _getSession()
|
52 |
+
{
|
53 |
+
return Mage::getSingleton('customer/session');
|
54 |
+
}
|
55 |
+
|
56 |
+
public function cleanSubscribeTable()
|
57 |
+
{
|
58 |
+
if (Mage::helper('optit')->isCheckoutOptInEnabled()) {
|
59 |
+
Mage::getResourceModel('optit/subscription')->cleanTable();
|
60 |
+
}
|
61 |
+
}
|
62 |
+
}
|
app/code/local/Inchoo/Optit/Model/Resource/Subscription.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Inchoo_Optit_Model_Resource_Subscription extends Mage_Core_Model_Resource_Db_Abstract
|
5 |
+
{
|
6 |
+
public function _construct()
|
7 |
+
{
|
8 |
+
$this->_init('optit/subscription', 'id');
|
9 |
+
}
|
10 |
+
|
11 |
+
public function getSubscriptionByPhoneAndInterest($interest, $phone)
|
12 |
+
{
|
13 |
+
$adapter = $this->_getReadAdapter();
|
14 |
+
$select = $adapter
|
15 |
+
->select()
|
16 |
+
->from($this->getMainTable())
|
17 |
+
->where('interest = ?', $interest)
|
18 |
+
->where('phone = ?', $phone);
|
19 |
+
|
20 |
+
$result = $adapter->fetchOne($select);
|
21 |
+
return $result;
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Delete all rows with retries equal or greater than config setting
|
26 |
+
*
|
27 |
+
* @throws Mage_Core_Exception
|
28 |
+
*/
|
29 |
+
public function cleanTable()
|
30 |
+
{
|
31 |
+
try {
|
32 |
+
$adapter = $this->_getWriteAdapter();
|
33 |
+
$adapter->beginTransaction();
|
34 |
+
|
35 |
+
$condition = array('retries >= ?' => Mage::helper('optit')->getMaxRetries());
|
36 |
+
$adapter->delete($this->getMainTable(), $condition);
|
37 |
+
|
38 |
+
$adapter->commit();
|
39 |
+
} catch (Mage_Core_Exception $e) {
|
40 |
+
$adapter->rollback();
|
41 |
+
throw $e;
|
42 |
+
} catch (Exception $e) {
|
43 |
+
$adapter->rollback();
|
44 |
+
Mage::logException($e);
|
45 |
+
}
|
46 |
+
}
|
47 |
+
}
|
app/code/local/Inchoo/Optit/Model/Resource/Subscription/Collection.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Inchoo_Optit_Model_Resource_Subscription_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
5 |
+
{
|
6 |
+
public function _construct()
|
7 |
+
{
|
8 |
+
$this->_init('optit/subscription');
|
9 |
+
}
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Subscribe members to corresponding keyword and interest(s)
|
13 |
+
*/
|
14 |
+
public function subscribeMembers()
|
15 |
+
{
|
16 |
+
$maxRetries = Mage::helper('optit')->getMaxRetries();
|
17 |
+
$this->addFieldToFilter('status', array('neq' => Inchoo_Optit_Model_Subscription::SUBSCRIPTION_TYPE_SUBSCRIBED))
|
18 |
+
->addFieldToFilter('retries', array('lt' => $maxRetries))
|
19 |
+
->setPageSize(10);
|
20 |
+
$model = Mage::getModel('optit/subscription');
|
21 |
+
$subscribedPhone = null;
|
22 |
+
|
23 |
+
foreach ($this as $member) {
|
24 |
+
$keywordId = $member->getKeyword();
|
25 |
+
$data = $member->getData();
|
26 |
+
$retries = $member->getRetries();
|
27 |
+
|
28 |
+
if ($retries >= $maxRetries) {
|
29 |
+
continue;
|
30 |
+
}
|
31 |
+
|
32 |
+
try {
|
33 |
+
$status = $member->getStatus();
|
34 |
+
$phone = $member->getPhone();
|
35 |
+
|
36 |
+
// we check subscribedPhone if already subscribed
|
37 |
+
if ($status === Inchoo_Optit_Model_Subscription::SUBSCRIPTION_TYPE_TO_SUBSCRIBE && $phone != $subscribedPhone) {
|
38 |
+
$model->subscribeMemberToKeyword($keywordId, $data);
|
39 |
+
$subscribedPhone = $phone;
|
40 |
+
}
|
41 |
+
|
42 |
+
if ($interestId = $member->getInterest()) {
|
43 |
+
$model->subscribeMemberToInterest($interestId, $data);
|
44 |
+
}
|
45 |
+
|
46 |
+
$member->setData('status', Inchoo_Optit_Model_Subscription::SUBSCRIPTION_TYPE_SUBSCRIBED);
|
47 |
+
} catch (Mage_Core_Exception $e) {
|
48 |
+
$member->setData('status', Inchoo_Optit_Model_Subscription::SUBSCRIPTION_TYPE_KEYWORD_SUBSCRIBED);
|
49 |
+
$member->setRetries($retries + 1);
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
$this->save();
|
54 |
+
}
|
55 |
+
}
|
app/code/local/Inchoo/Optit/Model/Subscription.php
CHANGED
@@ -3,16 +3,25 @@
|
|
3 |
|
4 |
class Inchoo_Optit_Model_Subscription extends Inchoo_Optit_Model_Abstract
|
5 |
{
|
6 |
-
const SUBSCRIPTION_TYPE_KEYWORD
|
7 |
const SUBSCRIPTION_TYPE_INTEREST = 'interest';
|
8 |
-
const SUBSCRIPTION_TYPE_MEMBER
|
|
|
|
|
|
|
|
|
9 |
|
10 |
protected $_urlKey = 'subscriptions';
|
11 |
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
/**
|
14 |
* Get all subscription by keyword or interest.
|
15 |
-
*
|
16 |
* @param string $type
|
17 |
* @param int $id
|
18 |
* @param array $params
|
@@ -93,7 +102,7 @@ class Inchoo_Optit_Model_Subscription extends Inchoo_Optit_Model_Abstract
|
|
93 |
* member_id - the member_id of a member. It is the ID attribute in the Members entity and can be viewed using the Get Member method. (Phone or member_id is required)
|
94 |
* Method: POST
|
95 |
* http://api.optitmobile.com/1/interests/{interest_id}/subscriptions.{format}
|
96 |
-
*
|
97 |
* @param $interestId
|
98 |
* @param array $params
|
99 |
* @return mixed
|
@@ -114,7 +123,7 @@ class Inchoo_Optit_Model_Subscription extends Inchoo_Optit_Model_Abstract
|
|
114 |
* Unsubscribe a member from all keywords.
|
115 |
* Method: DELETE
|
116 |
* http://api.optitmobile.com/1/subscription/{phone}.{format}
|
117 |
-
*
|
118 |
* @param string $phone
|
119 |
* @return mixed
|
120 |
* @throws Zend_Http_Client_Exception
|
@@ -155,7 +164,7 @@ class Inchoo_Optit_Model_Subscription extends Inchoo_Optit_Model_Abstract
|
|
155 |
* Delete a subscribed member from an interest.
|
156 |
* Method: DELETE
|
157 |
* http://api.optitmobile.com/1/interests/{interest_id}/subscriptions/{phone}.{format}
|
158 |
-
*
|
159 |
* @param int $interestId
|
160 |
* @param string $memberPhone
|
161 |
* @return mixed
|
@@ -164,7 +173,7 @@ class Inchoo_Optit_Model_Subscription extends Inchoo_Optit_Model_Abstract
|
|
164 |
public function unsubscribeMemberFromInterest($interestId, $memberPhone)
|
165 |
{
|
166 |
$uri = $this->_composeUri(
|
167 |
-
'interests/%s/' . $this->_urlKey .'/%s',
|
168 |
array($interestId, $memberPhone)
|
169 |
);
|
170 |
|
@@ -215,7 +224,7 @@ class Inchoo_Optit_Model_Subscription extends Inchoo_Optit_Model_Abstract
|
|
215 |
* signup_date_end - yyyymmddhhmmss
|
216 |
* Method: GET
|
217 |
* http://api.optitmobile.com/1/keywords/{keyword_id}/subscriptions.{format}
|
218 |
-
*
|
219 |
* @param $keywordId
|
220 |
* @param array $params
|
221 |
* @return mixed
|
@@ -231,4 +240,63 @@ class Inchoo_Optit_Model_Subscription extends Inchoo_Optit_Model_Abstract
|
|
231 |
$response = $this->getClient()->setUri($uri)->setParameterGet($params)->request(Zend_Http_Client::GET);
|
232 |
return $this->decodeAndCheck($response->getBody());
|
233 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
}
|
3 |
|
4 |
class Inchoo_Optit_Model_Subscription extends Inchoo_Optit_Model_Abstract
|
5 |
{
|
6 |
+
const SUBSCRIPTION_TYPE_KEYWORD = 'keyword';
|
7 |
const SUBSCRIPTION_TYPE_INTEREST = 'interest';
|
8 |
+
const SUBSCRIPTION_TYPE_MEMBER = 'member';
|
9 |
+
|
10 |
+
const SUBSCRIPTION_TYPE_TO_SUBSCRIBE = "0";
|
11 |
+
const SUBSCRIPTION_TYPE_SUBSCRIBED = "1";
|
12 |
+
const SUBSCRIPTION_TYPE_KEYWORD_SUBSCRIBED = "2";
|
13 |
|
14 |
protected $_urlKey = 'subscriptions';
|
15 |
|
16 |
+
public function _construct()
|
17 |
+
{
|
18 |
+
$this->_init('optit/subscription');
|
19 |
+
parent::_construct();
|
20 |
+
}
|
21 |
|
22 |
/**
|
23 |
* Get all subscription by keyword or interest.
|
24 |
+
*
|
25 |
* @param string $type
|
26 |
* @param int $id
|
27 |
* @param array $params
|
102 |
* member_id - the member_id of a member. It is the ID attribute in the Members entity and can be viewed using the Get Member method. (Phone or member_id is required)
|
103 |
* Method: POST
|
104 |
* http://api.optitmobile.com/1/interests/{interest_id}/subscriptions.{format}
|
105 |
+
*
|
106 |
* @param $interestId
|
107 |
* @param array $params
|
108 |
* @return mixed
|
123 |
* Unsubscribe a member from all keywords.
|
124 |
* Method: DELETE
|
125 |
* http://api.optitmobile.com/1/subscription/{phone}.{format}
|
126 |
+
*
|
127 |
* @param string $phone
|
128 |
* @return mixed
|
129 |
* @throws Zend_Http_Client_Exception
|
164 |
* Delete a subscribed member from an interest.
|
165 |
* Method: DELETE
|
166 |
* http://api.optitmobile.com/1/interests/{interest_id}/subscriptions/{phone}.{format}
|
167 |
+
*
|
168 |
* @param int $interestId
|
169 |
* @param string $memberPhone
|
170 |
* @return mixed
|
173 |
public function unsubscribeMemberFromInterest($interestId, $memberPhone)
|
174 |
{
|
175 |
$uri = $this->_composeUri(
|
176 |
+
'interests/%s/' . $this->_urlKey . '/%s',
|
177 |
array($interestId, $memberPhone)
|
178 |
);
|
179 |
|
224 |
* signup_date_end - yyyymmddhhmmss
|
225 |
* Method: GET
|
226 |
* http://api.optitmobile.com/1/keywords/{keyword_id}/subscriptions.{format}
|
227 |
+
*
|
228 |
* @param $keywordId
|
229 |
* @param array $params
|
230 |
* @return mixed
|
240 |
$response = $this->getClient()->setUri($uri)->setParameterGet($params)->request(Zend_Http_Client::GET);
|
241 |
return $this->decodeAndCheck($response->getBody());
|
242 |
}
|
243 |
+
|
244 |
+
public function addToQueue()
|
245 |
+
{
|
246 |
+
if (!$this->_getSubscriptionFromDB()) {
|
247 |
+
$this->_prepareForSave()->save();
|
248 |
+
}
|
249 |
+
return $this;
|
250 |
+
}
|
251 |
+
|
252 |
+
protected function _prepareForSave()
|
253 |
+
{
|
254 |
+
$quote = $this->getQuote();
|
255 |
+
$billingAddress = $quote->getBillingAddress();
|
256 |
+
$customerCellPhone = $this->_validateCustomerCellPhone($quote->getCustomerCellphone());
|
257 |
+
|
258 |
+
$this->setData(array(
|
259 |
+
'keyword' => $quote->getKeyword(),
|
260 |
+
'interest' => $quote->getInterest(),
|
261 |
+
'phone' => $customerCellPhone,
|
262 |
+
'email_address' => $quote->getCustomerEmail(),
|
263 |
+
'first_name' => $quote->getCustomerFirstname(),
|
264 |
+
'last_name' => $quote->getCustomerLastname(),
|
265 |
+
'gender' => $quote->getCustomerGender(),
|
266 |
+
'birth_date' => $quote->getCustomerDob(),
|
267 |
+
'address1' => $billingAddress->getStreet1(),
|
268 |
+
'address2' => $billingAddress->getStreet2(),
|
269 |
+
'city' => $billingAddress->getCity(),
|
270 |
+
'state' => $billingAddress->getRegionCode(),
|
271 |
+
'zip' => $billingAddress->getPostcode(),
|
272 |
+
'status' => self::SUBSCRIPTION_TYPE_TO_SUBSCRIBE,
|
273 |
+
));
|
274 |
+
|
275 |
+
return $this;
|
276 |
+
}
|
277 |
+
|
278 |
+
protected function _validateCustomerCellPhone($customerCellphone)
|
279 |
+
{
|
280 |
+
$error = false;
|
281 |
+
if (!Zend_Validate::is($customerCellphone, 'NotEmpty')) {
|
282 |
+
$error = true;
|
283 |
+
}
|
284 |
+
|
285 |
+
if (!Zend_Validate::is($customerCellphone, 'Digits')) {
|
286 |
+
$error = true;
|
287 |
+
}
|
288 |
+
|
289 |
+
if ($error) {
|
290 |
+
Mage::throwException('Cellphone number not valid');
|
291 |
+
}
|
292 |
+
|
293 |
+
return $customerCellphone;
|
294 |
+
}
|
295 |
+
|
296 |
+
protected function _getSubscriptionFromDB()
|
297 |
+
{
|
298 |
+
$interest = $this->getQuote()->getInterest();
|
299 |
+
$phone = $this->getQuote()->getCustomerCellphone();
|
300 |
+
return $this->getResource()->getSubscriptionByPhoneAndInterest($interest, $phone);
|
301 |
+
}
|
302 |
}
|
app/code/local/Inchoo/Optit/Model/System/Config/Source/Message/Keyword.php
CHANGED
@@ -21,6 +21,7 @@ class Inchoo_Optit_Model_System_Config_Source_Message_Keyword
|
|
21 |
$this->_populateData($keywords);
|
22 |
}
|
23 |
|
|
|
24 |
return $this->_data;
|
25 |
}
|
26 |
|
@@ -37,4 +38,23 @@ class Inchoo_Optit_Model_System_Config_Source_Message_Keyword
|
|
37 |
$this->_key++;
|
38 |
}
|
39 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
}
|
21 |
$this->_populateData($keywords);
|
22 |
}
|
23 |
|
24 |
+
Mage::register('optit_keyword_first', $this->_data[0]);
|
25 |
return $this->_data;
|
26 |
}
|
27 |
|
38 |
$this->_key++;
|
39 |
}
|
40 |
}
|
41 |
+
|
42 |
+
public function toOptionArrayWithAuthentication()
|
43 |
+
{
|
44 |
+
$model = Mage::getModel('optit/keyword');
|
45 |
+
|
46 |
+
try {
|
47 |
+
$model->getAllKeywords();
|
48 |
+
} catch (Mage_Core_Exception $e) {
|
49 |
+
return array();
|
50 |
+
}
|
51 |
+
|
52 |
+
$keywords = self::toOptionArray();
|
53 |
+
$data = array();
|
54 |
+
foreach ($keywords as $key => $keyword) {
|
55 |
+
$data[$keyword['value']]= $keyword['label'];
|
56 |
+
}
|
57 |
+
|
58 |
+
return $data;
|
59 |
+
}
|
60 |
}
|
app/code/local/Inchoo/Optit/Model/System/Config/Source/Subscription/Interest.php
CHANGED
@@ -7,8 +7,22 @@ class Inchoo_Optit_Model_System_Config_Source_Subscription_Interest
|
|
7 |
|
8 |
protected $_key = 0;
|
9 |
|
10 |
-
public function toOptionArray($keywordId)
|
11 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
$currentPage = 1;
|
13 |
$interests = $this->_getInterests($keywordId, $currentPage);
|
14 |
$totalPages = $interests['total_pages'];
|
@@ -36,4 +50,18 @@ class Inchoo_Optit_Model_System_Config_Source_Subscription_Interest
|
|
36 |
$this->_key++;
|
37 |
}
|
38 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
}
|
7 |
|
8 |
protected $_key = 0;
|
9 |
|
10 |
+
public function toOptionArray($multiselect, $keywordId = null)
|
11 |
{
|
12 |
+
$configKeywordId = Mage::getStoreConfig('promo/optit_checkout/optit_default_keyword');
|
13 |
+
$paramKeywordId = Mage::app()->getRequest()->getParam(Inchoo_Optit_Block_Adminhtml_System_Config_Field_Keyword::REQUEST_PARAM_KEYWORD);
|
14 |
+
$firstKeyword = Mage::registry('optit_keyword_first');
|
15 |
+
|
16 |
+
if (!is_null($paramKeywordId)) {
|
17 |
+
$keywordId = $paramKeywordId;
|
18 |
+
} elseif (!is_null($configKeywordId)) {
|
19 |
+
$keywordId = $configKeywordId;
|
20 |
+
} elseif (!is_null($firstKeyword) && !$keywordId) {
|
21 |
+
$keywordId = $firstKeyword['value'];
|
22 |
+
} elseif (is_null($keywordId)) {
|
23 |
+
return array();
|
24 |
+
}
|
25 |
+
|
26 |
$currentPage = 1;
|
27 |
$interests = $this->_getInterests($keywordId, $currentPage);
|
28 |
$totalPages = $interests['total_pages'];
|
50 |
$this->_key++;
|
51 |
}
|
52 |
}
|
53 |
+
|
54 |
+
public function toOptionArrayWithAuthentication()
|
55 |
+
{
|
56 |
+
// Authenticate
|
57 |
+
$model = Mage::getModel('optit/keyword');
|
58 |
+
|
59 |
+
try {
|
60 |
+
$model->getAllKeywords();
|
61 |
+
} catch (Mage_Core_Exception $e) {
|
62 |
+
return array();
|
63 |
+
}
|
64 |
+
|
65 |
+
return self::toOptionArray(true, null);
|
66 |
+
}
|
67 |
}
|
app/code/local/Inchoo/Optit/controllers/Adminhtml/Optit/MessageController.php
CHANGED
@@ -32,7 +32,7 @@ class Inchoo_Optit_Adminhtml_Optit_MessageController extends Mage_Adminhtml_Cont
|
|
32 |
$params = $this->getRequest()->getParams();
|
33 |
|
34 |
try {
|
35 |
-
$data = Mage::getSingleton('optit/system_config_source_message_keyword')->toOptionArray();
|
36 |
$form = $this->getLayout()->getBlock('optit_send_sms')->getChild('form');
|
37 |
if ($form) {
|
38 |
$form->setKeywords($data);
|
32 |
$params = $this->getRequest()->getParams();
|
33 |
|
34 |
try {
|
35 |
+
$data = Mage::getSingleton('optit/system_config_source_message_keyword')->toOptionArray(false, true);
|
36 |
$form = $this->getLayout()->getBlock('optit_send_sms')->getChild('form');
|
37 |
if ($form) {
|
38 |
$form->setKeywords($data);
|
app/code/local/Inchoo/Optit/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Inchoo_Optit>
|
5 |
-
<version>0.1.
|
6 |
</Inchoo_Optit>
|
7 |
</modules>
|
8 |
<global>
|
@@ -30,6 +30,9 @@
|
|
30 |
<bulk_message_phones>
|
31 |
<table>optit_bulk_phones</table>
|
32 |
</bulk_message_phones>
|
|
|
|
|
|
|
33 |
</entities>
|
34 |
</optit_resource>
|
35 |
</models>
|
@@ -64,8 +67,54 @@
|
|
64 |
<default>
|
65 |
<promo>
|
66 |
<optit>
|
67 |
-
<optit_password backend_model="adminhtml/system_config_backend_encrypted"
|
68 |
</optit>
|
69 |
</promo>
|
70 |
</default>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
</config>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Inchoo_Optit>
|
5 |
+
<version>0.1.1</version>
|
6 |
</Inchoo_Optit>
|
7 |
</modules>
|
8 |
<global>
|
30 |
<bulk_message_phones>
|
31 |
<table>optit_bulk_phones</table>
|
32 |
</bulk_message_phones>
|
33 |
+
<subscription>
|
34 |
+
<table>optit_subscribe_queue</table>
|
35 |
+
</subscription>
|
36 |
</entities>
|
37 |
</optit_resource>
|
38 |
</models>
|
67 |
<default>
|
68 |
<promo>
|
69 |
<optit>
|
70 |
+
<optit_password backend_model="adminhtml/system_config_backend_encrypted"/>
|
71 |
</optit>
|
72 |
</promo>
|
73 |
</default>
|
74 |
+
<frontend>
|
75 |
+
<events>
|
76 |
+
<sales_quote_save_after>
|
77 |
+
<observers>
|
78 |
+
<inchoo_optit>
|
79 |
+
<class>optit/observer</class>
|
80 |
+
<method>subscribeMemberToTextNotifications</method>
|
81 |
+
</inchoo_optit>
|
82 |
+
</observers>
|
83 |
+
</sales_quote_save_after>
|
84 |
+
<sales_order_place_after>
|
85 |
+
<observers>
|
86 |
+
<inchoo_optit>
|
87 |
+
<class>optit/observer</class>
|
88 |
+
<method>enableSubscription</method>
|
89 |
+
</inchoo_optit>
|
90 |
+
</observers>
|
91 |
+
</sales_order_place_after>
|
92 |
+
</events>
|
93 |
+
<layout>
|
94 |
+
<updates>
|
95 |
+
<optit>
|
96 |
+
<file>optit.xml</file>
|
97 |
+
</optit>
|
98 |
+
</updates>
|
99 |
+
</layout>
|
100 |
+
</frontend>
|
101 |
+
<crontab>
|
102 |
+
<jobs>
|
103 |
+
<optit_subscribe_members>
|
104 |
+
<schedule><cron_expr>*/5 * * * *</cron_expr></schedule>
|
105 |
+
<run><model>optit/observer::subscribeMembers</model></run>
|
106 |
+
</optit_subscribe_members>
|
107 |
+
<optit_clean_subscribe_table>
|
108 |
+
<schedule><cron_expr>0 0 * * *</cron_expr></schedule>
|
109 |
+
<run><model>optit/observer::cleanSubscribeTable</model></run>
|
110 |
+
</optit_clean_subscribe_table>
|
111 |
+
</jobs>
|
112 |
+
</crontab>
|
113 |
+
<default>
|
114 |
+
<promo>
|
115 |
+
<optit_checkout>
|
116 |
+
<optit_max_cron_retries>10</optit_max_cron_retries>
|
117 |
+
</optit_checkout>
|
118 |
+
</promo>
|
119 |
+
</default>
|
120 |
</config>
|
app/code/local/Inchoo/Optit/etc/system.xml
CHANGED
@@ -7,6 +7,7 @@
|
|
7 |
<label>Opt It</label>
|
8 |
<show_in_default>1</show_in_default>
|
9 |
<sort_order>10</sort_order>
|
|
|
10 |
<fields>
|
11 |
<optit_username translate="label comment">
|
12 |
<label>Username</label>
|
@@ -27,6 +28,63 @@
|
|
27 |
<show_in_store>0</show_in_store>
|
28 |
<comment>Opt It Password</comment>
|
29 |
</optit_password>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
</fields>
|
31 |
</optit>
|
32 |
</groups>
|
7 |
<label>Opt It</label>
|
8 |
<show_in_default>1</show_in_default>
|
9 |
<sort_order>10</sort_order>
|
10 |
+
<frontend_class>complex</frontend_class>
|
11 |
<fields>
|
12 |
<optit_username translate="label comment">
|
13 |
<label>Username</label>
|
28 |
<show_in_store>0</show_in_store>
|
29 |
<comment>Opt It Password</comment>
|
30 |
</optit_password>
|
31 |
+
<optit_checkout type="group" translate="label comment">
|
32 |
+
<label>Checkout Opt-in</label>
|
33 |
+
<frontend_type>text</frontend_type>
|
34 |
+
<frontend_class>active</frontend_class>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>1</show_in_store>
|
38 |
+
<sort_order>30</sort_order>
|
39 |
+
<group>optit</group >
|
40 |
+
<fields>
|
41 |
+
<optit_enable_checkout_subscription translate="label comment">
|
42 |
+
<label>Enabled</label>
|
43 |
+
<frontend_type>select</frontend_type>
|
44 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
45 |
+
<sort_order>30</sort_order>
|
46 |
+
<show_in_default>1</show_in_default>
|
47 |
+
<show_in_website>1</show_in_website>
|
48 |
+
<show_in_store>1</show_in_store>
|
49 |
+
<comment>Checkout opt-in</comment>
|
50 |
+
</optit_enable_checkout_subscription>
|
51 |
+
<optit_default_keyword translate="label comment">
|
52 |
+
<label>Default Keyword</label>
|
53 |
+
<frontend_type>select</frontend_type>
|
54 |
+
<frontend_model>optit/adminhtml_system_config_field_keyword</frontend_model>
|
55 |
+
<source_model>optit/system_config_source_message_keyword::toOptionArrayWithAuthentication</source_model>
|
56 |
+
<sort_order>40</sort_order>
|
57 |
+
<show_in_default>1</show_in_default>
|
58 |
+
<show_in_website>1</show_in_website>
|
59 |
+
<show_in_store>1</show_in_store>
|
60 |
+
<depends><optit_enable_checkout_subscription>1</optit_enable_checkout_subscription></depends>
|
61 |
+
<comment>Keyword used at checkout</comment>
|
62 |
+
</optit_default_keyword>
|
63 |
+
<optit_default_interests translate="label comment">
|
64 |
+
<label>Default Interest</label>
|
65 |
+
<frontend_type>multiselect</frontend_type>
|
66 |
+
<source_model>optit/system_config_source_subscription_interest::toOptionArrayWithAuthentication</source_model>
|
67 |
+
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
68 |
+
<sort_order>50</sort_order>
|
69 |
+
<show_in_default>1</show_in_default>
|
70 |
+
<show_in_website>1</show_in_website>
|
71 |
+
<show_in_store>1</show_in_store>
|
72 |
+
<depends><optit_enable_checkout_subscription>1</optit_enable_checkout_subscription></depends>
|
73 |
+
<comment>Interest used at checkout</comment>
|
74 |
+
</optit_default_interests>
|
75 |
+
<optit_max_cron_retries translate="label comment">
|
76 |
+
<label>Max Retries</label>
|
77 |
+
<frontend_type>text</frontend_type>
|
78 |
+
<frontend_class>validate-digits</frontend_class>
|
79 |
+
<sort_order>60</sort_order>
|
80 |
+
<show_in_default>1</show_in_default>
|
81 |
+
<show_in_website>1</show_in_website>
|
82 |
+
<show_in_store>1</show_in_store>
|
83 |
+
<depends><optit_enable_checkout_subscription>1</optit_enable_checkout_subscription></depends>
|
84 |
+
<comment>Max retries for cron to try subscribe member</comment>
|
85 |
+
</optit_max_cron_retries>
|
86 |
+
</fields>
|
87 |
+
</optit_checkout>
|
88 |
</fields>
|
89 |
</optit>
|
90 |
</groups>
|
app/code/local/Inchoo/Optit/sql/optit_setup/upgrade-0.1.0-0.1.1.php
ADDED
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/** @var $installer Mage_Catalog_Model_Resource_Setup */
|
4 |
+
|
5 |
+
$installer = $this;
|
6 |
+
$connection = $this->getConnection();
|
7 |
+
|
8 |
+
$installer->startSetup();
|
9 |
+
|
10 |
+
if (!$connection->isTableExists($installer->getTable('optit/subscription'))) {
|
11 |
+
$table = $this->getConnection()
|
12 |
+
->newTable($this->getTable('optit/subscription'))
|
13 |
+
->addColumn(
|
14 |
+
'id',
|
15 |
+
Varien_Db_Ddl_Table::TYPE_INTEGER,
|
16 |
+
null,
|
17 |
+
array(
|
18 |
+
'primary' => true,
|
19 |
+
'identity' => true,
|
20 |
+
'unsigned' => true,
|
21 |
+
'nullable' => false,
|
22 |
+
), 'Id')
|
23 |
+
->addColumn(
|
24 |
+
'keyword',
|
25 |
+
Varien_Db_Ddl_Table::TYPE_INTEGER,
|
26 |
+
null,
|
27 |
+
array(
|
28 |
+
'nullable' => true,
|
29 |
+
), 'Keyword')
|
30 |
+
->addColumn(
|
31 |
+
'interest',
|
32 |
+
Varien_Db_Ddl_Table::TYPE_INTEGER,
|
33 |
+
null,
|
34 |
+
array(
|
35 |
+
'nullable' => true,
|
36 |
+
), 'Interest')
|
37 |
+
->addColumn(
|
38 |
+
'phone',
|
39 |
+
Varien_Db_Ddl_Table::TYPE_VARCHAR,
|
40 |
+
50,
|
41 |
+
array(
|
42 |
+
'nullable' => false,
|
43 |
+
), 'Phone')
|
44 |
+
->addColumn(
|
45 |
+
'email_address',
|
46 |
+
Varien_Db_Ddl_Table::TYPE_VARCHAR,
|
47 |
+
255,
|
48 |
+
array(
|
49 |
+
'nullable' => true,
|
50 |
+
), 'Email')
|
51 |
+
->addColumn(
|
52 |
+
'first_name',
|
53 |
+
Varien_Db_Ddl_Table::TYPE_VARCHAR,
|
54 |
+
255,
|
55 |
+
array(
|
56 |
+
'nullable' => true,
|
57 |
+
), 'First Name')
|
58 |
+
->addColumn(
|
59 |
+
'last_name',
|
60 |
+
Varien_Db_Ddl_Table::TYPE_VARCHAR,
|
61 |
+
255,
|
62 |
+
array(
|
63 |
+
'nullable' => true,
|
64 |
+
), 'Last Name')
|
65 |
+
->addColumn(
|
66 |
+
'address1',
|
67 |
+
Varien_Db_Ddl_Table::TYPE_VARCHAR,
|
68 |
+
255,
|
69 |
+
array(
|
70 |
+
'nullable' => true,
|
71 |
+
), 'Address 1')
|
72 |
+
->addColumn(
|
73 |
+
'address2',
|
74 |
+
Varien_Db_Ddl_Table::TYPE_VARCHAR,
|
75 |
+
255,
|
76 |
+
array(
|
77 |
+
'nullable' => true,
|
78 |
+
), 'Address 2')
|
79 |
+
->addColumn(
|
80 |
+
'city',
|
81 |
+
Varien_Db_Ddl_Table::TYPE_VARCHAR,
|
82 |
+
255,
|
83 |
+
array(
|
84 |
+
'nullable' => true,
|
85 |
+
), 'City')
|
86 |
+
->addColumn(
|
87 |
+
'state',
|
88 |
+
Varien_Db_Ddl_Table::TYPE_VARCHAR,
|
89 |
+
255,
|
90 |
+
array(
|
91 |
+
'nullable' => true,
|
92 |
+
), 'State')
|
93 |
+
->addColumn(
|
94 |
+
'zip',
|
95 |
+
Varien_Db_Ddl_Table::TYPE_INTEGER,
|
96 |
+
null,
|
97 |
+
array(
|
98 |
+
'nullable' => true,
|
99 |
+
), 'Zip')
|
100 |
+
->addColumn(
|
101 |
+
'gender',
|
102 |
+
Varien_Db_Ddl_Table::TYPE_VARCHAR,
|
103 |
+
null,
|
104 |
+
array(
|
105 |
+
'nullable' => true,
|
106 |
+
), 'Gender')
|
107 |
+
->addColumn(
|
108 |
+
'birth_date',
|
109 |
+
Varien_Db_Ddl_Table::TYPE_VARCHAR,
|
110 |
+
null,
|
111 |
+
array(
|
112 |
+
'nullable' => true,
|
113 |
+
), 'Birth Date')
|
114 |
+
->addColumn(
|
115 |
+
'status',
|
116 |
+
Varien_Db_Ddl_Table::TYPE_TINYINT,
|
117 |
+
1,
|
118 |
+
array(
|
119 |
+
'nullable' => false,
|
120 |
+
'default' => '0',
|
121 |
+
), 'Status')
|
122 |
+
->addColumn(
|
123 |
+
'retries',
|
124 |
+
Varien_Db_Ddl_Table::TYPE_INTEGER,
|
125 |
+
null,
|
126 |
+
array(
|
127 |
+
'nullable' => false,
|
128 |
+
'default' => '0',
|
129 |
+
), 'Retries')
|
130 |
+
->addIndex(
|
131 |
+
$installer->getIdxName(
|
132 |
+
'optit/subscription',
|
133 |
+
array('keyword', 'interest', 'phone'),
|
134 |
+
Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
|
135 |
+
),
|
136 |
+
array('keyword', 'interest', 'phone'),
|
137 |
+
array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
|
138 |
+
)->setComment('Subscription Queue');
|
139 |
+
|
140 |
+
$this->getConnection()->createTable($table);
|
141 |
+
}
|
142 |
+
|
143 |
+
$installer->endSetup();
|
app/design/frontend/base/default/layout/optit.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2 |
+
<layout>
|
3 |
+
<checkout_onepage_index>
|
4 |
+
<reference name="checkout.onepage.billing">
|
5 |
+
<action method="setTemplate"><template>optit/checkout/onepage/billing.phtml</template></action>
|
6 |
+
<block type="optit/subscribe" name="optit.subscribe" template="optit/checkout/onepage/subscribe.phtml"/>
|
7 |
+
</reference>
|
8 |
+
</checkout_onepage_index>
|
9 |
+
</layout>
|
app/etc/modules/Inchoo_Optit.xml
CHANGED
@@ -4,6 +4,9 @@
|
|
4 |
<Inchoo_Optit>
|
5 |
<active>true</active>
|
6 |
<codePool>local</codePool>
|
|
|
|
|
|
|
7 |
</Inchoo_Optit>
|
8 |
</modules>
|
9 |
</config>
|
4 |
<Inchoo_Optit>
|
5 |
<active>true</active>
|
6 |
<codePool>local</codePool>
|
7 |
+
<depends>
|
8 |
+
<Mage_Checkout/>
|
9 |
+
</depends>
|
10 |
</Inchoo_Optit>
|
11 |
</modules>
|
12 |
</config>
|
package.xml
CHANGED
@@ -1,62 +1,20 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Optit</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license>GNU General Public License (GPL)</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Integration with Opt It SMS and MMS</summary>
|
10 |
-
<description>Opt It
|
11 |

|
12 |
-
|
13 |
-

|
14 |
-
Opt It Mobile is an industry leading text message marketing application to engage, build brand awareness and create a direct dialogue with your customers. Thousands are growing their businesses by utilizing the power of permission based text message marketing.
|
15 |
-

|
16 |
-
This extension integrates with Opt It's Mobile API and provides membership management and messaging UI as well as a PHP API.
|
17 |
-

|
18 |
-
Features:
|
19 |
-

|
20 |
-
Keyword Management Functionality
|
21 |
-
- List all existing keywords
|
22 |
-
- Add a new keyword
|
23 |
-
- Update an existing keyword
|
24 |
-

|
25 |
-
Member Management
|
26 |
-
- List all existing members
|
27 |
-
- Add a new member
|
28 |
-
- Update an existing member
|
29 |
-

|
30 |
-
Interests
|
31 |
-
- List all interests for a keyword
|
32 |
-
- Create an interest
|
33 |
-

|
34 |
-
Subscriptions
|
35 |
-
- List subscriptions for a keyword
|
36 |
-
- Create a subscription for a keyword
|
37 |
-
- List subscriptions for an interest
|
38 |
-
- Create a subscription for an interest
|
39 |
-
- Delete a subscription for an interest
|
40 |
-

|
41 |
-
Send Message
|
42 |
-
- Send a text message to one or more members
|
43 |
-
- Send a text message to one or more keyword subscription lists
|
44 |
-
- Send a text message to one or more interest subscription lists
|
45 |
-

|
46 |
-
Bulk Message
|
47 |
-
- Send bulk SMS messages
|
48 |
-

|
49 |
-
Permissions
|
50 |
-
- Send a message
|
51 |
-
- View keywords, interests, and subscriptions
|
52 |
-
- Create or edit keywords, interests, and subscriptions
|
53 |
-
- View members
|
54 |
-
- Create or edit members</description>
|
55 |
<notes>Install extension and configure at Promotions > Opt It.</notes>
|
56 |
<authors><author><name>Technivant</name><user>technivant</user><email>info@technivant.com</email></author></authors>
|
57 |
-
<date>2016-
|
58 |
-
<time>
|
59 |
-
<contents><target name="magelocal"><dir name="Inchoo"><dir name="Optit"><dir name="Block"><dir name="Adminhtml"><dir name="Interest"><dir name="Edit"><file name="Form.php" hash="df10a009994e5374d7746c0c92ce9c12"/></dir><file name="Edit.php" hash="0172c0c244fb114af0f13dd73831556b"/><dir name="Grid"><dir name="Renderer"><file name="Action.php" hash="8cba7872f28f6b1a4164975985f84ed4"/></dir></dir><file name="Grid.php" hash="e6f6c0c2130bbc3cef013c2b5d59a3ec"/></dir><file name="Interest.php" hash="be10603096527cbed2fde68be36a35d3"/><dir name="Keyword"><dir name="Edit"><file name="Form.php" hash="6aeb0706dbf04db126d1e307fd829c23"/></dir><file name="Edit.php" hash="656069a0f85727fd9a835df80ee72cf0"/><dir name="Grid"><dir name="Renderer"><file name="Action.php" hash="2c45ddef6c320895ccd92942c5d767cf"/></dir></dir><file name="Grid.php" hash="86a74f09ec914eb487cf1fbcf5809b76"/></dir><file name="Keyword.php" hash="181fc425efea649c9e49b876d301ad1b"/><dir name="Member"><dir name="Grid"><dir name="Renderer"><file name="Action.php" hash="2082516783f3f3902868b75354590e9e"/></dir></dir><file name="Grid.php" hash="4e1fb6f3d704b8fcb610388862b65c27"/></dir><file name="Member.php" hash="7ff3b27bbc7c821f25eb3d57ff985630"/><dir name="Message"><dir name="Mms"><dir name="Edit"><file name="Form.php" hash="b37be684c503c129a9d6e9a68765d918"/></dir><file name="Edit.php" hash="374658f309899041d0e3a53a256d5f0e"/><file name="Grid.php" hash="ff151a11c534166fd9dc91bdd9559f41"/></dir><file name="Mms.php" hash="8ea4720ddbe38f354df62ee55f52d58b"/><dir name="Sms"><dir name="Edit"><file name="Form.php" hash="0dfa643029d505dd1d010b2439b541bc"/></dir><file name="Edit.php" hash="f0fbed3cda33f4357cd4541188a4e069"/><file name="Grid.php" hash="ad8c7a89747fe7a9bfbbfefd087bc22b"/></dir><file name="Sms.php" hash="96a9548b60439eb714b5237a191b3428"/></dir><dir name="Subscription"><dir name="Edit"><file name="Form.php" hash="4523f8c9198a01104af6d7715b6c420e"/></dir><file name="Edit.php" hash="abafedbb184ab992c2bf86c911a35602"/><dir name="Grid"><dir name="Renderer"><file name="Action.php" hash="17778376644da1bf0ee6f392bffdb45a"/></dir></dir><file name="Grid.php" hash="7a354b9d7169c791ae5c65b1cb699d2c"/><dir name="Subscribe"><dir name="Edit"><file name="Form.php" hash="ada190d4e10ee7e47b98f8e8ac47eeeb"/></dir><file name="Edit.php" hash="62df7dbb26c291df4aa84138b4e2c983"/></dir></dir><file name="Subscription.php" hash="3310bddbff194e31277ae13330ddbe2a"/><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Action.php" hash="7c5fecdb611324e125939fe198c2dd64"/></dir></dir></dir></dir></dir
|
60 |
<compatible/>
|
61 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
62 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Optit</name>
|
4 |
+
<version>1.0.2</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>GNU General Public License (GPL)</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Integration with Opt It SMS and MMS</summary>
|
10 |
+
<description>Opt It Mobile is an industry leading text message marketing application to engage, build brand awareness and create a direct dialogue with your customers. Thousands are growing their businesses by utilizing the power of permission based text message marketing.
|
11 |

|
12 |
+
This extension integrates with Opt It's Mobile API and provides membership management and messaging UI as well as a PHP API. Use it to sign up users for SMS alerts during the Magento checkout; send bulk SMS messages to subscribers; send rich media messages (MMS) like videos and images right from Magento; add/update/delete Opt It subscriptions, interests, and keywords; or build a custom SMS workflow using the Opt It PHP API.</description>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
<notes>Install extension and configure at Promotions > Opt It.</notes>
|
14 |
<authors><author><name>Technivant</name><user>technivant</user><email>info@technivant.com</email></author></authors>
|
15 |
+
<date>2016-10-03</date>
|
16 |
+
<time>18:17:55</time>
|
17 |
+
<contents><target name="magelocal"><dir name="Inchoo"><dir name="Optit"><dir name="Block"><dir name="Adminhtml"><dir name="Interest"><dir name="Edit"><file name="Form.php" hash="df10a009994e5374d7746c0c92ce9c12"/></dir><file name="Edit.php" hash="0172c0c244fb114af0f13dd73831556b"/><dir name="Grid"><dir name="Renderer"><file name="Action.php" hash="8cba7872f28f6b1a4164975985f84ed4"/></dir></dir><file name="Grid.php" hash="e6f6c0c2130bbc3cef013c2b5d59a3ec"/></dir><file name="Interest.php" hash="be10603096527cbed2fde68be36a35d3"/><dir name="Keyword"><dir name="Edit"><file name="Form.php" hash="6aeb0706dbf04db126d1e307fd829c23"/></dir><file name="Edit.php" hash="656069a0f85727fd9a835df80ee72cf0"/><dir name="Grid"><dir name="Renderer"><file name="Action.php" hash="2c45ddef6c320895ccd92942c5d767cf"/></dir></dir><file name="Grid.php" hash="86a74f09ec914eb487cf1fbcf5809b76"/></dir><file name="Keyword.php" hash="181fc425efea649c9e49b876d301ad1b"/><dir name="Member"><dir name="Grid"><dir name="Renderer"><file name="Action.php" hash="2082516783f3f3902868b75354590e9e"/></dir></dir><file name="Grid.php" hash="4e1fb6f3d704b8fcb610388862b65c27"/></dir><file name="Member.php" hash="7ff3b27bbc7c821f25eb3d57ff985630"/><dir name="Message"><dir name="Mms"><dir name="Edit"><file name="Form.php" hash="b37be684c503c129a9d6e9a68765d918"/></dir><file name="Edit.php" hash="374658f309899041d0e3a53a256d5f0e"/><file name="Grid.php" hash="ff151a11c534166fd9dc91bdd9559f41"/></dir><file name="Mms.php" hash="8ea4720ddbe38f354df62ee55f52d58b"/><dir name="Sms"><dir name="Edit"><file name="Form.php" hash="0dfa643029d505dd1d010b2439b541bc"/></dir><file name="Edit.php" hash="f0fbed3cda33f4357cd4541188a4e069"/><file name="Grid.php" hash="ad8c7a89747fe7a9bfbbfefd087bc22b"/></dir><file name="Sms.php" hash="96a9548b60439eb714b5237a191b3428"/></dir><dir name="Subscription"><dir name="Edit"><file name="Form.php" hash="4523f8c9198a01104af6d7715b6c420e"/></dir><file name="Edit.php" hash="abafedbb184ab992c2bf86c911a35602"/><dir name="Grid"><dir name="Renderer"><file name="Action.php" hash="17778376644da1bf0ee6f392bffdb45a"/></dir></dir><file name="Grid.php" hash="7a354b9d7169c791ae5c65b1cb699d2c"/><dir name="Subscribe"><dir name="Edit"><file name="Form.php" hash="ada190d4e10ee7e47b98f8e8ac47eeeb"/></dir><file name="Edit.php" hash="62df7dbb26c291df4aa84138b4e2c983"/></dir></dir><file name="Subscription.php" hash="3310bddbff194e31277ae13330ddbe2a"/><dir name="System"><dir name="Config"><dir name="Field"><file name="Keyword.php" hash="6f22281eab789fc0c6e00a086619364b"/></dir></dir></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Action.php" hash="7c5fecdb611324e125939fe198c2dd64"/></dir></dir></dir></dir></dir><file name="Subscribe.php" hash="49a8b455396afe21eb1ad23dadb3c042"/></dir><dir name="Helper"><file name="Data.php" hash="f68d6036d36638a50f83864b68af7f02"/></dir><dir name="Model"><file name="Abstract.php" hash="d9fc6dddce55b4926c6cacd262071bb8"/><file name="Client.php" hash="c57fbf485e9fc96ce623e19807dcf741"/><file name="Collecition.php" hash="c41691c5bc4eac2a32cdc7afc8d1d4fd"/><file name="Interest.php" hash="5e516647ed41ecc4d7c765826ef0d19e"/><file name="Keyword.php" hash="efe1c134ef8faa229354486ebdd1dbf1"/><file name="Member.php" hash="8f34d20363d7b3c5b820a809b8f0327d"/><file name="Message.php" hash="d495d7712d4c78dd01ec8a03371413bc"/><file name="Observer.php" hash="6ad5643bc274f8e19f8b4311ab1750c7"/><dir name="Resource"><dir name="Message"><file name="Collection.php" hash="29911120fcad734ffa39b760acb1db53"/></dir><file name="Message.php" hash="a16ce9e6b10216b75e3a0edd31a71c20"/><file name="Phone.php" hash="27c2954051dda30d18b9cb23256c52ca"/><dir name="Subscription"><file name="Collection.php" hash="81887c7771222cd46a36d0284a3abf0a"/></dir><file name="Subscription.php" hash="3c2a483a2f256559880be077a60daa38"/></dir><file name="Subscription.php" hash="0ab8acbb54ccd59bc8db7121f332390d"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Billing"><file name="Type.php" hash="800d8f9979007385a40c1166e4c9e92e"/></dir><dir name="Customer"><file name="Gender.php" hash="b8625afdc238b9cfe5d249ec4b3acdc4"/></dir><dir name="Message"><file name="Keyword.php" hash="e59529ec5a83fb51fdaca3d533200d87"/></dir><dir name="Subscribed"><dir name="Message"><file name="Type.php" hash="d351cc84a860f9c61c1d3ced4e3dd69e"/></dir></dir><dir name="Subscription"><file name="Interest.php" hash="2c6467f1a4144ff59ed6a51cf4d8e344"/><file name="Phone.php" hash="5b16446404b73f24ac6d2009f1599807"/></dir><dir name="Web"><dir name="Form"><dir name="Message"><file name="Type.php" hash="6984f36be07d3460d939e5a845353c8f"/></dir></dir></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Optit"><file name="BulkController.php" hash="84ed21ffbd335d6c4fb3e0948a37d717"/><file name="InterestController.php" hash="cfb2d653329129d650db6df8362f2415"/><file name="KeywordController.php" hash="e094cc91ca9e5b31719ca51d0a9025e1"/><file name="MemberController.php" hash="71f063ab9c61f17f79c6403aee9f85af"/><file name="MessageController.php" hash="542307aae048d830f5fbf7dbe7501d98"/><file name="SubscriptionController.php" hash="ded72ce832ae52b30115f307cd2ebafb"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="2ba9415e5d9a8ac7355ccf253f5984f2"/><file name="config.xml" hash="cc2cb6b257c6400d498f5bc5691af268"/><file name="system.xml" hash="c39edf406117cc8e120cea19720bb0b7"/></dir><dir name="sql"><dir name="optit_setup"><file name="install-0.1.0.php" hash="9eef425b56118d478f4cf59f87d328f9"/><file name="upgrade-0.1.0-0.1.1.php" hash="85e9de1564ebaffd4f1f8cc98f29fa66"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="optit.xml" hash="44554e5e8a8108d5733c3ccbc9f7c425"/></dir><dir name="template"><dir name="optit"><file name="grid.phtml" hash="701a433d0dc3a701921321b757d0a669"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="optit.xml" hash="fd827610166d148fb84728fe74f0f5e2"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Inchoo_Optit.xml" hash="22f4cb34a839d933be7d5cf7ff87140c"/></dir></target></contents>
|
18 |
<compatible/>
|
19 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
20 |
</package>
|