Version Notes
.
Download this release
Release Info
Developer | Luke Davis |
Extension | Ventata_Connector |
Version | 1.1.0.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.0.0 to 1.1.0.0
- app/code/local/Ventata/Connector/Model/Order/Observer.php +1 -1
- package.xml +5 -5
- ventata.php +61 -0
app/code/local/Ventata/Connector/Model/Order/Observer.php
CHANGED
@@ -37,7 +37,7 @@ class Ventata_Connector_Model_Order_Observer extends Varien_Event_Observer
|
|
37 |
$data_string = json_encode($data);
|
38 |
$ch = curl_init();
|
39 |
|
40 |
-
$APIKey = Mage::getStoreConfig('ventata/orderhook_group/apikey',Mage::app()->getStore());;
|
41 |
|
42 |
$url = "https://api.ventata.com/orders?ApiKey=" . $APIKey;
|
43 |
|
37 |
$data_string = json_encode($data);
|
38 |
$ch = curl_init();
|
39 |
|
40 |
+
$APIKey = Mage::getStoreConfig('ventata/orderhook_group/apikey', Mage::app()->getStore());;
|
41 |
|
42 |
$url = "https://api.ventata.com/orders?ApiKey=" . $APIKey;
|
43 |
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Ventata_Connector</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license>MIT</license>
|
7 |
<channel>community</channel>
|
@@ -10,9 +10,9 @@
|
|
10 |
<description>Ventata Dynamic Pricing Software</description>
|
11 |
<notes>.</notes>
|
12 |
<authors><author><name>Luke Davis</name><user>ventata</user><email>ldavis@ventata.com</email></author></authors>
|
13 |
-
<date>2012-06-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magelocal"><dir name="Ventata"><dir name="Connector"><dir name="Helper"><file name="Data.php" hash="d2838df85bb8d15047db074dd6712ee1"/></dir><dir name="Model"><dir name="Order"><file name="Observer.php" hash="
|
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.
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Ventata_Connector</name>
|
4 |
+
<version>1.1.0.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>MIT</license>
|
7 |
<channel>community</channel>
|
10 |
<description>Ventata Dynamic Pricing Software</description>
|
11 |
<notes>.</notes>
|
12 |
<authors><author><name>Luke Davis</name><user>ventata</user><email>ldavis@ventata.com</email></author></authors>
|
13 |
+
<date>2012-06-04</date>
|
14 |
+
<time>01:41:07</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Ventata"><dir name="Connector"><dir name="Helper"><file name="Data.php" hash="d2838df85bb8d15047db074dd6712ee1"/></dir><dir name="Model"><dir name="Order"><file name="Observer.php" hash="05db5bdf96dbdb9b2d341b8d63a46f5c"/></dir><file name=".DS_Store" hash="4fd0cefc93be2b011f8fe45626f49faf"/></dir><dir name="etc"><file name="adminhtml.xml" hash="f8096b19be11130aebca410143f113b8"/><file name="config.xml" hash="aaf8535f1531ebca1c67f32c3bc1dbea"/><file name="system.xml" hash="ff3404073be3003636259b4bba99ebf6"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ventata_Connector.xml" hash="b88dfd737477ad81895d153fd3a41106"/></dir></target><target name="mage"><dir name="."><file name="ventata.php" hash="06b4891d1e854fb66a5b39b46c3ef124"/></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.4.0.0</min><max>1.7</max></package></required></dependencies>
|
18 |
</package>
|
ventata.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require 'app/Mage.php';
|
4 |
+
umask(0);
|
5 |
+
try {
|
6 |
+
$app = Mage::app('default');
|
7 |
+
$ventataApiKey = $_GET['APIKey'];
|
8 |
+
$magentoApiKey = $_GET['MagentoKey'];
|
9 |
+
|
10 |
+
Mage::getModel('core/config')->saveConfig('ventata/orderhook_group/apikey', $ventataApiKey );
|
11 |
+
|
12 |
+
$user = Mage::getModel('api/user')->loadByUsername('VentataConnector');
|
13 |
+
if(!$user || !$user->getId()) {
|
14 |
+
$role = Mage::getModel('api/roles')
|
15 |
+
->setName('Ventata')
|
16 |
+
->setPid(false)
|
17 |
+
->setRoleType('G')
|
18 |
+
->save();
|
19 |
+
|
20 |
+
|
21 |
+
Mage::getModel('api/rules')
|
22 |
+
->setRoleId($role->getId())
|
23 |
+
->setResources(array('all'))
|
24 |
+
->saveRel();
|
25 |
+
|
26 |
+
|
27 |
+
$user = Mage::getModel('api/user');
|
28 |
+
$user->setData(array(
|
29 |
+
'username' => 'VentataConnector',
|
30 |
+
'firstname' => 'Ventata',
|
31 |
+
'lastname' => 'Connector',
|
32 |
+
'email' => 'magento@ventata.com',
|
33 |
+
'api_key' => $magentoApiKey,
|
34 |
+
'api_key_confirmation' => $magentoApiKey,
|
35 |
+
'is_active' => 1,
|
36 |
+
'user_roles' => '',
|
37 |
+
'assigned_user_role' => '',
|
38 |
+
'role_name' => '',
|
39 |
+
'roles' => array($role->getId())
|
40 |
+
));
|
41 |
+
|
42 |
+
$user->save()->load($user->getId());
|
43 |
+
|
44 |
+
$user->setRoleIds(array($role->getId()))
|
45 |
+
->setRoleUserId($user->getUserId())
|
46 |
+
->saveRelations();
|
47 |
+
|
48 |
+
$rules = Mage::getModel('api/rules')->getCollection()
|
49 |
+
->addFieldToFilter('role_id', $role->getId());
|
50 |
+
|
51 |
+
foreach($rules as $rule) {
|
52 |
+
$rule->setApiPermission('allow');
|
53 |
+
}
|
54 |
+
$rules->save();
|
55 |
+
}
|
56 |
+
|
57 |
+
echo "Successfull";
|
58 |
+
|
59 |
+
} catch (Exception $e) {
|
60 |
+
Mage::printException($e);
|
61 |
+
}
|