Version Notes
Support for installation of multiple Lexity extensions.
Download this release
Release Info
Developer | Lexity |
Extension | Lexity_Live |
Version | 1.1.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.1.0
- app/code/local/Lexity/LexCore/Block/Live.php +0 -9
- app/code/local/Lexity/LexCore/Helper/Data.php +0 -5
- app/code/local/Lexity/LexCore/controllers/Adminhtml/LexCore/IndexController.php +0 -17
- app/code/local/Lexity/LexCore/controllers/Adminhtml/LexCore/LexityController.php +0 -18
- app/code/local/Lexity/LexCore/controllers/Adminhtml/LexCore/LiveController.php +0 -12
- app/code/local/Lexity/LexCore/controllers/Adminhtml/LexityController.php +0 -27
- app/code/local/Lexity/LexCore/etc/config.xml +0 -56
- app/code/local/LexityLive/Block/Live.php +9 -0
- app/code/local/LexityLive/Helper/Data.php +5 -0
- app/code/local/{Lexity/LexCore → LexityLive}/Model/Core.php +40 -31
- app/code/local/{Lexity/LexCore → LexityLive}/Model/Core/Api.php +3 -3
- app/code/local/LexityLive/Model/Order/Api.php +95 -0
- app/code/local/LexityLive/controllers/CoreController.php +20 -0
- app/code/local/LexityLive/controllers/MarketingController.php +21 -0
- app/code/local/{Lexity/LexCore → LexityLive}/etc/api.xml +6 -7
- app/code/local/LexityLive/etc/config.xml +54 -0
- app/design/adminhtml/default/default/template/{lexity/lexcore → lexitylive}/live.phtml +1 -1
- app/etc/modules/{Lexity_LexCore.xml → LexityLive.xml} +2 -2
- package.xml +5 -5
app/code/local/Lexity/LexCore/Block/Live.php
DELETED
@@ -1,9 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Lexity_LexCore_Block_Live extends Mage_Adminhtml_Block_Template
|
3 |
-
{
|
4 |
-
public function _construct()
|
5 |
-
{
|
6 |
-
parent::_construct();
|
7 |
-
$this->setTemplate('lexity/lexcore/live.phtml');
|
8 |
-
}
|
9 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Lexity/LexCore/Helper/Data.php
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Lexity_LexCore_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
-
{
|
4 |
-
}
|
5 |
-
?>
|
|
|
|
|
|
|
|
|
|
app/code/local/Lexity/LexCore/controllers/Adminhtml/LexCore/IndexController.php
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Lexity_LexCore_Adminhtml_LexCore_IndexController extends Mage_Adminhtml_Controller_Action
|
3 |
-
{
|
4 |
-
public function liveAction()
|
5 |
-
{
|
6 |
-
$this->_title('Lexity Live');
|
7 |
-
$this->loadLayout()
|
8 |
-
->_setActiveMenu('Lexity');
|
9 |
-
$this->_addContent($this->getLayout()->createBlock('lexcore/live'));
|
10 |
-
$this->renderLayout();
|
11 |
-
}
|
12 |
-
|
13 |
-
public function marketingAction()
|
14 |
-
{
|
15 |
-
|
16 |
-
}
|
17 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Lexity/LexCore/controllers/Adminhtml/LexCore/LexityController.php
DELETED
@@ -1,18 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Lexity_LexCore_Adminhtml_LexCore_LexityController extends Mage_Adminhtml_Controller_Action
|
3 |
-
{
|
4 |
-
public function liveAction()
|
5 |
-
{
|
6 |
-
Mage::Log('In the liveAction for adminhtml lexity controller');
|
7 |
-
$this->_title('Lexity Live');
|
8 |
-
$this->loadLayout()
|
9 |
-
->_setActiveMenu('Lexity');
|
10 |
-
$this->_addContent($this->getLayout()->createBlock('lexcore/live'));
|
11 |
-
$this->renderLayout();
|
12 |
-
}
|
13 |
-
|
14 |
-
public function marketingAction()
|
15 |
-
{
|
16 |
-
|
17 |
-
}
|
18 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Lexity/LexCore/controllers/Adminhtml/LexCore/LiveController.php
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Lexity_LexCore_Adminhtml_LexCore_LiveController extends Mage_Adminhtml_Controller_Action
|
3 |
-
{
|
4 |
-
public function indexAction()
|
5 |
-
{
|
6 |
-
$this->_title('Lexity Live');
|
7 |
-
$this->loadLayout()
|
8 |
-
->_setActiveMenu('Lexity');
|
9 |
-
$this->_addContent($this->getLayout()->createBlock('lexcore/live'));
|
10 |
-
$this->renderLayout();
|
11 |
-
}
|
12 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Lexity/LexCore/controllers/Adminhtml/LexityController.php
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Lexity_LexCore_Adminhtml_LexityController extends Mage_Adminhtml_Controller_Action
|
3 |
-
{
|
4 |
-
protected function _construct()
|
5 |
-
{
|
6 |
-
$this->setUsedModuleName('Lexity_LexCore');
|
7 |
-
}
|
8 |
-
|
9 |
-
public function liveAction()
|
10 |
-
{
|
11 |
-
$this->_title('Lexity Live');
|
12 |
-
$this->loadLayout()
|
13 |
-
->_setActiveMenu('lexity/live');
|
14 |
-
$this->_addContent($this->getLayout()->createBlock('lexcore/live'));
|
15 |
-
$this->renderLayout();
|
16 |
-
}
|
17 |
-
|
18 |
-
public function marketingAction()
|
19 |
-
{
|
20 |
-
$this->_title('Lexity Dashboard');
|
21 |
-
$this->loadLayout()
|
22 |
-
->_setActiveMenu('lexity/marketing');
|
23 |
-
|
24 |
-
$uri = Mage::getModel('lexcore/core')->loginAndRedirect();
|
25 |
-
$this->getResponse()->setRedirect($uri);
|
26 |
-
}
|
27 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Lexity/LexCore/etc/config.xml
DELETED
@@ -1,56 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Lexity_LexCore>
|
5 |
-
<version>0.1.0</version>
|
6 |
-
</Lexity_LexCore>
|
7 |
-
</modules>
|
8 |
-
<global>
|
9 |
-
<helpers>
|
10 |
-
<lexcore>
|
11 |
-
<class>Lexity_LexCore_Helper</class>
|
12 |
-
</lexcore>
|
13 |
-
</helpers>
|
14 |
-
<models>
|
15 |
-
<lexcore>
|
16 |
-
<class>Lexity_LexCore_Model</class>
|
17 |
-
</lexcore>
|
18 |
-
</models>
|
19 |
-
<blocks>
|
20 |
-
<lexcore>
|
21 |
-
<class>Lexity_LexCore_Block</class>
|
22 |
-
</lexcore>
|
23 |
-
</blocks>
|
24 |
-
</global>
|
25 |
-
<admin>
|
26 |
-
<routers>
|
27 |
-
<adminhtml>
|
28 |
-
<args>
|
29 |
-
<modules>
|
30 |
-
<Lexity_LexCore before="Mage_Adminhtml">Lexity_LexCore_Adminhtml</Lexity_LexCore>
|
31 |
-
</modules>
|
32 |
-
</args>
|
33 |
-
</adminhtml>
|
34 |
-
</routers>
|
35 |
-
</admin>
|
36 |
-
<adminhtml>
|
37 |
-
<menu>
|
38 |
-
<lexity translate="title">
|
39 |
-
<title>Lexity</title>
|
40 |
-
<sort_order>99</sort_order>
|
41 |
-
<children>
|
42 |
-
<lexlive translate="title">
|
43 |
-
<title>Live</title>
|
44 |
-
<action>adminhtml/lexity/live</action>
|
45 |
-
<sort_order>10</sort_order>
|
46 |
-
</lexlive>
|
47 |
-
<lexdash translate="title">
|
48 |
-
<title>Apps</title>
|
49 |
-
<action>adminhtml/lexity/marketing</action>
|
50 |
-
<sort_order>20</sort_order>
|
51 |
-
</lexdash>
|
52 |
-
</children>
|
53 |
-
</lexity>
|
54 |
-
</menu>
|
55 |
-
</adminhtml>
|
56 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/LexityLive/Block/Live.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class LexityLive_Block_Live extends Mage_Adminhtml_Block_Template
|
3 |
+
{
|
4 |
+
public function _construct()
|
5 |
+
{
|
6 |
+
parent::_construct();
|
7 |
+
$this->setTemplate('lexitylive/live.phtml');
|
8 |
+
}
|
9 |
+
}
|
app/code/local/LexityLive/Helper/Data.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class LexityLive_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
}
|
5 |
+
?>
|
app/code/local/{Lexity/LexCore → LexityLive}/Model/Core.php
RENAMED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
-
class
|
3 |
{
|
4 |
-
public $app_name = '
|
5 |
public $platform = 'magento';
|
6 |
|
7 |
public function has_lexity_user()
|
@@ -9,7 +9,7 @@ class Lexity_LexCore_Model_Core extends Mage_Core_Model_Config
|
|
9 |
$resource = Mage::getSingleton('core/resource');
|
10 |
$readConnection = $resource->getConnection('core_read');
|
11 |
$tableName = $resource->getTableName('api/user');
|
12 |
-
$results = $readConnection->fetchALL("SELECT * FROM api_user where username = '
|
13 |
|
14 |
return (isset($results[0]) && $results[0]["email"] == 'support@lexity.com');
|
15 |
}
|
@@ -17,7 +17,7 @@ class Lexity_LexCore_Model_Core extends Mage_Core_Model_Config
|
|
17 |
public function add_lexity_user($api_key)
|
18 |
{
|
19 |
$role = Mage::getModel('api/roles')
|
20 |
-
->setName('
|
21 |
->setPid(false)
|
22 |
->setRoleType('G')
|
23 |
->save();
|
@@ -29,7 +29,7 @@ class Lexity_LexCore_Model_Core extends Mage_Core_Model_Config
|
|
29 |
|
30 |
$user = Mage::getModel('api/user');
|
31 |
$user->setData(array(
|
32 |
-
'username' => '
|
33 |
'firstname' => 'lexity',
|
34 |
'lastname' => 'lexity',
|
35 |
'email' => 'support@lexity.com',
|
@@ -49,10 +49,10 @@ class Lexity_LexCore_Model_Core extends Mage_Core_Model_Config
|
|
49 |
->saveRelations();
|
50 |
}
|
51 |
|
52 |
-
public function create_account($new_token = null
|
53 |
{
|
54 |
$user = Mage::getModel('api/user');
|
55 |
-
$user->loadByUsername('
|
56 |
|
57 |
$hash = $user->getApiKey();
|
58 |
$hashArr = explode(':', $hash);
|
@@ -63,46 +63,51 @@ class Lexity_LexCore_Model_Core extends Mage_Core_Model_Config
|
|
63 |
$token = $hashArr[0];
|
64 |
$skey = $hashArr[1];
|
65 |
}
|
|
|
66 |
|
67 |
if (isset($new_token)) {
|
68 |
$token = $new_token;
|
69 |
}
|
70 |
|
71 |
-
$
|
|
|
|
|
|
|
72 |
. $this->app_name
|
73 |
-
. "&platform=" . $this->platform . "&
|
|
|
|
|
74 |
. "&url=" . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
75 |
|
76 |
if (isset($skey)) {
|
77 |
$uri .= "&skey=${skey}";
|
78 |
}
|
79 |
|
80 |
-
$admin_user = Mage::getSingleton('admin/session')->getUser();
|
81 |
-
if (isset($admin_user)) {
|
82 |
-
$uri .= "&email=" . urlencode($admin_user->getEmail());
|
83 |
-
}
|
84 |
-
|
85 |
-
if ($signup_type != null) {
|
86 |
-
$uri .= "&signup_type=" . $signup_type;
|
87 |
-
}
|
88 |
-
|
89 |
# initiate handshake
|
90 |
$client = new Varien_Http_Client($uri);
|
91 |
$response = $client->request('GET');
|
92 |
-
$body = $response->
|
93 |
|
94 |
$decode = json_decode($body);
|
95 |
if (!isset($decode->error) && isset($decode->public_id)) {
|
96 |
-
$this->saveConfig('
|
|
|
|
|
|
|
97 |
}
|
98 |
|
99 |
-
return
|
|
|
|
|
|
|
|
|
|
|
100 |
}
|
101 |
|
102 |
public function get_lexity_login_url($target = null)
|
103 |
{
|
104 |
$user = Mage::getModel('api/user');
|
105 |
-
$user->loadByUsername('
|
106 |
|
107 |
$hash = $user->getApiKey();
|
108 |
$hashArr = explode(':', $hash);
|
@@ -114,12 +119,16 @@ class Lexity_LexCore_Model_Core extends Mage_Core_Model_Config
|
|
114 |
$skey = $hashArr[1];
|
115 |
}
|
116 |
|
117 |
-
|
|
|
|
|
118 |
|
119 |
-
$redirect_url = "https://lexity.com/
|
120 |
. $this->app_name
|
121 |
. "&platform=" . $this->platform . "&token=" . $token
|
122 |
-
. "&public_id=" .
|
|
|
|
|
123 |
|
124 |
if (isset($skey)) {
|
125 |
$redirect_url .= "&skey=${skey}";
|
@@ -131,9 +140,10 @@ class Lexity_LexCore_Model_Core extends Mage_Core_Model_Config
|
|
131 |
return $redirect_url;
|
132 |
}
|
133 |
|
134 |
-
public function loginAndRedirect($target = null
|
135 |
{
|
136 |
-
|
|
|
137 |
if (empty($public_id)) {
|
138 |
$token = null;
|
139 |
if (!$this->has_lexity_user()) {
|
@@ -141,11 +151,10 @@ class Lexity_LexCore_Model_Core extends Mage_Core_Model_Config
|
|
141 |
$this->add_lexity_user($token);
|
142 |
}
|
143 |
|
144 |
-
return $this->create_account($token
|
145 |
-
}
|
146 |
-
else {
|
147 |
-
return $this->get_lexity_login_url($target);
|
148 |
}
|
|
|
|
|
149 |
}
|
150 |
}
|
151 |
?>
|
1 |
<?php
|
2 |
+
class LexityLive_Model_Core extends Mage_Core_Model_Config
|
3 |
{
|
4 |
+
public $app_name = 'live';
|
5 |
public $platform = 'magento';
|
6 |
|
7 |
public function has_lexity_user()
|
9 |
$resource = Mage::getSingleton('core/resource');
|
10 |
$readConnection = $resource->getConnection('core_read');
|
11 |
$tableName = $resource->getTableName('api/user');
|
12 |
+
$results = $readConnection->fetchALL("SELECT * FROM api_user where username = 'lexity_live' LIMIT 1");
|
13 |
|
14 |
return (isset($results[0]) && $results[0]["email"] == 'support@lexity.com');
|
15 |
}
|
17 |
public function add_lexity_user($api_key)
|
18 |
{
|
19 |
$role = Mage::getModel('api/roles')
|
20 |
+
->setName('lexity_live')
|
21 |
->setPid(false)
|
22 |
->setRoleType('G')
|
23 |
->save();
|
29 |
|
30 |
$user = Mage::getModel('api/user');
|
31 |
$user->setData(array(
|
32 |
+
'username' => 'lexity_live',
|
33 |
'firstname' => 'lexity',
|
34 |
'lastname' => 'lexity',
|
35 |
'email' => 'support@lexity.com',
|
49 |
->saveRelations();
|
50 |
}
|
51 |
|
52 |
+
public function create_account($new_token = null)
|
53 |
{
|
54 |
$user = Mage::getModel('api/user');
|
55 |
+
$user->loadByUsername('lexity_live');
|
56 |
|
57 |
$hash = $user->getApiKey();
|
58 |
$hashArr = explode(':', $hash);
|
63 |
$token = $hashArr[0];
|
64 |
$skey = $hashArr[1];
|
65 |
}
|
66 |
+
$hashed_token = $token;
|
67 |
|
68 |
if (isset($new_token)) {
|
69 |
$token = $new_token;
|
70 |
}
|
71 |
|
72 |
+
$admin_user = Mage::getSingleton('admin/session');
|
73 |
+
$admin_email = $admin_user->getUser()->getEmail();
|
74 |
+
|
75 |
+
$uri = "https://lexity.com/api/account/create?app="
|
76 |
. $this->app_name
|
77 |
+
. "&platform=" . $this->platform . "&password=" . $token
|
78 |
+
. "&login=lexity_live"
|
79 |
+
. "&email=" . urlencode($admin_email)
|
80 |
. "&url=" . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
81 |
|
82 |
if (isset($skey)) {
|
83 |
$uri .= "&skey=${skey}";
|
84 |
}
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
# initiate handshake
|
87 |
$client = new Varien_Http_Client($uri);
|
88 |
$response = $client->request('GET');
|
89 |
+
$body = $response->getRawBody();
|
90 |
|
91 |
$decode = json_decode($body);
|
92 |
if (!isset($decode->error) && isset($decode->public_id)) {
|
93 |
+
$this->saveConfig('lexity/live/public_id', $decode->public_id);
|
94 |
+
$this->saveConfig('lexity/live/email', $admin_email);
|
95 |
+
Mage::getConfig()->reinit();
|
96 |
+
Mage::app()->reinitStores();
|
97 |
}
|
98 |
|
99 |
+
return "https://lexity.com/api/account/login?app="
|
100 |
+
. $this->app_name
|
101 |
+
. "&email=" . urlencode($admin_email)
|
102 |
+
. "&platform=" . $this->platform . "&token=" . $hashed_token
|
103 |
+
. "&public_id=" . $decode->public_id
|
104 |
+
. "&domain=" . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
105 |
}
|
106 |
|
107 |
public function get_lexity_login_url($target = null)
|
108 |
{
|
109 |
$user = Mage::getModel('api/user');
|
110 |
+
$user->loadByUsername('lexity_live');
|
111 |
|
112 |
$hash = $user->getApiKey();
|
113 |
$hashArr = explode(':', $hash);
|
119 |
$skey = $hashArr[1];
|
120 |
}
|
121 |
|
122 |
+
Mage::app()->getCacheInstance()->cleanType('config');
|
123 |
+
$public_id = Mage::getStoreConfig('lexity/live/public_id');
|
124 |
+
$login_email = Mage::getStoreConfig('lexity/live/email');
|
125 |
|
126 |
+
$redirect_url = "https://lexity.com/api/account/login?app="
|
127 |
. $this->app_name
|
128 |
. "&platform=" . $this->platform . "&token=" . $token
|
129 |
+
. "&public_id=" . $public_id
|
130 |
+
. "&email=" . urlencode($login_email)
|
131 |
+
. "&domain=" . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
132 |
|
133 |
if (isset($skey)) {
|
134 |
$redirect_url .= "&skey=${skey}";
|
140 |
return $redirect_url;
|
141 |
}
|
142 |
|
143 |
+
public function loginAndRedirect($target = null)
|
144 |
{
|
145 |
+
Mage::app()->getCacheInstance()->cleanType('config');
|
146 |
+
$public_id = Mage::getStoreConfig('lexity/live/public_id');
|
147 |
if (empty($public_id)) {
|
148 |
$token = null;
|
149 |
if (!$this->has_lexity_user()) {
|
151 |
$this->add_lexity_user($token);
|
152 |
}
|
153 |
|
154 |
+
return $this->create_account($token);
|
|
|
|
|
|
|
155 |
}
|
156 |
+
|
157 |
+
return $this->get_lexity_login_url($target);
|
158 |
}
|
159 |
}
|
160 |
?>
|
app/code/local/{Lexity/LexCore → LexityLive}/Model/Core/Api.php
RENAMED
@@ -1,17 +1,17 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
public function getMisc()
|
6 |
{
|
7 |
-
|
8 |
$js = Mage::getStoreConfig('design/head/includes');
|
9 |
return $js;
|
10 |
}
|
11 |
|
12 |
public function setMisc($js)
|
13 |
{
|
14 |
-
|
15 |
Mage::getModel('core/config')->saveConfig('design/head/includes', $js );
|
16 |
return array('status' => 'updated');
|
17 |
}
|
1 |
<?php
|
2 |
|
3 |
+
class LexityLive_Model_Core_Api extends Mage_Api_Model_Resource_Abstract
|
4 |
{
|
5 |
public function getMisc()
|
6 |
{
|
7 |
+
Mage::app()->getCacheInstance()->cleanType('config');
|
8 |
$js = Mage::getStoreConfig('design/head/includes');
|
9 |
return $js;
|
10 |
}
|
11 |
|
12 |
public function setMisc($js)
|
13 |
{
|
14 |
+
Mage::app()->getCacheInstance()->cleanType('config');
|
15 |
Mage::getModel('core/config')->saveConfig('design/head/includes', $js );
|
16 |
return array('status' => 'updated');
|
17 |
}
|
app/code/local/LexityLive/Model/Order/Api.php
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class LexityLive_Model_Order_Api extends Mage_Sales_Model_Order_Api_V2
|
4 |
+
{
|
5 |
+
public function limiteditems($size='3',$page='1',$filters = null)
|
6 |
+
{
|
7 |
+
// Why the hell is this scoping brace here?!
|
8 |
+
{
|
9 |
+
//TODO: add full name logic
|
10 |
+
$billingAliasName = 'billing_o_a';
|
11 |
+
$shippingAliasName = 'shipping_o_a';
|
12 |
+
|
13 |
+
$collection = Mage::getModel("sales/order")->getCollection()
|
14 |
+
->addAttributeToSelect('*')
|
15 |
+
->addAddressFields()
|
16 |
+
->addExpressionFieldToSelect(
|
17 |
+
'billing_firstname', "{{billing_firstname}}", array('billing_firstname'=>"$billingAliasName.firstname")
|
18 |
+
)
|
19 |
+
->addExpressionFieldToSelect(
|
20 |
+
'billing_lastname', "{{billing_lastname}}", array('billing_lastname'=>"$billingAliasName.lastname")
|
21 |
+
)
|
22 |
+
->addExpressionFieldToSelect(
|
23 |
+
'shipping_firstname', "{{shipping_firstname}}", array('shipping_firstname'=>"$shippingAliasName.firstname")
|
24 |
+
)
|
25 |
+
->addExpressionFieldToSelect(
|
26 |
+
'shipping_lastname', "{{shipping_lastname}}", array('shipping_lastname'=>"$shippingAliasName.lastname")
|
27 |
+
)
|
28 |
+
->addExpressionFieldToSelect(
|
29 |
+
'billing_name',
|
30 |
+
"CONCAT({{billing_firstname}}, ' ', {{billing_lastname}})",
|
31 |
+
array('billing_firstname'=>"$billingAliasName.firstname", 'billing_lastname'=>"$billingAliasName.lastname")
|
32 |
+
)
|
33 |
+
->addExpressionFieldToSelect(
|
34 |
+
'shipping_name',
|
35 |
+
'CONCAT({{shipping_firstname}}, " ", {{shipping_lastname}})',
|
36 |
+
array('shipping_firstname'=>"$shippingAliasName.firstname", 'shipping_lastname'=>"$shippingAliasName.lastname")
|
37 |
+
)
|
38 |
+
->setPageSize($size)
|
39 |
+
->setCurPage($page);
|
40 |
+
}
|
41 |
+
|
42 |
+
|
43 |
+
$preparedFilters = array();
|
44 |
+
if (isset($filters->filter)) {
|
45 |
+
foreach ($filters->filter as $_filter) {
|
46 |
+
$preparedFilters[][$_filter->key] = $_filter->value;
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
if (isset($filters->complex_filter)) {
|
51 |
+
foreach ($filters->complex_filter as $_filter) {
|
52 |
+
$_value = $_filter->value;
|
53 |
+
if (is_object($_value)) {
|
54 |
+
$preparedFilters[][$_filter->key] = array(
|
55 |
+
$_value->key => $_value->value
|
56 |
+
);
|
57 |
+
}
|
58 |
+
elseif (is_array($_value)) {
|
59 |
+
$preparedFilters[][$_filter->key] = array(
|
60 |
+
$_value['key'] => $_value['value']
|
61 |
+
);
|
62 |
+
}
|
63 |
+
else {
|
64 |
+
$preparedFilters[][$_filter->key] = $_value;
|
65 |
+
}
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
if (!empty($preparedFilters)) {
|
70 |
+
try {
|
71 |
+
foreach ($preparedFilters as $preparedFilter) {
|
72 |
+
foreach ($preparedFilter as $field => $value) {
|
73 |
+
if (isset($this->_attributesMap['order'][$field])) {
|
74 |
+
$field = $this->_attributesMap['order'][$field];
|
75 |
+
}
|
76 |
+
|
77 |
+
$collection->addFieldToFilter($field, $value);
|
78 |
+
}
|
79 |
+
}
|
80 |
+
}
|
81 |
+
catch (Mage_Core_Exception $e) {
|
82 |
+
$this->_fault('filters_invalid', $e->getMessage());
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
$result = array();
|
87 |
+
|
88 |
+
foreach ($collection as $order) {
|
89 |
+
$result[] = $this->_getAttributes($order, 'order');
|
90 |
+
}
|
91 |
+
|
92 |
+
return $result;
|
93 |
+
}
|
94 |
+
}
|
95 |
+
?>
|
app/code/local/LexityLive/controllers/CoreController.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class LexityLive_CoreController extends Mage_Adminhtml_Controller_Action
|
3 |
+
{
|
4 |
+
public function golexityAction()
|
5 |
+
{
|
6 |
+
if (Mage::getModel('lexitylive/core')->has_lexity_user()) {
|
7 |
+
Mage::Log('Found lexity user, redirecting for login.');
|
8 |
+
}
|
9 |
+
else {
|
10 |
+
Mage::Log('No lexity user found, redirecting for account creation.');
|
11 |
+
|
12 |
+
$token = uniqid();
|
13 |
+
Mage::Log("Shared public key is: " . Mage::getModel('lexitylive/core')->shared_key);
|
14 |
+
Mage::Log("Token is: ${token}");
|
15 |
+
Mage::getModel('lexitylive/core')->add_lexity_user($token);
|
16 |
+
//$this->getResponse()->setRedirect("http://lexity.com/?token=${token}");
|
17 |
+
}
|
18 |
+
}
|
19 |
+
}
|
20 |
+
?>
|
app/code/local/LexityLive/controllers/MarketingController.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class LexityLive_MarketingController extends Mage_Adminhtml_Controller_Action
|
3 |
+
{
|
4 |
+
public function golexityAction()
|
5 |
+
{
|
6 |
+
Mage::app()->getCacheInstance()->cleanType('config');
|
7 |
+
$public_id = Mage::getStoreConfig('lexity/live/public_id');
|
8 |
+
if (empty($public_id)) {
|
9 |
+
$uri = Mage::getModel('lexitylive/core')->loginAndRedirect();
|
10 |
+
$this->getResponse()->setRedirect($uri);
|
11 |
+
}
|
12 |
+
else {
|
13 |
+
$this->_title('Lexity Live');
|
14 |
+
$this->loadLayout()
|
15 |
+
->_setActiveMenu('Marketing');
|
16 |
+
$this->_addContent($this->getLayout()->createBlock('lexitylive/live'));
|
17 |
+
$this->renderLayout();
|
18 |
+
}
|
19 |
+
}
|
20 |
+
}
|
21 |
+
?>
|
app/code/local/{Lexity/LexCore → LexityLive}/etc/api.xml
RENAMED
@@ -1,23 +1,22 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
|
3 |
<config>
|
4 |
<api>
|
5 |
<resources>
|
6 |
-
<
|
7 |
-
<model>
|
8 |
<title>Lexity Core API</title>
|
9 |
-
<acl>
|
10 |
<methods>
|
11 |
-
<getMisc translate="title" module="
|
12 |
<title>Get header scripts</title>
|
13 |
<method>getMisc</method>
|
14 |
</getMisc>
|
15 |
-
<setMisc translate="title" module="
|
16 |
<title>Set header scripts</title>
|
17 |
<method>setMisc</method>
|
18 |
</setMisc>
|
19 |
</methods>
|
20 |
-
</
|
21 |
</resources>
|
22 |
</api>
|
23 |
</config>
|
1 |
<?xml version="1.0"?>
|
|
|
2 |
<config>
|
3 |
<api>
|
4 |
<resources>
|
5 |
+
<lexitylive_core translate="title" module="lexitylive">
|
6 |
+
<model>lexitylive/core_api</model>
|
7 |
<title>Lexity Core API</title>
|
8 |
+
<acl>lexitylive/core</acl>
|
9 |
<methods>
|
10 |
+
<getMisc translate="title" module="lexitylive">
|
11 |
<title>Get header scripts</title>
|
12 |
<method>getMisc</method>
|
13 |
</getMisc>
|
14 |
+
<setMisc translate="title" module="lexitylive">
|
15 |
<title>Set header scripts</title>
|
16 |
<method>setMisc</method>
|
17 |
</setMisc>
|
18 |
</methods>
|
19 |
+
</lexitylive_core>
|
20 |
</resources>
|
21 |
</api>
|
22 |
</config>
|
app/code/local/LexityLive/etc/config.xml
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<lexitylive>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</lexitylive>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<helpers>
|
10 |
+
<lexitylive>
|
11 |
+
<class>LexityLive_Helper</class>
|
12 |
+
</lexitylive>
|
13 |
+
</helpers>
|
14 |
+
<models>
|
15 |
+
<lexitylive>
|
16 |
+
<class>LexityLive_Model</class>
|
17 |
+
</lexitylive>
|
18 |
+
</models>
|
19 |
+
<blocks>
|
20 |
+
<lexitylive>
|
21 |
+
<class>LexityLive_Block</class>
|
22 |
+
</lexitylive>
|
23 |
+
</blocks>
|
24 |
+
</global>
|
25 |
+
|
26 |
+
<admin>
|
27 |
+
<routers>
|
28 |
+
<lexitylive>
|
29 |
+
<use>admin</use>
|
30 |
+
<args>
|
31 |
+
<module>LexityLive</module>
|
32 |
+
<frontName>lexitylive</frontName>
|
33 |
+
</args>
|
34 |
+
</lexitylive>
|
35 |
+
</routers>
|
36 |
+
</admin>
|
37 |
+
|
38 |
+
<adminhtml>
|
39 |
+
<menu>
|
40 |
+
<Lexity translate="title">
|
41 |
+
<title>Marketing</title>
|
42 |
+
<children>
|
43 |
+
<lexitylive translate="title" module="lexitylive">
|
44 |
+
<title>Lexity Live</title>
|
45 |
+
<action>lexitylive/marketing/golexity</action>
|
46 |
+
<sort_order>0</sort_order>
|
47 |
+
</lexitylive>
|
48 |
+
</children>
|
49 |
+
<sort_order>900</sort_order>
|
50 |
+
</Lexity>
|
51 |
+
</menu>
|
52 |
+
</adminhtml>
|
53 |
+
|
54 |
+
</config>
|
app/design/adminhtml/default/default/template/{lexity/lexcore → lexitylive}/live.phtml
RENAMED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
$liveUri = Mage::getModel('
|
3 |
?>
|
4 |
|
5 |
<iframe src="<?php echo $liveUri ?>" width="100%" style="min-height: 800px;" scrolling="auto" frameborder="0"></iframe>
|
1 |
<?php
|
2 |
+
$liveUri = Mage::getModel('lexitylive/core')->loginAndRedirect(urlencode('admin/live?embed=true'));
|
3 |
?>
|
4 |
|
5 |
<iframe src="<?php echo $liveUri ?>" width="100%" style="min-height: 800px;" scrolling="auto" frameborder="0"></iframe>
|
app/etc/modules/{Lexity_LexCore.xml → LexityLive.xml}
RENAMED
@@ -1,8 +1,8 @@
|
|
1 |
<config>
|
2 |
<modules>
|
3 |
-
<
|
4 |
<active>true</active>
|
5 |
<codePool>local</codePool>
|
6 |
-
</
|
7 |
</modules>
|
8 |
</config>
|
1 |
<config>
|
2 |
<modules>
|
3 |
+
<LexityLive>
|
4 |
<active>true</active>
|
5 |
<codePool>local</codePool>
|
6 |
+
</LexityLive>
|
7 |
</modules>
|
8 |
</config>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Lexity_Live</name>
|
4 |
-
<version>1.0
|
5 |
<stability>stable</stability>
|
6 |
<license>BSD License</license>
|
7 |
<channel>community</channel>
|
@@ -20,11 +20,11 @@ See how your traffic improves over time and when your peak hours of business are
|
|
20 |
See Where Your Customers Spend Their Time
|
21 |

|
22 |
What pages do your customers look at and for how long? Where are they dropping off? Find out by tracking each individual customer and seeing their realtime behavior in your ecommerce store. Detailed path and page analysis reports for unique visitors include time on site, down to the second.</description>
|
23 |
-
<notes>
|
24 |
<authors><author><name>Lexity</name><user>lexity</user><email>support@lexity.com</email></author></authors>
|
25 |
-
<date>2012-05
|
26 |
-
<time>
|
27 |
-
<contents><target name="magelocal"><dir name="
|
28 |
<compatible/>
|
29 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
30 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Lexity_Live</name>
|
4 |
+
<version>1.1.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>BSD License</license>
|
7 |
<channel>community</channel>
|
20 |
See Where Your Customers Spend Their Time
|
21 |

|
22 |
What pages do your customers look at and for how long? Where are they dropping off? Find out by tracking each individual customer and seeing their realtime behavior in your ecommerce store. Detailed path and page analysis reports for unique visitors include time on site, down to the second.</description>
|
23 |
+
<notes>Support for installation of multiple Lexity extensions.</notes>
|
24 |
<authors><author><name>Lexity</name><user>lexity</user><email>support@lexity.com</email></author></authors>
|
25 |
+
<date>2012-08-05</date>
|
26 |
+
<time>02:35:03</time>
|
27 |
+
<contents><target name="magelocal"><dir name="LexityLive"><dir name="Block"><file name="Live.php" hash="eba95b73fc106ee5f16f79007900bce4"/></dir><dir name="Helper"><file name="Data.php" hash="81b07c4eb066f3f6ca74ac7f288ea3d1"/></dir><dir name="Model"><dir name="Core"><file name="Api.php" hash="0ca1f11c4dbd825832c0141d0a8103bf"/></dir><file name="Core.php" hash="94e43c47dbe3e1f9c4149506cfb7aa73"/><dir name="Order"><file name="Api.php" hash="793c3381f2b330162edff20d032aa87a"/></dir></dir><dir name="controllers"><file name="CoreController.php" hash="825255d558bf9b79877bb89d67c95153"/><file name="MarketingController.php" hash="2654936fd724a1c15b376cf3fa0be089"/></dir><dir name="etc"><file name="api.xml" hash="2839f8ced7d210be5d75616876de301b"/><file name="config.xml" hash="f747cf1797200f99cc1f66c6d924fd30"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="LexityLive.xml" hash="90f47f9fefe55580e1e77f118100c3a1"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="lexitylive"><file name="live.phtml" hash="b654ecf70b4e8c99658b15fe8bd6e990"/></dir></dir></dir></dir></dir></target></contents>
|
28 |
<compatible/>
|
29 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
30 |
</package>
|