Asulpunto_Unicentaopos - Version 0.0.2

Version Notes

First official release.

Download this release

Release Info

Developer asulpunto
Extension Asulpunto_Unicentaopos
Version 0.0.2
Comparing to
See all releases


Version 0.0.2

app/code/local/Asulpunto/Unicentaopos/Block/Adminhtml/System/Config/Form/Button.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento - Unicenta Opos Integrator by Asulpunto
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, Version 3 of the License. You can view
9
+ * the license here http://opensource.org/licenses/GPL-3.0
10
+
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * @category Asulpunto
17
+ * @package Asulpunto_Unicentaopos
18
+ * @copyright Copyright (c) 2013 Asulpunto (http://www.asulpunto.com)
19
+ * @license http://opensource.org/licenses/GPL-3.0 GNU General Public License, version 3 (GPL-3.0)
20
+ *
21
+ */
22
+
23
+ class Asulpunto_Unicentaopos_Block_Adminhtml_System_Config_Form_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
24
+ {
25
+ /*
26
+ * Set template
27
+ */
28
+ protected function _construct()
29
+ {
30
+ parent::_construct();
31
+ $this->setTemplate('asulpunto/unicentaopos/system/config/button.phtml');
32
+ }
33
+
34
+ /**
35
+ * Return element html
36
+ *
37
+ * @param Varien_Data_Form_Element_Abstract $element
38
+ * @return string
39
+ */
40
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
41
+ {
42
+ return $this->_toHtml();
43
+ }
44
+
45
+ /**
46
+ * Return ajax url for button
47
+ *
48
+ * @return string
49
+ */
50
+ public function getAjaxCheckUrl()
51
+ {
52
+ return Mage::helper('adminhtml')->getUrl('adminhtml/adminhtml_unicentaopos/check');
53
+ }
54
+
55
+ /**
56
+ * Generate button html
57
+ *
58
+ * @return string
59
+ */
60
+ public function getButtonHtml()
61
+ {
62
+ $button = $this->getLayout()->createBlock('adminhtml/widget_button')
63
+ ->setData(array(
64
+ 'id' => 'asulpuntounicentaopos_button',
65
+ 'label' => $this->helper('adminhtml')->__('Test Connection & Get Products'),
66
+ 'onclick' => 'javascript:check(); return false;'
67
+ ));
68
+
69
+ return $button->toHtml();
70
+ }
71
+ }
app/code/local/Asulpunto/Unicentaopos/Helper/Data.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento - Unicenta Opos Integrator by Asulpunto
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, Version 3 of the License. You can view
9
+ * the license here http://opensource.org/licenses/GPL-3.0
10
+
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * @category Asulpunto
17
+ * @package Asulpunto_Unicentaopos
18
+ * @copyright Copyright (c) 2013 Asulpunto (http://www.asulpunto.com)
19
+ * @license http://opensource.org/licenses/GPL-3.0 GNU General Public License, version 3 (GPL-3.0)
20
+ *
21
+ */
22
+
23
+
24
+
25
+ class Asulpunto_Unicentaopos_Helper_Data extends Mage_Core_Helper_Abstract
26
+ {
27
+
28
+ public function getUnicentaOposConnection(){
29
+ $url=Mage::getStoreConfig('asulpuntounicentaopos/unicentaconfig/url');
30
+ $login=Mage::getStoreConfig('asulpuntounicentaopos/unicentaconfig/login');
31
+ $password=Mage::getStoreConfig('asulpuntounicentaopos/unicentaconfig/password');
32
+ $name=Mage::getStoreConfig('asulpuntounicentaopos/unicentaconfig/dbname');
33
+ $db = new PDO("mysql:host={$url};dbname={$name}",
34
+ $login,
35
+ $password
36
+ );
37
+ return $db;
38
+ }
39
+
40
+ }
app/code/local/Asulpunto/Unicentaopos/Model/Mysql4/Unicentaoposorderitem.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento - Unicenta Opos Integrator by Asulpunto
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, Version 3 of the License. You can view
9
+ * the license here http://opensource.org/licenses/GPL-3.0
10
+
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * @category Asulpunto
17
+ * @package Asulpunto_Unicentaopos
18
+ * @copyright Copyright (c) 2013 Asulpunto (http://www.asulpunto.com)
19
+ * @license http://opensource.org/licenses/GPL-3.0 GNU General Public License, version 3 (GPL-3.0)
20
+ *
21
+ */
22
+
23
+
24
+ class Asulpunto_Unicentaopos_Model_Mysql4_Unicentaoposorderitem extends Mage_Core_Model_Mysql4_Abstract
25
+ {
26
+ public function _construct()
27
+ {
28
+ $this->_init('unicentaopos/unicentaoposorderitem', 'entity_id');
29
+ }
30
+ }
app/code/local/Asulpunto/Unicentaopos/Model/Mysql4/Unicentaoposorderitem/Collection.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento - Unicenta Opos Integrator by Asulpunto
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, Version 3 of the License. You can view
9
+ * the license here http://opensource.org/licenses/GPL-3.0
10
+
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * @category Asulpunto
17
+ * @package Asulpunto_Unicentaopos
18
+ * @copyright Copyright (c) 2013 Asulpunto (http://www.asulpunto.com)
19
+ * @license http://opensource.org/licenses/GPL-3.0 GNU General Public License, version 3 (GPL-3.0)
20
+ *
21
+ */
22
+
23
+
24
+ class Asulpunto_Unicentaopos_Model_Mysql4_Unicentaoposorderitem_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
25
+
26
+ public function _construct(){
27
+
28
+ $this->_init('unicentaopos/unicentaoposorderitem');
29
+ }
30
+ }
31
+ ?>
app/code/local/Asulpunto/Unicentaopos/Model/Mysql4/Unicentaoposproduct.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento - Unicenta Opos Integrator by Asulpunto
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, Version 3 of the License. You can view
9
+ * the license here http://opensource.org/licenses/GPL-3.0
10
+
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * @category Asulpunto
17
+ * @package Asulpunto_Unicentaopos
18
+ * @copyright Copyright (c) 2013 Asulpunto (http://www.asulpunto.com)
19
+ * @license http://opensource.org/licenses/GPL-3.0 GNU General Public License, version 3 (GPL-3.0)
20
+ *
21
+ */
22
+
23
+ class Asulpunto_Unicentaopos_Model_Mysql4_Unicentaoposproduct extends Mage_Core_Model_Mysql4_Abstract
24
+ {
25
+ public function _construct()
26
+ {
27
+ $this->_init('unicentaopos/unicentaoposproduct', 'entity_id');
28
+ }
29
+ }
app/code/local/Asulpunto/Unicentaopos/Model/Mysql4/Unicentaoposproduct/Collection.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento - Unicenta Opos Integrator by Asulpunto
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, Version 3 of the License. You can view
9
+ * the license here http://opensource.org/licenses/GPL-3.0
10
+
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * @category Asulpunto
17
+ * @package Asulpunto_Unicentaopos
18
+ * @copyright Copyright (c) 2013 Asulpunto (http://www.asulpunto.com)
19
+ * @license http://opensource.org/licenses/GPL-3.0 GNU General Public License, version 3 (GPL-3.0)
20
+ *
21
+ */
22
+
23
+ class Asulpunto_Unicentaopos_Model_Mysql4_Unicentaoposproduct_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
24
+
25
+ public function _construct(){
26
+
27
+ $this->_init('unicentaopos/unicentaoposproduct');
28
+ }
29
+ }
30
+ ?>
app/code/local/Asulpunto/Unicentaopos/Model/Unicentaoposapi.php ADDED
@@ -0,0 +1,294 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento - Unicenta Opos Integrator by Asulpunto
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, Version 3 of the License. You can view
9
+ * the license here http://opensource.org/licenses/GPL-3.0
10
+
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * @category Asulpunto
17
+ * @package Asulpunto_Unicentaopos
18
+ * @copyright Copyright (c) 2013 Asulpunto (http://www.asulpunto.com)
19
+ * @license http://opensource.org/licenses/GPL-3.0 GNU General Public License, version 3 (GPL-3.0)
20
+ *
21
+ */
22
+
23
+ class Asulpunto_Unicentaopos_Model_Unicentaoposapi extends Mage_Core_Model_Abstract
24
+ {
25
+ private $_UPPHash=array();
26
+ private $_UPS=array();
27
+
28
+ public function checkActivate(){
29
+ try{
30
+ $db=Mage::Helper('unicentaopos')->getUnicentaOposConnection();
31
+ $sql="select * from `APPLICATIONS`";
32
+ $rows=$db->query($sql);
33
+ foreach ($rows as $row){
34
+ if ($row['ID']=='unicentaopos')
35
+ return true;
36
+ }
37
+ }catch(Exception $e){
38
+ Mage::log("checkActivate() Error. ".$e->getMessage()."asulpunto_unicentaopos.log");
39
+ }
40
+ return false;
41
+ }
42
+
43
+ public function cronProducts(){
44
+ try{
45
+ $this->_loadProductHash();//load a hash of history
46
+
47
+ $db=Mage::Helper('unicentaopos')->getUnicentaOposConnection();
48
+ $sql="select * from `PRODUCTS`";
49
+ $rows=$db->query($sql);
50
+
51
+ foreach ($rows as $row){
52
+ $this->_getUnicentaProducts($row);
53
+ }
54
+ $this->updateMagentoProducts();
55
+ }catch(Exception $e){
56
+ Mage::log("cronProducts() Error. ".$e->getMessage()."asulpunto_unicentaopos.log");
57
+ }
58
+ }
59
+
60
+ public function cronStock(){
61
+ try{
62
+ $this->_loadStock();
63
+ $db=Mage::Helper('unicentaopos')->getUnicentaOposConnection();
64
+ $sql="select b.REFERENCE as REFERENCE,a.UNITS as UNITS from `STOCKCURRENT` a , `PRODUCTS` b where a.PRODUCT=b.ID";
65
+ $rows=$db->query($sql);
66
+ foreach ($rows as $row){
67
+ $this->_getUnicentaStock($row);
68
+ }
69
+ $this->updateMagentoStock();
70
+ }catch(Exception $e){
71
+ Mage::log("cronStock() Error. ".$e->getMessage()."asulpunto_unicentaopos.log");
72
+ }
73
+ }
74
+
75
+
76
+ private function _getUnicentaProducts($row){
77
+ $updateNeeded=false;
78
+
79
+ $md5=md5(
80
+ $row['CODE'].'|'.
81
+ $row['NAME'].'|'.
82
+ $row['ATTRIBUTES'].'|'.
83
+ $row['PRICEBUY'].'|'.
84
+ $row['PRICESELL']
85
+ );
86
+
87
+ if (array_key_exists($row['REFERENCE'],$this->_UPPHash)){
88
+ if ($this->_UPPHash[$row['REFERENCE']]!=$md5){
89
+ $updateNeeded=true;
90
+ $mageRow=$this->_getRowByCode($row['REFERENCE']);
91
+ }
92
+ }else{
93
+ $updateNeeded=true;
94
+ $mageRow=Mage::getModel('unicentaopos/unicentaoposproduct');
95
+ }
96
+ if ($updateNeeded){
97
+ $mageRow->setName($row['NAME']);
98
+ $mageRow->setSku($row['REFERENCE']);
99
+ $mageRow->setBarcode($row['CODE']);
100
+ $mageRow->setLongdesc($row['ATTRIBUTES']);
101
+ $mageRow->setCost($row['PRICEBUY']);
102
+ $mageRow->setPrice($row['PRICESELL']);
103
+ $mageRow->setStock($row['STOCKVOLUME']);
104
+ $mageRow->setInfoupdated(1);
105
+ $mageRow->save();
106
+ }
107
+ }
108
+
109
+ private function _getUnicentaStock($row){
110
+ if (array_key_exists($row['REFERENCE'],$this->_UPS)){
111
+ if ($this->_UPS[$row['REFERENCE']]!=$row['UNITS']){
112
+ $mageRow=$this->_getRowByCode($row['REFERENCE']);
113
+ if ($mageRow){
114
+ $mageRow->setStock($row['UNITS']);
115
+ $mageRow->setStockupdated(1);
116
+ $mageRow->save();
117
+ }
118
+ }
119
+ }
120
+ }
121
+
122
+ public function cronOrders(){
123
+
124
+ $maxorder=$this->getMaxOrderId();
125
+ $status=Mage::getStoreConfig('asulpuntounicentaopos/tools/orderstatus');
126
+ $readCon=Mage::getSingleton('core/resource')->getConnection('core_read');
127
+
128
+ $sql="select entity_id from sales_flat_order a where
129
+ status = '$status'
130
+ and a.entity_id > $maxorder
131
+ and a.entity_id not in
132
+ (select magento_order_id from asulpunto_unicentaopos_order_item b where b.magento_order_id=a.entity_id)";
133
+
134
+ $res=$readCon->query($sql);
135
+
136
+ foreach($res as $row){
137
+ $order=Mage::getModel('sales/order')->load($row['entity_id']);
138
+ $this->_writeStockOrder($order);
139
+ }
140
+ $this->_updateUnicentaStock();
141
+ }
142
+
143
+ public function getMaxOrderId(){
144
+ $orderNo=Mage::getStoreConfig('asulpuntounicentaopos/advanced/orderno');
145
+ if (empty($orderNo)){
146
+ $orderNo=0;
147
+ }else{
148
+ $col=Mage::getModel('sales/order')->getCollection()->addFilter('increment_id',$orderNo);
149
+ $row=$col->getFirstItem();
150
+ $orderNo=$row->getId();
151
+ }
152
+ return $orderNo;
153
+ }
154
+
155
+ private function _writeStockOrder($order){
156
+ $items=$order->getAllItems();
157
+ foreach ($items as $item){
158
+ if (!$this->_getRowByCode($item->getSku()))continue;
159
+ $oitem=Mage::getModel('unicentaopos/unicentaoposorderitem');
160
+ $oitem->setMagentoOrderId($order->getId());
161
+ $oitem->setMagentoIncrementId($order->getIncrementId());
162
+ $oitem->setSku($item->getSku());
163
+ $oitem->setQuantity($item->getQtyOrdered());
164
+ $oitem->setAction('-');
165
+ $oitem->setStockupdated(1);
166
+ $oitem->save();
167
+ }
168
+ }
169
+
170
+ private function _updateUnicentaStock(){
171
+ $col=Mage::getModel('unicentaopos/unicentaoposorderitem')->getCollection()->addFilter('stockupdated',1);
172
+ try{
173
+ $db=Mage::Helper('unicentaopos')->getUnicentaOposConnection();
174
+ foreach($col as $item){
175
+ $sql="UPDATE `STOCKCURRENT` set UNITS=UNITS-{$item->getQuantity()} where PRODUCT=(SELECT ID FROM PRODUCTS WHERE REFERENCE='{$item->getSku()}')";
176
+ $res=$db->query($sql);
177
+ $item->setStockupdated(0);
178
+ $item->save();
179
+ }
180
+ }catch(Exception $e){
181
+ Mage::log("_updateUnicentaStock() Error. ".$e->getMessage()."asulpunto_unicentaopos.log");
182
+ }
183
+ }
184
+
185
+ private function _getRowByCode($skucode){
186
+
187
+ $col=Mage::getModel('unicentaopos/unicentaoposproduct')->getCollection()->addFilter('sku',$skucode);
188
+ if ($col->count()>0){
189
+ $item= $col->getFirstItem();
190
+ return $item;
191
+ }
192
+
193
+ return false; //not found
194
+ }
195
+
196
+ public function updateMagentoProducts(){
197
+ $col=Mage::getModel('unicentaopos/unicentaoposproduct')->getCollection()->addFilter('infoupdated',1);
198
+ foreach ($col as $row){
199
+ $this->_saveMagentoProduct($row);
200
+ }
201
+ }
202
+
203
+ public function updateMagentoStock(){
204
+ $col=Mage::getModel('unicentaopos/unicentaoposproduct')->getCollection()->addFilter('stockupdated',1);
205
+ foreach ($col as $row){
206
+ if ($row->getMagentoProductId()){
207
+ $product = Mage::getModel('catalog/product')->load($row->getMagentoProductId());
208
+ if ($product->getId()){
209
+ $sData=$product->getStockData();
210
+ $sData['qty']=$row->getStock();
211
+ if ($row->getStock()>0) {
212
+ $sData['is_in_stock']=1;
213
+ } else {
214
+ $sData['is_in_stock']=0;
215
+ }
216
+ $product->setStockData($sData);
217
+ $product->save();
218
+ }
219
+ }
220
+ $row->setStockupdated(0);
221
+ $row->save();
222
+ }
223
+ }
224
+
225
+
226
+ private function _saveMagentoProduct($row){
227
+ try
228
+ {
229
+ $newProduct=false;
230
+ $product = Mage::getModel('catalog/product');
231
+ if ($row->getMagentoProductId()){
232
+ $product = $product->load($row->getMagentoProductId());
233
+ }
234
+
235
+ if (!$product->getId()){
236
+ $product->setSku($row->getSku());
237
+ $product->setTypeId('simple');
238
+ $product->setAttributeSetId(9);
239
+ $product->setTaxClassId(1);
240
+ $product->setWeight(0.0);
241
+ $sData['qty']=$row->getStock();
242
+ if ($row->getStock()>0) $sData['is_in_stock']=1;
243
+ $product->setStockData($sData);
244
+ $newProduct=true;
245
+ }
246
+
247
+ //$product->setWebsiteIds(array(1));
248
+
249
+ $product->setName($row->getName());
250
+ $product->setDescription($row->getLongdesc());
251
+ $product->setShortDescription($row->getName());
252
+ $sData=$product->getStockData($sData);
253
+ $product->setCostPrice($row->getCost());
254
+ $product->setPrice($row->getPrice());
255
+ $product->save();
256
+
257
+ if ($newProduct) Mage::getModel('catalog/product_status')->updateProductStatus($product->getId(), 0, Mage_Catalog_Model_Product_Status::STATUS_DISABLED);
258
+
259
+ $row->setInfoupdated(0);
260
+ $row->setMagentoProductId($product->getId());
261
+ $row->save();
262
+ return $product->getId();
263
+ }
264
+ catch (exception $e)
265
+ {
266
+ Mage::log("_saveMagentoProduct() Error. ".$e->getMessage()."asulpunto_unicentaopos.log");
267
+ }
268
+ return 0;
269
+ }
270
+
271
+ private function _loadProductHash(){
272
+ $cols=Mage::getModel('unicentaopos/unicentaoposproduct')->getCollection();
273
+ foreach ($cols as $item){
274
+ $this->_UPPHash[$item->getSku()]=md5(
275
+ $item->getBarcode().'|'.
276
+ $item->getName().'|'.
277
+ $item->getLongdesc().'|'.
278
+ $item->getCost().'|'.
279
+ $item->getPrice()
280
+ );
281
+ }
282
+ unset($cols);
283
+ }
284
+
285
+ private function _loadStock(){
286
+ $cols=Mage::getModel('unicentaopos/unicentaoposproduct')->getCollection();
287
+ foreach ($cols as $item){
288
+ $this->_UPS[$item->getSku()]=$item->getStock();
289
+ }
290
+ unset($cols);
291
+ }
292
+
293
+
294
+ }
app/code/local/Asulpunto/Unicentaopos/Model/Unicentaoposorderitem.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento - Unicenta Opos Integrator by Asulpunto
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, Version 3 of the License. You can view
9
+ * the license here http://opensource.org/licenses/GPL-3.0
10
+
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * @category Asulpunto
17
+ * @package Asulpunto_Unicentaopos
18
+ * @copyright Copyright (c) 2013 Asulpunto (http://www.asulpunto.com)
19
+ * @license http://opensource.org/licenses/GPL-3.0 GNU General Public License, version 3 (GPL-3.0)
20
+ *
21
+ */
22
+
23
+
24
+ class Asulpunto_Unicentaopos_Model_Unicentaoposorderitem extends Mage_Core_Model_Abstract
25
+ {
26
+ public function _construct()
27
+ {
28
+ parent::_construct();
29
+ $this->_init('unicentaopos/unicentaoposorderitem');
30
+ }
31
+ }
app/code/local/Asulpunto/Unicentaopos/Model/Unicentaoposproduct.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento - Unicenta Opos Integrator by Asulpunto
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, Version 3 of the License. You can view
9
+ * the license here http://opensource.org/licenses/GPL-3.0
10
+
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * @category Asulpunto
17
+ * @package Asulpunto_Unicentaopos
18
+ * @copyright Copyright (c) 2013 Asulpunto (http://www.asulpunto.com)
19
+ * @license http://opensource.org/licenses/GPL-3.0 GNU General Public License, version 3 (GPL-3.0)
20
+ *
21
+ */
22
+
23
+
24
+
25
+ class Asulpunto_Unicentaopos_Model_Unicentaoposproduct extends Mage_Core_Model_Abstract
26
+ {
27
+ public function _construct()
28
+ {
29
+ parent::_construct();
30
+ $this->_init('unicentaopos/unicentaoposproduct');
31
+ }
32
+ }
app/code/local/Asulpunto/Unicentaopos/controllers/Adminhtml/UnicentaoposController.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento - Unicenta Opos Integrator by Asulpunto
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, Version 3 of the License. You can view
9
+ * the license here http://opensource.org/licenses/GPL-3.0
10
+
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * @category Asulpunto
17
+ * @package Asulpunto_Unicentaopos
18
+ * @copyright Copyright (c) 2013 Asulpunto (http://www.asulpunto.com)
19
+ * @license http://opensource.org/licenses/GPL-3.0 GNU General Public License, version 3 (GPL-3.0)
20
+ *
21
+ */
22
+
23
+
24
+
25
+ class Asulpunto_Unicentaopos_Adminhtml_UnicentaoposController extends Mage_Adminhtml_Controller_Action
26
+ {
27
+ /**
28
+ * Return some checking result
29
+ *
30
+ * @return void
31
+ */
32
+ public function checkAction()
33
+ {
34
+ $result=Mage::getModel('unicentaopos/unicentaoposapi')->checkActivate();
35
+ Mage::app()->getResponse()->setBody($result);
36
+
37
+ }
38
+ }
app/code/local/Asulpunto/Unicentaopos/etc/config.xml ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento - Unicenta Opos Integrator by Asulpunto
5
+ *
6
+ * NOTICE OF LICENSE
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, Version 3 of the License. You can view
10
+ * the license here http://opensource.org/licenses/GPL-3.0
11
+
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * @category Asulpunto
18
+ * @package Asulpunto_Unicentaopos
19
+ * @copyright Copyright (c) 2013 Asulpunto (http://www.asulpunto.com)
20
+ * @license http://opensource.org/licenses/GPL-3.0 GNU General Public License, version 3 (GPL-3.0)
21
+ *
22
+ */
23
+
24
+ -->
25
+ <config>
26
+ <modules>
27
+ <Asulpunto_Unicentaopos>
28
+ <version>0.0.2</version>
29
+ </Asulpunto_Unicentaopos>
30
+ </modules>
31
+ <global>
32
+ <helpers>
33
+ <unicentaopos>
34
+ <class>Asulpunto_Unicentaopos_Helper</class>
35
+ </unicentaopos>
36
+ </helpers>
37
+ <blocks>
38
+ <asulpuntounicentaopos>
39
+ <class>Asulpunto_Unicentaopos_Block</class>
40
+ </asulpuntounicentaopos>
41
+ </blocks>
42
+ <models>
43
+ <unicentaopos>
44
+ <class>Asulpunto_Unicentaopos_Model</class>
45
+ <resourceModel>unicentaopos_mysql4</resourceModel>
46
+ </unicentaopos>
47
+ <unicentaopos_mysql4>
48
+ <class>Asulpunto_Unicentaopos_Model_Mysql4</class>
49
+ <entities>
50
+ <unicentaoposproduct><table>asulpunto_unicentaopos_product</table></unicentaoposproduct>
51
+ <unicentaoposorderitem><table>asulpunto_unicentaopos_order_item</table></unicentaoposorderitem>
52
+ <!--<flat_price2><table>macfarlane_flat_price_2</table></flat_price2>-->
53
+ </entities>
54
+ </unicentaopos_mysql4>
55
+ </models>
56
+ <resources>
57
+ <unicentaopos_setup>
58
+ <setup>
59
+ <module>Asulpunto_Unicentaopos</module>
60
+ </setup>
61
+ <connection>
62
+ <use>core_setup</use>
63
+ </connection>
64
+ </unicentaopos_setup>
65
+ </resources>
66
+ </global>
67
+ <admin>
68
+ <routers>
69
+ <adminhtml>
70
+ <args>
71
+ <modules>
72
+ <unicentaopos after="Mage_Adminhtml">Asulpunto_Unicentaopos</unicentaopos>
73
+ </modules>
74
+ </args>
75
+ </adminhtml>
76
+ </routers>
77
+ </admin>
78
+ <crontab>
79
+ <jobs>
80
+ <unicentaopos_products_sysnc>
81
+ <schedule><cron_expr>*/10 * * * *</cron_expr></schedule>
82
+ <run><model>unicentaopos/unicentaoposapi::cronProducts</model></run>
83
+ </unicentaopos_products_sysnc>
84
+ <unicentaopos_stock_sysnc>
85
+ <schedule><cron_expr>*/1 * * * *</cron_expr></schedule>
86
+ <run><model>unicentaopos/unicentaoposapi::cronStock</model></run>
87
+ </unicentaopos_stock_sysnc>
88
+ <unicentaopos_order_sysnc>
89
+ <schedule><cron_expr>*/1 * * * *</cron_expr></schedule>
90
+ <run><model>unicentaopos/unicentaoposapi::cronOrders</model></run>
91
+ </unicentaopos_order_sysnc>
92
+ </jobs>
93
+ </crontab>
94
+ <adminhtml>
95
+ <acl>
96
+ <resources>
97
+ <all>
98
+ <title>Allow Everything</title>
99
+ </all>
100
+ <admin>
101
+ <children>
102
+ <system>
103
+ <children>
104
+ <config>
105
+ <children>
106
+ <asulpuntounicentaopos>
107
+ <title>Asulpunto Settings</title>
108
+ </asulpuntounicentaopos>
109
+ </children>
110
+ </config>
111
+ </children>
112
+ </system>
113
+ </children>
114
+ </admin>
115
+ </resources>
116
+ </acl>
117
+ </adminhtml>
118
+ <default>
119
+ <asulpuntounicentaopos>
120
+ <tools>
121
+ <orderstatus>complete</orderstatus>
122
+ </tools>
123
+ </asulpuntounicentaopos>
124
+ </default>
125
+ </config>
app/code/local/Asulpunto/Unicentaopos/etc/system.xml ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento - Unicenta Opos Integrator by Asulpunto
5
+ *
6
+ * NOTICE OF LICENSE
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, Version 3 of the License. You can view
10
+ * the license here http://opensource.org/licenses/GPL-3.0
11
+
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * @category Asulpunto
18
+ * @package Asulpunto_Unicentaopos
19
+ * @copyright Copyright (c) 2013 Asulpunto (http://www.asulpunto.com)
20
+ * @license http://opensource.org/licenses/GPL-3.0 GNU General Public License, version 3 (GPL-3.0)
21
+ *
22
+ */
23
+ -->
24
+ <config>
25
+ <tabs>
26
+ <asulpunto translate="label" module="unicentaopos">
27
+ <label>Asulpunto</label>
28
+ <sort_order>99999</sort_order>
29
+ </asulpunto>
30
+ </tabs>
31
+ <sections>
32
+
33
+ <asulpuntounicentaopos translate="label" module="unicentaopos">
34
+ <label>Tweaks</label>
35
+ <tab>asulpunto</tab>
36
+ <frontend_type>text</frontend_type>
37
+ <sort_order>99999</sort_order>
38
+ <show_in_default>1</show_in_default>
39
+ <show_in_website>0</show_in_website>
40
+ <show_in_store>0</show_in_store>
41
+ <groups>
42
+ <banner>
43
+ <label>Module Information</label>
44
+ <frontend_type>text</frontend_type>
45
+ <sort_order>5</sort_order>
46
+ <show_in_default>1</show_in_default>
47
+ <show_in_website>1</show_in_website>
48
+ <show_in_store>1</show_in_store>
49
+ <comment>
50
+ <![CDATA[Module developed by Asulpunto. <br/><a href="http://www.asulpunto.com">http://www.asulpunto.com</a>]]></comment>
51
+ </banner>
52
+ <unicentaconfig translate="label">
53
+ <label>Configuration</label>
54
+ <sort_order>10</sort_order>
55
+ <show_in_default>1</show_in_default>
56
+ <show_in_website>0</show_in_website>
57
+ <show_in_store>0</show_in_store>
58
+ <fields>
59
+ <url translate="label">
60
+ <label>Unicenta Opos Hostname</label>
61
+ <frontend_type>text</frontend_type>
62
+ <sort_order>10</sort_order>
63
+ <show_in_default>1</show_in_default>
64
+ <show_in_website>1</show_in_website>
65
+ <show_in_store>1</show_in_store>
66
+ </url>
67
+ <dbname translate="label">
68
+ <label>Unicenta Opos Database Name</label>
69
+ <frontend_type>text</frontend_type>
70
+ <sort_order>20</sort_order>
71
+ <show_in_default>1</show_in_default>
72
+ <show_in_website>1</show_in_website>
73
+ <show_in_store>1</show_in_store>
74
+ </dbname>
75
+ <login translate="label">
76
+ <label>Unicenta Opos Database Login</label>
77
+ <frontend_type>text</frontend_type>
78
+ <sort_order>30</sort_order>
79
+ <show_in_default>1</show_in_default>
80
+ <show_in_website>1</show_in_website>
81
+ <show_in_store>1</show_in_store>
82
+ </login>
83
+ <password translate="label">
84
+ <label>Unicenta Opos Database Password</label>
85
+ <frontend_type>text</frontend_type>
86
+ <sort_order>40</sort_order>
87
+ <show_in_default>1</show_in_default>
88
+ <show_in_website>1</show_in_website>
89
+ <show_in_store>1</show_in_store>
90
+ </password>
91
+ </fields>
92
+ </unicentaconfig>
93
+ <tools translate="label">
94
+ <label>Syncronise</label>
95
+ <sort_order>15</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
+ <fields>
100
+ <check translate="label">
101
+ <label>Get Unicenta Opos Products</label>
102
+ <frontend_type>button</frontend_type>
103
+ <frontend_model>asulpuntounicentaopos/adminhtml_system_config_form_button</frontend_model>
104
+ <sort_order>20</sort_order>
105
+ <show_in_default>1</show_in_default>
106
+ <show_in_website>0</show_in_website>
107
+ <show_in_store>0</show_in_store>
108
+ </check>
109
+ <orderstatus translate="label">
110
+ <label>Order Status for Stock Syncronisation</label>
111
+ <comment>Only orders with this status will have the stock value updated in Unicenta Opos</comment>
112
+ <frontend_type>select</frontend_type>
113
+ <source_model>adminhtml/system_config_source_order_status</source_model>
114
+ <validate>required-entry</validate>
115
+ <sort_order>30</sort_order>
116
+ <show_in_default>1</show_in_default>
117
+ <show_in_website>0</show_in_website>
118
+ <show_in_store>0</show_in_store>
119
+ </orderstatus>
120
+ </fields>
121
+
122
+ </tools>
123
+ <advanced translate="label">
124
+ <label>Advanced</label>
125
+ <sort_order>20</sort_order>
126
+ <show_in_default>1</show_in_default>
127
+ <show_in_website>0</show_in_website>
128
+ <show_in_store>0</show_in_store>
129
+ <fields>
130
+ <orderno translate="label">
131
+ <label>Last Order No</label>
132
+ <frontend_type>text</frontend_type>
133
+ <sort_order>10</sort_order>
134
+ <show_in_default>1</show_in_default>
135
+ <show_in_website>0</show_in_website>
136
+ <show_in_store>0</show_in_store>
137
+ </orderno>
138
+ </fields>
139
+ </advanced>
140
+ </groups>
141
+ </asulpuntounicentaopos>
142
+ </sections>
143
+ </config>
app/code/local/Asulpunto/Unicentaopos/sql/unicentaopos_setup/mysql4-install-0.0.1.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento - Unicenta Opos Integrator by Asulpunto
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, Version 3 of the License. You can view
9
+ * the license here http://opensource.org/licenses/GPL-3.0
10
+
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * @category Asulpunto
17
+ * @package Asulpunto_Unicentaopos
18
+ * @copyright Copyright (c) 2013 Asulpunto (http://www.asulpunto.com)
19
+ * @license http://opensource.org/licenses/GPL-3.0 GNU General Public License, version 3 (GPL-3.0)
20
+ *
21
+ */
22
+
23
+
24
+ $installer = $this;
25
+ $installer->startSetup();
26
+
27
+ $installer->run("
28
+ CREATE TABLE
29
+ {$installer->getTable('unicentaopos/unicentaoposproduct')} (
30
+ entity_id int(11) unsigned NOT NULL AUTO_INCREMENT,
31
+ sku varchar(64) DEFAULT NULL,
32
+ magento_product_id int(11) DEFAULT NULL,
33
+ barcode varchar(128) DEFAULT NULL,
34
+ name varchar(255) DEFAULT NULL,
35
+ longdesc varchar(2000) DEFAULT NULL,
36
+ cost double DEFAULT NULL,
37
+ price double DEFAULT NULL,
38
+ stock double DEFAULT NULL,
39
+ data varchar(2000) DEFAULT NULL,
40
+ infoupdated int(11) DEFAULT NULL,
41
+ stockupdated int(11) DEFAULT NULL,
42
+ lastupdate timestamp NULL DEFAULT NULL,
43
+ PRIMARY KEY (entity_id)
44
+ ) ");
45
+
46
+ $installer->run("
47
+
48
+ CREATE TABLE {$installer->getTable('unicentaopos/unicentaoposorderitem')} (
49
+ entity_id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT ,
50
+ magento_order_id INT(11) NULL ,
51
+ magento_increment_id VARCHAR(50) NULL ,
52
+ sku VARCHAR(64) NULL ,
53
+ action VARCHAR(1) NULL ,
54
+ quantity DOUBLE NULL ,
55
+ stockupdated INT(11) NULL ,
56
+ lastupdate TIMESTAMP NULL ,
57
+ PRIMARY KEY (entity_id) )");
58
+
59
+
60
+ $installer->endSetup();
app/code/local/Asulpunto/Unicentaopos/sql/unicentaopos_setup/mysql4-upgrade-0.0.1-0.0.2.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento - Unicenta Opos Integrator by Asulpunto
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, Version 3 of the License. You can view
9
+ * the license here http://opensource.org/licenses/GPL-3.0
10
+
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * @category Asulpunto
17
+ * @package Asulpunto_Unicentaopos
18
+ * @copyright Copyright (c) 2013 Asulpunto (http://www.asulpunto.com)
19
+ * @license http://opensource.org/licenses/GPL-3.0 GNU General Public License, version 3 (GPL-3.0)
20
+ *
21
+ */
22
+
23
+ $installer = $this;
24
+ $installer->startSetup();
25
+
26
+ $col=Mage::getModel('sales/order') ->getCollection()
27
+ ->setOrder('entity_id')
28
+ ->setPage(1, 1);
29
+
30
+
31
+ $item=$col->getFirstItem();
32
+ $docNo='';
33
+ if ($item->getId()){
34
+ $docNo=$item->getIncrementId();
35
+ }
36
+
37
+ $groups['advanced']['fields']['orderno']['value'] = $docNo;
38
+
39
+ /* Save config values */
40
+ $data = Mage::getModel('adminhtml/config_data')
41
+ ->setSection('asulpuntounicentaopos')
42
+ ->setWebsite(0)
43
+ ->setGroups($groups)
44
+ ->save();
45
+ $installer->endSetup();
app/design/adminhtml/default/default/template/asulpunto/unicentaopos/system/config/button.phtml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento - Unicenta Opos Integrator by Asulpunto
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, Version 3 of the License. You can view
9
+ * the license here http://opensource.org/licenses/GPL-3.0
10
+
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * @category Asulpunto
17
+ * @package Asulpunto_Unicentaopos
18
+ * @copyright Copyright (c) 2013 Asulpunto (http://www.asulpunto.com)
19
+ * @license http://opensource.org/licenses/GPL-3.0 GNU General Public License, version 3 (GPL-3.0)
20
+ *
21
+ */
22
+ ?>
23
+
24
+ <script type="text/javascript">
25
+ //<![CDATA[
26
+ function check() {
27
+ new Ajax.Request('<?php echo $this->getAjaxCheckUrl() ?>', {
28
+ method: 'get',
29
+ onSuccess: function(transport){
30
+
31
+ if (transport.responseText){
32
+ alert('Connection OK. Syncronisation has been activated.')
33
+ }else {
34
+ alert('Connection Error');
35
+ }
36
+ }
37
+ });
38
+ }
39
+ //]]>
40
+ </script>
41
+
42
+ <?php echo $this->getButtonHtml() ?>
app/etc/modules/Asulpunto_Unicentaopos.xml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!-- /**
3
+ * Magento - Unicenta Opos Integrator by Asulpunto
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, Version 3 of the License. You can view
9
+ * the license here http://opensource.org/licenses/GPL-3.0
10
+
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * @category Asulpunto
17
+ * @package Asulpunto_Unicentaopos
18
+ * @copyright Copyright (c) 2013 Asulpunto (http://www.asulpunto.com)
19
+ * @license http://opensource.org/licenses/GPL-3.0 GNU General Public License, version 3 (GPL-3.0)
20
+ *
21
+ */
22
+ -->
23
+ <config>
24
+ <modules>
25
+ <Asulpunto_Unicentaopos>
26
+ <active>true</active>
27
+ <codePool>local</codePool>
28
+ </Asulpunto_Unicentaopos>
29
+ </modules>
30
+ </config>
package.xml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Asulpunto_Unicentaopos</name>
4
+ <version>0.0.2</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/GPL-3.0">GNU General Public License 3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>A basic integration for Magento with the popular Unicenta OPOS the open source, touch screen POS. </summary>
10
+ <description>Integrates Magento with Unicenta OPOS. http://www.unicentaopos.co.uk &#xD;
11
+ Unicenta is a free, commercial grade POS. It also supports touch screen terminals.&#xD;
12
+ &#xD;
13
+ Features:&#xD;
14
+ -Product created on Unicenta a create automatically on Magento&#xD;
15
+ -Stock updates on Unicenta are sent to Magento&#xD;
16
+ -Purchases on Magento subtract stock from Unicenta.&#xD;
17
+ &#xD;
18
+ To use this extension you have to install Unicenta's database on a Mysql server accessible by the Magento server.&#xD;
19
+ &#xD;
20
+ </description>
21
+ <notes>First official release.</notes>
22
+ <authors><author><name>Asulpunto</name><user>asulpunto</user><email>asulpunto@asulpunto.com</email></author></authors>
23
+ <date>2013-09-11</date>
24
+ <time>19:43:33</time>
25
+ <contents><target name="magelocal"><dir name="Asulpunto"><dir name="Unicentaopos"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="c8d765e9cd5f9609e1ffd4892cfd1539"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="e72e7f19036b4de80f1e7b6be0ca7118"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Unicentaoposorderitem"><file name="Collection.php" hash="bb9cf8ab48304c34fd7bd575e1002574"/></dir><file name="Unicentaoposorderitem.php" hash="edc7cfecd2b60b0bc372da8c0509cf7d"/><dir name="Unicentaoposproduct"><file name="Collection.php" hash="03f65e284b426d36daa2376e38a813e1"/></dir><file name="Unicentaoposproduct.php" hash="1f849c04da97b863ee88c3b34dc8255b"/></dir><file name="Unicentaoposapi.php" hash="b9f4e6923e17c813be24d0404e673684"/><file name="Unicentaoposorderitem.php" hash="31b0f22a1fa3af396a01b741fd9d4adf"/><file name="Unicentaoposproduct.php" hash="8754d16acf3372355bf379deb563ab03"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="UnicentaoposController.php" hash="7da0f12f269dfdc16ef1f8881753d5fa"/></dir></dir><dir name="etc"><file name="config.xml" hash="81e0fb435bcd3d8534c066fc63d621f3"/><file name="system.xml" hash="714fc892dab8972fcd0105a4c798acf4"/></dir><dir name="sql"><dir name="unicentaopos_setup"><file name="mysql4-install-0.0.1.php" hash="84ba3c4373b2a1c6b1219e8fbd881b51"/><file name="mysql4-upgrade-0.0.1-0.0.2.php" hash="76ea73b06b500e88db0891df95744b65"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="asulpunto"><dir name="unicentaopos"><dir name="system"><dir name="config"><file name="button.phtml" hash="37aa35efb0ab32383f130ae9c5bd25df"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Asulpunto_Unicentaopos.xml" hash="8a3eb821341c00e70f1286192e16037e"/></dir></target></contents>
26
+ <compatible/>
27
+ <dependencies><required><php><min>5.3.0</min><max>5.4.0</max></php></required></dependencies>
28
+ </package>