QuickLicenseManager - Version 1.0.1

Version Notes

First Release.

Download this release

Release Info

Developer Soraco Technologies
Extension QuickLicenseManager
Version 1.0.1
Comparing to
See all releases


Version 1.0.1

app/code/local/Soraco/Qlm/Helper/Data.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Soraco_Qlm_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ public function generatekeydata($pid,$licparameter,$parameter){
5
+
6
+ $api_url = Mage::getStoreConfig('soraco_qlm/qlm_group/qlm_apiurl',Mage::app()->getStore());
7
+ $api_vendor = Mage::getStoreConfig('soraco_qlm/qlm_group/qlm_isvendor',Mage::app()->getStore());
8
+
9
+ $key = "";
10
+ if($pid){
11
+ $input_xml = '<?xml version="1.0" encoding="UTF-8"?><ecommerce>';
12
+ foreach($parameter as $key=>$val){
13
+ $input_xml .= '<'.$key.'>'.$val.'</'.$key.'>';
14
+ }
15
+ $input_xml .= '</ecommerce>';
16
+
17
+ $url = $api_url."/GetActivationKeyWithExpiryDate?is_vendor=magento".$licparameter;
18
+
19
+ $ch = curl_init();
20
+ curl_setopt($ch, CURLOPT_URL, $url);
21
+ curl_setopt($ch, CURLOPT_POSTFIELDS,"xmlRequest=" . $input_xml);
22
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
23
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 300);
24
+ $result = curl_exec($ch);
25
+ curl_close($ch);
26
+
27
+ $key = $result;
28
+
29
+ }
30
+ return $key;
31
+ }
32
+ }
33
+
app/code/local/Soraco/Qlm/Model/Observer.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Soraco_Qlm_Model_Observer {
3
+
4
+ public function setgeneratedKey(Varien_Event_Observer $observer)
5
+ {
6
+ $order = $observer->getEvent()->getOrder();
7
+
8
+ if( $order->getId() ) {
9
+
10
+ $data = $order->getBillingAddress()->getData();
11
+
12
+ $parameter = array();
13
+ $parameter["OrderId"] = $order->getId();
14
+ $parameter["ReceiptId"] = $order->getIncrementId();
15
+ $parameter["Customer_Name"] = $order->getCustomerFirstname() ." ".$order->getCustomerLastname();
16
+ $parameter["Customer_Email"] = $order->getCustomerEmail();
17
+ $parameter["Customer_Company"] = $data["company"];
18
+ $parameter["Customer_Address1"] = $data["city"];
19
+ $parameter["Customer_Address2"] = $data["street"];
20
+ $parameter["Customer_City"] = $data["city"];
21
+ $parameter["Customer_State"] = $data["region"];
22
+ $parameter["Customer_Zip"] = $data["postcode"];
23
+ $parameter["Customer_Country"] = $data["country_id"];
24
+ $parameter["Customer_Phone"] = $data["telephone"];
25
+ $parameter["is_quantity"] = 1;
26
+ $parameter["yearly_maintenance_plan"] = 1;
27
+
28
+ foreach( $order->getAllVisibleItems() as $item ) {
29
+ $pid = $item->getProductId();
30
+
31
+ $coll = Mage::getModel('catalog/product')->load($pid);
32
+ $licparameter = $coll->getLicparameter();
33
+
34
+ $parameter["is_quantity"] = $item->getQtyOrdered();
35
+
36
+ $keyid = Mage::helper("soraco_qlm")->generatekeydata($pid,$licparameter,$parameter);
37
+
38
+ $existentOptions = $item->getProductOptions();
39
+ if (!isset($existentOptions['additional_options'])) {
40
+ $existentOptions['additional_options'] = array();
41
+ }
42
+
43
+ if($keyid!="")
44
+ {
45
+ $existentOptions['additional_options'][] = array(
46
+ 'label' => 'Licence Key',
47
+ 'value' => $keyid,
48
+ 'print_value' => $keyid
49
+ );
50
+ $item->setProductOptions($existentOptions);
51
+ }
52
+ }
53
+ }
54
+
55
+ }
56
+ }
app/code/local/Soraco/Qlm/controllers/IndexController.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Soraco_Qlm_IndexController extends Mage_Core_Controller_Front_Action{
3
+
4
+ public function IndexAction(){
5
+
6
+ }
7
+
8
+
9
+ }
app/code/local/Soraco/Qlm/etc/config.xml ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Soraco_Qlm>
5
+ <version>1.0.0</version>
6
+ </Soraco_Qlm>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <soraco_qlm>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Soraco_Qlm</module>
14
+ <frontName>soraco_qlm</frontName>
15
+ </args>
16
+ </soraco_qlm>
17
+ </routers>
18
+ <events>
19
+ <sales_order_place_after>
20
+ <observers>
21
+ <setgenerated_key_product>
22
+ <class>Soraco_Qlm_Model_Observer</class>
23
+ <method>setgeneratedKey</method>
24
+ </setgenerated_key_product>
25
+ </observers>
26
+ </sales_order_place_after>
27
+ </events>
28
+ </frontend>
29
+ <global>
30
+ <models>
31
+ <soraco_qlm>
32
+ <class>Soraco_Qlm_Model</class>
33
+ </soraco_qlm>
34
+ </models>
35
+
36
+ <helpers>
37
+ <soraco_qlm>
38
+ <class>Soraco_Qlm_Helper</class>
39
+ </soraco_qlm>
40
+ </helpers>
41
+
42
+ <resources>
43
+ <soraco_qlm_setup>
44
+ <setup>
45
+ <module>Soraco_Qlm</module>
46
+ </setup>
47
+ <connection>
48
+ <use>core_setup</use>
49
+ </connection>
50
+ </soraco_qlm_setup>
51
+ <soraco_qlm_write>
52
+ <connection>
53
+ <use>core_write</use>
54
+ </connection>
55
+ </soraco_qlm_write>
56
+ <soraco_qlm_read>
57
+ <connection>
58
+ <use>core_read</use>
59
+ </connection>
60
+ </soraco_qlm_read>
61
+ </resources>
62
+ </global>
63
+
64
+ <adminhtml>
65
+ <acl>
66
+ <resources>
67
+ <all>
68
+ <title>Allow Everything</title>
69
+ </all>
70
+ <admin>
71
+ <children>
72
+ <system>
73
+ <children>
74
+ <config>
75
+ <children>
76
+ <soraco_qlm>
77
+ <title>QLM - All</title>
78
+ </soraco_qlm>
79
+ </children>
80
+ </config>
81
+ </children>
82
+ </system>
83
+ </children>
84
+ </admin>
85
+ </resources>
86
+ </acl>
87
+ </adminhtml>
88
+ </config>
app/code/local/Soraco/Qlm/etc/system.xml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <tabs>
4
+ <qlm translate="label" module="soraco_qlm">
5
+ <label>QLM</label>
6
+ <sort_order>0</sort_order>
7
+ </qlm>
8
+ </tabs>
9
+ <sections>
10
+ <soraco_qlm translate="label" module="soraco_qlm">
11
+ <label>General</label>
12
+ <tab>qlm</tab>
13
+ <sort_order>1000</sort_order>
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+ <show_in_store>1</show_in_store>
17
+
18
+ <groups>
19
+ <qlm_group translate="label" module="soraco_qlm">
20
+ <label>Settings</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>1000</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+
27
+ <fields>
28
+ <qlm_apiurl translate="label">
29
+ <label>License Server Url: </label>
30
+ <comment>*Mandatory</comment>
31
+ <frontend_type>text</frontend_type>
32
+ <sort_order>20</sort_order>
33
+ <show_in_default>1</show_in_default>
34
+ <show_in_website>1</show_in_website>
35
+ <show_in_store>1</show_in_store>
36
+ </qlm_apiurl>
37
+ </fields>
38
+ </qlm_group>
39
+ </groups>
40
+ </soraco_qlm>
41
+ </sections>
42
+ </config>
app/code/local/Soraco/Qlm/sql/soraco_qlm_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = new Mage_Eav_Model_Entity_Setup('core_setup');
3
+ $installer->startSetup();
4
+
5
+ $installer->addAttribute('catalog_product', 'licparameter', array(
6
+ 'type' => 'varchar',
7
+ 'backend' => '',
8
+ 'frontend' => '',
9
+ 'label' => 'QLM Settings',
10
+ 'input' => 'text',
11
+ 'class' => '',
12
+ 'source' => '',
13
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
14
+ 'visible' => false,
15
+ 'required' => false,
16
+ 'user_defined' => false,
17
+ 'default' => '',
18
+ 'searchable' => false,
19
+ 'filterable' => false,
20
+ 'comparable' => false,
21
+ 'visible_on_front' => false,
22
+ 'unique' => false,
23
+ 'apply_to' => '',
24
+ 'is_configurable' => false
25
+ ));
26
+
27
+ $installer->endSetup();
28
+
app/etc/modules/Soraco_Qlm.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Soraco_Qlm>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ <version>1.0.0</version>
8
+ </Soraco_Qlm>
9
+ </modules>
10
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>QuickLicenseManager</name>
4
+ <version>1.0.1</version>
5
+ <stability>stable</stability>
6
+ <license uri="https://opensource.org/licenses/lgpl-license">LGPL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Integration of Quick License Manager with Magento</summary>
10
+ <description>Automatically generate and email a license key to your customer when an order is placed via Magento.</description>
11
+ <notes>First Release.</notes>
12
+ <authors><author><name>Soraco Technologies</name><user>soraco</user><email>ralph@soraco.co</email></author></authors>
13
+ <date>2017-02-19</date>
14
+ <time>14:01:38</time>
15
+ <contents><target name="magelocal"><dir name="Soraco"><dir name="Qlm"><dir name="Helper"><file name="Data.php" hash="a57fcc28de8d31eb65b13b66818bcf81"/></dir><dir name="Model"><file name="Observer.php" hash="6022d42249bb1e80b4125e9567349cfb"/></dir><dir name="controllers"><file name="IndexController.php" hash="cb53d827f738050e0c6bc0a0ed0595c5"/></dir><dir name="etc"><file name="config.xml" hash="9290adf97b1784581523f8b9b4d161c1"/><file name="system.xml" hash="45d020bf56efceb0bf8c984ae81205d3"/></dir><dir name="sql"><dir name="soraco_qlm_setup"><file name="mysql4-install-0.1.0.php" hash="0e8ebc44878479cd35bc3562731622ad"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Soraco_Qlm.xml" hash="cf228883649a589dd371d304591135c3"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>7.0.0</max></php></required></dependencies>
18
+ </package>