Exorbyte_Commercesearch - Version 0.1.0

Version Notes

Tested and bugs fixed

Download this release

Release Info

Developer exorbyte GmbH
Extension Exorbyte_Commercesearch
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

Files changed (28) hide show
  1. app/code/community/Exorbyte/Commercesearch/Block/Adminhtml/Commercesearch.php +16 -0
  2. app/code/community/Exorbyte/Commercesearch/Block/Adminhtml/Commercesearch/Edit.php +19 -0
  3. app/code/community/Exorbyte/Commercesearch/Block/Adminhtml/Commercesearch/Edit/Form.php +13 -0
  4. app/code/community/Exorbyte/Commercesearch/Block/Adminhtml/Commercesearch/Edit/Tab/Form.php +42 -0
  5. app/code/community/Exorbyte/Commercesearch/Block/Adminhtml/Commercesearch/Edit/Tabs.php +17 -0
  6. app/code/community/Exorbyte/Commercesearch/Block/Adminhtml/Commercesearch/Grid.php +44 -0
  7. app/code/community/Exorbyte/Commercesearch/Block/Adminhtml/Ecs.php +592 -0
  8. app/code/community/Exorbyte/Commercesearch/Block/Adminhtml/Suggest.php +590 -0
  9. app/code/community/Exorbyte/Commercesearch/Block/Backend/Exportbutton.php +38 -0
  10. app/code/community/Exorbyte/Commercesearch/Block/Manualupload.php +28 -0
  11. app/code/community/Exorbyte/Commercesearch/Helper/Data.php +6 -0
  12. app/code/community/Exorbyte/Commercesearch/Helper/exorbyte_export.php +64 -0
  13. app/code/community/Exorbyte/Commercesearch/Model/Activate.php +16 -0
  14. app/code/community/Exorbyte/Commercesearch/Model/Backend/Design.php +51 -0
  15. app/code/community/Exorbyte/Commercesearch/Model/Backend/Email.php +36 -0
  16. app/code/community/Exorbyte/Commercesearch/Model/Backend/Layout.php +56 -0
  17. app/code/community/Exorbyte/Commercesearch/Model/Commercesearch.php +7 -0
  18. app/code/community/Exorbyte/Commercesearch/Model/Connect.php +127 -0
  19. app/code/community/Exorbyte/Commercesearch/Model/Mysql4/Commercesearch.php +6 -0
  20. app/code/community/Exorbyte/Commercesearch/Model/Mysql4/Commercesearch/Collection.php +7 -0
  21. app/code/community/Exorbyte/Commercesearch/Model/Observer.php +220 -0
  22. app/code/community/Exorbyte/Commercesearch/controllers/Adminhtml/CommercesearchController.php +105 -0
  23. app/code/community/Exorbyte/Commercesearch/controllers/IndexController.php +10 -0
  24. app/code/community/Exorbyte/Commercesearch/etc/config.xml +156 -0
  25. app/code/community/Exorbyte/Commercesearch/etc/system.xml +213 -0
  26. app/code/community/Exorbyte/Commercesearch/sql/Commercesearch_setup/mysql4-install-0.1.0.php +33 -0
  27. app/etc/modules/Exorbyte_Commercesearch.xml +9 -0
  28. package.xml +19 -0
app/code/community/Exorbyte/Commercesearch/Block/Adminhtml/Commercesearch.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Exorbyte_Commercesearch_Block_Adminhtml_Commercesearch extends Mage_Adminhtml_Block_Widget_Grid_Container {
3
+ public function __construct() {
4
+ $this->_controller = 'adminhtml_Commercesearch';
5
+ $this->_blockGroup = 'Commercesearch';
6
+ $this->_headerText = Mage::helper('Commercesearch')->__('Exorbyte Plugin');
7
+ //$this->_addButtonLabel = Mage::helper('Commercesearch')->__('Add Item');
8
+ parent::__construct();
9
+ }
10
+ protected function _prepareLayout() {
11
+ $this->setChild( 'grid',
12
+ $this->getLayout()->createBlock( $this->_blockGroup.'/' . $this->_controller . '_grid',
13
+ $this->_controller . '.grid')->setSaveParametersInSession(true) );
14
+ return parent::_prepareLayout();
15
+ }
16
+ }
app/code/community/Exorbyte/Commercesearch/Block/Adminhtml/Commercesearch/Edit.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Exorbyte_Commercesearch_Block_Adminhtml_Commercesearch_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
3
+ public function __construct() {echo "test gefunden";
4
+ parent::__construct();
5
+ $this->_objectId = 'id';
6
+ $this->_blockGroup = 'Commercesearch';
7
+ $this->_controller = 'adminhtml_Commercesearch';
8
+ $this->_updateButton('save', 'label', Mage::helper('Commercesearch')->__('Save Item'));
9
+ $this->_updateButton('delete', 'label', Mage::helper('Commercesearch')->__('Delete Item'));
10
+ }
11
+ public function getHeaderText() {
12
+ if( Mage::registry('Commercesearch_data') && Mage::registry('Commercesearch_data')->getId() ) {
13
+ return Mage::helper('Commercesearch')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('Commercesearch_data')->getTitle()));
14
+ } else {
15
+ return Mage::helper('Commercesearch')->__('Add Item');
16
+ }
17
+
18
+ }
19
+ }
app/code/community/Exorbyte/Commercesearch/Block/Adminhtml/Commercesearch/Edit/Form.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Exorbyte_Commercesearch_Block_Adminhtml_Commercesearch_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
3
+ protected function _prepareForm() {
4
+ $form = new Varien_Data_Form(array(
5
+ 'id' => 'edit_form',
6
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
7
+ 'method' => 'post',
8
+ );
9
+ $form->setUseContainer(true);
10
+ $this->setForm($form);
11
+ return parent::_prepareForm();
12
+ }
13
+ }
app/code/community/Exorbyte/Commercesearch/Block/Adminhtml/Commercesearch/Edit/Tab/Form.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Exorbyte_Commercesearch_Block_Adminhtml_Commercesearch_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
3
+ protected function _prepareForm() {
4
+ $form = new Varien_Data_Form();
5
+ $this->setForm($form);
6
+ $fieldset = $form->addFieldset('Commercesearch_form', array('legend'=>Mage::helper('Commercesearch')->__('Item information')));
7
+ $fieldset->addField('project_id', 'text', array(
8
+ 'label' => Mage::helper('Commercesearch')->__('Projekt ID'),
9
+ 'class' => 'required-entry',
10
+ 'required' => true,
11
+ 'name' => 'project_id',
12
+ ));
13
+ $fieldset->addField('customer_id', 'text', array(
14
+ 'label' => Mage::helper('Commercesearch')->__('Projekt ID'),
15
+ 'class' => 'required-entry',
16
+ 'required' => true,
17
+ 'name' => 'customer_id',
18
+ ));
19
+ /* $fieldset->addField('status', 'select', array(
20
+ 'label' => Mage::helper('Commercesearch')->__('Status'),
21
+ 'name' => 'status',
22
+ 'values' => array(
23
+ array(
24
+ 'value' => 1,
25
+ 'label' => Mage::helper('Commercesearch')->__('Active'),
26
+ ),
27
+ array(
28
+ 'value' => 0,
29
+ 'label' => Mage::helper('Commercesearch')->__('Inactive'),
30
+ ),
31
+ ),
32
+ ));
33
+ */
34
+ if ( Mage::getSingleton('adminhtml/session')->getCommercesearchData() ) {
35
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getCommercesearchData());
36
+ Mage::getSingleton('adminhtml/session')->setCommercesearchData(null);
37
+ } elseif ( Mage::registry('Commercesearch_data') ) {
38
+ $form->setValues(Mage::registry('Commercesearch_data')->getData());
39
+ }
40
+ return parent::_prepareForm();
41
+ }
42
+ }
app/code/community/Exorbyte/Commercesearch/Block/Adminhtml/Commercesearch/Edit/Tabs.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Exorbyte_Commercesearch_Block_Adminhtml_Commercesearch_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
3
+ public function __construct() {
4
+ parent::__construct();
5
+ $this->setId('Commercesearch_tabs');
6
+ $this->setDestElementId('edit_form');
7
+ $this->setTitle(Mage::helper('Commercesearch')->__('News Information'));
8
+ }
9
+ protected function _beforeToHtml() {
10
+ $this->addTab('form_section', array(
11
+ 'label' => Mage::helper('Commercesearch')->__('Item Information'),
12
+ 'title' => Mage::helper('Commercesearch')->__('Item Information'),
13
+ 'content' => $this->getLayout()->createBlock('Commercesearch/adminhtml_Commercesearch_edit_tab_form')->toHtml(),
14
+ ));echo nix gutes
15
+ return parent::_beforeToHtml();
16
+ }
17
+ }
app/code/community/Exorbyte/Commercesearch/Block/Adminhtml/Commercesearch/Grid.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Exorbyte_Commercesearch_Block_Adminhtml_Commercesearch_Grid extends Mage_Adminhtml_Block_Widget_Grid {
3
+ public function __construct()
4
+ {
5
+ parent::__construct();
6
+ $this->setId('CommercesearchGrid');
7
+ // This is the primary key of the database
8
+ $this->setDefaultSort('Commercesearch_id');
9
+ $this->setDefaultDir('ASC');
10
+ $this->setSaveParametersInSession(true);
11
+ }
12
+ protected function _prepareCollection() {
13
+ $collection = Mage::getModel('Commercesearch/Commercesearch')->getCollection();
14
+ $this->setCollection($collection);
15
+ return parent::_prepareCollection();
16
+ }
17
+ protected function _prepareColumns() {
18
+ $this->addColumn('Commercesearch_id', array(
19
+ 'header' => Mage::helper('Commercesearch')->__('ID'),
20
+ 'align' =>'right',
21
+ 'width' => '50px',
22
+ 'index' => 'Commercesearch_id',
23
+ ));
24
+ $this->addColumn('project_id', array(
25
+ 'header' => Mage::helper('Commercesearch')->__('Projekt ID'),
26
+ 'align' =>'left',
27
+ 'index' => 'title',
28
+ ));
29
+ $this->addColumn('customer_id', array(
30
+ 'header' => Mage::helper('Commercesearch')->__('Projekt ID'),
31
+ 'align' =>'left',
32
+ 'index' => 'title',
33
+ ));
34
+ $this->addColumn('secure_key', array(
35
+ 'header' => Mage::helper('Commercesearch')->__('Projekt ID'),
36
+ 'align' =>'left',
37
+ 'index' => 'title',
38
+ ));
39
+ return parent::_prepareColumns();
40
+ }
41
+ public function getRowUrl($row) {
42
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
43
+ }
44
+ }
app/code/community/Exorbyte/Commercesearch/Block/Adminhtml/Ecs.php ADDED
@@ -0,0 +1,592 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Exorbyte
22
+ * @package Exorbyte_Commercesearch
23
+ * @copyright Copyright (c) 2012 exorbyte GmbH. (http://commerce.exorbyte.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Fieldset renderer for Exorbyte global settings
29
+ * @author exorbyte Team <core@magentocommerce.com>, dg
30
+ */
31
+
32
+ // defined('WSDL_URL') || define('WSDL_URL','https://management.exorbyte.com/Partner-Soap/soap?wsdl');
33
+ defined('WSDL_URL') || define('WSDL_URL','https://test-management.sellbysearch.com/Partner-Soap/soap?wsdl');
34
+ //defined('WSDL') || define('WSDL','https://management.exorbyte.com/Partner-Soap/soap?wsdl');
35
+ defined('WSDL') || define('WSDL','https://test-management.sellbysearch.com/Partner-Soap/soap?wsdl');
36
+
37
+
38
+ class Exorbyte_Commercesearch_Block_Adminhtml_Ecs
39
+ extends Mage_Adminhtml_Block_Abstract
40
+ implements Varien_Data_Form_Element_Renderer_Interface
41
+ {
42
+ /**
43
+ * Associative array of PayPal product selection elements
44
+ *
45
+ * @var array
46
+ */
47
+ protected $_elements = array();
48
+
49
+ /**
50
+ * Custom template
51
+ *
52
+ * @var string
53
+ */
54
+ protected $_template = 'Commercesearch/ecs.phtml';
55
+
56
+ /**
57
+ * Render fieldset html
58
+ *
59
+ * @param Varien_Data_Form_Element_Abstract $fieldset
60
+ * @return string
61
+ */
62
+ public function render(Varien_Data_Form_Element_Abstract $fieldset)
63
+ {
64
+ foreach ($fieldset->getSortedElements() as $element) {
65
+ $htmlId = $element->getHtmlId();
66
+ $this->_elements[$htmlId] = $element;
67
+ }
68
+ $originalData = $fieldset->getOriginalData();
69
+ $this->addData(array(
70
+ 'fieldset_label' => $fieldset->getLegend(),
71
+ 'fieldset_help_url' => isset($originalData['help_url']) ? $originalData['help_url'] : '',
72
+ ));
73
+ return $this->toHtml();
74
+ }
75
+
76
+ /**
77
+ * Get array of element objects
78
+ *
79
+ * @return array
80
+ */
81
+ public function getElements()
82
+ {
83
+ return $this->_elements;
84
+ }
85
+
86
+ /**
87
+ * Get element by id
88
+ *
89
+ * @param string $elementId
90
+ * @return Varien_Data_Form_Element_Abstract
91
+ */
92
+ public function getElement($elementId)
93
+ {
94
+ if (isset($this->_elements[$elementId])) {
95
+ return $this->_elements[$elementId];
96
+ }
97
+ return false;
98
+ }
99
+
100
+ /**
101
+ * Return checkbox html with hidden field for correct config values
102
+ *
103
+ * @param string $elementId
104
+ * @return string
105
+ */
106
+ public function getElementHtml(Varien_Data_Form_Element_Abstract $element)
107
+ {
108
+ $configValue = (string)$element->getValue();
109
+ if ($configValue) {
110
+ $element->setChecked(true);
111
+ } else {
112
+ $element->setValue('1');
113
+ }
114
+ if ($element->getCanUseDefaultValue() && $element->getInherit()) {
115
+ $element->setDisabled(true);
116
+ }
117
+
118
+ $hidden = new Varien_Data_Form_Element_Hidden(array(
119
+ 'html_id' => $element->getHtmlId() . '_value',
120
+ 'name' => $element->getName(),
121
+ 'value' => '0'
122
+ ));
123
+ $hidden->setForm($element->getForm());
124
+ return $hidden->getElementHtml() . $element->getElementHtml();
125
+ }
126
+
127
+ /**
128
+ * Whether element should be rendered in "simplified" mode
129
+ *
130
+ * @param Varien_Data_Form_Element_Abstract $element
131
+ * @return bool
132
+ */
133
+ public function getIsElementSimplified(Varien_Data_Form_Element_Abstract $element)
134
+ {
135
+ $originalData = $element->getOriginalData();
136
+ return isset($originalData['is_simplified']) && 1 == $originalData['is_simplified'];
137
+ }
138
+
139
+ /**
140
+ * Getter for element label
141
+ *
142
+ * @param Varien_Data_Form_Element_Abstract $element
143
+ * @return string
144
+ */
145
+ public function getElementLabel(Varien_Data_Form_Element_Abstract $element)
146
+ {
147
+ return $element->getLabel();
148
+ }
149
+
150
+ /**
151
+ * Getter for element comment
152
+ *
153
+ * @param Varien_Data_Form_Element_Abstract $element
154
+ * @return string
155
+ */
156
+ public function getElementComment(Varien_Data_Form_Element_Abstract $element)
157
+ {
158
+ return $element->getComment();
159
+ }
160
+
161
+ /**
162
+ * Getter for element comment
163
+ *
164
+ * @param Varien_Data_Form_Element_Abstract $element
165
+ * @return string
166
+ */
167
+ public function getElementOriginalData(Varien_Data_Form_Element_Abstract $element, $key)
168
+ {
169
+ $data = $element->getOriginalData();
170
+ return isset($data[$key]) ? $data[$key] : '';
171
+ }
172
+
173
+ /**
174
+ * Check whether checkbox has "Use default" option or not
175
+ *
176
+ * @param Varien_Data_Form_Element_Abstract $element
177
+ * @return bool
178
+ */
179
+ public function hasInheritElement(Varien_Data_Form_Element_Abstract $element)
180
+ {
181
+ return (bool)$element->getCanUseDefaultValue();
182
+ }
183
+
184
+ /**
185
+ * Return "Use default" checkbox html
186
+ *
187
+ * @param Varien_Data_Form_Element_Abstract $element
188
+ * @return string
189
+ */
190
+ public function getInheritElementHtml(Varien_Data_Form_Element_Abstract $element)
191
+ {
192
+ $elementId = $element->getHtmlId();
193
+ $inheritCheckbox = new Varien_Data_Form_Element_Checkbox(array(
194
+ 'html_id' => $elementId . '_inherit',
195
+ 'name' => preg_replace('/\[value\](\[\])?$/', '[inherit]', $element->getName()),
196
+ 'value' => '1',
197
+ 'class' => 'checkbox config-inherit',
198
+ 'onclick' => 'toggleValueElements(this, $(\'' . $elementId . '\').up())'
199
+ ));
200
+ if ($element->getInherit()) {
201
+ $inheritCheckbox->setChecked(true);
202
+ }
203
+
204
+ $inheritCheckbox->setForm($element->getForm());
205
+ return $inheritCheckbox->getElementHtml();
206
+ }
207
+
208
+ /**
209
+ * Return label for "Use default" checkbox
210
+ *
211
+ * @param Varien_Data_Form_Element_Abstract $element
212
+ * @return string
213
+ */
214
+ public function getInheritElementLabelHtml(Varien_Data_Form_Element_Abstract $element)
215
+ {
216
+ return sprintf('<label for="%s" class="inherit" title="%s">%s</label>',
217
+ $element->getHtmlId() . '_inherit',
218
+ $element->getDefaultValue(),
219
+ Mage::helper('adminhtml')->__('Use Default')
220
+ );
221
+ }
222
+
223
+ /**
224
+ * Return element label with tag SPAN
225
+ *
226
+ * @param Varien_Data_Form_Element_Abstract $element
227
+ * @return string
228
+ */
229
+ public function getElementLabelTextHtml(Varien_Data_Form_Element_Abstract $element)
230
+ {
231
+ return sprintf('<span id="%s">%s</span>',
232
+ $element->getHtmlId() . '_label_text',
233
+ $this->escapeHtml($this->getElementLabel($element))
234
+ );
235
+ }
236
+
237
+ /**
238
+ * Return backend config for element like JSON
239
+ *
240
+ * @param Varien_Data_Form_Element_Abstract $element
241
+ * @return string
242
+ */
243
+ public function getElementBackendConfig(Varien_Data_Form_Element_Abstract $element)
244
+ {
245
+ return Mage::helper('commercesearch')->getElementBackendConfig($element);
246
+ }
247
+
248
+
249
+
250
+ /**
251
+ * WSDL URL of the ECOS Web Server SOAP API
252
+ * @var string
253
+ */
254
+ protected static $WSDLURL=WSDL_URL;
255
+ protected $_oSoap;
256
+ public $_logtable='ecos_soap_log';
257
+ protected $_WSDLdebug=true;
258
+ /**
259
+ * Template for the ex_user, overriden for max compatibility, e.g. harmless
260
+ * @var string
261
+ */
262
+ protected $aSoap_options=array('trace'=>true);
263
+ public $aData;
264
+ protected $aFunctions;
265
+ protected $aOldData;
266
+ protected $blEx_ecos_CustomerOnSave=false;
267
+ protected $_lastXMLReq;
268
+ protected $_ret;
269
+ protected $_lastXMLRes;
270
+
271
+
272
+ function __construct(){
273
+ }
274
+
275
+ protected function init_ecos_soap(){
276
+ try{
277
+ if($this->_WSDLdebug){
278
+ ini_set("soap.wsdl_cache_enabled", "0");
279
+ }
280
+ $this->_oSoap=new SoapClient(WSDL,$this->aSoap_options);
281
+ $ret=true;
282
+ $this->_oSoap->__setCookie('XDEBUG_SESSION','htr');
283
+
284
+ $this->aFunctions=$this->_oSoap->__getFunctions();
285
+ $this->aTypes=$this->_oSoap->__getTypes();
286
+ } catch (Exception $e) {
287
+ $SOAP_MSG = "Es konnte keine Verbindung zu https://management.exorbyte.com aufgebaut werden. ".
288
+ "Stellen sie sicher das die Seite von Ihrem Webserver aus erreichbar und PHP ".
289
+ "für die Verwendung von SSL konfiguriert ist." ;
290
+ throw new Exception($SOAP_MSG);
291
+ }
292
+ return $ret;
293
+ }
294
+
295
+ public function SoapCall(){
296
+ if(is_null($this->_oSoap)){
297
+ $this->init_ecos_soap();
298
+ }
299
+ $mArgs = func_num_args();
300
+ $aArgs=func_get_args();
301
+ if(($mArgs < 2) or ($mArgs > 5)) {
302
+ throw new Exception("Invalid number of arguments ".$mArgs." passed to the SOAP call");
303
+ }
304
+ $SOAPaction = $aArgs[0];
305
+ switch ($mArgs) {
306
+ case 2:
307
+ $ret = $this->_oSoap->$SOAPaction($aArgs[1]);
308
+ break;
309
+ case 3:
310
+ $ret = $this->_oSoap->$SOAPaction($aArgs[1], $aArgs[2]);
311
+ break;
312
+ case 4:
313
+ $ret = $this->_oSoap->$SOAPaction($aArgs[1], $aArgs[2], $aArgs[3]);
314
+ break;
315
+ case 5:
316
+ $ret = $this->_oSoap->$SOAPaction($aArgs[1], $aArgs[2], $aArgs[3], $aArgs[4]);
317
+ break;
318
+ }
319
+
320
+ if(is_null($ret)){
321
+ $ret='Error, empty result';
322
+ }
323
+ $this->_ret=$ret;
324
+ $this->_lastXMLReq=$this->_oSoap->__last_request;
325
+ $this->_lastXMLRes=$this->_oSoap->__last_response;
326
+ return $ret;
327
+ }
328
+ public function setExoData($data){
329
+ $this->aOldData=$this->aData;
330
+ $this->aData=$this->validateExoData($data);
331
+ }
332
+ public function setExoAction($action){
333
+ $this->sEx_action=$action;
334
+ }
335
+ public function getExoAction(){
336
+ return $this->sEx_action;
337
+ }
338
+ protected function validateExoData($data=null){
339
+ if(is_null($data)){
340
+ $data=$this->aData;
341
+ }
342
+ foreach ($data as $key=>$value){
343
+ if($value===''){
344
+ unset($data[$key]);
345
+ }
346
+ }
347
+ return $data;
348
+ }
349
+ public function checkExoData($data){
350
+ foreach($this->aDefault as $key=>$value){
351
+ if(!isset($data[$key])){
352
+ $data[$key]=$value;
353
+ }elseif($data[$key]===''){
354
+ $data[$key]=$value;
355
+ }
356
+ }
357
+ $this->setExoData($data);
358
+ }
359
+ public function getEcosURL($ecosAppURL=false){
360
+ $test=parse_url(self::$WSDLURL);
361
+ if (!$ecosAppURL){
362
+ return $test['scheme'].'://'.$test['host'].'/'.'index.php?';
363
+ } else {
364
+ return $test['scheme'].'://'.$test['host'].'/'.$ecosAppURL;
365
+ }
366
+ }
367
+
368
+
369
+
370
+
371
+
372
+ public $plugin_id;
373
+ protected $aAllowed_Keys = array("action","to_do","exo_confirm","exo_auth_mail",
374
+ "exopw","exo_auth_firstname","exo_auth_name","telephone","get_pid","sn_template","email","password",
375
+ "show_images","second_col","display_type","exo_company","exo_title","export_action","set","module");
376
+ protected $aCustomer_Mandatories = array("exo_title","exo_auth_mail","exopw",
377
+ "exo_auth_firstname","exo_auth_name");
378
+ function init() {
379
+ /**
380
+ * Initialisation of all requests, check against allowed keys
381
+ * @var $_REQUEST: user input array
382
+ * @var $aAllowed_Keys array
383
+ * @return keys as object elements
384
+ */
385
+ if(isset($_REQUEST)) {
386
+ foreach($_REQUEST as $key=>$value) {
387
+ if(in_array($key,$this->aAllowed_Keys)) {
388
+ $this->$key=$value;
389
+ }
390
+
391
+ }
392
+ }
393
+ if($this->action=="") {$this->action="aktivierung";}
394
+ }
395
+
396
+ function get_exo_project_id() {
397
+ global $db;
398
+ /**
399
+ * checks the contants for the exorbyte project id
400
+ * no input
401
+ * @return project_id or -1 if not set
402
+ */
403
+ $rs_all=$db->getAll("SELECT * FROM ".TABLE_EXORBYTE);
404
+ if(is_array($rs_all[0])) {$rs=$rs_all[0];}
405
+ else {$rs=$rs_all;}
406
+ if($rs['project_id']>0) {
407
+ return $rs['project_id'];
408
+ }
409
+ return -1;
410
+ }
411
+ function get_exo_project_info($rSOAP) {
412
+ /**
413
+ * check the project
414
+ * @obj $rSOAP
415
+ * @return project info as array.
416
+ */
417
+ $this->aProjectData=$rSOAP->SoapCall("getProjectInfo",$rSOAP->aData['c_id'],$rSOAP->aData['secure_key'],$rSOAP->aData['p_id']);
418
+ $this->aIntegrationData=$rSOAP->SoapCall("getIntegration",$rSOAP->aData['c_id'],$rSOAP->aData['secure_key'],$rSOAP->aData['p_id']);
419
+ return $rSOAP;
420
+ }
421
+
422
+ function authenticate_exo_customer($rSOAP,$email, $password) {
423
+ $rSOAP->aData['email'] = $email;
424
+ $rSOAP->aData['password'] = $password;
425
+ $rSOAP->aData['shop_id'] = "xt";
426
+ $res = $rSOAP->SoapCall("authenticateCustomer",$email,$password,$rSOAP->aData['shop_id']);
427
+
428
+ if( !is_array($res) ){ return false; }
429
+ return $res;
430
+ }
431
+
432
+ function get_exo_customer($rSOAP) {
433
+ global $db;
434
+ /**
435
+ * transfer customer data to use with SOAP
436
+ * @obj $rSOAP
437
+ * @return obj for later use
438
+ */
439
+
440
+ $rs_all=$db->getAll("SELECT * FROM ".TABLE_EXORBYTE);
441
+ if(is_array($rs_all[0])) {$rs=$rs_all[0];}
442
+ else {$rs=$rs_all;}
443
+ $rSOAP->aData['c_id']=$rs['customer_id'];
444
+ $rSOAP->aData['secure_key']=$rs['secure_key'];
445
+
446
+
447
+ // Return if customer data allready exist
448
+ if( $rs['customer_id'] != '' ) { return $rSOAP; }
449
+
450
+ // Throw exception if customer is to be created but
451
+ // no password is provided
452
+ if( $rSOAP->aData['password'] == "" ) {
453
+ $pwmsg = "Bitte geben sie bei der ersten Aktivierung ein Passwort an, ".
454
+ "mit dem Sie sich anschließend in Ihren Administrationsbereich auf ".
455
+ "http://commerce.exorbyte.de/ einloggen können.";
456
+ throw new Exception($pwmsg);
457
+ }
458
+
459
+ // REMOVE PASSWORD FROM XTCOMMERCE
460
+ $db->Execute("UPDATE ".TABLE_PLUGIN_CONFIGURATION." SET config_value='Bitte bei management.exorbyte.com aendern.' WHERE plugin_id='".$this->plugin_id."' and config_key='EXORBYTE_PASSWORD';");
461
+
462
+
463
+
464
+ // Get user data
465
+ $aXTAllUser=$db->getAll("select * FROM ".TABLE_ADMIN_ACL_AREA_USER);
466
+ if(is_array($aXTAllUser[0])) {$aXTUser=$aXTAllUser[0];}
467
+ else {$aXTUSer=$aXTAllUser;}
468
+
469
+ // Check if user exists
470
+ $auth = $this->authenticate_exo_customer($rSOAP, $aXTUser["email"], $rSOAP->aData['password']);
471
+
472
+ if ($auth['error_code']==401) {
473
+ $auth=$rSOAP->SoapCall("addCustomer",$rSOAP->aData['email'],$rSOAP->aData['password'],$rSOAP->aData['shop_id']);
474
+ }
475
+ $rSOAP->aData['c_id']=$auth['c_id'];
476
+ $rSOAP->aData['secure_key']=$auth['secure_key'];
477
+ $rSOAP->aData['email']=$aXTUser["email"];
478
+
479
+ $db->Execute("insert into ".TABLE_EXORBYTE." (
480
+ customer_id, secure_key ) values (
481
+ '".$rSOAP->aData['c_id']."','".$rSOAP->aData['secure_key']."')");
482
+ return $rSOAP;
483
+
484
+
485
+
486
+ // Otherwise setup user data for later usage
487
+ $rSOAP->aData['customers_email_address']=$aXTUser["email"];
488
+ $rSOAP->aData['customers_password']= $rSOAP->aData['password'] ;
489
+ $rSOAP->aData['exo_auth_firstname']=$aXTUser["firstname"];
490
+ $rSOAP->aData['exo_auth_name']=$aXTUser["lastname"];
491
+ $rSOAP->aData['exo_title']="Herrn";
492
+
493
+ return $rSOAP;
494
+ }
495
+ function get_exo_uid(){
496
+ /**
497
+ * create the unique id for the exorbyte customer
498
+ * no input
499
+ * @return customer_id
500
+ */
501
+ return substr( session_id(), 0, 3 ) . substr( md5( uniqid( '', true ).'|'.microtime() ), 0, 29 );
502
+ }
503
+
504
+ function set_exo_secure_key($cid,$pass){
505
+ /**
506
+ * generate the secure key for exorbyte
507
+ * @var cid: customer id;
508
+ * @var pass: selected password
509
+ * @return secure key
510
+ */
511
+ $sSecureKey=md5($cid).md5(substr($pass,2,16));
512
+ return $sSecureKey;
513
+ }
514
+ function call_exo_customer($rSOAP) {
515
+ /**
516
+ * Adds the customer to the database table
517
+ * @obj rSOAP
518
+ * @return obj with new settings
519
+ */
520
+ $this->get_exo_customer($rSOAP);
521
+ $rSOAP->SoapCall("addCustomer");
522
+ /*$check=$rSOAP->aData;
523
+ if((is_string($check)) and (substr($check,1,8)=="xception")) {
524
+ $this->Message=$rSOAP->aData."<p>";
525
+ }*/
526
+ return $rSOAP;
527
+ }
528
+ function add_exo_project($rSOAP) {
529
+ global $db;
530
+ /**
531
+ * Add project and project integration, install updates
532
+ * @obj rSOAP
533
+ * @return obj with new settings
534
+ */
535
+ $this->get_exo_customer($rSOAP);
536
+ $jahr=date(Y)+1;
537
+ $mail=str_replace("@","_",$rSOAP->aData['email']);
538
+ $mail=str_replace(".","_",$mail);
539
+ $rSOAP->aData['p_customer_id']=$rSOAP->aData['c_id'];
540
+ $rSOAP->aData['product_id']="3";
541
+ $rSOAP->aData['orderid']=$this->get_exo_uid();
542
+ $rSOAP->aData['upgrade_orderid']='.';
543
+ $rSOAP->aData['max_queries']="5000";
544
+ $rSOAP->aData['max_records']="100000";
545
+ $rSOAP->aData['coupon']="xtcommerce";
546
+ $rSOAP->aData['contract_status']="time_trial";
547
+ $rSOAP->aData['project_locale']="de_DE";
548
+ $rSOAP->aData['purchase_logo_removal']='false';
549
+ $rSOAP->aData['is_subscription']='0';
550
+ $rSOAP->aData['date_expiry']="$jahr-".date(m)."-".date(d);
551
+ $rSOAP->aData['locale']="de_DE";
552
+ $rSOAP->aData['project_name']=$mail;
553
+ $rSOAP->aData['domain_name']=_SYSTEM_BASE_URL;
554
+
555
+ $shop_root = substr(_SRV_WEB,0,strlen(_SRV_WEB)-strlen(_SRV_WEB_ADMIN));
556
+ $data_src_url = _SYSTEM_BASE_URL.$shop_root._SRV_WEB_EXPORT."exorbyte.csv";
557
+
558
+ $rSOAP->aData['source_data_url']=$data_src_url;
559
+ $rSOAP->aData['source_data_format']="billiger";
560
+ $rSOAP->aData['source_data_file_format']="csv";
561
+ $rSOAP->aData['source_data_field_delimiter']=";";
562
+ $rSOAP->aData['source_data_cat_delimiter']=">";
563
+ $rSOAP->aData['source_data_encoding']="utf-8";
564
+ $ret=$rSOAP->SoapCall("addProject",$rSOAP->aData['c_id'],$rSOAP->aData['secure_key'],$rSOAP->aData);
565
+ $rSOAP->aData['p_id']=$ret;
566
+ $rSOAP->aData['projectKey']=$ret;
567
+ $rSOAP->aData['p_product_id']=$rSOAP->aData['product_id'];
568
+ $rSOAP->aData['p_project_id']=$ret;
569
+ $rSOAP->aData['project_key']=$rSOAP->aData['orderid'];
570
+ $ret2=$rSOAP->SoapCall("updateProject",$rSOAP->aData['c_id'],$rSOAP->aData['secure_key'],$rSOAP->aData['p_id'],$rSOAP->aData);
571
+ $rSOAP->aData['search_field_sel']=EXORBYTE_SEARCH_FIELD_SELECTOR;
572
+ $rSOAP->aData['container_div_sel']=EXORBYTE_RESULT_SELECTOR;
573
+ $rSOAP->aData['is_url_trigger']='false';
574
+ $ret3=$rSOAP->SoapCall("setIntegration",$rSOAP->aData['c_id'],$rSOAP->aData['secure_key'],$rSOAP->aData['p_id'],$rSOAP->aData);
575
+ return $rSOAP;
576
+ }
577
+
578
+ function check_projects($rSOAP) {
579
+ global $db;
580
+ /**
581
+ * Retrieve projects of user - just in case a project id was not written back in the database
582
+ * @obj rSOAP
583
+ * @return obj with new settings
584
+ */
585
+ $ret=$rSOAP->SoapCall("getProjects",$rSOAP->aData['c_id'],$rSOAP->aData['secure_key']);
586
+ if($ret[0]['p_id']!=0) {
587
+ $rSOAP->aData['p_id']=$ret[0]['p_id'];
588
+ }
589
+ }
590
+
591
+
592
+ }
app/code/community/Exorbyte/Commercesearch/Block/Adminhtml/Suggest.php ADDED
@@ -0,0 +1,590 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Exorbyte
22
+ * @package Exorbyte_Commercesearch
23
+ * @copyright Copyright (c) 2012 exorbyte GmbH. (http://commerce.exorbyte.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Fieldset renderer for Exorbyte global settings
29
+ * @author exorbyte Team <core@magentocommerce.com>, dg
30
+ */
31
+
32
+ // defined('WSDL_URL') || define('WSDL_URL','https://management.exorbyte.com/Partner-Soap/soap?wsdl');
33
+ defined('WSDL_URL') || define('WSDL_URL','https://test-management.sellbysearch.com/Partner-Soap/soap?wsdl');
34
+ //defined('WSDL') || define('WSDL','https://management.exorbyte.com/Partner-Soap/soap?wsdl');
35
+ defined('WSDL') || define('WSDL','https://test-management.sellbysearch.com/Partner-Soap/soap?wsdl');
36
+
37
+
38
+ class Exorbyte_Commercesearch_Block_Adminhtml_Suggest
39
+ extends Mage_Adminhtml_Block_Abstract
40
+ implements Varien_Data_Form_Element_Renderer_Interface
41
+ {
42
+ /**
43
+ * Associative array of PayPal product selection elements
44
+ *
45
+ * @var array
46
+ */
47
+ protected $_elements = array();
48
+
49
+ /**
50
+ * Custom template
51
+ *
52
+ * @var string
53
+ */
54
+ protected $_template = 'Commercesearch/ecs.phtml';
55
+
56
+ /**
57
+ * Render fieldset html
58
+ *
59
+ * @param Varien_Data_Form_Element_Abstract $fieldset
60
+ * @return string
61
+ */
62
+ public function render(Varien_Data_Form_Element_Abstract $fieldset)
63
+ {
64
+ foreach ($fieldset->getSortedElements() as $element) {
65
+ $htmlId = $element->getHtmlId();
66
+ $this->_elements[$htmlId] = $element;
67
+ }
68
+ $originalData = $fieldset->getOriginalData();
69
+ $this->addData(array(
70
+ 'fieldset_label' => $fieldset->getLegend(),
71
+ 'fieldset_help_url' => isset($originalData['help_url']) ? $originalData['help_url'] : '',
72
+ ));
73
+ return $this->toHtml();
74
+ }
75
+
76
+ /**
77
+ * Get array of element objects
78
+ *
79
+ * @return array
80
+ */
81
+ public function getElements()
82
+ {
83
+ return $this->_elements;
84
+ }
85
+
86
+ /**
87
+ * Get element by id
88
+ *
89
+ * @param string $elementId
90
+ * @return Varien_Data_Form_Element_Abstract
91
+ */
92
+ public function getElement($elementId)
93
+ {
94
+ if (isset($this->_elements[$elementId])) {
95
+ return $this->_elements[$elementId];
96
+ }
97
+ return false;
98
+ }
99
+
100
+ /**
101
+ * Return checkbox html with hidden field for correct config values
102
+ *
103
+ * @param string $elementId
104
+ * @return string
105
+ */
106
+ public function getElementHtml(Varien_Data_Form_Element_Abstract $element)
107
+ {
108
+ $configValue = (string)$element->getValue();
109
+ if ($configValue) {
110
+ $element->setChecked(true);
111
+ } else {
112
+ $element->setValue('1');
113
+ }
114
+ if ($element->getCanUseDefaultValue() && $element->getInherit()) {
115
+ $element->setDisabled(true);
116
+ }
117
+
118
+ $hidden = new Varien_Data_Form_Element_Hidden(array(
119
+ 'html_id' => $element->getHtmlId() . '_value',
120
+ 'name' => $element->getName(),
121
+ 'value' => '0'
122
+ ));
123
+ $hidden->setForm($element->getForm());
124
+ return $hidden->getElementHtml() . $element->getElementHtml();
125
+ }
126
+
127
+ /**
128
+ * Whether element should be rendered in "simplified" mode
129
+ *
130
+ * @param Varien_Data_Form_Element_Abstract $element
131
+ * @return bool
132
+ */
133
+ public function getIsElementSimplified(Varien_Data_Form_Element_Abstract $element)
134
+ {
135
+ $originalData = $element->getOriginalData();
136
+ return isset($originalData['is_simplified']) && 1 == $originalData['is_simplified'];
137
+ }
138
+
139
+ /**
140
+ * Getter for element label
141
+ *
142
+ * @param Varien_Data_Form_Element_Abstract $element
143
+ * @return string
144
+ */
145
+ public function getElementLabel(Varien_Data_Form_Element_Abstract $element)
146
+ {
147
+ return $element->getLabel();
148
+ }
149
+
150
+ /**
151
+ * Getter for element comment
152
+ *
153
+ * @param Varien_Data_Form_Element_Abstract $element
154
+ * @return string
155
+ */
156
+ public function getElementComment(Varien_Data_Form_Element_Abstract $element)
157
+ {
158
+ return $element->getComment();
159
+ }
160
+
161
+ /**
162
+ * Getter for element comment
163
+ *
164
+ * @param Varien_Data_Form_Element_Abstract $element
165
+ * @return string
166
+ */
167
+ public function getElementOriginalData(Varien_Data_Form_Element_Abstract $element, $key)
168
+ {
169
+ $data = $element->getOriginalData();
170
+ return isset($data[$key]) ? $data[$key] : '';
171
+ }
172
+
173
+ /**
174
+ * Check whether checkbox has "Use default" option or not
175
+ *
176
+ * @param Varien_Data_Form_Element_Abstract $element
177
+ * @return bool
178
+ */
179
+ public function hasInheritElement(Varien_Data_Form_Element_Abstract $element)
180
+ {
181
+ return (bool)$element->getCanUseDefaultValue();
182
+ }
183
+
184
+ /**
185
+ * Return "Use default" checkbox html
186
+ *
187
+ * @param Varien_Data_Form_Element_Abstract $element
188
+ * @return string
189
+ */
190
+ public function getInheritElementHtml(Varien_Data_Form_Element_Abstract $element)
191
+ {
192
+ $elementId = $element->getHtmlId();
193
+ $inheritCheckbox = new Varien_Data_Form_Element_Checkbox(array(
194
+ 'html_id' => $elementId . '_inherit',
195
+ 'name' => preg_replace('/\[value\](\[\])?$/', '[inherit]', $element->getName()),
196
+ 'value' => '1',
197
+ 'class' => 'checkbox config-inherit',
198
+ 'onclick' => 'toggleValueElements(this, $(\'' . $elementId . '\').up())'
199
+ ));
200
+ if ($element->getInherit()) {
201
+ $inheritCheckbox->setChecked(true);
202
+ }
203
+
204
+ $inheritCheckbox->setForm($element->getForm());
205
+ return $inheritCheckbox->getElementHtml();
206
+ }
207
+
208
+ /**
209
+ * Return label for "Use default" checkbox
210
+ *
211
+ * @param Varien_Data_Form_Element_Abstract $element
212
+ * @return string
213
+ */
214
+ public function getInheritElementLabelHtml(Varien_Data_Form_Element_Abstract $element)
215
+ {
216
+ return sprintf('<label for="%s" class="inherit" title="%s">%s</label>',
217
+ $element->getHtmlId() . '_inherit',
218
+ $element->getDefaultValue(),
219
+ Mage::helper('adminhtml')->__('Use Default')
220
+ );
221
+ }
222
+
223
+ /**
224
+ * Return element label with tag SPAN
225
+ *
226
+ * @param Varien_Data_Form_Element_Abstract $element
227
+ * @return string
228
+ */
229
+ public function getElementLabelTextHtml(Varien_Data_Form_Element_Abstract $element)
230
+ {
231
+ return sprintf('<span id="%s">%s</span>',
232
+ $element->getHtmlId() . '_label_text',
233
+ $this->escapeHtml($this->getElementLabel($element))
234
+ );
235
+ }
236
+
237
+ /**
238
+ * Return backend config for element like JSON
239
+ *
240
+ * @param Varien_Data_Form_Element_Abstract $element
241
+ * @return string
242
+ */
243
+ public function getElementBackendConfig(Varien_Data_Form_Element_Abstract $element)
244
+ {
245
+ return Mage::helper('commercesearch')->getElementBackendConfig($element);
246
+ }
247
+
248
+
249
+
250
+ /**
251
+ * WSDL URL of the ECOS Web Server SOAP API
252
+ * @var string
253
+ */
254
+ protected static $WSDLURL=WSDL_URL;
255
+ protected $_oSoap;
256
+ public $_logtable='ecos_soap_log';
257
+ protected $_WSDLdebug=true;
258
+ /**
259
+ * Template for the ex_user, overriden for max compatibility, e.g. harmless
260
+ * @var string
261
+ */
262
+ protected $aSoap_options=array('trace'=>true);
263
+ public $aData;
264
+ protected $aFunctions;
265
+ protected $aOldData;
266
+ protected $blEx_ecos_CustomerOnSave=false;
267
+ protected $_lastXMLReq;
268
+ protected $_ret;
269
+ protected $_lastXMLRes;
270
+
271
+
272
+
273
+ protected function init_ecos_soap(){
274
+ try{
275
+ if($this->_WSDLdebug){
276
+ ini_set("soap.wsdl_cache_enabled", "0");
277
+ }
278
+ $this->_oSoap=new SoapClient(WSDL,$this->aSoap_options);
279
+ $ret=true;
280
+ $this->_oSoap->__setCookie('XDEBUG_SESSION','htr');
281
+
282
+ $this->aFunctions=$this->_oSoap->__getFunctions();
283
+ $this->aTypes=$this->_oSoap->__getTypes();
284
+ } catch (Exception $e) {
285
+ $SOAP_MSG = "Es konnte keine Verbindung zu https://management.exorbyte.com aufgebaut werden. ".
286
+ "Stellen sie sicher das die Seite von Ihrem Webserver aus erreichbar und PHP ".
287
+ "für die Verwendung von SSL konfiguriert ist." ;
288
+ throw new Exception($SOAP_MSG);
289
+ }
290
+ return $ret;
291
+ }
292
+
293
+ public function SoapCall(){
294
+ if(is_null($this->_oSoap)){
295
+ $this->init_ecos_soap();
296
+ }
297
+ $mArgs = func_num_args();
298
+ $aArgs=func_get_args();
299
+ if(($mArgs < 2) or ($mArgs > 5)) {
300
+ throw new Exception("Invalid number of arguments ".$mArgs." passed to the SOAP call");
301
+ }
302
+ $SOAPaction = $aArgs[0];
303
+ switch ($mArgs) {
304
+ case 2:
305
+ $ret = $this->_oSoap->$SOAPaction($aArgs[1]);
306
+ break;
307
+ case 3:
308
+ $ret = $this->_oSoap->$SOAPaction($aArgs[1], $aArgs[2]);
309
+ break;
310
+ case 4:
311
+ $ret = $this->_oSoap->$SOAPaction($aArgs[1], $aArgs[2], $aArgs[3]);
312
+ break;
313
+ case 5:
314
+ $ret = $this->_oSoap->$SOAPaction($aArgs[1], $aArgs[2], $aArgs[3], $aArgs[4]);
315
+ break;
316
+ }
317
+
318
+ if(is_null($ret)){
319
+ $ret='Error, empty result';
320
+ }
321
+ $this->_ret=$ret;
322
+ $this->_lastXMLReq=$this->_oSoap->__last_request;
323
+ $this->_lastXMLRes=$this->_oSoap->__last_response;
324
+ return $ret;
325
+ }
326
+ public function setExoData($data){
327
+ $this->aOldData=$this->aData;
328
+ $this->aData=$this->validateExoData($data);
329
+ }
330
+ public function setExoAction($action){
331
+ $this->sEx_action=$action;
332
+ }
333
+ public function getExoAction(){
334
+ return $this->sEx_action;
335
+ }
336
+ protected function validateExoData($data=null){
337
+ if(is_null($data)){
338
+ $data=$this->aData;
339
+ }
340
+ foreach ($data as $key=>$value){
341
+ if($value===''){
342
+ unset($data[$key]);
343
+ }
344
+ }
345
+ return $data;
346
+ }
347
+ public function checkExoData($data){
348
+ foreach($this->aDefault as $key=>$value){
349
+ if(!isset($data[$key])){
350
+ $data[$key]=$value;
351
+ }elseif($data[$key]===''){
352
+ $data[$key]=$value;
353
+ }
354
+ }
355
+ $this->setExoData($data);
356
+ }
357
+ public function getEcosURL($ecosAppURL=false){
358
+ $test=parse_url(self::$WSDLURL);
359
+ if (!$ecosAppURL){
360
+ return $test['scheme'].'://'.$test['host'].'/'.'index.php?';
361
+ } else {
362
+ return $test['scheme'].'://'.$test['host'].'/'.$ecosAppURL;
363
+ }
364
+ }
365
+
366
+
367
+
368
+
369
+
370
+ public $plugin_id;
371
+ protected $aAllowed_Keys = array("action","to_do","exo_confirm","exo_auth_mail",
372
+ "exopw","exo_auth_firstname","exo_auth_name","telephone","get_pid","sn_template","email","password",
373
+ "show_images","second_col","display_type","exo_company","exo_title","export_action","set","module");
374
+ protected $aCustomer_Mandatories = array("exo_title","exo_auth_mail","exopw",
375
+ "exo_auth_firstname","exo_auth_name");
376
+ function init() {
377
+ /**
378
+ * Initialisation of all requests, check against allowed keys
379
+ * @var $_REQUEST: user input array
380
+ * @var $aAllowed_Keys array
381
+ * @return keys as object elements
382
+ */
383
+ if(isset($_REQUEST)) {
384
+ foreach($_REQUEST as $key=>$value) {
385
+ if(in_array($key,$this->aAllowed_Keys)) {
386
+ $this->$key=$value;
387
+ }
388
+
389
+ }
390
+ }
391
+ if($this->action=="") {$this->action="aktivierung";}
392
+ }
393
+
394
+ function get_exo_project_id() {
395
+ global $db;
396
+ /**
397
+ * checks the contants for the exorbyte project id
398
+ * no input
399
+ * @return project_id or -1 if not set
400
+ */
401
+ $rs_all=$db->getAll("SELECT * FROM ".TABLE_EXORBYTE);
402
+ if(is_array($rs_all[0])) {$rs=$rs_all[0];}
403
+ else {$rs=$rs_all;}
404
+ if($rs['project_id']>0) {
405
+ return $rs['project_id'];
406
+ }
407
+ return -1;
408
+ }
409
+ function get_exo_project_info($rSOAP) {
410
+ /**
411
+ * check the project
412
+ * @obj $rSOAP
413
+ * @return project info as array.
414
+ */
415
+ $this->aProjectData=$rSOAP->SoapCall("getProjectInfo",$rSOAP->aData['c_id'],$rSOAP->aData['secure_key'],$rSOAP->aData['p_id']);
416
+ $this->aIntegrationData=$rSOAP->SoapCall("getIntegration",$rSOAP->aData['c_id'],$rSOAP->aData['secure_key'],$rSOAP->aData['p_id']);
417
+ return $rSOAP;
418
+ }
419
+
420
+ function authenticate_exo_customer($rSOAP,$email, $password) {
421
+ $rSOAP->aData['email'] = $email;
422
+ $rSOAP->aData['password'] = $password;
423
+ $rSOAP->aData['shop_id'] = "xt";
424
+ $res = $rSOAP->SoapCall("authenticateCustomer",$email,$password,$rSOAP->aData['shop_id']);
425
+
426
+ if( !is_array($res) ){ return false; }
427
+ return $res;
428
+ }
429
+
430
+ function get_exo_customer($rSOAP) {
431
+ global $db;
432
+ /**
433
+ * transfer customer data to use with SOAP
434
+ * @obj $rSOAP
435
+ * @return obj for later use
436
+ */
437
+
438
+ $rs_all=$db->getAll("SELECT * FROM ".TABLE_EXORBYTE);
439
+ if(is_array($rs_all[0])) {$rs=$rs_all[0];}
440
+ else {$rs=$rs_all;}
441
+ $rSOAP->aData['c_id']=$rs['customer_id'];
442
+ $rSOAP->aData['secure_key']=$rs['secure_key'];
443
+
444
+
445
+ // Return if customer data allready exist
446
+ if( $rs['customer_id'] != '' ) { return $rSOAP; }
447
+
448
+ // Throw exception if customer is to be created but
449
+ // no password is provided
450
+ if( $rSOAP->aData['password'] == "" ) {
451
+ $pwmsg = "Bitte geben sie bei der ersten Aktivierung ein Passwort an, ".
452
+ "mit dem Sie sich anschließend in Ihren Administrationsbereich auf ".
453
+ "http://commerce.exorbyte.de/ einloggen können.";
454
+ throw new Exception($pwmsg);
455
+ }
456
+
457
+ // REMOVE PASSWORD FROM XTCOMMERCE
458
+ $db->Execute("UPDATE ".TABLE_PLUGIN_CONFIGURATION." SET config_value='Bitte bei management.exorbyte.com aendern.' WHERE plugin_id='".$this->plugin_id."' and config_key='EXORBYTE_PASSWORD';");
459
+
460
+
461
+
462
+ // Get user data
463
+ $aXTAllUser=$db->getAll("select * FROM ".TABLE_ADMIN_ACL_AREA_USER);
464
+ if(is_array($aXTAllUser[0])) {$aXTUser=$aXTAllUser[0];}
465
+ else {$aXTUSer=$aXTAllUser;}
466
+
467
+ // Check if user exists
468
+ $auth = $this->authenticate_exo_customer($rSOAP, $aXTUser["email"], $rSOAP->aData['password']);
469
+
470
+ if ($auth['error_code']==401) {
471
+ $auth=$rSOAP->SoapCall("addCustomer",$rSOAP->aData['email'],$rSOAP->aData['password'],$rSOAP->aData['shop_id']);
472
+ }
473
+ $rSOAP->aData['c_id']=$auth['c_id'];
474
+ $rSOAP->aData['secure_key']=$auth['secure_key'];
475
+ $rSOAP->aData['email']=$aXTUser["email"];
476
+
477
+ $db->Execute("insert into ".TABLE_EXORBYTE." (
478
+ customer_id, secure_key ) values (
479
+ '".$rSOAP->aData['c_id']."','".$rSOAP->aData['secure_key']."')");
480
+ return $rSOAP;
481
+
482
+
483
+
484
+ // Otherwise setup user data for later usage
485
+ $rSOAP->aData['customers_email_address']=$aXTUser["email"];
486
+ $rSOAP->aData['customers_password']= $rSOAP->aData['password'] ;
487
+ $rSOAP->aData['exo_auth_firstname']=$aXTUser["firstname"];
488
+ $rSOAP->aData['exo_auth_name']=$aXTUser["lastname"];
489
+ $rSOAP->aData['exo_title']="Herrn";
490
+
491
+ return $rSOAP;
492
+ }
493
+ function get_exo_uid(){
494
+ /**
495
+ * create the unique id for the exorbyte customer
496
+ * no input
497
+ * @return customer_id
498
+ */
499
+ return substr( session_id(), 0, 3 ) . substr( md5( uniqid( '', true ).'|'.microtime() ), 0, 29 );
500
+ }
501
+
502
+ function set_exo_secure_key($cid,$pass){
503
+ /**
504
+ * generate the secure key for exorbyte
505
+ * @var cid: customer id;
506
+ * @var pass: selected password
507
+ * @return secure key
508
+ */
509
+ $sSecureKey=md5($cid).md5(substr($pass,2,16));
510
+ return $sSecureKey;
511
+ }
512
+ function call_exo_customer($rSOAP) {
513
+ /**
514
+ * Adds the customer to the database table
515
+ * @obj rSOAP
516
+ * @return obj with new settings
517
+ */
518
+ $this->get_exo_customer($rSOAP);
519
+ $rSOAP->SoapCall("addCustomer");
520
+ /*$check=$rSOAP->aData;
521
+ if((is_string($check)) and (substr($check,1,8)=="xception")) {
522
+ $this->Message=$rSOAP->aData."<p>";
523
+ }*/
524
+ return $rSOAP;
525
+ }
526
+ function add_exo_project($rSOAP) {
527
+ global $db;
528
+ /**
529
+ * Add project and project integration, install updates
530
+ * @obj rSOAP
531
+ * @return obj with new settings
532
+ */
533
+ $this->get_exo_customer($rSOAP);
534
+ $jahr=date(Y)+1;
535
+ $mail=str_replace("@","_",$rSOAP->aData['email']);
536
+ $mail=str_replace(".","_",$mail);
537
+ $rSOAP->aData['p_customer_id']=$rSOAP->aData['c_id'];
538
+ $rSOAP->aData['product_id']="3";
539
+ $rSOAP->aData['orderid']=$this->get_exo_uid();
540
+ $rSOAP->aData['upgrade_orderid']='.';
541
+ $rSOAP->aData['max_queries']="5000";
542
+ $rSOAP->aData['max_records']="100000";
543
+ $rSOAP->aData['coupon']="xtcommerce";
544
+ $rSOAP->aData['contract_status']="time_trial";
545
+ $rSOAP->aData['project_locale']="de_DE";
546
+ $rSOAP->aData['purchase_logo_removal']='false';
547
+ $rSOAP->aData['is_subscription']='0';
548
+ $rSOAP->aData['date_expiry']="$jahr-".date(m)."-".date(d);
549
+ $rSOAP->aData['locale']="de_DE";
550
+ $rSOAP->aData['project_name']=$mail;
551
+ $rSOAP->aData['domain_name']=_SYSTEM_BASE_URL;
552
+
553
+ $shop_root = substr(_SRV_WEB,0,strlen(_SRV_WEB)-strlen(_SRV_WEB_ADMIN));
554
+ $data_src_url = _SYSTEM_BASE_URL.$shop_root._SRV_WEB_EXPORT."exorbyte.csv";
555
+
556
+ $rSOAP->aData['source_data_url']=$data_src_url;
557
+ $rSOAP->aData['source_data_format']="billiger";
558
+ $rSOAP->aData['source_data_file_format']="csv";
559
+ $rSOAP->aData['source_data_field_delimiter']=";";
560
+ $rSOAP->aData['source_data_cat_delimiter']=">";
561
+ $rSOAP->aData['source_data_encoding']="utf-8";
562
+ $ret=$rSOAP->SoapCall("addProject",$rSOAP->aData['c_id'],$rSOAP->aData['secure_key'],$rSOAP->aData);
563
+ $rSOAP->aData['p_id']=$ret;
564
+ $rSOAP->aData['projectKey']=$ret;
565
+ $rSOAP->aData['p_product_id']=$rSOAP->aData['product_id'];
566
+ $rSOAP->aData['p_project_id']=$ret;
567
+ $rSOAP->aData['project_key']=$rSOAP->aData['orderid'];
568
+ $ret2=$rSOAP->SoapCall("updateProject",$rSOAP->aData['c_id'],$rSOAP->aData['secure_key'],$rSOAP->aData['p_id'],$rSOAP->aData);
569
+ $rSOAP->aData['search_field_sel']=EXORBYTE_SEARCH_FIELD_SELECTOR;
570
+ $rSOAP->aData['container_div_sel']=EXORBYTE_RESULT_SELECTOR;
571
+ $rSOAP->aData['is_url_trigger']='false';
572
+ $ret3=$rSOAP->SoapCall("setIntegration",$rSOAP->aData['c_id'],$rSOAP->aData['secure_key'],$rSOAP->aData['p_id'],$rSOAP->aData);
573
+ return $rSOAP;
574
+ }
575
+
576
+ function check_projects($rSOAP) {
577
+ global $db;
578
+ /**
579
+ * Retrieve projects of user - just in case a project id was not written back in the database
580
+ * @obj rSOAP
581
+ * @return obj with new settings
582
+ */
583
+ $ret=$rSOAP->SoapCall("getProjects",$rSOAP->aData['c_id'],$rSOAP->aData['secure_key']);
584
+ if($ret[0]['p_id']!=0) {
585
+ $rSOAP->aData['p_id']=$ret[0]['p_id'];
586
+ }
587
+ }
588
+
589
+
590
+ }
app/code/community/Exorbyte/Commercesearch/Block/Backend/Exportbutton.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Exorbyte
22
+ * @package Exorbyte_Commercesearch
23
+ * @copyright Copyright (c) 2012 exorbyte GmbH
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ class Exorbyte_Commercesearch_Block_Backend_Exportbutton
29
+ //extends Mage_Adminhtml_System_Convert_GuiController
30
+ extends Mage_Adminhtml_System_Convert_ProfileController
31
+ {
32
+
33
+ public function __construct() {
34
+ return "<button style=width:200px;height:200px;background-color:black;color:white;>MyButton</button>";
35
+ $this->_initProfile('exorbyte');
36
+ return $this->getRunButtonHtml();
37
+ }
38
+ }
app/code/community/Exorbyte/Commercesearch/Block/Manualupload.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Exorbyte_Commercesearch_Block_Manualupload
3
+ extends Mage_Adminhtml_Block_System_Config_Form_Field {
4
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
5
+ $this->setElement($element);
6
+ $baseurl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
7
+ $select = 'SELECT profile_id';
8
+ $table = 'dataflow_profile';
9
+ $where = 'name=\'exorbyte\'';
10
+ $order = '';
11
+ $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
12
+ $result = $connection->select($select)
13
+ ->from($table)
14
+ ->where($where)
15
+ ->order($order);
16
+ $data = $connection->fetchAll($result);
17
+
18
+ $editurl=$this->getUrl('*/system_convert_gui/edit') . 'id/'.$data[0]["profile_id"];
19
+ $html = $this->getLayout()->createBlock('adminhtml/widget_button')
20
+ ->setType('button')
21
+ ->setClass('scalable')
22
+ ->setLabel('View and run datafeed!')
23
+ //->setOnClick("window.open('".$baseurl."exorbyteexport.php','window','width=400,height=200')")
24
+ ->setOnClick("window.open('".$editurl."','window','width=800,height=600')")
25
+ ->toHtml();
26
+ return $html;
27
+ }
28
+ }
app/code/community/Exorbyte/Commercesearch/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Exorbyte_Commercesearch_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
app/code/community/Exorbyte/Commercesearch/Helper/exorbyte_export.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ define('SAVE_FEED_LOCATION','export/exorbyte.csv');
3
+ // avoid timeouts - but be aware that the memory limit can be touched
4
+ set_time_limit(0);
5
+ require_once '../../app/Mage.php';
6
+ Mage::app('default');
7
+ try{
8
+ //$handle = fopen(SAVE_FEED_LOCATION, 'w');
9
+ $heading = array('"aid"','"brand"','"name"','"desc"','"price"','"stock"','"link"','"image"','"stock_description"','"shipping_rate"','"shop_cat"');
10
+ $feed_line=implode("\t", $heading)."\r\n";
11
+ //fwrite($handle, $feed_line);
12
+ echo $feed_line;
13
+
14
+ //---------------------- read products
15
+ $products = Mage::getModel('catalog/product')->getCollection();
16
+ $products->addAttributeToFilter('status', 1);//enabled
17
+ $products->addAttributeToFilter('visibility', 4);//catalog, search
18
+ $products->addAttributeToSelect('*');
19
+ $prodIds=$products->getAllIds();
20
+
21
+ $product = Mage::getModel('catalog/product');
22
+
23
+ foreach($prodIds as $productId) {
24
+ $product->load($productId);
25
+
26
+ $product_data = array();
27
+ $product_data['sku']=$product->getSku();
28
+ $product_data['brand']=$product->getResource()->getAttribute('manufacturer')->getFrontend()->getValue($product);
29
+ $product_data['title']=$product->getName();
30
+ $product_data['description']=$product->getDescription();
31
+ $product_data['price']=$product->getPrice();
32
+ $product_data['availability']='yes';
33
+ $product_data['link']=str_replace("exorbyte.php","index.php",$product->getUrlPath());
34
+ $product_data['image_link']=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'catalog/product'.$product->getImage();
35
+ $product_data['stock_descrip']='';
36
+ $product_data['shipping_rate']='';
37
+
38
+ //get the product categories
39
+ foreach($product->getCategoryIds() as $_categoryId){
40
+ $category = Mage::getModel('catalog/category')->load($_categoryId);
41
+ $product_data['product_type'].=$category->getName().', ';
42
+ }
43
+ $product_data['product_type']=rtrim($product_data['product_type'],', ');
44
+ //sanitize data
45
+ foreach($product_data as $k=>$val){
46
+ $bad=array('"',"\r\n","\n","\r","\t");
47
+ $good=array(""," "," "," ","");
48
+ $product_data[$k] = '"'.str_replace($bad,$good,$val).'"';
49
+ }
50
+
51
+ $feed_line = implode("\t", $product_data)."\r\n";
52
+ //fwrite($handle, $feed_line);
53
+ //fflush($handle);
54
+ echo $feed_line;
55
+ }
56
+
57
+ //---------------------- WRITE THE FEED
58
+ //fclose($handle);
59
+
60
+ }
61
+ catch(Exception $e){
62
+ die($e->getMessage());
63
+ }
64
+
app/code/community/Exorbyte/Commercesearch/Model/Activate.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Exorbyte_Commercesearch_Model_activate extends Exorbyte_Commercesearch_Model_Connect {
3
+ public function save() {
4
+ /* $email = $this->getValue(); //get the value from our config
5
+ if(!strpos($email,"@")){ //exit if we're less than 10 digits long
6
+ Mage::throwException("please enter a valid email adress");
7
+ }
8
+ $cid="bd37a2261f4bb262e1c34bb9d2131035";
9
+ $sec="2c37d6bef0ca6e1dc6e1a21c5a505d6ad455cf9dd340a920407985eebfa14c0f";
10
+ $status=$this->SoapCall("getFirstProject",$cid, $sec);
11
+ Mage::throwException("<p>pid ".$status);
12
+
13
+ return parent::save(); //call original save method so whatever happened
14
+ //before still happens (the value saves)
15
+ */ }
16
+ }
app/code/community/Exorbyte/Commercesearch/Model/Backend/Design.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Exorbyte
22
+ * @package Exorbyte_Commercesearch
23
+ * @copyright Copyright (c) 2012 exorbyte GmbH
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ class Exorbyte_Commercesearch_Model_Backend_Design {
29
+
30
+ protected static $_options;
31
+
32
+ const DESIGN_R = 'round';
33
+ const DESIGN_S = 'square';
34
+
35
+ public function toOptionArray() {
36
+ if (!self::$_options) {
37
+ self::$_options = array(
38
+ array(
39
+ 'label' => Mage::helper('adminhtml')->__('square'),
40
+ 'value' => self::DESIGN_S,
41
+ ),
42
+ array(
43
+ 'label' => Mage::helper('adminhtml')->__('round'),
44
+ 'value' => self::DESIGN_R,
45
+ ),
46
+ );
47
+ }
48
+ return self::$_options;
49
+ }
50
+
51
+ }
app/code/community/Exorbyte/Commercesearch/Model/Backend/Email.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Exorbyte
22
+ * @package Exorbyte_Commercesearch
23
+ * @copyright Copyright (c) 2012 exorbyte GmbH
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ class Exorbyte_Commercesearch_Model_Backend_Email {
29
+ //function getUserEmail() {
30
+ $userArray = Mage::getSingleton('admin/session')->getData();
31
+ $user = Mage::getSingleton('admin/session');
32
+ $userEmail = $user->getUser()->getEmail();
33
+ Mage::throwException("ok, model gefunden");
34
+ return $userEmail;
35
+ //}
36
+ }
app/code/community/Exorbyte/Commercesearch/Model/Backend/Layout.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Exorbyte
22
+ * @package Exorbyte_Commercesearch
23
+ * @copyright Copyright (c) 2012 exorbyte GmbH
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ class Exorbyte_Commercesearch_Model_Backend_Layout {
29
+
30
+ protected static $_options;
31
+
32
+ const LAYOUT_P = 'none';
33
+ const LAYOUT_PC = 'category';
34
+ const LAYOUT_PCB = 'type';
35
+
36
+ public function toOptionArray() {
37
+ if (!self::$_options) {
38
+ self::$_options = array(
39
+ array(
40
+ 'label' => Mage::helper('adminhtml')->__('Products only'),
41
+ 'value' => self::LAYOUT_P,
42
+ ),
43
+ array(
44
+ 'label' => Mage::helper('adminhtml')->__('Products and category'),
45
+ 'value' => self::LAYOUT_PC,
46
+ ),
47
+ array(
48
+ 'label' => Mage::helper('adminhtml')->__('Products, category and brands'),
49
+ 'value' => self::LAYOUT_PCB,
50
+ ),
51
+ );
52
+ }
53
+ return self::$_options;
54
+ }
55
+
56
+ }
app/code/community/Exorbyte/Commercesearch/Model/Commercesearch.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+ class Exorbyte_Commercesearch_Model_commercesearch extends Mage_Core_Model_Abstract {
3
+ public function _construct() {
4
+ parent::_construct();
5
+ $this->_init('Commercesearch/commercesearch');
6
+ }
7
+ }
app/code/community/Exorbyte/Commercesearch/Model/Connect.php ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('WSDL_URL') || define('WSDL_URL','https://management.exorbyte.com/Partner-Soap/soap?wsdl');
3
+ //defined('WSDL_URL') || define('WSDL_URL','https://test-management.sellbysearch.com/Partner-Soap/soap?wsdl');
4
+ defined('WSDL') || define('WSDL','https://management.exorbyte.com/Partner-Soap/soap?wsdl');
5
+ //defined('WSDL') || define('WSDL','https://test-management.sellbysearch.com/Partner-Soap/soap?wsdl');
6
+
7
+ class Exorbyte_Commercesearch_Model_Connect extends Mage_Core_Model_Config_Data {
8
+
9
+ /**
10
+ * WSDL URL of the ECOS Web Server SOAP API
11
+ * @var string
12
+ */
13
+ protected static $WSDLURL=WSDL_URL;
14
+ protected $_oSoap;
15
+ public $_logtable='ecos_soap_log';
16
+ protected $_WSDLdebug=true;
17
+ /**
18
+ * Template for the ex_user, overriden for max compatibility, e.g. harmless
19
+ * @var string
20
+ */
21
+ protected $aSoap_options=array('trace'=>true);
22
+ public $aData;
23
+ protected $aFunctions;
24
+ protected $aOldData;
25
+ protected $blEx_ecos_CustomerOnSave=false;
26
+ protected $_lastXMLReq;
27
+ protected $_ret;
28
+ protected $_lastXMLRes;
29
+
30
+ /*public function save() {
31
+ return parent::save();
32
+ }*/
33
+
34
+
35
+ protected function init_ecos_soap(){
36
+ try{
37
+ if($this->_WSDLdebug){
38
+ ini_set("soap.wsdl_cache_enabled", "0");
39
+ }
40
+ $this->_oSoap=new SoapClient(WSDL,$this->aSoap_options);
41
+ $ret=true;
42
+ $this->_oSoap->__setCookie('XDEBUG_SESSION','htr');
43
+
44
+ $this->aFunctions=$this->_oSoap->__getFunctions();
45
+ $this->aTypes=$this->_oSoap->__getTypes();
46
+ } catch (Exception $e) {
47
+ $SOAP_MSG = "Es konnte keine Verbindung zu https://management.exorbyte.com aufgebaut werden. ".
48
+ "Stellen sie sicher das die Seite von Ihrem Webserver aus erreichbar und PHP ".
49
+ "für die Verwendung von SSL konfiguriert ist." ;
50
+ throw new Exception($SOAP_MSG);
51
+ }
52
+ return $ret;
53
+ }
54
+
55
+ public function SoapCall(){
56
+ if(is_null($this->_oSoap)){
57
+ $this->init_ecos_soap();
58
+ }
59
+ $mArgs = func_num_args();
60
+ $aArgs=func_get_args();
61
+ if(($mArgs < 2) or ($mArgs > 5)) {
62
+ throw new Exception("Invalid number of arguments ".$mArgs." passed to the SOAP call");
63
+ }
64
+ $SOAPaction = $aArgs[0];
65
+ switch ($mArgs) {
66
+ case 2:
67
+ $ret = $this->_oSoap->$SOAPaction($aArgs[1]);
68
+ break;
69
+ case 3:
70
+ $ret = $this->_oSoap->$SOAPaction($aArgs[1], $aArgs[2]);
71
+ break;
72
+ case 4:
73
+ $ret = $this->_oSoap->$SOAPaction($aArgs[1], $aArgs[2], $aArgs[3]);
74
+ break;
75
+ case 5:
76
+ $ret = $this->_oSoap->$SOAPaction($aArgs[1], $aArgs[2], $aArgs[3], $aArgs[4]);
77
+ break;
78
+ }
79
+
80
+ if(is_null($ret)){
81
+ $ret='Error, empty result';
82
+ }
83
+ $this->_ret=$ret;
84
+ $this->_lastXMLReq=$this->_oSoap->__last_request;
85
+ $this->_lastXMLRes=$this->_oSoap->__last_response;
86
+ return $ret;
87
+ }
88
+ public function setExoData($data){
89
+ $this->aOldData=$this->aData;
90
+ $this->aData=$this->validateExoData($data);
91
+ }
92
+ public function setExoAction($action){
93
+ $this->sEx_action=$action;
94
+ }
95
+ public function getExoAction(){
96
+ return $this->sEx_action;
97
+ }
98
+ protected function validateExoData($data=null){
99
+ if(is_null($data)){
100
+ $data=$this->aData;
101
+ }
102
+ foreach ($data as $key=>$value){
103
+ if($value===''){
104
+ unset($data[$key]);
105
+ }
106
+ }
107
+ return $data;
108
+ }
109
+ public function checkExoData($data){
110
+ foreach($this->aDefault as $key=>$value){
111
+ if(!isset($data[$key])){
112
+ $data[$key]=$value;
113
+ }elseif($data[$key]===''){
114
+ $data[$key]=$value;
115
+ }
116
+ }
117
+ $this->setExoData($data);
118
+ }
119
+ public function getEcosURL($ecosAppURL=false){
120
+ $test=parse_url(self::$WSDLURL);
121
+ if (!$ecosAppURL){
122
+ return $test['scheme'].'://'.$test['host'].'/'.'index.php?';
123
+ } else {
124
+ return $test['scheme'].'://'.$test['host'].'/'.$ecosAppURL;
125
+ }
126
+ }
127
+ }
app/code/community/Exorbyte/Commercesearch/Model/Mysql4/Commercesearch.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ class Exorbyte_Commercesearch_Model_Mysql4_commercesearch extends Mage_Core_Model_Mysql4_Abstract {
3
+ public function _construct() {
4
+ $this->_init('Commercesearch/commercesearch', 'Commercesearch_id');
5
+ }
6
+ }
app/code/community/Exorbyte/Commercesearch/Model/Mysql4/Commercesearch/Collection.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+ class Exorbyte_Commercesearch_Model_Mysql4_commercesearch_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
3
+ public function _construct() {
4
+ parent::_construct();
5
+ $this->_init('Commercesearch/commercesearch');
6
+ }
7
+ }
app/code/community/Exorbyte/Commercesearch/Model/Observer.php ADDED
@@ -0,0 +1,220 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Exorbyte_Commercesearch_Model_Observer extends Exorbyte_Commercesearch_Model_Connect {
3
+
4
+ public function save() {
5
+ $postData = Mage::app()->getRequest()->getPost();
6
+ Mage::getModel('core/config')->deleteConfig('general', 0 );
7
+ // print_r($postData);
8
+ $sFehler="";
9
+ $activate_new=$postData['groups']['settings']['fields']['Commercesearch_activate']['value'];
10
+ $activate_old = Mage::getStoreConfig('Commercesearch_options/settings/Commercesearch_activate');
11
+ $email_new=$postData['groups']['settings']['fields']['Commercesearch_email']['value'];
12
+ $email_new=$this->exoCheckMail($email_new);
13
+ $email_old = Mage::getStoreConfig('Commercesearch_options/settings/Commercesearch_email');
14
+ $this->aData["p_id"] = Mage::getStoreConfig('Commercesearch_options/settings/Commercesearch_pid');
15
+ $this->aData["c_id"] = Mage::getStoreConfig('Commercesearch_options/settings/Commercesearch_cid');
16
+ $this->aData["secure_key"]= Mage::getStoreConfig('Commercesearch_options/settings/Commercesearch_securekey');
17
+ if(!$this->aData["c_id"]) {
18
+ $password_new=$postData['groups']['settings']['fields']['Commercesearch_password']['value'];
19
+ $password_old= Mage::getStoreConfig('Commercesearch_options/settings/Commercesearch_password');
20
+ if(($password_new=="") and (!$password_old)) { Mage::throwException("Please enter a password for your exorbyte account");}
21
+ }
22
+ if($this->aData["p_id"]>0) {
23
+ if($this->exoCheckExport()==false) {
24
+ Mage::throwException("Please change to System/Import_Export/Dataflow_Profiles and run the exorbyte export profile");
25
+ }
26
+ if($activate_new!=$activate_old) {
27
+ if($activate_new==0) {$nex=$this->SoapCall("deactivateProject",$this->aData["c_id"],$this->aData["secure_key"],$this->aData["p_id"]);}
28
+ else {
29
+ $nex=$this->SoapCall("activateProject",$this->aData["c_id"],$this->aData["secure_key"],$this->aData["p_id"]);
30
+ $p_id_for_message=$this->SoapCall("installProject",$this->aData["c_id"],$this->aData["secure_key"],$this->aData["p_id"]);
31
+ }
32
+ }
33
+ }
34
+ else {
35
+ if($activate_new==1) {
36
+ //first of all check for export file
37
+ if($this->exoCheckExport()==false) {
38
+ Mage::throwException("Please change to System/Import_Export/Dataflow_Profiles and run the exorbyte export profile");
39
+ }
40
+ if($this->aData["c_id"]>0) {
41
+ $this->aData["email"]=$email_old;
42
+ }
43
+ else {
44
+ $aCustomer=$this->SoapCall("addCustomer",$email_new,$password_new,$this->exoGetRegion());
45
+ if($aCustomer['c_id']!="") {
46
+ $this->aData["c_id"]=$aCustomer['c_id'];
47
+ $this->aData["secure_key"]=$aCustomer['secure_key'];
48
+ $this->exoSave('Commercesearch_options/settings/Commercesearch_cid', $this->aData["c_id"]);
49
+ $this->exoSave('Commercesearch_options/settings/Commercesearch_securekey',$this->aData["secure_key"]);
50
+ $this->exoSave('Commercesearch_options/settings/Commercesearch_field', 'input[name=exo_query]');
51
+ $this->exoSave('Commercesearch_options/settings/Commercesearch_result','.col-main');
52
+ $password_new='please change your password in the management console';
53
+ $this->exoSave('Commercesearch_options/settings/Commercesearch_password',$password_new);
54
+ $this->aData["email"]=$email_new;
55
+ }
56
+ else {
57
+ if(is_array($aCustomer)) {
58
+ foreach($aCustomer as $fkey=>$fvalue) {$sFehler.=" ".$fkey.": ".$fvalue;}
59
+ }
60
+ else {$sFehler=$aCustomer;}
61
+ Mage::throwException("Could not add new exorbyte customer, reason code: ".$sFehler);
62
+ }
63
+ }
64
+ //next action: add project
65
+ $this->exoSetData(); //add all needed data to the aData array
66
+ $this->aData["p_id"]=$this->SoapCall("addProject",$this->aData["c_id"],$this->aData["secure_key"],$this->aData);
67
+ if($this->aData["p_id"]>0) {
68
+ $this->aData["project_snippet"]=$this->SoapCall("getProjectSnippet",$this->aData["c_id"],$this->aData["secure_key"]);
69
+ $this->exoSave('Commercesearch_options/settings/Commercesearch_pid', $this->aData["p_id"]);
70
+ $this->exoSave('Commercesearch_options/settings/Commercesearch_projectsnippet',$this->aData["project_snippet"]);
71
+ }
72
+ }
73
+ }
74
+ //now we need to rework the data feed
75
+ if($activate_new==1) {
76
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
77
+ $update1="update catalog_product_entity_text set value = replace(value, '\n', ' ')";
78
+ $update2="update catalog_product_entity_text set value = replace(value, '\r', ' ')";
79
+ $update3="update catalog_product_entity_text set value = replace(value, '\l', ' ')";
80
+ $write->query($update1);
81
+ $write->query($update2);
82
+ $write->query($update3);
83
+ //next action: add integration if changed or new project
84
+ if($this->exoCheckForDoIntegration($postData)==true) {
85
+ $this->aData["project_snippet"]=$this->SoapCall("getProjectSnippet",$this->aData["c_id"],$this->aData["secure_key"],$this->aData["p_id"]);
86
+ $this->exoSave('Commercesearch_options/settings/Commercesearch_projectsnippet',$this->aData["project_snippet"]);
87
+ $p_id_for_nextmessage=$this->SoapCall("setPresentation",$this->aData["c_id"],$this->aData["secure_key"],$this->aData["p_id"],$this->aData);
88
+ $p_id_for_message=$this->SoapCall("installProject",$this->aData["c_id"],$this->aData["secure_key"],$this->aData["p_id"]);
89
+ }
90
+ $this->aData['search_field_sel']='input[name=exo_query]';
91
+ $this->aData['container_div_sel']='.col-main';
92
+ $nex=$this->SoapCall("setIntegration",$this->aData["c_id"],$this->aData["secure_key"],$this->aData["p_id"],$this->aData);
93
+ $p_id_for_nextmessage=$this->SoapCall("setPresentation",$this->aData["c_id"],$this->aData["secure_key"],$this->aData["p_id"],$this->aData);
94
+ $p_id_for_message=$this->SoapCall("installProject",$this->aData["c_id"],$this->aData["secure_key"],$this->aData["p_id"]);
95
+ //next: install/update project
96
+ //Mage::throwException("all saved: ".$p_id_for_message);
97
+ }
98
+ return parent::save(); //call original save method so whatever happened
99
+ //before still happens (the value saves)
100
+ }
101
+
102
+ public function exoSave($field,$value) {
103
+ Mage::getModel('core/config')->saveConfig($field, $value );
104
+ }
105
+ public function exoCheckMail($email) {
106
+ if(!strpos($email,"@")){
107
+ Mage::throwException("Please enter a valid email adress, cannot retrieve $email ");
108
+ }
109
+ $this->exoSave('Commercesearch_options/settings/Commercesearch_email', $email);
110
+ return $email;
111
+ }
112
+ public function exoSetData() {
113
+ $jahr=date("Y")+1;
114
+ $this->aData['p_customer_id']=$this->aData['c_id'];
115
+ $this->aData['product_id']="3";
116
+ $this->aData['p_product_id']="3";
117
+ $this->aData['orderid']=$this->exoGetUid();
118
+ $this->aData['upgrade_orderid']='.';
119
+ $this->aData['max_queries']="10000";
120
+ $this->aData['max_records']="100000";
121
+ $this->aData['coupon']="magento";
122
+ $this->aData['contract_status']="time_trial";
123
+ $this->aData['project_locale']=$this->exoGetLocale();
124
+ $this->aData['purchase_logo_removal']='false';
125
+ $this->aData['is_subscription']='0';
126
+ $this->aData['date_expiry']="$jahr-".date("m")."-".date("d");
127
+ $this->aData['locale']=$this->exoGetLocale();
128
+ $this->aData['project_name']=preg_replace('/[^A-Za-z0-9]+/', '_',$this->aData["email"]);
129
+ $this->aData['domain_name']=Mage::getStoreConfig('web/unsecure/base_url');
130
+ $this->aData['source_data_url']=$this->aData['domain_name']."/var/export/exorbyte.csv";
131
+ $this->aData['source_data_format']="billiger";
132
+ $this->aData['source_data_file_format']="excel_csv";
133
+ $this->aData['source_data_field_delimiter']="\t";
134
+ $this->aData['source_data_field_qoute']="\"";
135
+ $this->aData['source_data_cat_delimiter']=">";
136
+ $this->aData['source_data_encoding']="utf-8";
137
+ }
138
+ public function exoGetUid(){
139
+ /**
140
+ * create a unique id for the order_id and other purposes
141
+ * no input
142
+ * @return uid
143
+ */
144
+ return substr( session_id(), 0, 3 ) . substr( md5( uniqid( '', true ).'|'.microtime() ), 0, 29 );
145
+ }
146
+ public function exoGetRegion(){
147
+ /**
148
+ * get region from Magento configuration
149
+ * no input
150
+ * @return region
151
+ */
152
+ $aLocales=explode("_",strtolower($this->exoGetLocale()));
153
+ return $aLocales[1];
154
+ }
155
+ public function exoGetLocale(){
156
+ /**
157
+ * get locale from Magento configuration and check against allowed locales, if not found return default
158
+ * no input
159
+ * @return locale
160
+ */
161
+ $check_locale="en_US";
162
+ $allowed=array("en_US","en_UK","de_DE");
163
+ $check_locale=Mage::getStoreConfig('general/locale/code');
164
+ if(!in_array($check_locale,$allowed)){
165
+ $check_locale="en_US";
166
+ }
167
+ if($check_locale=="en_US") {$this->aData['max_queries']="25000";}
168
+ return $check_locale;
169
+ }
170
+ public function exoCheckExport(){
171
+ /**
172
+ * check filesystem for existing csv file, check for allowing access via http
173
+ * writing htaccess to allow access if necessary
174
+ * no input
175
+ * @return true or false
176
+ */
177
+ $myScriptPath=str_replace("index.php","",$_SERVER['SCRIPT_FILENAME']);
178
+ if(!file_exists($myScriptPath."var/export")){
179
+ mkdir($myScriptPath."var/export",0777);
180
+ }
181
+ if(!file_exists($myScriptPath."var/export/.htaccess")){
182
+ $string_to_write="Order deny,allow\nAllow from all\nRewriteEngine on\nRewriteRule ^exorbyte.csv$ exorbyte.php";
183
+ $fp=fopen($myScriptPath."var/export/.htaccess","w");
184
+ fwrite($fp,$string_to_write);
185
+ fclose($fp);
186
+ }
187
+ if(!file_exists($myScriptPath."var/export/exorbyte.php")){
188
+ $string_to_write=$this->getExportScheme($myScriptPath);
189
+ $fp=fopen($myScriptPath."var/export/exorbyte.php","w");
190
+ fwrite($fp,$string_to_write);
191
+ fclose($fp);
192
+ }
193
+ return true;
194
+ }
195
+ public function exoCheckForDoIntegration($postData){
196
+ $this->aData["sn_template"]=$postData['groups']['layout']['fields']['sn_style']['value'];
197
+ $this->aData["sn_display_type"]=$postData['groups']['layout']['fields']['sn_type']['value'];
198
+ $this->aData["sn_show_images"]=$postData['groups']['layout']['fields']['show_thumb']['value'];
199
+ $this->aData["sn_image_width"]=38;
200
+ $this->aData["sn_col_order"]="cat|article|brand|suggestion";
201
+ if($postData['groups']['layout']['fields']['second_col']['value']==1){
202
+ $this->aData["sn_second_col_fcn"]="secondColPrice";
203
+ }
204
+ else { $this->aData["sn_second_col_fcn"]="secondColNone";}
205
+ //check project status
206
+ $aIntegrationData=$this->SoapCall("getIntegration",$this->aData['c_id'],$this->aData['secure_key'],$this->aData['p_id']);
207
+ if($aIntegrationData['error_message'] = 'Failed to get data') {return true;}
208
+ if($this->aData["sn_template"]!=Mage::getStoreConfig('Commercesearch_options/layout/sn_style')) {return true;}
209
+ if($this->aData["sn_display_type"]!=Mage::getStoreConfig('Commercesearch_options/layout/sn_type')) {return true;}
210
+ if($this->aData["sn_show_images"]!=Mage::getStoreConfig('Commercesearch_options/layout/show_thumb')) {return true;}
211
+ if($postData['groups']['layout']['fields']['second_col']['value']!=Mage::getStoreConfig('Commercesearch_options/layout/second_col')) {return true;}
212
+ return false;
213
+ }
214
+ public function getExportScheme($myScriptPath) {
215
+ $fp=fopen($myScriptPath."app/code/community/Exorbyte/Commercesearch/Helper/exorbyte_export.php","r");
216
+ $content=fread($fp,1000000);
217
+ fclose($fp);
218
+ return $content;
219
+ }
220
+ }
app/code/community/Exorbyte/Commercesearch/controllers/Adminhtml/CommercesearchController.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // defined('WSDL_URL') || define('WSDL_URL','https://management.exorbyte.com/Partner-Soap/soap?wsdl');
3
+ defined('WSDL_URL') || define('WSDL_URL','https://test-management.sellbysearch.com/Partner-Soap/soap?wsdl');
4
+ //defined('WSDL') || define('WSDL','https://management.exorbyte.com/Partner-Soap/soap?wsdl');
5
+ defined('WSDL') || define('WSDL','https://test-management.sellbysearch.com/Partner-Soap/soap?wsdl');
6
+
7
+ class Exorbyte_Commercesearch_controllers_Adminhtml_CommercesearchController extends Mage_Adminhtml_Controller_Action {
8
+ protected $_request;
9
+ public function __construct() {
10
+ }
11
+
12
+ protected function init_ecos_soap(){
13
+ try{
14
+ if($this->_WSDLdebug){
15
+ ini_set("soap.wsdl_cache_enabled", "0");
16
+ }
17
+ $this->_oSoap=new SoapClient(WSDL,$this->aSoap_options);
18
+ $ret=true;
19
+ $this->_oSoap->__setCookie('XDEBUG_SESSION','htr');
20
+
21
+ $this->aFunctions=$this->_oSoap->__getFunctions();
22
+ $this->aTypes=$this->_oSoap->__getTypes();
23
+ } catch (Exception $e) {
24
+ $SOAP_MSG = "Es konnte keine Verbindung zu https://management.exorbyte.com aufgebaut werden. ".
25
+ "Stellen sie sicher das die Seite von Ihrem Webserver aus erreichbar und PHP ".
26
+ "für die Verwendung von SSL konfiguriert ist." ;
27
+ throw new Exception($SOAP_MSG);
28
+ }
29
+ return $ret;
30
+ }
31
+
32
+ public function SoapCall(){
33
+ if(is_null($this->_oSoap)){
34
+ $this->init_ecos_soap();
35
+ }
36
+ $mArgs = func_num_args();
37
+ $aArgs=func_get_args();
38
+ if(($mArgs < 2) or ($mArgs > 5)) {
39
+ throw new Exception("Invalid number of arguments ".$mArgs." passed to the SOAP call");
40
+ }
41
+ $SOAPaction = $aArgs[0];
42
+ switch ($mArgs) {
43
+ case 2:
44
+ $ret = $this->_oSoap->$SOAPaction($aArgs[1]);
45
+ break;
46
+ case 3:
47
+ $ret = $this->_oSoap->$SOAPaction($aArgs[1], $aArgs[2]);
48
+ break;
49
+ case 4:
50
+ $ret = $this->_oSoap->$SOAPaction($aArgs[1], $aArgs[2], $aArgs[3]);
51
+ break;
52
+ case 5:
53
+ $ret = $this->_oSoap->$SOAPaction($aArgs[1], $aArgs[2], $aArgs[3], $aArgs[4]);
54
+ break;
55
+ }
56
+
57
+ if(is_null($ret)){
58
+ $ret='Error, empty result';
59
+ }
60
+ $this->_ret=$ret;
61
+ $this->_lastXMLReq=$this->_oSoap->__last_request;
62
+ $this->_lastXMLRes=$this->_oSoap->__last_response;
63
+ return $ret;
64
+ }
65
+ public function setExoData($data){
66
+ $this->aOldData=$this->aData;
67
+ $this->aData=$this->validateExoData($data);
68
+ }
69
+ public function setExoAction($action){
70
+ $this->sEx_action=$action;
71
+ }
72
+ public function getExoAction(){
73
+ return $this->sEx_action;
74
+ }
75
+ protected function validateExoData($data=null){
76
+ if(is_null($data)){
77
+ $data=$this->aData;
78
+ }
79
+ foreach ($data as $key=>$value){
80
+ if($value===''){
81
+ unset($data[$key]);
82
+ }
83
+ }
84
+ return $data;
85
+ }
86
+ public function checkExoData($data){
87
+ foreach($this->aDefault as $key=>$value){
88
+ if(!isset($data[$key])){
89
+ $data[$key]=$value;
90
+ }elseif($data[$key]===''){
91
+ $data[$key]=$value;
92
+ }
93
+ }
94
+ $this->setExoData($data);
95
+ }
96
+ public function getEcosURL($ecosAppURL=false){
97
+ $test=parse_url(self::$WSDLURL);
98
+ if (!$ecosAppURL){
99
+ return $test['scheme'].'://'.$test['host'].'/'.'index.php?';
100
+ } else {
101
+ return $test['scheme'].'://'.$test['host'].'/'.$ecosAppURL;
102
+ }
103
+ }
104
+
105
+ }
app/code/community/Exorbyte/Commercesearch/controllers/IndexController.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Exorbyte_Commercesearch_IndexController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+ $this->loadLayout();
7
+ $this->renderLayout();
8
+
9
+ }
10
+ }
app/code/community/Exorbyte/Commercesearch/etc/config.xml ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Exorbyte_Commercesearch>
5
+ <version>0.1.0</version>
6
+ </Exorbyte_Commercesearch>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <Commercesearch>
11
+ <use>standard</use>
12
+ <args>
13
+ <!-- <modules>
14
+ <Exorbyte_Commercesearch>Exorbyte_Commercesearch</Exorbyte_Commercesearch>
15
+ </modules>-->
16
+ <module>Exorbyte_Commercesearch</module>
17
+ </args>
18
+ </Commercesearch>
19
+ </routers>
20
+ <layout>
21
+ <updates>
22
+ <Commercesearch>
23
+ <file>commercesearch.xml</file>
24
+ </Commercesearch>
25
+ </updates>
26
+ </layout>
27
+ </frontend>
28
+
29
+ <!-- <admin>
30
+ <routers>
31
+ <Commercesearch>
32
+ <use>admin</use>
33
+ <args>
34
+ <module>Exorbyte_Commercesearch</module>
35
+ <frontName>Commercesearch</frontName>
36
+ </args>
37
+ </Commercesearch>
38
+ </routers>
39
+ </admin>-->
40
+ <admin>
41
+ <routers>
42
+ <adminhtml>
43
+ <args>
44
+ <modules>
45
+ <Commercesearch before="Mage_Adminhtml">Exorbyte_Commercesearch_Adminhtml</Commercesearch>
46
+ </modules>
47
+ </args>
48
+ </adminhtml>
49
+ </routers>
50
+ </admin>
51
+
52
+
53
+ <adminhtml>
54
+ <!-- <menu>
55
+ <Commercesearch module="Commercesearch">
56
+ <title>Commercesearch</title>
57
+ <sort_order>71</sort_order>
58
+ <children>
59
+ <items module="Commercesearch">
60
+ <title>Manage Items</title>
61
+ <sort_order>0</sort_order>
62
+ <action>Commercesearch/adminhtml_Commercesearch</action>
63
+ </items>
64
+ </children>
65
+ </Commercesearch>
66
+ </menu>-->
67
+
68
+ <acl>
69
+ <resources>
70
+ <admin>
71
+ <children>
72
+ <system>
73
+ <children>
74
+ <config>
75
+ <children>
76
+ <Commercesearch_options>
77
+ <title>Commercesearch Settings</title>
78
+ </Commercesearch_options>
79
+ </children>
80
+ </config>
81
+ </children>
82
+ </system>
83
+ </children>
84
+ </admin>
85
+ </resources>
86
+ </acl>
87
+ <layout>
88
+ <updates>
89
+ <Commercesearch>
90
+ <file>Commercesearch.xml</file>
91
+ </Commercesearch>
92
+ </updates>
93
+ </layout>
94
+ </adminhtml>
95
+ <default>
96
+ <Commercesearch_options>
97
+ <settings>
98
+ <Commercesearch_activate>0</Commercesearch_activate>
99
+ </settings>
100
+ </Commercesearch_options>
101
+ </default>
102
+
103
+
104
+
105
+ <global>
106
+ <models>
107
+ <Commercesearch>
108
+ <class>Exorbyte_Commercesearch_Model</class>
109
+ <resourceModel>Commercesearch_mysql4</resourceModel>
110
+ </Commercesearch>
111
+ <Commercesearch_mysql4>
112
+ <class>Exorbyte_Commercesearch_Model_Mysql4</class>
113
+ <entities>
114
+ <Commercesearch>
115
+ <table>commercesearch</table>
116
+ </Commercesearch>
117
+ </entities>
118
+ </Commercesearch_mysql4>
119
+ </models>
120
+ <resources>
121
+ <Commercesearch_setup>
122
+ <setup>
123
+ <module>Exorbyte_Commercesearch</module>
124
+ </setup>
125
+ <connection><use>core_setup</use></connection>
126
+ </Commercesearch_setup>
127
+ <Commercesearch_write>
128
+ <connection><use>core_write</use></connection>
129
+ </Commercesearch_write>
130
+ <Commercesearch_read>
131
+ <connection><use>core_read</use></connection>
132
+ </Commercesearch_read>
133
+ </resources>
134
+ <blocks>
135
+ <Commercesearch>
136
+ <class>Exorbyte_Commercesearch_Block</class>
137
+ </Commercesearch>
138
+ </blocks>
139
+ <helpers>
140
+ <Commercesearch>
141
+ <class>Exorbyte_Commercesearch_Helper</class>
142
+ </Commercesearch>
143
+ </helpers>
144
+
145
+ <events>
146
+ <admin_system_config_changed_section_Commercesearch_options>
147
+ <observers>
148
+ <Commercesearch>
149
+ <class>Commercesearch/observer</class>
150
+ <method>save</method>
151
+ </Commercesearch>
152
+ </observers>
153
+ </admin_system_config_changed_section_Commercesearch_options>
154
+ </events>
155
+ </global>
156
+ </config>
app/code/community/Exorbyte/Commercesearch/etc/system.xml ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Exorbyte
17
+ * @package Exorbyte_Commercesearch
18
+ * @copyright Copyright (c) 2012 exorbyte GmbH (http://commerce.exorbyte.de)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ -->
22
+ <config>
23
+ <tabs>
24
+ <exorbyte translate="label" module="Commercesearch">
25
+ <label>Search</label>
26
+ <sort_order>190</sort_order>
27
+ </exorbyte>
28
+ </tabs>
29
+ <sections>
30
+ <Commercesearch_options translate="label" module="Commercesearch">
31
+ <label>Exorbyte Commerce Search</label>
32
+ <tab>exorbyte</tab>
33
+ <frontend_type>text</frontend_type>
34
+ <sort_order>990</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ <show_in_store>1</show_in_store>
38
+ <groups>
39
+ <settings translate="label">
40
+ <label>Exorbyte registration</label>
41
+ <frontend_type>text</frontend_type>
42
+ <sort_order>5</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>1</show_in_store>
46
+ <fields>
47
+ <Commercesearch_cid translate="label,comment">
48
+ <label>Customer_id</label>
49
+ <frontend_type>hidden</frontend_type>
50
+ <sort_order>10</sort_order>
51
+ <show_in_default>0</show_in_default>
52
+ <show_in_website>0</show_in_website>
53
+ <show_in_store>0</show_in_store>
54
+ </Commercesearch_cid>
55
+ <Commercesearch_securekey translate="label,comment">
56
+ <label>transactionkey</label>
57
+ <frontend_type>hidden</frontend_type>
58
+ <sort_order>10</sort_order>
59
+ <show_in_default>0</show_in_default>
60
+ <show_in_website>0</show_in_website>
61
+ <show_in_store>0</show_in_store>
62
+ </Commercesearch_securekey>
63
+ <Commercesearch_pid translate="label,comment">
64
+ <label>project_id</label>
65
+ <frontend_type>hidden</frontend_type>
66
+ <sort_order>10</sort_order>
67
+ <show_in_default>0</show_in_default>
68
+ <show_in_website>0</show_in_website>
69
+ <show_in_store>0</show_in_store>
70
+ </Commercesearch_pid>
71
+
72
+ <Commercesearch_activate translate="label">
73
+ <label>Activate Commerce Search</label>
74
+ <frontend_type>select</frontend_type>
75
+ <source_model>adminhtml/system_config_source_yesno</source_model>
76
+ <sort_order>5</sort_order>
77
+ <show_in_default>1</show_in_default>
78
+ <show_in_website>0</show_in_website>
79
+ <tooltip><![CDATA[
80
+ <style type=text/css>.system-tooltip-box{width:380px !important;height:500px !important;background-color:#ffffff;border: 1px solid #CCCCCC; border-radius:8px;box-shadow: 5px 5px 5px #333;-webkit-box-shadow: 5px 5px 5px #333;-moz-box-shadow: 5px 5px 5px #333; padding:5px;}</style>
81
+ <h3>Intelligent Product Search for Your Online Store</h3><p><img src=http://commerce.exorbyte.de/tl_files/general/header/header_logo.png align=left style=margin-right:10px;margin-bottom:10px;width:125px;>Exorbyte Commerce Search is an advanced, intelligent search-centric merchandising system for online stores including reporting. It starts by replacing Magento’s existing search engine. With Exorbyte Commerce Search, visitors to your shop can find the products they are looking for quickly and seamlessly, regardless of misspellings, typos, alternative or related product names, and more. It provides a better usability, higher conversion rate, more customer loyalty and permanently more sales.
82
+ <h3>Just More Sales – Your Visitors Will Become Customers</h3>
83
+ <p>With Exorbyte Commerce Search you choose the technologically-superior and most cost efficient intelligent product search solution for online stores. The search engine boasts a combination of error-tolerance, accuracy, speed, customization and scalability. As a genuine cloud solution, your search runs entirely on our high-performance servers and can be integrated into your Magento store by a few clicks.
84
+ <h3>Try now for 30 days for free, with no obligation</h3>
85
+ <p>Utilize Exorbyte Commerce Search in your Magento store for more sales: Try now for 30 days for free, with no obligation. The trial ends automatically. After the trial you can decide to order. Your settings will be taken over fully when ordering. Exorbyte Commerce Search is easily activated by a few clicks. It is worthwhile. See for yourself.
86
+ ]]></tooltip>
87
+ <comment><![CDATA[See all features and details on <a href=http://commerce.exorbyte.com target=_blank>http://commerce.exorbyte.com</a>]]></comment>
88
+ </Commercesearch_activate>
89
+
90
+ <Commercesearch_email translate="label,comment">
91
+ <label>Email address of your exorbyte account</label>
92
+ <comment><![CDATA[To utilize Exorbyte Commerce Search you need an Exorbyte account. Your account is registered with the shown email adress. ]]></comment>
93
+ <frontend_type>text</frontend_type>
94
+ <backend_model>Commercesearch/activate</backend_model>
95
+ <sort_order>10</sort_order>
96
+ <show_in_default>1</show_in_default>
97
+ <show_in_website>0</show_in_website>
98
+ <show_in_store>0</show_in_store>
99
+ </Commercesearch_email>
100
+ <Commercesearch_password translate="label,comment">
101
+ <label>Password for your exorbyte account</label>
102
+ <comment><![CDATA[To utilize Exorbyte Commerce Search you need an Exorbyte account. Please register directly by typing in your email address and password.<br>This password is not stored in your magento shop.]]></comment>
103
+ <frontend_type>text</frontend_type>
104
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
105
+ <sort_order>10</sort_order>
106
+ <show_in_default>1</show_in_default>
107
+ <show_in_website>1</show_in_website>
108
+ <show_in_store>1</show_in_store>
109
+ <depends><Commercesearch_cid></Commercesearch_cid></depends>
110
+ </Commercesearch_password>
111
+
112
+ </fields>
113
+ </settings>
114
+
115
+
116
+ <!--exportfile translate="label">
117
+ <label>Start your export</label>
118
+ <frontend_type>text</frontend_type>
119
+ <sort_order>9</sort_order>
120
+ <show_in_default>1</show_in_default>
121
+ <fields>
122
+ <manual>
123
+ <label>Export file</label>
124
+ <comment>Clicking the will create in a new window with the data flow profile, please do not close the window while working.</comment>
125
+ <frontend_type>button</frontend_type>
126
+ <frontend_model>Commercesearch/manualupload</frontend_model>
127
+ <show_in_website>0</show_in_website>
128
+ <show_in_default>1</show_in_default>
129
+ <sort_order>12</sort_order>
130
+ </manual>
131
+ </fields>
132
+ </exportfile-->
133
+
134
+ <layout translate="label">
135
+ <label>Basic Auto-Suggest Configuration</label>
136
+ <help_url><![CDATA[http://commerce.exorbyte.com]]></help_url>
137
+ <frontend_type>text</frontend_type>
138
+ <sort_order>10</sort_order>
139
+ <show_in_default>1</show_in_default>
140
+ <show_in_website>0</show_in_website>
141
+ <fields>
142
+ <sn_type translate="label comment">
143
+ <label>Format</label>
144
+ <frontend_type>select</frontend_type>
145
+ <source_model>Commercesearch/backend_layout</source_model>
146
+ <comment>How to display the search results / suggestions in the Auto-Suggest</comment>
147
+ <demo_url><![CDATA[http://commerce.exorbyte.com]]></demo_url>
148
+ <more_url><![CDATA[http://ommerce.exorbyte.com]]></more_url>
149
+ <sort_order>10</sort_order>
150
+ <show_in_default>1</show_in_default>
151
+ <show_in_website>0</show_in_website>
152
+ <tooltip><![CDATA[<img src=https://management.exorbyte.com/img/auto-cats.png width=360>]]></tooltip>
153
+ </sn_type>
154
+ <sn_style translate="label comment">
155
+ <label>Layout</label>
156
+ <frontend_type>select</frontend_type>
157
+ <source_model>Commercesearch/backend_design</source_model>
158
+ <comment>How to display the corners of the Auto-Suggest.</comment>
159
+ <demo_url><![CDATA[http://commerce.exorbyte.com]]></demo_url>
160
+ <more_url><![CDATA[http://ommerce.exorbyte.com]]></more_url>
161
+ <sort_order>15</sort_order>
162
+ <show_in_default>1</show_in_default>
163
+ <show_in_website>0</show_in_website>
164
+ </sn_style>
165
+ <second_col translate="label comment">
166
+ <label>Show Price</label>
167
+ <frontend_type>select</frontend_type>
168
+ <source_model>adminhtml/system_config_source_yesno</source_model>
169
+ <comment>Show the product price on the right side.</comment>
170
+ <demo_url><![CDATA[http://commerce.exorbyte.com]]></demo_url>
171
+ <more_url><![CDATA[http://ommerce.exorbyte.com]]></more_url>
172
+ <sort_order>20</sort_order>
173
+ <show_in_default>1</show_in_default>
174
+ <show_in_website>0</show_in_website>
175
+ </second_col>
176
+ <show_thumb translate="label comment">
177
+ <label>Show Thumbnails</label>
178
+ <frontend_type>select</frontend_type>
179
+ <source_model>adminhtml/system_config_source_yesno</source_model>
180
+ <comment>Show product thumbnails on the left side.</comment>
181
+ <demo_url><![CDATA[http://commerce.exorbyte.com]]></demo_url>
182
+ <more_url><![CDATA[http://ommerce.exorbyte.com]]></more_url>
183
+ <sort_order>30</sort_order>
184
+ <show_in_default>1</show_in_default>
185
+ <show_in_website>0</show_in_website>
186
+ </show_thumb>
187
+ </fields>
188
+ </layout>
189
+
190
+
191
+ <advanced translate="label">
192
+ <label>Advanced configuration</label>
193
+ <frontend_type>text</frontend_type>
194
+ <sort_order>99</sort_order>
195
+ <show_in_default>1</show_in_default>
196
+ <fields>
197
+ <manual>
198
+ <label> </label>
199
+ <comment>For advanced configurations you can log in with your above login data to Exorbyte’s management console: https://management.exorbyte.com </comment>
200
+ <frontend_type>note</frontend_type>
201
+ <show_in_website>0</show_in_website>
202
+ <show_in_default>1</show_in_default>
203
+ <sort_order>40</sort_order>
204
+ </manual>
205
+ </fields>
206
+ </advanced>
207
+
208
+
209
+
210
+ </groups>
211
+ </Commercesearch_options>
212
+ </sections>
213
+ </config>
app/code/community/Exorbyte/Commercesearch/sql/Commercesearch_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $action='<action type="catalog/convert_adapter_product" method="load">\r\n <var name="store"><![CDATA[0]]></var>\r\n <var name="filter/visibility"><![CDATA[4]]></var>\r\n <var name="filter/status"><![CDATA[1]]></var>\r\n</action>\r\n\r\n<action type="catalog/convert_parser_product" method="unparse">\r\n <var name="store"><![CDATA[0]]></var>\r\n <var name="url_field"><![CDATA[0]]></var>\r\n</action>\r\n\r\n<action type="dataflow/convert_mapper_column" method="map">\r\n <var name="map">\r\n <map name="sku"><![CDATA[aid]]></map>\r\n <map name="name"><![CDATA[name]]></map>\r\n <map name="description"><![CDATA[desc]]></map>\r\n <map name="price"><![CDATA[price]]></map>\r\n <map name="url_key"><![CDATA[link]]></map>\r\n <map name="manufacturer"><![CDATA[brand]]></map>\r\n <map name="category_ids"><![CDATA[shop_cat]]></map>\r\n <map name="image"><![CDATA[image]]></map>\r\n <map name="is_in_stock"><![CDATA[is_in_stock]]></map>\r\n </var>\r\n <var name="_only_specified">true</var>\r\n</action>\r\n\r\n<action type="dataflow/convert_parser_csv" method="unparse">\r\n <var name="delimiter"><![CDATA[\\t]]></var>\r\n <var name="enclose"><![CDATA["]]></var>\r\n <var name="fieldnames">true</var>\r\n</action>\r\n\r\n<action type="dataflow/convert_adapter_io" method="save">\r\n <var name="type">file</var>\r\n <var name="path">var/export</var>\r\n <var name="filename"><![CDATA[exorbyte.csv]]></var>\r\n</action>\r\n\r\n';
3
+ $gui_data='a:7:{s:6:"export";a:1:{s:13:"add_url_field";s:1:"0";}s:6:"import";a:2:{s:17:"number_of_records";s:1:"1";s:17:"decimal_separator";s:1:".";}s:4:"file";a:8:{s:4:"type";s:4:"file";s:8:"filename";s:12:"exorbyte.csv";s:4:"path";s:10:"var/export";s:4:"host";s:0:"";s:4:"user";s:0:"";s:8:"password";s:0:"";s:9:"file_mode";s:1:"2";s:7:"passive";s:0:"";}s:5:"parse";a:5:{s:4:"type";s:3:"csv";s:12:"single_sheet";s:0:"";s:9:"delimiter";s:2:"\\t";s:7:"enclose";s:1:""";s:10:"fieldnames";s:0:"";}s:3:"map";a:3:{s:14:"only_specified";s:4:"true";s:7:"product";a:2:{s:2:"db";a:9:{i:1;s:3:"sku";i:2;s:4:"name";i:3;s:11:"description";i:4;s:5:"price";i:5;s:7:"url_key";i:6;s:12:"manufacturer";i:7;s:12:"category_ids";i:8;s:5:"image";i:9;s:11:"is_in_stock";}s:4:"file";a:9:{i:1;s:3:"aid";i:2;s:4:"name";i:3;s:4:"desc";i:4;s:5:"price";i:5;s:4:"link";i:6;s:5:"brand";i:7;s:8:"shop_cat";i:8;s:5:"image";i:9;s:11:"is_in_stock";}}s:8:"customer";a:2:{s:2:"db";a:0:{}s:4:"file";a:0:{}}}s:7:"product";a:1:{s:6:"filter";a:8:{s:4:"name";s:0:"";s:3:"sku";s:0:"";s:4:"type";s:1:"0";s:13:"attribute_set";s:0:"";s:5:"price";a:2:{s:4:"from";s:0:"";s:2:"to";s:0:"";}s:3:"qty";a:2:{s:4:"from";s:0:"";s:2:"to";s:0:"";}s:10:"visibility";s:1:"4";s:6:"status";s:1:"1";}}s:8:"customer";a:1:{s:6:"filter";a:10:{s:9:"firstname";s:0:"";s:8:"lastname";s:0:"";s:5:"email";s:0:"";s:5:"group";s:1:"0";s:10:"adressType";s:15:"default_billing";s:9:"telephone";s:0:"";s:8:"postcode";s:0:"";s:7:"country";s:0:"";s:6:"region";s:0:"";s:10:"created_at";a:2:{s:4:"from";s:0:"";s:2:"to";s:0:"";}}}}';
4
+
5
+ $installer = $this;
6
+ $installer->startSetup();
7
+
8
+ $conn = $installer->getConnection();
9
+
10
+ $select = $conn
11
+ ->select()
12
+ ->from($this->getTable('admin/user'), array('email'));
13
+ $admindata = $conn->fetchAll($select);
14
+ $email=$admindata[0]["email"];
15
+
16
+ $data["scope"]='default';
17
+ $data["scope_id"]='0';
18
+ $data["path"]='Commercesearch_options/settings/Commercesearch_email';
19
+ $data["value"]= $email;//'nothing@nothing.com';
20
+ $conn->insertOnDuplicate($this->getTable('core/config_data'), $data, array('path'));
21
+
22
+ $dataflow["name"]='exorbyte';
23
+ $dataflow["created_at"]='2011-12-31 23:59:59';
24
+ $dataflow["updated_at"]='2011-12-31 23:59:59';
25
+ $dataflow["actions_xml"]=$action;
26
+ $dataflow["gui_data"]=$gui_data;
27
+ $dataflow["direction"]='export';
28
+ $dataflow["entity_type"]='product';
29
+ $dataflow["store_id"]=0;
30
+ $dataflow["data_transfer"]='file';
31
+ //$conn->insertOnDuplicate($this->getTable('dataflow/profile'), $dataflow, array('name'));
32
+
33
+ $installer->endSetup();
app/etc/modules/Exorbyte_Commercesearch.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Exorbyte_Commercesearch>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Exorbyte_Commercesearch>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Exorbyte_Commercesearch</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license>GPL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Increase your sales and usability with the intelligent, search-centric, merchandising system.</summary>
10
+ <description>Exorbyte Commerce is an advanced, intelligent, search-centric merchandising system designed specifically for online stores. It starts by replacing and enhancing your store's existing search engine. It features powerful reporting and merchandising features giving you the control to naturally guide visitors to the products they want to buy. With Exorbyte Commerce, visitors can find the products they are looking for quickly and seamlessly, regardless of misspellings, typos, alternative product names, equivalent products you carry, related products, and more.</description>
11
+ <notes>Tested and bugs fixed&#xD;
12
+ </notes>
13
+ <authors><author><name>exorbyte GmbH</name><user>exorbytecs</user><email>thomas.braun@exorbyte.com</email></author></authors>
14
+ <date>2012-03-26</date>
15
+ <time>12:18:48</time>
16
+ <contents><target name="magecommunity"><dir name="Exorbyte"><dir name="Commercesearch"><dir name="Block"><dir name="Adminhtml"><dir name="Commercesearch"><dir name="Edit"><file name="Form.php" hash="35f4717f4200c27536f8fbd059e3a40b"/><dir name="Tab"><file name="Form.php" hash="59d2546eb64f925520f069bafbf1818f"/></dir><file name="Tabs.php" hash="7ee7912235ad2c6f666989776ce50e4d"/></dir><file name="Edit.php" hash="2ea10acbf7aaf3cca80df730be5c3f8f"/><file name="Grid.php" hash="14ef4efc5f92259ba7a3c54f6bc404a1"/></dir><file name="Commercesearch.php" hash="f73be0b0888cda949c97794c9f27010b"/><file name="Ecs.php" hash="de6e6321cbd9f362154dbbfa8f1a45f0"/><file name="Suggest.php" hash="4b06980361b077bf12dae44d776912b2"/></dir><dir name="Backend"><file name="Exportbutton.php" hash="89f4fc353a9cc4550fd3255ea86756c2"/></dir><file name="Manualupload.php" hash="23aadf03cc2432c2fd2ad7a946893756"/></dir><dir name="Helper"><file name="Data.php" hash="e1fe12b764967a896bcfc7a24e78f135"/><file name="exorbyte_export.php" hash="6c87697076b8ca65b5ccf1d58e0835ad"/></dir><dir name="Model"><file name="Activate.php" hash="ce60deb1f93bd481999572d593a971ef"/><dir name="Backend"><file name="Design.php" hash="705615e2767736c1312856335b921c16"/><file name="Email.php" hash="c6d984d3f7064f061e4763eaad498416"/><file name="Layout.php" hash="cadb56ae0aa4d2961c5c1e9f5bfbf75b"/></dir><file name="Commercesearch.php" hash="36bcaec51d9d109f9cf4bccfbbaec369"/><file name="Connect.php" hash="2a4d7609b0a163529a0d563440b020c6"/><dir name="Mysql4"><dir name="Commercesearch"><file name="Collection.php" hash="c26a4d9be07bf37a9b4910f13f357bf2"/></dir><file name="Commercesearch.php" hash="ba4043466e98fe9ad9fd0962fcc6b9a1"/></dir><file name="Observer.php" hash="a2f62b72fa171f4ef60c33ea7c215ac1"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="CommercesearchController.php" hash="13190138733e68d2d7bc1a7bb10ee560"/></dir><file name="IndexController.php" hash="ee10413adbd70fd8f45f91ba97332401"/></dir><dir name="etc"><file name="config.xml" hash="9d934128988c2070008235d4bae0a1b9"/><file name="system.xml" hash="abb073a89ced5420878a8509fa47a808"/></dir><dir name="sql"><dir name="Commercesearch_setup"><file name="mysql4-install-0.1.0.php" hash="432cccdc03c4fa5f9b1c58f41068b040"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="Commerceseach.xml" hash=""/></dir></dir></dir></dir></target><target name="magelocal"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="commercesearch.xml" hash=""/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Exorbyte_Commercesearch.xml" hash="ccd16076bda5a73dabdaa48aaa591a77"/></dir></target></contents>
17
+ <compatible/>
18
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
19
+ </package>