SellerActive - Version 1.0.0

Version Notes

Strategically price, manage, and fulfill your orders in your Magento store and on other marketplaces.

Download this release

Release Info

Developer SellerActive
Extension SellerActive
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/SellerActive/SellerActive/Block/Adminhtml/Settings.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category   SellerActive
4
+ * @package    SellerActive
5
+ * @version    1.0.0
6
+ * @copyright  Copyright 2013 SellerActive (http://www.selleractove.com/)
7
+ */
8
+ class SellerActive_SellerActive_Block_Adminhtml_Settings extends Mage_Adminhtml_Block_Widget_Form_Container
9
+ {
10
+ public function __construct()
11
+ {
12
+ parent::__construct();
13
+
14
+ $this->_objectId = 'id';
15
+ $this->_blockGroup = 'selleractive';
16
+ $this->_controller = 'adminhtml';
17
+ $this->_mode = 'settings';
18
+
19
+ $this->_removeButton('reset');
20
+ $this->_removeButton('back');
21
+ $this->_updateButton('save', 'label', Mage::helper('selleractive')->__('Save Settings'));
22
+
23
+ $validateUrl = Mage::helper('adminhtml')->getUrl('selleractive/adminhtml_settings/validate');
24
+ $config = Mage::getSingleton('selleractive/config');
25
+ $apiKeyFieldName = $config->getField('webapikey', 'api_key');
26
+ $isActiveFieldName = $config->getField('is_active', 'api_key');
27
+
28
+ $this->_formScripts[] = "
29
+ function resetInputs(e){
30
+ $$('#edit_form input').each(function(_e){
31
+ if (_e.id != e.id && _e.type!='hidden') {
32
+ _e.disabled = true;
33
+ if (_e.type=='text') {
34
+ _e.value='';
35
+ }
36
+ }
37
+ });
38
+ }
39
+
40
+ function _qresetForm(){
41
+ $$('#edit_form input').each(function(e){
42
+ if (e.id != '{$apiKeyFieldName}') {e.disabled=true;}
43
+ });
44
+ alert('Validation failed, please try again. If still unresolved contact support here or call 1-800-545-7385.');
45
+ }
46
+ function validateApiKey(){
47
+ new Ajax.Request('{$validateUrl}', {
48
+ method:'post',
49
+ parameters: {webapikey: $('{$apiKeyFieldName}').value},
50
+ onSuccess: function(transport){
51
+ var json = transport.responseText.evalJSON();
52
+ if ('{$isActiveFieldName}' in json) {
53
+ if (json['{$isActiveFieldName}']== 'False' || json['{$isActiveFieldName}'] == 'false') {
54
+ $('{$isActiveFieldName}').checked = false;
55
+ $('{$isActiveFieldName}').disabled = false;
56
+ }else if (json['{$isActiveFieldName}']== 'True' || json['{$isActiveFieldName}'] == 'true'){
57
+ $('{$isActiveFieldName}').checked = true;
58
+ $('{$isActiveFieldName}').disabled = false;
59
+ }else{
60
+ _qresetForm();
61
+
62
+ }
63
+ }else{
64
+ _qresetForm();
65
+ }
66
+ for(var i in json){
67
+ if (i != '{$isActiveFieldName}') {
68
+ $(i).value = json[i];
69
+ $(i).disabled = false;
70
+ }
71
+ }
72
+ },
73
+ onFailure: function() { alert('".Mage::helper('selleractive')->__('Something went wrong...')."'); }
74
+ });
75
+
76
+ }
77
+
78
+ ";
79
+ }
80
+
81
+ public function getHeaderText()
82
+ {
83
+ return Mage::helper('selleractive')->__('SellerActive Magento Settings');
84
+ }
85
+ }
app/code/community/SellerActive/SellerActive/Block/Adminhtml/Settings/Form.php ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category   SellerActive
4
+ * @package    SellerActive
5
+ * @version    1.0.0
6
+ * @copyright  Copyright 2013 SellerActive (http://www.selleractove.com/)
7
+ */
8
+ class SellerActive_SellerActive_Block_Adminhtml_Settings_Form extends Mage_Adminhtml_Block_Widget_Form
9
+ {
10
+ protected function _prepareForm()
11
+ {
12
+ $model = Mage::registry('setting_data');
13
+ $config = Mage::getSingleton('selleractive/config');
14
+ $apiKeyFieldName = $config->getField('webapikey', 'api_key');
15
+ $isActiveFieldName = $config->getField('is_active', 'api_key');
16
+
17
+ $form = new Varien_Data_Form(array(
18
+ 'id' => 'edit_form',
19
+ 'action' => $this->getUrl('*/*/save'),
20
+ 'method' => 'post',
21
+ 'enctype' => 'multipart/form-data'
22
+ )
23
+ );
24
+
25
+ $fieldset = $form->addFieldset('credential_settings', array('legend' => Mage::helper('selleractive')->__('Credential Settings')));
26
+
27
+ $fieldset->addField($config->getField('webapikey', 'api_key'), 'text', array(
28
+ 'label' => $config->getField('webapikey', 'label'),
29
+ 'class' => 'required-entry',
30
+ 'required' => true,
31
+ 'onchange' => 'resetInputs(this);',
32
+ 'name' => $config->getField('webapikey', 'api_key'),
33
+ 'note' => '<a onclick="validateApiKey()" href="#webapikey">' . Mage::helper('selleractive')->__('validate api key') . '</a>',
34
+ 'after_element_html' => $config->getField('webapikey', 'document_link/link_to')
35
+ ? '<a href="'.$config->getField('webapikey', 'document_link/link_to')
36
+ .'" style="margin-left:15px" target="_blank">'
37
+ .$config->getField('webapikey', 'document_link/label').'</a>'
38
+ : ''
39
+ ));
40
+
41
+ $checked = 1;
42
+ if(strtolower($model->getData($config->getField('is_active', 'api_key'))) == 'false')
43
+ {
44
+ $checked = 0;
45
+ }
46
+ $model->setData($config->getField('is_active', 'api_key'), 'true');
47
+ $fieldset->addField($config->getField('is_active', 'api_key'), 'checkbox', array(
48
+ 'label' => $config->getField('is_active', 'label'),
49
+ 'name' => $config->getField('is_active', 'api_key'),
50
+ 'value' => 'true',
51
+ 'checked' => $checked,
52
+ 'disabled' => !$model->getWebapikey() ? true : false,
53
+ ));
54
+
55
+ $fieldset->addField($config->getField('magento_to_domain', 'api_key'), 'text', array(
56
+ 'label' => $config->getField('magento_to_domain', 'label'),
57
+ 'class' => 'required-entry',
58
+ 'required' => true,
59
+ 'name' => $config->getField('magento_to_domain', 'api_key'),
60
+ 'disabled' => !$model->getWebapikey() ? true : false,
61
+ 'after_element_html' => $config->getField('magento_to_domain', 'document_link/link_to')
62
+ ? '<a href="'.$config->getField('magento_to_domain', 'document_link/link_to')
63
+ .'" style="margin-left:15px" target="_blank">'
64
+ .$config->getField('magento_to_domain', 'document_link/label').'</a>'
65
+ : ''
66
+ ));
67
+
68
+ $fieldset->addField($config->getField('magento_to_login', 'api_key'), 'text', array(
69
+ 'label' => $config->getField('magento_to_login', 'label'),
70
+ 'class' => 'required-entry',
71
+ 'required' => true,
72
+ 'name' => $config->getField('magento_to_login', 'api_key'),
73
+ 'disabled' => !$model->getWebapikey() ? true : false,
74
+ 'after_element_html' => $config->getField('magento_to_login', 'document_link/link_to')
75
+ ? '<a href="'.$config->getField('magento_to_login', 'document_link/link_to')
76
+ .'" style="margin-left:15px" target="_blank">'
77
+ .$config->getField('magento_to_login', 'document_link/label').'</a>'
78
+ : ''
79
+
80
+ ));
81
+
82
+ $fieldset->addField($config->getField('magento_password', 'api_key'), 'text', array(
83
+ 'label' => $config->getField('magento_password', 'label'),
84
+ 'class' => 'required-entry',
85
+ 'required' => true,
86
+ 'name' => $config->getField('magento_password', 'api_key'),
87
+ 'disabled' => !$model->getWebapikey() ? true : false
88
+ ));
89
+
90
+ $fieldset->addField($config->getField('magento_version', 'api_key'), 'text', array(
91
+ 'label' => $config->getField('magento_version', 'label'),
92
+ 'name' => $config->getField('magento_version', 'api_key'),
93
+ 'readonly' => 'readonly',
94
+ 'style' => 'background-color:#eee',
95
+ 'disabled' => !$model->getWebapikey() ? true : false
96
+ ));
97
+
98
+ $fieldset = $form->addFieldset('order_management_settings', array('legend' => Mage::helper('selleractive')->__('Order Management Settings')));
99
+ $fieldset->addField($config->getField('magento_order_start', 'api_key'), 'text', array(
100
+ 'label' => $config->getField('magento_order_start', 'label'),
101
+ 'class' => 'required-entry validate-digits',
102
+ 'required' => true,
103
+ 'name' => $config->getField('magento_order_start', 'api_key'),
104
+ 'disabled' => !$model->getWebapikey() ? true : false,
105
+ 'after_element_html' => $config->getField('magento_order_start', 'document_link/link_to')
106
+ ? '<a href="'.$config->getField('magento_order_start', 'document_link/link_to')
107
+ .'" style="margin-left:15px" target="_blank">'
108
+ .$config->getField('magento_order_start', 'document_link/label').'</a>'
109
+ : ''
110
+ ));
111
+
112
+ $fieldset = $form->addFieldset('inventory_management_settings', array('legend' => Mage::helper('selleractive')->__('Inventory Management Settings')));
113
+ $fieldset->addField($config->getField('magento_store_view', 'api_key'), 'text', array(
114
+ 'label' => $config->getField('magento_store_view', 'label'),
115
+ //'class' => 'required-entry',
116
+ //'required' => true,
117
+ 'name' => $config->getField('magento_store_view', 'api_key'),
118
+ 'disabled' => !$model->getWebapikey() ? true : false,
119
+ 'after_element_html' => $config->getField('magento_store_view', 'document_link/link_to')
120
+ ? '<a href="'.$config->getField('magento_store_view', 'document_link/link_to')
121
+ .'" style="margin-left:15px" target="_blank">'
122
+ .$config->getField('magento_store_view', 'document_link/label').'</a>'
123
+ : ''
124
+ ));
125
+
126
+ $form->setValues($model->getData());
127
+ $form->setUseContainer(true);
128
+ $this->setForm($form);
129
+
130
+ return parent::_prepareForm();
131
+ }
132
+ }
app/code/community/SellerActive/SellerActive/Helper/Data.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category   SellerActive
4
+ * @package    SellerActive
5
+ * @version    1.0.0
6
+ * @copyright  Copyright 2013 SellerActive (http://www.selleractove.com/)
7
+ */
8
+ class SellerActive_SellerActive_Helper_Data extends Mage_Core_Helper_Abstract
9
+ {
10
+ }
app/code/community/SellerActive/SellerActive/Model/Config.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category   SellerActive
4
+ * @package    SellerActive
5
+ * @version    1.0.0
6
+ * @copyright  Copyright 2013 SellerActive (http://www.selleractove.com/)
7
+ */
8
+ class SellerActive_SellerActive_Model_Config extends Varien_Object
9
+ {
10
+ protected $_webServiceConfig;
11
+
12
+ protected function _construct()
13
+ {
14
+ parent::_construct();
15
+ $this->_loadConfig();
16
+ }
17
+
18
+ protected function _loadConfig()
19
+ {
20
+ $filePath = Mage::getModuleDir('etc', 'SellerActive_SellerActive') . DS . 'webservice.xml';
21
+ $this->_webServiceConfig = new Varien_Simplexml_Config($filePath);
22
+ }
23
+
24
+ public function getFieldConfig($field)
25
+ {
26
+ if (is_null($this->_webServiceConfig)) {
27
+ $this->_loadConfig();
28
+ }
29
+
30
+ if (is_object($this->_webServiceConfig)) {
31
+ return $this->_webServiceConfig->getNode('setting_fields/' . $field);
32
+ } else {
33
+ throw new Exception('Unable to load web service config file.');
34
+ }
35
+ }
36
+
37
+ public function getField($field, $path)
38
+ {
39
+ try {
40
+ $fieldConfig = $this->getFieldConfig($field);
41
+ if ($r = $fieldConfig->xpath($path)){
42
+ return $r[0]->asArray();
43
+ }
44
+ return null;
45
+ }catch (Exception $e) {
46
+ return null;
47
+ }
48
+ }
49
+
50
+ const PATH_SAVE_SELLER_ACTIVE_WEB_API_KEY = 'selleractive/general/webApiKey';
51
+ public function getSavedWebApiKey()
52
+ {
53
+ return Mage::getStoreConfig(self::PATH_SAVE_SELLER_ACTIVE_WEB_API_KEY, 0);
54
+ }
55
+
56
+ public function saveWebApiKey($value)
57
+ {
58
+ Mage::getConfig()->saveConfig(self::PATH_SAVE_SELLER_ACTIVE_WEB_API_KEY, $value)
59
+ ->reinit();
60
+ Mage::app()->reinitStores();
61
+ }
62
+ }
app/code/community/SellerActive/SellerActive/Model/Resource/Setting.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category   SellerActive
4
+ * @package    SellerActive
5
+ * @version    1.0.0
6
+ * @copyright  Copyright 2013 SellerActive (http://www.selleractove.com/)
7
+ */
8
+ class SellerActive_SellerActive_Model_Resource_Setting extends Varien_Object
9
+ {
10
+ protected $serviceUrl = 'https://api.selleractive.com/API/SiteSettings/4';
11
+ protected $params = array();
12
+
13
+ public function setWebApiKey($webApiKey)
14
+ {
15
+ $config = Mage::getSingleton('selleractive/config');
16
+ $this->params[$config->getField('webapikey', 'api_key')] = $webApiKey;
17
+ }
18
+
19
+ public function load(SellerActive_SellerActive_Model_Setting $object, $webApiKey = null, $field = 'webapikey')
20
+ {
21
+ if (!is_null($webApiKey)) {
22
+ $this->params[$field] = $webApiKey;
23
+ }
24
+
25
+ $this->_submitData($object);
26
+
27
+ return $this;
28
+ }
29
+
30
+ public function setRemoteData($key, $value)
31
+ {
32
+ $this->params['settingkey'] = $key;
33
+ $this->params['settingvalue'] = $value;
34
+
35
+ return $this;
36
+ }
37
+
38
+ public function save(SellerActive_SellerActive_Model_Setting $object)
39
+ {
40
+ $config = Mage::getSingleton('selleractive/config');
41
+ $data = $object->getData();
42
+ $this->setWebApiKey($data[$config->getField('webapikey', 'api_key')]);
43
+ //check webapikey
44
+ try {
45
+ $this->_submitData($object);
46
+ }catch (Exception $e){
47
+ throw new Exception('API Key Invalid!');
48
+ }
49
+
50
+ $toSave = array();
51
+ $filters = array(
52
+ $config->getField('is_active', 'api_key'),
53
+ $config->getField('magento_to_domain', 'api_key'),
54
+ $config->getField('magento_to_login', 'api_key'),
55
+ $config->getField('magento_password', 'api_key'),
56
+ $config->getField('magento_order_start', 'api_key'),
57
+ $config->getField('magento_store_view', 'api_key')
58
+ );
59
+
60
+ foreach ($filters as $field) {
61
+ if (isset($data[$field])) {
62
+ $toSave[$field] = $data[$field];
63
+ }
64
+ }
65
+
66
+ //clear magento_store_view
67
+ $MagentoStoreView = $config->getField('magento_store_view', 'api_key');
68
+ if (isset($toSave[$MagentoStoreView]) && !$toSave[$MagentoStoreView]) {
69
+ $toSave[$MagentoStoreView] = 'blank';
70
+ }
71
+
72
+ //set Magento version
73
+ $toSave[$config->getField('magento_version', 'api_key')] = Mage::getVersion();
74
+ //Mage::log($toSave,null,'q.log',true);exit;
75
+
76
+ //save data
77
+ foreach ($toSave as $k => $v) {
78
+ $this->setRemoteData($k, $v);
79
+ $this->_submitData($object, 'put', false);
80
+ }
81
+
82
+ return $this;
83
+ }
84
+
85
+ protected function _submitData($object, $method='get', $parseResponse = true)
86
+ {
87
+ $url = $this->serviceUrl . '?format=json&' . http_build_query($this->params);
88
+ //Mage::log($url,null,'q.log',true);
89
+ $curlSession = curl_init();
90
+ curl_setopt($curlSession, CURLOPT_URL, $url);
91
+ curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, 1);
92
+ curl_setopt($curlSession, CURLOPT_SSL_VERIFYPEER, 0);
93
+ if ($method == 'put') {
94
+ curl_setopt($curlSession, CURLOPT_CUSTOMREQUEST, "PUT");
95
+ curl_setopt($curlSession, CURLOPT_PUT, 1);
96
+ curl_setopt($curlSession, CURLOPT_HTTPHEADER, array('X-HTTP-Method-Override: PUT'));
97
+ }
98
+
99
+ $response = curl_exec($curlSession);
100
+
101
+ if ($parseResponse) {
102
+ if ($response) {
103
+ $results = Mage::helper('core')->jsonDecode($response);
104
+ foreach ($results as $result) {
105
+ $object->setData($result['SettingKey'], $result['SettingValue']);
106
+ }
107
+ }else {
108
+ throw new Exception('Curl error: ' . curl_error($curlSession) . ' (' . curl_errno($curlSession) . ')');
109
+ }
110
+ }
111
+
112
+ curl_close($curlSession);
113
+
114
+ return $object;
115
+ }
116
+
117
+ }
app/code/community/SellerActive/SellerActive/Model/Setting.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category   SellerActive
4
+ * @package    SellerActive
5
+ * @version    1.0.0
6
+ * @copyright  Copyright 2013 SellerActive (http://www.selleractove.com/)
7
+ */
8
+ class SellerActive_SellerActive_Model_Setting extends Mage_Core_Model_Abstract
9
+ {
10
+ public function _construct()
11
+ {
12
+ parent::_construct();
13
+ $this->_init('selleractive/setting');
14
+ }
15
+
16
+ public function load($webApiKey, $field = null)
17
+ {
18
+ $config = Mage::getSingleton('selleractive/config');
19
+ $field = $field ? $field : $config->getField('webapikey', 'api_key');
20
+
21
+ return parent::load($webApiKey, $field);
22
+ }
23
+
24
+ public function save()
25
+ {
26
+ $this->_getResource()->save($this);
27
+ }
28
+ }
app/code/community/SellerActive/SellerActive/controllers/Adminhtml/SettingsController.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category   SellerActive
4
+ * @package    SellerActive
5
+ * @version    1.0.0
6
+ * @copyright  Copyright 2013 SellerActive (http://www.selleractove.com/)
7
+ */
8
+ class SellerActive_SellerActive_Adminhtml_SettingsController extends Mage_Adminhtml_Controller_Action
9
+ {
10
+ private function _initSettingData()
11
+ {
12
+ $config = Mage::getSingleton('selleractive/config');
13
+
14
+ $webApiKey = $config->getSavedWebApiKey();
15
+ $model = Mage::getModel('selleractive/setting');
16
+ if ($webApiKey) {
17
+ try {
18
+ $model->load($webApiKey)
19
+ ->setWebapikey($webApiKey);
20
+ } catch (Exception $e) {
21
+ $this->_getSession()->addError('Validation failed, please try again. If still unresolved contact support here or call 1-800-545-7385.');
22
+ }
23
+ }
24
+
25
+ // 3. Set entered data if was error when we do save
26
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
27
+ if (!empty($data)) {
28
+ $model->setData($data);
29
+ }
30
+
31
+ Mage::register('setting_data', $model);
32
+
33
+ return $model;
34
+ }
35
+
36
+ public function indexAction()
37
+ {
38
+ $this->_initSettingData();
39
+
40
+ $this->loadLayout();
41
+ $this->_setActiveMenu('system');
42
+ $this->_addBreadcrumb(Mage::helper('selleractive')->__('Seller Active Magento Settings'), Mage::helper('selleractive')->__('SellerActive Magento Settings'));
43
+ $this->_addContent($this->getLayout()->createBlock('selleractive/adminhtml_settings'));
44
+
45
+ $this->renderLayout();
46
+ }
47
+
48
+ public function saveAction()
49
+ {
50
+ $config = Mage::getSingleton('selleractive/config');
51
+ $data = $this->getRequest()->getPost();
52
+ if (isset($data[$config->getField('webapikey', 'api_key')])) {
53
+ try {
54
+ if (!isset($data[$config->getField('is_active', 'api_key')])) {
55
+ $data[$config->getField('is_active', 'api_key')] = 'false';
56
+ }
57
+
58
+ $validator = new Zend_Validate_Digits();
59
+ if (!$validator->isValid($data[$config->getField('magento_order_start', 'api_key')])) {
60
+ Mage::throwException('Please use digits only in Starting Order ID');
61
+ }
62
+
63
+ $model = Mage::getModel('selleractive/setting');
64
+ $model->setData($data);
65
+ $model->save();
66
+ $config->saveWebApiKey($data[$config->getField('webapikey', 'api_key')]);
67
+
68
+ $this->_getSession()->addSuccess(Mage::helper('selleractive')->__('SellerActive Settings was successfully saved'));
69
+ $this->_getSession()->setFormData(false);
70
+
71
+ $this->_redirect('*/*/');
72
+ return;
73
+ } catch (Exception $e) {
74
+ $this->_getSession()->addError($e->getMessage());
75
+ $this->_getSession()->setFormData($data);
76
+ $this->_redirect('*/*/');
77
+ return;
78
+ }
79
+ }
80
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('selleractive')->__('Unable to save SellerActive Settings'));
81
+ $this->_redirect('*/*/');
82
+ }
83
+
84
+ public function validateAction()
85
+ {
86
+ try {
87
+ $siteSetting = Mage::getModel('selleractive/setting')->load($this->getRequest()->getParam('webapikey'));
88
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($siteSetting->getData()));
89
+ }catch (Exception $e) {
90
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array('error'=>true)));
91
+ }
92
+
93
+ }
94
+ }
app/code/community/SellerActive/SellerActive/etc/adminhtml.xml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <menu>
4
+ <system>
5
+ <children>
6
+ <selleractive module="selleractive">
7
+ <title>SellerActive</title>
8
+ <action>selleractive/adminhtml_settings</action>
9
+ </selleractive>
10
+ </children>
11
+ </system>
12
+ </menu>
13
+ <acl>
14
+ <resources>
15
+ <admin>
16
+ <children>
17
+ <system>
18
+ <children>
19
+ <selleractive module="selleractive">
20
+ <title>SellerActive</title>
21
+ </selleractive>
22
+ </children>
23
+ </system>
24
+ </children>
25
+ </admin>
26
+ </resources>
27
+ </acl>
28
+ </config>
app/code/community/SellerActive/SellerActive/etc/config.xml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <SellerActive_SellerActive>
5
+ <version>1.0.0</version>
6
+ </SellerActive_SellerActive>
7
+ </modules>
8
+ <admin>
9
+ <routers>
10
+ <selleractive>
11
+ <use>admin</use>
12
+ <args>
13
+ <module>SellerActive_SellerActive</module>
14
+ <frontName>selleractive</frontName>
15
+ </args>
16
+ </selleractive>
17
+ </routers>
18
+ </admin>
19
+ <global>
20
+ <blocks>
21
+ <selleractive>
22
+ <class>SellerActive_SellerActive_Block</class>
23
+ </selleractive>
24
+ </blocks>
25
+ <models>
26
+ <selleractive>
27
+ <class>SellerActive_SellerActive_Model</class>
28
+ <resourceModel>selleractive_resource</resourceModel>
29
+ </selleractive>
30
+ <selleractive_resource>
31
+ <class>SellerActive_SellerActive_Model_Resource</class>
32
+ </selleractive_resource>
33
+ </models>
34
+
35
+ <helpers>
36
+ <selleractive>
37
+ <class>SellerActive_SellerActive_Helper</class>
38
+ </selleractive>
39
+ </helpers>
40
+ </global>
41
+ </config>
app/code/community/SellerActive/SellerActive/etc/webservice.xml ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <webservice>
3
+ <setting_fields>
4
+ <webapikey>
5
+ <label><![CDATA[SellerActive API Key]]></label>
6
+ <api_key>webapikey</api_key>
7
+ <document_link>
8
+ <label><![CDATA[How to find your API key]]></label>
9
+ <link_to><![CDATA[https://selleractive.zendesk.com/entries/23512476]]></link_to>
10
+ </document_link>
11
+ </webapikey>
12
+
13
+ <is_active>
14
+ <label><![CDATA[Turn SellerActive On/Off]]></label>
15
+ <api_key>IsActive</api_key>
16
+ </is_active>
17
+ <magento_to_domain>
18
+ <label><![CDATA[Domain Name]]></label>
19
+ <api_key>MagentoDomain</api_key>
20
+ <document_link>
21
+ <label><![CDATA[How to find your domain name]]></label>
22
+ <link_to><![CDATA[https://selleractive.zendesk.com/entries/23494472]]></link_to>
23
+ </document_link>
24
+ </magento_to_domain>
25
+ <magento_to_login>
26
+ <label><![CDATA[SOAP User Name]]></label>
27
+ <api_key>MagentoLogin</api_key>
28
+ <document_link>
29
+ <label><![CDATA[How to find your SOAP user name and password]]></label>
30
+ <link_to><![CDATA[https://selleractive.zendesk.com/entries/23494482]]></link_to>
31
+ </document_link>
32
+ </magento_to_login>
33
+ <magento_password>
34
+ <label><![CDATA[SOAP Password]]></label>
35
+ <api_key>MagentoPassword</api_key>
36
+ </magento_password>
37
+
38
+ <magento_order_start>
39
+ <label><![CDATA[Starting Order ID]]></label>
40
+ <api_key>MagentoOrderStart</api_key>
41
+ <document_link>
42
+ <label><![CDATA[How to set your starting Order ID]]></label>
43
+ <link_to><![CDATA[https://selleractive.zendesk.com/entries/23508487]]></link_to>
44
+ </document_link>
45
+ </magento_order_start>
46
+
47
+ <magento_store_view>
48
+ <label><![CDATA[Website Name]]></label>
49
+ <api_key>MagentoStoreView</api_key>
50
+ <document_link>
51
+ <label><![CDATA[How to find your website name]]></label>
52
+ <link_to><![CDATA[https://selleractive.zendesk.com/entries/23494512]]></link_to>
53
+ </document_link>
54
+ </magento_store_view>
55
+
56
+ <magento_version>
57
+ <label><![CDATA[Magento Version]]></label>
58
+ <api_key>MagentoVersion</api_key>
59
+ </magento_version>
60
+ </setting_fields>
61
+ </webservice>
app/etc/modules/SellerActive_SellerActive.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <SellerActive_SellerActive>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </SellerActive_SellerActive>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>SellerActive</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>community</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Strategically price, manage, and fulfill your orders in your Magento store and on other marketplaces.</summary>
10
+ <description>Automatically and competitively price your inventory across multiple marketplaces. Manage all incoming orders from a single location. Shop the lowest shipping rates to save on order fulfillment.</description>
11
+ <notes>Strategically price, manage, and fulfill your orders in your Magento store and on other marketplaces. </notes>
12
+ <authors><author><name>SellerActive</name><user>SellerActive</user><email>support@selleractive.com</email></author></authors>
13
+ <date>2013-05-04</date>
14
+ <time>15:37:40</time>
15
+ <contents><target name="magecommunity"><dir name="SellerActive"><dir name="SellerActive"><dir name="Block"><dir name="Adminhtml"><dir name="Settings"><file name="Form.php" hash="7819521c81d8c3938d079ffb7b749a13"/></dir><file name="Settings.php" hash="eb0cb9f167de58600b8e1ea6adc1afe4"/></dir></dir><dir name="Helper"><file name="Data.php" hash="6640d03fa4750df5997d1924f758519e"/></dir><dir name="Model"><file name="Config.php" hash="a8b2bf5f6b0c7151e047ed9cc7bbcc03"/><dir name="Resource"><file name="Setting.php" hash="f2d47788c088790633197f85b824fcb8"/></dir><file name="Setting.php" hash="db68b1a54da3e5df826211adfeed3991"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SettingsController.php" hash="47cb320ce5b5caaa4b5b81529805e4ca"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="6e9af6333e890b8a5d95195417659758"/><file name="config.xml" hash="00a6e70576bfefce980b9f839482c611"/><file name="webservice.xml" hash="e52f53cb934be5c3a36327fd92d4ba93"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="SellerActive_SellerActive.xml" hash="d746c99a15c9e80ca376d06a2894dc5e"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>