Version Notes
Create API user for use in Zenstores.
Download this release
Release Info
Developer | Zenstores |
Extension | Zenstores_Core |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Zenstores/Core/Block/Button.php +26 -0
- app/code/community/Zenstores/Core/Block/Description.php +35 -0
- app/code/community/Zenstores/Core/Block/Logo.php +39 -0
- app/code/community/Zenstores/Core/Block/Text/Endpoint.php +20 -0
- app/code/community/Zenstores/Core/Block/Text/Key.php +32 -0
- app/code/community/Zenstores/Core/Block/Text/Username.php +24 -0
- app/code/community/Zenstores/Core/Helper/Data.php +151 -0
- app/code/community/Zenstores/Core/controllers/Adminhtml/ZenstoresController.php +23 -0
- app/code/community/Zenstores/Core/etc/adminhtml.xml +31 -0
- app/code/community/Zenstores/Core/etc/config.xml +47 -0
- app/code/community/Zenstores/Core/etc/system.xml +88 -0
- app/code/community/Zenstores/Core/sql/zenstores_core_setup/install-1.0.0.php +20 -0
- app/code/community/Zenstores/Core/sql/zenstores_core_setup/mysql4-install-1.0.0.php +20 -0
- app/etc/modules/Zenstores_Core.xml +21 -0
- package.xml +18 -0
app/code/community/Zenstores/Core/Block/Button.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Zenstores Button Block
|
4 |
+
*
|
5 |
+
* @category Zenstores
|
6 |
+
* @package Zenstores_Core
|
7 |
+
* @copyright Copyright (c) 2015 Mechfeed Ltd (Zenstores) (https://www.zenstores.com/)
|
8 |
+
*/
|
9 |
+
class Zenstores_Core_Block_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
|
10 |
+
{
|
11 |
+
protected function _getElementHtml($element)
|
12 |
+
{
|
13 |
+
$elementData = $element->getData();
|
14 |
+
|
15 |
+
$this->setElement($element);
|
16 |
+
|
17 |
+
$url = Mage::helper("adminhtml")->getUrl('zenstores_core_admin/adminhtml_zenstores');
|
18 |
+
|
19 |
+
$html = $this->getLayout()->createBlock('adminhtml/widget_button')
|
20 |
+
->setLabel($elementData['original_data']['button_label'])
|
21 |
+
->setOnClick("setLocation('$url'); return false;")
|
22 |
+
->toHtml();
|
23 |
+
|
24 |
+
return $html;
|
25 |
+
}
|
26 |
+
}
|
app/code/community/Zenstores/Core/Block/Description.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Zenstores Description Block
|
4 |
+
*
|
5 |
+
* @category Zenstores
|
6 |
+
* @package Zenstores_Core
|
7 |
+
* @copyright Copyright (c) 2015 Mechfeed Ltd (Zenstores) (https://www.zenstores.com/)
|
8 |
+
*/
|
9 |
+
class Zenstores_Core_Block_Description extends Mage_Adminhtml_Block_System_Config_Form_Field
|
10 |
+
{
|
11 |
+
protected function _getElementHtml($element)
|
12 |
+
{
|
13 |
+
$elementData = $element->getData();
|
14 |
+
|
15 |
+
$this->setData('zenstores_description', $elementData['original_data']['description']);
|
16 |
+
|
17 |
+
return $this->toHtml();
|
18 |
+
}
|
19 |
+
|
20 |
+
protected function _toHtml()
|
21 |
+
{
|
22 |
+
$html = $this->getBeforeHtml().'<span '
|
23 |
+
. ($this->getId()?' id="'.$this->getId() . '"':'')
|
24 |
+
. ($this->getTitle()?' title="'.Mage::helper('core')->quoteEscape($this->getTitle()) . '"':'')
|
25 |
+
. ' class="scalable ' . $this->getClass() . ($this->getDisabled() ? ' disabled' : '') . '"'
|
26 |
+
. ' onclick="'.$this->getOnClick().'"'
|
27 |
+
. ' style="'.$this->getStyle() .'"'
|
28 |
+
. ($this->getDisabled() ? ' disabled="disabled"' : '')
|
29 |
+
. ($this->getSrc()?' src="'.$this->getSrc() . '"':'')
|
30 |
+
. ($this->getAlt()?' alt="'.$this->getAlt() . '"':'')
|
31 |
+
. '>'. $this->getData('zenstores_description') .'</span>'.$this->getAfterHtml();
|
32 |
+
|
33 |
+
return $html;
|
34 |
+
}
|
35 |
+
}
|
app/code/community/Zenstores/Core/Block/Logo.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Zenstores Logo Block
|
4 |
+
*
|
5 |
+
* @category Zenstores
|
6 |
+
* @package Zenstores_Core
|
7 |
+
* @copyright Copyright (c) 2015 Mechfeed Ltd (Zenstores) (https://www.zenstores.com/)
|
8 |
+
*/
|
9 |
+
class Zenstores_Core_Block_Logo extends Mage_Adminhtml_Block_System_Config_Form_Field
|
10 |
+
{
|
11 |
+
protected function _getElementHtml($element)
|
12 |
+
{
|
13 |
+
$elementData = $element->getData();
|
14 |
+
|
15 |
+
$this->setData('zenstores_img_url', $elementData['original_data']['img_url']);
|
16 |
+
$this->setData('zenstores_img_src', $elementData['original_data']['img_src']);
|
17 |
+
$this->setData('zenstores_img_alt', $elementData['original_data']['img_alt']);
|
18 |
+
|
19 |
+
$this->setStyle('width: ' . $elementData['original_data']['img_width'] . 'px;');
|
20 |
+
|
21 |
+
return $this->toHtml();
|
22 |
+
}
|
23 |
+
|
24 |
+
protected function _toHtml()
|
25 |
+
{
|
26 |
+
$html = $this->getBeforeHtml().'<a target="_blank" href="' . $this->getData('zenstores_img_url') . '"><img '
|
27 |
+
. ($this->getId()?' id="'.$this->getId() . '"':'')
|
28 |
+
. ($this->getTitle()?' title="'.Mage::helper('core')->quoteEscape($this->getTitle()) . '"':'')
|
29 |
+
. ' class="scalable ' . $this->getClass() . ($this->getDisabled() ? ' disabled' : '') . '"'
|
30 |
+
. ' onclick="'.$this->getOnClick().'"'
|
31 |
+
. ' style="'.$this->getStyle() .'"'
|
32 |
+
. ($this->getDisabled() ? ' disabled="disabled"' : '')
|
33 |
+
. ($this->getData('zenstores_img_src') ? ' src="'. $this->getData('zenstores_img_src') . '"':'')
|
34 |
+
. ($this->getData('zenstores_img_alt') ? ' alt="'. $this->getData('zenstores_img_alt') . '"':'')
|
35 |
+
. ' /></a>'.$this->getAfterHtml();
|
36 |
+
|
37 |
+
return $html;
|
38 |
+
}
|
39 |
+
}
|
app/code/community/Zenstores/Core/Block/Text/Endpoint.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Zenstores API Endpoint Text Block
|
4 |
+
*
|
5 |
+
* @category Zenstores
|
6 |
+
* @package Zenstores_Core
|
7 |
+
* @copyright Copyright (c) 2015 Mechfeed Ltd (Zenstores) (https://www.zenstores.com/)
|
8 |
+
*/
|
9 |
+
class Zenstores_Core_Block_Text_Endpoint extends Mage_Adminhtml_Block_System_Config_Form_Field
|
10 |
+
{
|
11 |
+
protected function _getElementHtml($element)
|
12 |
+
{
|
13 |
+
$element->setReadonly(true);
|
14 |
+
|
15 |
+
// SOAP API Endpoint
|
16 |
+
$element->setValue(Mage::getUrl('api/v2_soap', array('_query' => array('wsdl' => 1))));
|
17 |
+
|
18 |
+
return parent::_getElementHtml($element);
|
19 |
+
}
|
20 |
+
}
|
app/code/community/Zenstores/Core/Block/Text/Key.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Zenstores API Key Text Block
|
4 |
+
*
|
5 |
+
* @category Zenstores
|
6 |
+
* @package Zenstores_Core
|
7 |
+
* @copyright Copyright (c) 2015 Mechfeed Ltd (Zenstores) (https://www.zenstores.com/)
|
8 |
+
*/
|
9 |
+
class Zenstores_Core_Block_Text_Key extends Mage_Adminhtml_Block_System_Config_Form_Field
|
10 |
+
{
|
11 |
+
protected function _getElementHtml($element)
|
12 |
+
{
|
13 |
+
$element->setReadonly(true);
|
14 |
+
|
15 |
+
$apiKey = Mage::getStoreConfig('zenstores_core/config/apikey');
|
16 |
+
$keyModified = Mage::getStoreConfig('zenstores_core/config/apikey_modified');
|
17 |
+
|
18 |
+
$element->setValue($apiKey);
|
19 |
+
|
20 |
+
/** @var Zenstores_Core_Helper_Data $zenstoresHelper */
|
21 |
+
$zenstoresHelper = Mage::helper('zenstores_core');
|
22 |
+
|
23 |
+
$apiUser = $zenstoresHelper->getApiUser();
|
24 |
+
|
25 |
+
// Check whether a user has not changed API user directly from Magento interface
|
26 |
+
if (strtotime($apiUser->getModified()) > strtotime($keyModified)) {
|
27 |
+
$element->setComment('API Key is not guaranteed to be correct');
|
28 |
+
}
|
29 |
+
|
30 |
+
return parent::_getElementHtml($element);
|
31 |
+
}
|
32 |
+
}
|
app/code/community/Zenstores/Core/Block/Text/Username.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Zenstores API Username Text Block
|
4 |
+
*
|
5 |
+
* @category Zenstores
|
6 |
+
* @package Zenstores_Core
|
7 |
+
* @copyright Copyright (c) 2015 Mechfeed Ltd (Zenstores) (https://www.zenstores.com/)
|
8 |
+
*/
|
9 |
+
class Zenstores_Core_Block_Text_Username extends Mage_Adminhtml_Block_System_Config_Form_Field
|
10 |
+
{
|
11 |
+
protected function _getElementHtml($element)
|
12 |
+
{
|
13 |
+
$element->setReadonly(true);
|
14 |
+
|
15 |
+
/** @var Zenstores_Core_Helper_Data $zenstoresHelper */
|
16 |
+
$zenstoresHelper = Mage::helper('zenstores_core');
|
17 |
+
|
18 |
+
$apiUser = $zenstoresHelper->getApiUser();
|
19 |
+
|
20 |
+
$element->setValue($apiUser->getUsername());
|
21 |
+
|
22 |
+
return parent::_getElementHtml($element);
|
23 |
+
}
|
24 |
+
}
|
app/code/community/Zenstores/Core/Helper/Data.php
ADDED
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Zenstores
|
4 |
+
*
|
5 |
+
* @category Zenstores
|
6 |
+
* @package Zenstores_Core
|
7 |
+
* @copyright Copyright (c) 2015 Mechfeed Ltd (Zenstores) (https://www.zenstores.com/)
|
8 |
+
*/
|
9 |
+
class Zenstores_Core_Helper_Data extends Mage_Payment_Helper_Data
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Get zenstores user
|
13 |
+
*
|
14 |
+
* @return Mage_Api_Model_User
|
15 |
+
*/
|
16 |
+
public function getApiUser()
|
17 |
+
{
|
18 |
+
/** @var Mage_Api_Model_User $apiUser */
|
19 |
+
$apiUser = Mage::getModel('api/user');
|
20 |
+
|
21 |
+
$apiUser->loadByUsername('zenstores');
|
22 |
+
|
23 |
+
return $apiUser;
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Generate new API Key for zenstores user
|
28 |
+
*
|
29 |
+
* @return string
|
30 |
+
*/
|
31 |
+
public function generateApiKey()
|
32 |
+
{
|
33 |
+
/** @var Mage_Core_Helper_Data $coreHelper */
|
34 |
+
$coreHelper = Mage::helper('core');
|
35 |
+
|
36 |
+
$apiKey = $coreHelper->getRandomString(40);
|
37 |
+
|
38 |
+
/** @var Mage_Core_Model_Config $coreConfig */
|
39 |
+
$coreConfig = Mage::getModel('core/config');
|
40 |
+
|
41 |
+
$apiUser = $this->getApiUser();
|
42 |
+
|
43 |
+
if ($apiUser->getId()) {
|
44 |
+
$apiUser->setApiKey($apiKey)->save();
|
45 |
+
}
|
46 |
+
|
47 |
+
$modifiedDateTime = Mage::getModel('core/date')->gmtDate();
|
48 |
+
|
49 |
+
$coreConfig->saveConfig('zenstores_core/config/apikey', $apiKey);
|
50 |
+
$coreConfig->saveConfig('zenstores_core/config/apikey_modified', $modifiedDateTime);
|
51 |
+
|
52 |
+
// Clean config cache
|
53 |
+
Mage::app()->getCacheInstance()->cleanType('config');
|
54 |
+
|
55 |
+
return $apiKey;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Create API Role and related rules
|
60 |
+
*
|
61 |
+
* @return Mage_Api_Model_Role
|
62 |
+
* @throws Exception
|
63 |
+
*/
|
64 |
+
protected function createApiRole()
|
65 |
+
{
|
66 |
+
/** @var Mage_Api_Model_Role $apiRole */
|
67 |
+
$apiRole = Mage::getModel('api/role');
|
68 |
+
|
69 |
+
$apiRole->setRoleName('Zenstores API')
|
70 |
+
->setParentId(0)
|
71 |
+
->setRoleType('G')
|
72 |
+
->save();
|
73 |
+
|
74 |
+
/** @var Mage_Api_Model_Rules $apiRules */
|
75 |
+
$apiRules = Mage::getModel('api/rules');
|
76 |
+
|
77 |
+
$apiRules->setRoleId($apiRole->getId())
|
78 |
+
->setResources(array(
|
79 |
+
'customer',
|
80 |
+
'customer/create',
|
81 |
+
'customer/update',
|
82 |
+
'customer/delete',
|
83 |
+
'customer/info',
|
84 |
+
'customer/address',
|
85 |
+
'customer/address/create',
|
86 |
+
'customer/address/update',
|
87 |
+
'customer/address/delete',
|
88 |
+
'customer/address/info',
|
89 |
+
'sales',
|
90 |
+
'sales/order',
|
91 |
+
'sales/order/change',
|
92 |
+
'sales/order/info',
|
93 |
+
'sales/order/shipment',
|
94 |
+
'sales/order/shipment/create',
|
95 |
+
'sales/order/shipment/comment',
|
96 |
+
'sales/order/shipment/track',
|
97 |
+
'sales/order/shipment/info',
|
98 |
+
'sales/order/shipment/send',
|
99 |
+
'sales/order/invoice',
|
100 |
+
'sales/order/invoice/create',
|
101 |
+
'sales/order/invoice/comment',
|
102 |
+
'sales/order/invoice/capture',
|
103 |
+
'sales/order/invoice/void',
|
104 |
+
'sales/order/invoice/cancel',
|
105 |
+
'sales/order/invoice/info',
|
106 |
+
'sales/order/creditmemo',
|
107 |
+
'sales/order/creditmemo/create',
|
108 |
+
'sales/order/creditmemo/comment',
|
109 |
+
'sales/order/creditmemo/cancel',
|
110 |
+
'sales/order/creditmemo/info',
|
111 |
+
'sales/order/creditmemo/list',
|
112 |
+
))
|
113 |
+
->saveRel();
|
114 |
+
|
115 |
+
return $apiRole;
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Create API User
|
120 |
+
*
|
121 |
+
* @return Mage_Api_Model_User
|
122 |
+
*/
|
123 |
+
public function createApiUser()
|
124 |
+
{
|
125 |
+
$apiUser = $this->getApiUser();
|
126 |
+
|
127 |
+
if ($apiUser->getId()) {
|
128 |
+
return $apiUser;
|
129 |
+
}
|
130 |
+
|
131 |
+
$apiRole = $this->createApiRole();
|
132 |
+
|
133 |
+
$apiUser->setData(array(
|
134 |
+
'username' => 'zenstores',
|
135 |
+
'firstname' => 'zenstores',
|
136 |
+
'lastname' => 'zenstores',
|
137 |
+
'email' => 'support@zenstores.com',
|
138 |
+
'is_active' => 1,
|
139 |
+
));
|
140 |
+
|
141 |
+
$apiUser->save();
|
142 |
+
|
143 |
+
$apiUser->setRoleIds(array($apiRole->getId()))
|
144 |
+
->setRoleUserId($apiUser->getUserId())
|
145 |
+
->saveRelations();
|
146 |
+
|
147 |
+
$this->generateApiKey();
|
148 |
+
|
149 |
+
return $apiUser;
|
150 |
+
}
|
151 |
+
}
|
app/code/community/Zenstores/Core/controllers/Adminhtml/ZenstoresController.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Zenstores Controller
|
4 |
+
*
|
5 |
+
* @category Zenstores
|
6 |
+
* @package Zenstores_Core
|
7 |
+
* @copyright Copyright (c) 2015 Mechfeed Ltd (Zenstores) (https://www.zenstores.com/)
|
8 |
+
*/
|
9 |
+
class Zenstores_Core_Adminhtml_ZenstoresController extends Mage_Adminhtml_Controller_Action
|
10 |
+
{
|
11 |
+
public function indexAction()
|
12 |
+
{
|
13 |
+
/** @var Zenstores_Core_Helper_Data $zenstoresHelper */
|
14 |
+
$zenstoresHelper = Mage::helper('zenstores_core');
|
15 |
+
|
16 |
+
$zenstoresHelper->generateApiKey();
|
17 |
+
|
18 |
+
// Redirect back to Zenstores extension configuration
|
19 |
+
Mage::app()->getResponse()->setRedirect(
|
20 |
+
Mage::helper('adminhtml')->getUrl('adminhtml/system_config/edit/section/zenstores_core')
|
21 |
+
);
|
22 |
+
}
|
23 |
+
}
|
app/code/community/Zenstores/Core/etc/adminhtml.xml
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Zenstores
|
5 |
+
*
|
6 |
+
* @category Zenstores
|
7 |
+
* @package Zenstores_Core
|
8 |
+
* @copyright Copyright (c) 2015 Mechfeed Ltd (Zenstores) (https://www.zenstores.com/)
|
9 |
+
*/
|
10 |
+
-->
|
11 |
+
<config>
|
12 |
+
<acl>
|
13 |
+
<resources>
|
14 |
+
<admin>
|
15 |
+
<children>
|
16 |
+
<system>
|
17 |
+
<children>
|
18 |
+
<config>
|
19 |
+
<children>
|
20 |
+
<zenstores_core translate="title">
|
21 |
+
<title>Zenstores</title>
|
22 |
+
</zenstores_core>
|
23 |
+
</children>
|
24 |
+
</config>
|
25 |
+
</children>
|
26 |
+
</system>
|
27 |
+
</children>
|
28 |
+
</admin>
|
29 |
+
</resources>
|
30 |
+
</acl>
|
31 |
+
</config>
|
app/code/community/Zenstores/Core/etc/config.xml
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Zenstores
|
5 |
+
*
|
6 |
+
* @category Zenstores
|
7 |
+
* @package Zenstores_Core
|
8 |
+
* @copyright Copyright (c) 2015 Mechfeed Ltd (Zenstores) (https://www.zenstores.com/)
|
9 |
+
*/
|
10 |
+
-->
|
11 |
+
<config>
|
12 |
+
<modules>
|
13 |
+
<Zenstores_Core>
|
14 |
+
<version>1.0.0</version>
|
15 |
+
</Zenstores_Core>
|
16 |
+
</modules>
|
17 |
+
<global>
|
18 |
+
<helpers>
|
19 |
+
<zenstores_core>
|
20 |
+
<class>Zenstores_Core_Helper</class>
|
21 |
+
</zenstores_core>
|
22 |
+
</helpers>
|
23 |
+
<resources>
|
24 |
+
<zenstores_core_setup>
|
25 |
+
<setup>
|
26 |
+
<module>Zenstores_Core</module>
|
27 |
+
</setup>
|
28 |
+
</zenstores_core_setup>
|
29 |
+
</resources>
|
30 |
+
<blocks>
|
31 |
+
<resources>
|
32 |
+
<class>Zenstores_Core_Block</class>
|
33 |
+
</resources>
|
34 |
+
</blocks>
|
35 |
+
</global>
|
36 |
+
<admin>
|
37 |
+
<routers>
|
38 |
+
<zenstores_core_admin>
|
39 |
+
<use>admin</use>
|
40 |
+
<args>
|
41 |
+
<module>Zenstores_Core</module>
|
42 |
+
<frontName>zenstores_core_admin</frontName>
|
43 |
+
</args>
|
44 |
+
</zenstores_core_admin>
|
45 |
+
</routers>
|
46 |
+
</admin>
|
47 |
+
</config>
|
app/code/community/Zenstores/Core/etc/system.xml
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Zenstores
|
5 |
+
*
|
6 |
+
* @category Zenstores
|
7 |
+
* @package Zenstores_Core
|
8 |
+
* @copyright Copyright (c) 2015 Mechfeed Ltd (Zenstores) (https://www.zenstores.com/)
|
9 |
+
*/
|
10 |
+
-->
|
11 |
+
<config>
|
12 |
+
<sections>
|
13 |
+
<zenstores_core translate="label" module="zenstores_core">
|
14 |
+
<label>Zenstores API Access</label>
|
15 |
+
<tab>service</tab>
|
16 |
+
<frontend_type>text</frontend_type>
|
17 |
+
<sort_order>1000</sort_order>
|
18 |
+
<show_in_default>1</show_in_default>
|
19 |
+
<show_in_website>1</show_in_website>
|
20 |
+
<show_in_store>1</show_in_store>
|
21 |
+
<groups>
|
22 |
+
<api translate="label">
|
23 |
+
<label>Zenstores API Access</label>
|
24 |
+
<frontend_type>text</frontend_type>
|
25 |
+
<sort_order>300</sort_order>
|
26 |
+
<show_in_default>1</show_in_default>
|
27 |
+
<show_in_website>0</show_in_website>
|
28 |
+
<show_in_store>0</show_in_store>
|
29 |
+
<expanded>1</expanded>
|
30 |
+
<fields>
|
31 |
+
<logo translate="label">
|
32 |
+
<img_src>https://zenstores.com/static/images/zenstores-logo@2x.png</img_src>
|
33 |
+
<img_alt>Zenstores</img_alt>
|
34 |
+
<img_url>https://www.zenstores.com/?utm_source=magento-extension&utm_medium=banner&utm_campaign=Magento%20Extension%20Logo%20Link</img_url>
|
35 |
+
<img_width>255</img_width>
|
36 |
+
<frontend_model>resources/logo</frontend_model>
|
37 |
+
<sort_order>10</sort_order>
|
38 |
+
<show_in_default>1</show_in_default>
|
39 |
+
<show_in_website>0</show_in_website>
|
40 |
+
<show_in_store>0</show_in_store>
|
41 |
+
</logo>
|
42 |
+
<description translate="label">
|
43 |
+
<description>Lorem ipsum</description>
|
44 |
+
<frontend_model>resources/description</frontend_model>
|
45 |
+
<sort_order>20</sort_order>
|
46 |
+
<show_in_default>1</show_in_default>
|
47 |
+
<show_in_website>0</show_in_website>
|
48 |
+
<show_in_store>0</show_in_store>
|
49 |
+
</description>
|
50 |
+
<username translate="label">
|
51 |
+
<label>API Username</label>
|
52 |
+
<frontend_model>resources/text_username</frontend_model>
|
53 |
+
<sort_order>30</sort_order>
|
54 |
+
<show_in_default>1</show_in_default>
|
55 |
+
<show_in_website>0</show_in_website>
|
56 |
+
<show_in_store>0</show_in_store>
|
57 |
+
</username>
|
58 |
+
<key translate="label">
|
59 |
+
<label>API Key</label>
|
60 |
+
<frontend_model>resources/text_key</frontend_model>
|
61 |
+
<disabled>1</disabled>
|
62 |
+
<sort_order>40</sort_order>
|
63 |
+
<show_in_default>1</show_in_default>
|
64 |
+
<show_in_website>0</show_in_website>
|
65 |
+
<show_in_store>0</show_in_store>
|
66 |
+
</key>
|
67 |
+
<endpoint translate="label">
|
68 |
+
<label>API Endpoint</label>
|
69 |
+
<frontend_model>resources/text_endpoint</frontend_model>
|
70 |
+
<sort_order>50</sort_order>
|
71 |
+
<show_in_default>1</show_in_default>
|
72 |
+
<show_in_website>0</show_in_website>
|
73 |
+
<show_in_store>0</show_in_store>
|
74 |
+
</endpoint>
|
75 |
+
<generate translate="label">
|
76 |
+
<button_label>Generate Key</button_label>
|
77 |
+
<frontend_model>resources/button</frontend_model>
|
78 |
+
<sort_order>60</sort_order>
|
79 |
+
<show_in_default>1</show_in_default>
|
80 |
+
<show_in_website>0</show_in_website>
|
81 |
+
<show_in_store>0</show_in_store>
|
82 |
+
</generate>
|
83 |
+
</fields>
|
84 |
+
</api>
|
85 |
+
</groups>
|
86 |
+
</zenstores_core>
|
87 |
+
</sections>
|
88 |
+
</config>
|
app/code/community/Zenstores/Core/sql/zenstores_core_setup/install-1.0.0.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Zenstores
|
4 |
+
*
|
5 |
+
* @category Zenstores
|
6 |
+
* @package Zenstores_Core
|
7 |
+
* @copyright Copyright (c) 2015 Mechfeed Ltd (Zenstores) (https://www.zenstores.com/)
|
8 |
+
*/
|
9 |
+
|
10 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
11 |
+
$installer = $this;
|
12 |
+
|
13 |
+
$installer->startSetup();
|
14 |
+
|
15 |
+
/** @var Zenstores_Core_Helper_Data $zenstoresHelper */
|
16 |
+
$zenstoresHelper = Mage::helper('zenstores_core');
|
17 |
+
|
18 |
+
$zenstoresHelper->createApiUser();
|
19 |
+
|
20 |
+
$installer->endSetup();
|
app/code/community/Zenstores/Core/sql/zenstores_core_setup/mysql4-install-1.0.0.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Zenstores Setup for Magento <= 1.5
|
4 |
+
*
|
5 |
+
* @category Zenstores
|
6 |
+
* @package Zenstores_Core
|
7 |
+
* @copyright Copyright (c) 2015 Mechfeed Ltd (Zenstores) (https://www.zenstores.com/)
|
8 |
+
*/
|
9 |
+
|
10 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
11 |
+
$installer = $this;
|
12 |
+
|
13 |
+
$installer->startSetup();
|
14 |
+
|
15 |
+
/** @var Zenstores_Core_Helper_Data $zenstoresHelper */
|
16 |
+
$zenstoresHelper = Mage::helper('zenstores_core');
|
17 |
+
|
18 |
+
$zenstoresHelper->createApiUser();
|
19 |
+
|
20 |
+
$installer->endSetup();
|
app/etc/modules/Zenstores_Core.xml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Zenstores
|
5 |
+
*
|
6 |
+
* @category Zenstores
|
7 |
+
* @package Zenstores_Core
|
8 |
+
* @copyright Copyright (c) 2015 Mechfeed Ltd (Zenstores) (https://www.zenstores.com/)
|
9 |
+
*/
|
10 |
+
-->
|
11 |
+
<config>
|
12 |
+
<modules>
|
13 |
+
<Zenstores_Core>
|
14 |
+
<active>true</active>
|
15 |
+
<codePool>community</codePool>
|
16 |
+
<depends>
|
17 |
+
<Mage_Adminhtml />
|
18 |
+
</depends>
|
19 |
+
</Zenstores_Core>
|
20 |
+
</modules>
|
21 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Zenstores_Core</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="https://www.gnu.org/licenses/gpl-3.0.txt">GPL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Zenstore integration for Magento.</summary>
|
10 |
+
<description>Zenstore integration for Magento.</description>
|
11 |
+
<notes>Create API user for use in Zenstores.</notes>
|
12 |
+
<authors><author><name>Zenstores</name><user>zenstores</user><email>support@zenstores.com</email></author></authors>
|
13 |
+
<date>2015-06-25</date>
|
14 |
+
<time>08:47:49</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Zenstores"><dir name="Core"><dir name="Block"><file name="Button.php" hash="45d703df015c52207a80449e92af0fb2"/><file name="Description.php" hash="9d2c3653ec72c41891785e18faee5714"/><file name="Logo.php" hash="1e6234112e0f1dc6149f4605aa94af70"/><dir name="Text"><file name="Endpoint.php" hash="6a27d94adef690ed176baca2edc22a82"/><file name="Key.php" hash="6b15bcd9a34c219328afcf950243997b"/><file name="Username.php" hash="1e74c103b964f0eabf7b94cd86d2e48a"/></dir></dir><dir name="Helper"><file name="Data.php" hash="c8d5d4cea69bc5e72239c26ba527de35"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ZenstoresController.php" hash="802d98217cb4a384adfff611d75611b6"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="3fb6203e969ae1059370808a14062b61"/><file name="config.xml" hash="eaf4c3d4ca2dce955c4078a5c4d6816e"/><file name="system.xml" hash="84f5d5e39a327ae07e6b3d8fd1d0eaae"/></dir><dir name="sql"><dir name="zenstores_core_setup"><file name="install-1.0.0.php" hash="c46182b1bf39d1f82b607c9b7043c19a"/><file name="mysql4-install-1.0.0.php" hash="34c0a800c16da4288468169d42993d89"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Zenstores_Core.xml" hash="a58031009d95aa1354aa095df0f88e0d"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.4.0</min><max>8.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|