Version Notes
Bugfix orders / customers with email in different lower/uppercase spelling
Download this release
Release Info
Developer | sven rothe |
Extension | Minubo_Interface |
Version | 1.1.31 |
Comparing to | |
See all releases |
Code changes from version 1.1.30 to 1.1.31
app/code/community/Minubo/Interface/Model/Mysql4/Orderaddresses.php
CHANGED
@@ -23,6 +23,24 @@ protected function getColumns() {
|
|
23 |
return array_merge($r, array($field1), $fields2);
|
24 |
}
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
public function loadByField($field,$value){
|
27 |
$table = $this->getMainTable();
|
28 |
$table2 = $this->getTable('sales_flat_order');
|
23 |
return array_merge($r, array($field1), $fields2);
|
24 |
}
|
25 |
|
26 |
+
/*
|
27 |
+
select
|
28 |
+
oab.entity_id as customerId, o.created_at, oab.customer_address_id as incrementKey, o.store_id,
|
29 |
+
o.store_id as websiteKey, o.store_name,o.customer_group_id, o.customer_dob, oab.prefix,
|
30 |
+
ifnull(oab.customer_address_id,concat(g_,oab.entity_id)) as customerNumber,
|
31 |
+
oab.entity_id as billingCustomerAddressKey, oab.entity_id as billingIncrementKey,oab.city,
|
32 |
+
oab.country_id, oab.postcode, oab.region, oab.region_id, oab.address_type,
|
33 |
+
oas.entity_id as shippingIncrementKey, oas.city as shippingCity, oas.country_id as shippingCountry,
|
34 |
+
oas.postcode as shippingPostcode, oas.region as shippingRegion,oas.region_id as shippingRegionId,
|
35 |
+
oas.address_type as shippingAddressType, md5(lower(o.customer_email)) as Customer_HashCode,
|
36 |
+
email, cg.customer_group_code, ifnull(oab.customer_id, md5(lower(o.customer_email))) as customerKey
|
37 |
+
from sales_flat_order_address oab
|
38 |
+
left outer join sales_flat_order o on o.billing_address_id = oab.entity_id
|
39 |
+
left outer join sales_flat_order_address oas on o.shipping_address_id = oas.entity_id
|
40 |
+
left outer join customer_group cg on o.customer_group_id = cg.customer_group_id
|
41 |
+
where o.store_id = 1
|
42 |
+
*/
|
43 |
+
|
44 |
public function loadByField($field,$value){
|
45 |
$table = $this->getMainTable();
|
46 |
$table2 = $this->getTable('sales_flat_order');
|
app/code/community/Minubo/Interface/Model/Mysql4/Orders.php
CHANGED
@@ -21,13 +21,13 @@ protected function getColumns() {
|
|
21 |
'store_To_Base_Rate','store_To_Order_Rate','base_To_Global_Rate','base_To_Order_Rate', /* is_active */ 'store_Name','status','state','applied_Rule_Ids',
|
22 |
'global_Currency_Code','base_Currency_Code','store_Currency_Code',
|
23 |
'order_Currency_Code','shipping_Method','shipping_Description', /* shippingAddressIsActive */ 'ifnull(oas.address_type,oab.address_type) as shippingAddressAddressType',
|
24 |
-
'ifnull(oas.region,oab.region) as shippingAddressRegion','op.method as paymentMethod','oab.customer_address_id','md5(o.customer_email) as Customer_HashCode');
|
25 |
$fields = Mage::getStoreConfig('minubo_interface/settings/orderfields',Mage::app()->getStore());
|
26 |
$f = explode(',', str_replace(' ','',$fields));
|
27 |
return array_merge($r, $f);
|
28 |
}
|
29 |
|
30 |
-
|
31 |
SELECT o.entity_id as orderKey,o.increment_id as orderNumber,o.created_At,o.updated_At, ifnull(oab.customer_address_id,concat('g_',oab.entity_id)) as customerKey,
|
32 |
ifnull(oas.postcode,oab.postcode) as shippingAddressPostcode,ifnull(oas.city,oab.city) as shippingAddressCity,ifnull(oas.country_id,oab.country_id) as shippingAddressCountryId,
|
33 |
ifnull(oas.entity_id,oab.entity_id) as shippingAddressIncrementId,ifnull(oas.parent_id,oab.parent_id) as shippingAddressParentId,
|
@@ -40,13 +40,13 @@ protected function getColumns() {
|
|
40 |
o.store_To_Base_Rate,o.store_To_Order_Rate,o.base_To_Global_Rate,o.base_To_Order_Rate,o.store_Name,o.status,o.state,o.applied_Rule_Ids,
|
41 |
o.global_Currency_Code,o.base_Currency_Code,o.store_Currency_Code,
|
42 |
o.order_Currency_Code,o.shipping_Method,o.shipping_Description, ifnull(oas.address_type,oab.address_type) as shippingAddressAddressType,
|
43 |
-
ifnull(oas.region,oab.region) as shippingAddressRegion,op.method as paymentMethod,oab.customer_address_id,md5(o.customer_email) as Customer_HashCode
|
44 |
FROM `sales_flat_order` o
|
45 |
left outer join sales_flat_order_address oas on o.shipping_address_id = oas.entity_id
|
46 |
left outer join sales_flat_order_payment op on o.entity_id = op.parent_id
|
47 |
left outer join sales_flat_order_address oab on o.billing_address_id = oab.entity_id
|
48 |
where o.store_id = 1
|
49 |
-
|
50 |
|
51 |
public function loadByField($field,$value){
|
52 |
$table = $this->getMainTable();
|
21 |
'store_To_Base_Rate','store_To_Order_Rate','base_To_Global_Rate','base_To_Order_Rate', /* is_active */ 'store_Name','status','state','applied_Rule_Ids',
|
22 |
'global_Currency_Code','base_Currency_Code','store_Currency_Code',
|
23 |
'order_Currency_Code','shipping_Method','shipping_Description', /* shippingAddressIsActive */ 'ifnull(oas.address_type,oab.address_type) as shippingAddressAddressType',
|
24 |
+
'ifnull(oas.region,oab.region) as shippingAddressRegion','op.method as paymentMethod','oab.customer_address_id','md5(lower(o.customer_email)) as Customer_HashCode');
|
25 |
$fields = Mage::getStoreConfig('minubo_interface/settings/orderfields',Mage::app()->getStore());
|
26 |
$f = explode(',', str_replace(' ','',$fields));
|
27 |
return array_merge($r, $f);
|
28 |
}
|
29 |
|
30 |
+
/*
|
31 |
SELECT o.entity_id as orderKey,o.increment_id as orderNumber,o.created_At,o.updated_At, ifnull(oab.customer_address_id,concat('g_',oab.entity_id)) as customerKey,
|
32 |
ifnull(oas.postcode,oab.postcode) as shippingAddressPostcode,ifnull(oas.city,oab.city) as shippingAddressCity,ifnull(oas.country_id,oab.country_id) as shippingAddressCountryId,
|
33 |
ifnull(oas.entity_id,oab.entity_id) as shippingAddressIncrementId,ifnull(oas.parent_id,oab.parent_id) as shippingAddressParentId,
|
40 |
o.store_To_Base_Rate,o.store_To_Order_Rate,o.base_To_Global_Rate,o.base_To_Order_Rate,o.store_Name,o.status,o.state,o.applied_Rule_Ids,
|
41 |
o.global_Currency_Code,o.base_Currency_Code,o.store_Currency_Code,
|
42 |
o.order_Currency_Code,o.shipping_Method,o.shipping_Description, ifnull(oas.address_type,oab.address_type) as shippingAddressAddressType,
|
43 |
+
ifnull(oas.region,oab.region) as shippingAddressRegion,op.method as paymentMethod,oab.customer_address_id,md5(lower(o.customer_email)) as Customer_HashCode
|
44 |
FROM `sales_flat_order` o
|
45 |
left outer join sales_flat_order_address oas on o.shipping_address_id = oas.entity_id
|
46 |
left outer join sales_flat_order_payment op on o.entity_id = op.parent_id
|
47 |
left outer join sales_flat_order_address oab on o.billing_address_id = oab.entity_id
|
48 |
where o.store_id = 1
|
49 |
+
*/
|
50 |
|
51 |
public function loadByField($field,$value){
|
52 |
$table = $this->getMainTable();
|
app/code/community/Minubo/Interface/controllers/ExportController.php.bak
ADDED
@@ -0,0 +1,404 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Minubo Interface Export Module
|
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 Minubo
|
22 |
+
* @package Minubo_Interface
|
23 |
+
* @copyright Copyright (c) 2013 Minubo (http://www.minubo.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
* @author Sven Rothe <sven@minubo.com>
|
26 |
+
* */
|
27 |
+
class Minubo_Interface_ExportController extends Mage_Core_Controller_Front_Action
|
28 |
+
{
|
29 |
+
public function indexAction () {
|
30 |
+
$this->loadLayout(array('default'));
|
31 |
+
$this->renderLayout();
|
32 |
+
}
|
33 |
+
public function mymethodeAction () {
|
34 |
+
$this->loadLayout(array('default'));
|
35 |
+
$this->renderLayout();
|
36 |
+
}
|
37 |
+
|
38 |
+
public function versionAction()
|
39 |
+
{
|
40 |
+
$this->getParam($lastChangeDate, $maxChangeDate, $lastOrderID, $maxOrderID, $limit, $offset, $debug, $pdata, $store_id, $download);
|
41 |
+
// echo Mage::getStoreConfig('minubo_interface/settings/version',Mage::app()->getStore());
|
42 |
+
echo (string) Mage::getConfig()->getNode()->modules->Minubo_Interface->version;
|
43 |
+
}
|
44 |
+
|
45 |
+
public function counterAction()
|
46 |
+
{
|
47 |
+
$this->getParam($lastChangeDate, $maxChangeDate, $lastOrderID, $maxOrderID, $limit, $offset, $debug, $pdata, $store_id, $download);
|
48 |
+
|
49 |
+
$store_id = substr($store_id, 0, strpos($store_id.',',','));
|
50 |
+
|
51 |
+
$countries = Mage::getModel('minubo_interface/read_collections')->readCountries($lastChangeDate, $maxChangeDate, $lastOrderID, $maxOrderID, $limit, $offset, $debug, $pdata, $store_id);
|
52 |
+
echo '# Countries: '.count($countries).'<br>';
|
53 |
+
|
54 |
+
$model = Mage::getModel('minubo_interface/tables');
|
55 |
+
$model->init('regions');
|
56 |
+
$regions = $model->readAll();
|
57 |
+
echo '# Regions: '.count($regions).'<br>';
|
58 |
+
|
59 |
+
$model = Mage::getModel('minubo_interface/tables');
|
60 |
+
$model->init('categories');
|
61 |
+
$categories = $model->readAllByStoreId($store_id);
|
62 |
+
echo '# Categories: '.count($categories).'<br>';
|
63 |
+
|
64 |
+
$model = Mage::getModel('minubo_interface/tables');
|
65 |
+
$model->init('products');
|
66 |
+
$products = $model->readAllByStoreId($store_id);
|
67 |
+
echo '# Products: '.count($products).'<br>';
|
68 |
+
|
69 |
+
$model = Mage::getModel('minubo_interface/tables');
|
70 |
+
$model->init('productattributes');
|
71 |
+
$productattributes = $model->readAll();
|
72 |
+
echo '# ProductAttributes: '.count($productattributes).'<br>';
|
73 |
+
|
74 |
+
$model = Mage::getModel('minubo_interface/tables');
|
75 |
+
$model->init('productcategories');
|
76 |
+
$productcategories = $model->readAllByStoreId($store_id);
|
77 |
+
echo '# ProductCategories: '.count($productcategories).'<br>';
|
78 |
+
|
79 |
+
$model = Mage::getModel('minubo_interface/tables');
|
80 |
+
$model->init('orders');
|
81 |
+
$orders = $model->readAllByStoreId($store_id);
|
82 |
+
echo '# Orders: '.count($orders).'<br>';
|
83 |
+
|
84 |
+
$model = Mage::getModel('minubo_interface/tables');
|
85 |
+
$model->init('orderitems');
|
86 |
+
$orderitems = $model->readAllByStoreId($store_id);
|
87 |
+
echo '# OrderItems: '.count($orderitems).'<br>';
|
88 |
+
|
89 |
+
$model = Mage::getModel('minubo_interface/tables');
|
90 |
+
$model->init('orderaddresses');
|
91 |
+
$orderaddresses = $model->readAllByStoreId($store_id);
|
92 |
+
echo '# OrderAddresses: '.count($orderaddresses).'<br>';
|
93 |
+
|
94 |
+
$model = Mage::getModel('minubo_interface/tables');
|
95 |
+
$model->init('customers');
|
96 |
+
$customers = $model->readAllByStoreId($store_id);
|
97 |
+
echo '# Customers: '.count($customers).'<br>';
|
98 |
+
|
99 |
+
$model = Mage::getModel('minubo_interface/tables');
|
100 |
+
$model->init('customeraddresses');
|
101 |
+
$customeraddresses = $model->readAllByStoreId($store_id);
|
102 |
+
echo '# CustomerAddresses: '.count($customeraddresses).'<br>';
|
103 |
+
|
104 |
+
$model = Mage::getModel('minubo_interface/tables');
|
105 |
+
$model->init('creditmemos');
|
106 |
+
$creditmemos = $model->readAllByStoreId($store_id);
|
107 |
+
echo '# CreditMemos: '.count($creditmemos).'<br>';
|
108 |
+
|
109 |
+
$model = Mage::getModel('minubo_interface/tables');
|
110 |
+
$model->init('creditmemoitems');
|
111 |
+
$creditmemoitems = $model->readAllByStoreId($store_id);
|
112 |
+
echo '# CreditMemoItems: '.count($creditmemoitems).'<br>';
|
113 |
+
|
114 |
+
$model = Mage::getModel('minubo_interface/tables');
|
115 |
+
$model->init('invoices');
|
116 |
+
$invoices = $model->readAllByStoreId($store_id);
|
117 |
+
echo '# Invoices: '.count($invoices).'<br>';
|
118 |
+
|
119 |
+
$model = Mage::getModel('minubo_interface/tables');
|
120 |
+
$model->init('invoiceitems');
|
121 |
+
$invoiceitems = $model->readAllByStoreId($store_id);
|
122 |
+
echo '# InvoiceItems: '.count($invoiceitems).'<br>';
|
123 |
+
|
124 |
+
}
|
125 |
+
|
126 |
+
public function getMicrotime() {
|
127 |
+
$mtime = microtime();
|
128 |
+
$mtime = explode(' ', $mtime);
|
129 |
+
return doubleval($mtime[1]) + doubleval($mtime[0]);
|
130 |
+
}
|
131 |
+
|
132 |
+
public function getStartlog() {
|
133 |
+
return $this->getMicrotime();
|
134 |
+
}
|
135 |
+
|
136 |
+
public function getEndlog($start) {
|
137 |
+
return '<br># runtime: '.abs($this->getMicrotime()-$start).'<br>'.
|
138 |
+
'# memory_get_usage(true): '.memory_get_usage(true).'<br>'.
|
139 |
+
'# memory_get_usage(false): '.memory_get_usage(false).'<br>'.
|
140 |
+
'# memory_get_peak_usage(true): '.memory_get_peak_usage(true).'<br>'.
|
141 |
+
'# memory_get_peak_usage(false): '.memory_get_peak_usage(false).'<br>';
|
142 |
+
}
|
143 |
+
|
144 |
+
function getParam(&$lastChangeDate, &$maxChangeDate, &$lastOrderID, &$maxOrderID, &$limit, &$offset, &$debug, &$pdata, &$store_id, &$download, $nolog = false) {
|
145 |
+
|
146 |
+
$debug = $this->getRequest()->getPost('debug');
|
147 |
+
|
148 |
+
$enabled = Mage::getStoreConfig('minubo_interface/settings/active',Mage::app()->getStore());
|
149 |
+
if(!$enabled) die('Minubo Interface is disabled.');
|
150 |
+
|
151 |
+
$login = $this->getRequest()->getPost('login');
|
152 |
+
$hash = Mage::getStoreConfig('minubo_interface/settings/hash',Mage::app()->getStore());
|
153 |
+
if($login!=$hash) die('You are not allowed to access this stuff.');
|
154 |
+
|
155 |
+
if($debug) echo '# memory_get_usage(true): '.memory_get_usage(true).'<br>';
|
156 |
+
if($debug) echo '# memory_get_usage(false): '.memory_get_usage(false).'<br>';
|
157 |
+
|
158 |
+
$lastChangeDate = $this->getRequest()->getPost('last_change_date');
|
159 |
+
// if(!$lastChangeDate) $lastChangeDate='2000-01-01';
|
160 |
+
|
161 |
+
$maxChangeDate = $this->getRequest()->getPost('max_change_date');
|
162 |
+
// if(!$maxChangeDate) $maxChangeDate='2099-12-31';
|
163 |
+
|
164 |
+
$lastOrderID = $this->getRequest()->getPost('last_order_id');
|
165 |
+
// if(!$lastOrderID) $lastOrderID=0;
|
166 |
+
|
167 |
+
$maxOrderID = $this->getRequest()->getPost('max_order_id');
|
168 |
+
// if(!$maxOrderID) $maxOrderID=9999999999;
|
169 |
+
|
170 |
+
$limit = $this->getRequest()->getPost('limit');
|
171 |
+
if($limit=='0') {
|
172 |
+
// ok
|
173 |
+
} else {
|
174 |
+
if(!$limit) $limit=1000;
|
175 |
+
}
|
176 |
+
|
177 |
+
$offset = $this->getRequest()->getPost('offset');
|
178 |
+
if(!$offset) $offset=0;
|
179 |
+
|
180 |
+
$store_id = Mage::getStoreConfig('minubo_interface/settings/storeid',Mage::app()->getStore());
|
181 |
+
if(!$store_id) $store_id = $this->getRequest()->getPost('store_id');
|
182 |
+
if(!$store_id) $store_id='1';
|
183 |
+
|
184 |
+
$pdata = $this->getRequest()->getPost('pdata');
|
185 |
+
|
186 |
+
$download = $this->getRequest()->getPost('download');
|
187 |
+
|
188 |
+
$endtime = str_replace('.','-',Mage::getStoreConfig('minubo_interface/settings/lastexportenddate',Mage::app()->getStore()));
|
189 |
+
if(((time()-strtotime($endtime))>600) && !$nolog) {
|
190 |
+
$config = new Mage_Core_Model_Config();
|
191 |
+
$config->saveConfig('minubo_interface/settings/lastexportstartdate', str_replace('.','-',date('Y.m.d H:i:s')), 'default', 0);
|
192 |
+
$config = null;
|
193 |
+
}
|
194 |
+
|
195 |
+
if($debug) {
|
196 |
+
echo 'lastChangeDate: '.$lastChangeDate.'<br>';
|
197 |
+
echo 'maxChangeDate: '.$maxChangeDate.'<br>';
|
198 |
+
echo 'lastOrderId: '.$lastOrderID.'<br>';
|
199 |
+
echo 'maxOrderId: '.$maxOrderID.'<br>';
|
200 |
+
echo 'limit: '.$limit.'<br>';
|
201 |
+
echo 'offset: '.$offset.'<br>';
|
202 |
+
echo 'storeId: '.$store_id.'<br>';
|
203 |
+
echo 'download: '.$download.'<br>';
|
204 |
+
}
|
205 |
+
}
|
206 |
+
|
207 |
+
public function countriesAction ()
|
208 |
+
{
|
209 |
+
$start = $this->getStartlog();
|
210 |
+
$this->getParam($lastChangeDate, $maxChangeDate, $lastOrderID, $maxOrderID, $limit, $offset, $debug, $pdata, $store_id, $download);
|
211 |
+
$countries = Mage::getModel('minubo_interface/read_collections')->readCountries($lastChangeDate, $maxChangeDate, $lastOrderID, $maxOrderID, $limit, $offset, $debug, $pdata, $store_id);
|
212 |
+
$this->handleCountries($countries,'country','countries','',$start,$download);
|
213 |
+
if($debug) echo $this->getEndlog($start);
|
214 |
+
}
|
215 |
+
|
216 |
+
public function handleCountries (&$rows, $filename, $type, $pdata, $start, $download)
|
217 |
+
{
|
218 |
+
// switch(Mage::getStoreConfig('minubo_interface/settings/output_type',Mage::app()->getStore())){
|
219 |
+
// case 'Standard':
|
220 |
+
$file = Mage::getModel('minubo_interface/export_csv')->exportCountries($rows, $filename, $type, $pdata);
|
221 |
+
if (!$download) {
|
222 |
+
echo file_get_contents(Mage::getBaseDir('export').'/'.$file);
|
223 |
+
} else {
|
224 |
+
$this->_prepareDownloadResponse($file, file_get_contents(Mage::getBaseDir('export').'/'.$file));
|
225 |
+
}
|
226 |
+
// break;
|
227 |
+
// }
|
228 |
+
$config = new Mage_Core_Model_Config();
|
229 |
+
$config->saveConfig('minubo_interface/settings/lastexportenddate', str_replace('.','-',date('Y.m.d H:i:s')), 'default', 0);
|
230 |
+
$config = null;
|
231 |
+
|
232 |
+
$rows = null;
|
233 |
+
$file = null;
|
234 |
+
}
|
235 |
+
|
236 |
+
/*
|
237 |
+
* load and export of data of type TABLE
|
238 |
+
* Read data directly from tables defined in config.xml and Model/Mysql4
|
239 |
+
*/
|
240 |
+
|
241 |
+
public function ordersAction ()
|
242 |
+
{
|
243 |
+
$renameCols = array('entity_id' => 'order_id');
|
244 |
+
$this->handleTable ('orders', 'order', 'orders', Array(), Array(), $renameCols, true);
|
245 |
+
}
|
246 |
+
|
247 |
+
public function orderItemsAction ()
|
248 |
+
{
|
249 |
+
$renameCols = array('item_id' => 'orderitem_id');
|
250 |
+
$this->handleTable ('orderitems', 'orderitem', 'orderitems', Array(), Array(), $renameCols, true);
|
251 |
+
}
|
252 |
+
|
253 |
+
public function orderCustomersAction ()
|
254 |
+
{
|
255 |
+
$this->handleTable ('orderaddresses', 'orderaddr', 'orderAddresses', Array(), Array(), Array(), true);
|
256 |
+
}
|
257 |
+
public function orderAddressesAction ()
|
258 |
+
{
|
259 |
+
$this->handleTable ('orderaddresses', 'orderaddr', 'orderAddresses', Array(), Array(), Array(), true);
|
260 |
+
}
|
261 |
+
|
262 |
+
public function customersAction ()
|
263 |
+
{
|
264 |
+
$renameCols = array('entity_id' => 'customer_id');
|
265 |
+
$this->handleTable ('customers', 'customer', 'customers', Array(), Array(), $renameCols, true);
|
266 |
+
}
|
267 |
+
|
268 |
+
public function customerAddressesAction ()
|
269 |
+
{
|
270 |
+
$this->handleTable ('orderaddresses', 'orderaddr', 'orderaddresses', Array(), Array(), Array(), true);
|
271 |
+
}
|
272 |
+
|
273 |
+
public function productsAction ()
|
274 |
+
{
|
275 |
+
$skipCols = array('description', 'in_depth', 'activation_information');
|
276 |
+
$this->handleTable ('products', 'product', 'products', Array(), $skipCols, Array(), true);
|
277 |
+
}
|
278 |
+
|
279 |
+
public function categoriesAction ()
|
280 |
+
{
|
281 |
+
$renameCols = array('entity_id' => 'category_id');
|
282 |
+
$colTitles = array('Category_Id','Parent_Id','Position','Category_Name','level','image','url_key','url_path');
|
283 |
+
$this->handleTable ('categories', 'category', 'categories', $colTitles, Array(), $renameCols, true, true);
|
284 |
+
}
|
285 |
+
|
286 |
+
public function productcategoriesAction ()
|
287 |
+
{
|
288 |
+
$skipCols = array('is_parent');
|
289 |
+
$colTitles = array('category_id','product_id','position','store_id','visibility');
|
290 |
+
$this->handleTable ('productcategories', 'productcategory', 'productcategories', $colTitles, $skipCols, Array(), true, true);
|
291 |
+
}
|
292 |
+
|
293 |
+
public function productattributesAction ()
|
294 |
+
{
|
295 |
+
$renameCols = array('attribute_set_id' => 'setKey',
|
296 |
+
'attribute_set_name' => 'setName',
|
297 |
+
'attribute_id' => 'attributeKey',
|
298 |
+
'attribute_code' => 'attributeCode',
|
299 |
+
'backend_type' => 'attributeType',
|
300 |
+
'is_required' => 'attributeRequired',
|
301 |
+
'value' => 'optionLabel',
|
302 |
+
'value_id' => 'optionValue');
|
303 |
+
$this->handleTable ('productattributes', 'productattribute', 'productattributes', Array(), Array(), $renameCols);
|
304 |
+
}
|
305 |
+
|
306 |
+
public function regionsAction ()
|
307 |
+
{
|
308 |
+
$colTitles = array('Region_Id','Country_Id','Region_Code','Region_Name');
|
309 |
+
$this->handleTable ('regions', 'region', 'regions', $colTitles, Array(), Array());
|
310 |
+
}
|
311 |
+
|
312 |
+
public function creditmemosAction ()
|
313 |
+
{
|
314 |
+
$this->handleTable ('creditmemos', 'creditmemo', 'creditmemos', Array(), Array(), Array(), true);
|
315 |
+
}
|
316 |
+
public function creditmemoItemsAction ()
|
317 |
+
{
|
318 |
+
$this->handleTable ('creditmemoitems', 'creditmemoitem', 'creditmemoitems', Array(), Array(), Array(), true);
|
319 |
+
}
|
320 |
+
|
321 |
+
public function invoicesAction ()
|
322 |
+
{
|
323 |
+
$this->handleTable ('invoices', 'invoice', 'invoices', Array(), Array(), Array(), true);
|
324 |
+
}
|
325 |
+
public function invoiceItemsAction ()
|
326 |
+
{
|
327 |
+
$this->handleTable ( 'invoiceitems', 'invoiceitem', 'invoiceitems', Array(), Array(), Array(), true);
|
328 |
+
}
|
329 |
+
|
330 |
+
public function handleTable ($sqlinterface, $filename, $type, $colTitles = Array(), $skipCols = Array(), $renameCols = Array(), $appendStoreId = false, $onlyFirstStoreId = false)
|
331 |
+
{
|
332 |
+
$start = $this->getMicrotime();
|
333 |
+
$this->getParam($lastChangeDate, $maxChangeDate, $lastOrderID, $maxOrderID, $limit, $offset, $debug, $pdata, $store_id, $download);
|
334 |
+
|
335 |
+
// switch(Mage::getStoreConfig('minubo_interface/settings/output_type',Mage::app()->getStore())){
|
336 |
+
// case 'Standard':
|
337 |
+
$model = Mage::getModel('minubo_interface/tables');
|
338 |
+
if($debug) echo 'model->init: '.$sqlinterface.'<br>';
|
339 |
+
$model->init($sqlinterface);
|
340 |
+
|
341 |
+
if($limit>0) {
|
342 |
+
if($appendStoreId):
|
343 |
+
if($debug) echo 'readLimitedByStoreId: '.$limit.'/'.$offset.'/'.$store_id.'<br>';
|
344 |
+
$store_ids = explode(',', $curr_store_id);
|
345 |
+
if (count($store_ids)==1) {
|
346 |
+
$rows = $model->readLimitedByStoreId($limit, $offset, $store_id);
|
347 |
+
} else {
|
348 |
+
$rows = $model->readLimitedByStoreId($limit, $offset, $store_ids[0]);
|
349 |
+
if(!$onlyFirstStoreId) {
|
350 |
+
for($i=1; $i<count($store_ids); $i++) {
|
351 |
+
$rows2 = $model->readLimitedByStoreId($limit, $offset, $store_ids[$i]);
|
352 |
+
$rows = array_merge($rows, $rows2);
|
353 |
+
}
|
354 |
+
}
|
355 |
+
}
|
356 |
+
else:
|
357 |
+
if($debug) echo 'readLimited: '.$limit.'/'.$offset.'<br>';
|
358 |
+
$rows = $model->readLimited($limit, $offset);
|
359 |
+
endif;
|
360 |
+
} else {
|
361 |
+
if($appendStoreId):
|
362 |
+
if($debug) echo 'readAllByStoreId: '.$store_id.'<br>';
|
363 |
+
$store_ids = explode(',', $store_id);
|
364 |
+
if (count($store_ids)==1) {
|
365 |
+
$rows = $model->readAllByStoreId($store_id);
|
366 |
+
} else {
|
367 |
+
$rows = $model->readAllByStoreId($store_ids[0]);
|
368 |
+
for($i=1; $i<count($store_ids); $i++) {
|
369 |
+
$rows2 = $model->readAllByStoreId($store_ids[$i]);
|
370 |
+
$rows = array_merge($rows, $rows2);
|
371 |
+
}
|
372 |
+
}
|
373 |
+
else:
|
374 |
+
if($debug) echo 'readAll<br>';
|
375 |
+
$rows = $model->readAll();
|
376 |
+
endif;
|
377 |
+
}
|
378 |
+
|
379 |
+
if (count($colTitles)==0) {
|
380 |
+
$colTitles = $rows[0]; // first data-row: Array ( [attribute_set_id] => 38 ...
|
381 |
+
} else {
|
382 |
+
$colTitles = array_flip($colTitles); // titles: Array ( [0] => Spalte ...
|
383 |
+
}
|
384 |
+
|
385 |
+
$file = Mage::getModel('minubo_interface/export_csv')->exportTable($rows, $filename, $type, $colTitles, $skipCols, $renameCols);
|
386 |
+
if (!$download) {
|
387 |
+
echo file_get_contents(Mage::getBaseDir('export').'/'.$file);
|
388 |
+
} else {
|
389 |
+
$this->_prepareDownloadResponse($file, file_get_contents(Mage::getBaseDir('export').'/'.$file));
|
390 |
+
}
|
391 |
+
// break;
|
392 |
+
// }
|
393 |
+
$config = new Mage_Core_Model_Config();
|
394 |
+
$config->saveConfig('minubo_interface/settings/lastexportenddate', str_replace('.','-',date('Y.m.d H:i:s')), 'default', 0);
|
395 |
+
$config = null;
|
396 |
+
|
397 |
+
$model = null;
|
398 |
+
$rows = null;
|
399 |
+
$file = null;
|
400 |
+
if($debug) echo $this->getEndlog($start).'<br>';
|
401 |
+
}
|
402 |
+
|
403 |
+
}
|
404 |
+
?>
|
app/code/community/Minubo/Interface/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Minubo_Interface>
|
5 |
-
<version>1.1.
|
6 |
</Minubo_Interface>
|
7 |
</modules>
|
8 |
<global>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Minubo_Interface>
|
5 |
+
<version>1.1.31</version>
|
6 |
</Minubo_Interface>
|
7 |
</modules>
|
8 |
<global>
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Minubo_Interface</name>
|
4 |
-
<version>1.1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Minubo Interface connects your Magento Shop to the All-In-One eCommerce Cloud BI Solution at minubo.com</summary>
|
10 |
<description>Minubo Interface connects your Magento Shop to the All-In-One eCommerce Cloud BI Solution at minubo.com. With this Extension in your Magento Shop your minubo Account at minubo.com can be configured to poll the newest data - of cause without any personalization - every day to bring the information to your screen, which you need to optimize your sales business. See more about minubo at minubo.com Minubo Interface supports Magento 1.5 (or newer). In Backend you can configure the Minubo Interface at System/Configuration/Sales/Minubo Interface (enable/disable, generate access key and see information about last export). Right now, the Minubo Interface is at the end of beta status and you have to change in the Magento Connect Backend the setting to allow download of other than stable releases.</description>
|
11 |
-
<notes>Bugfix
|
12 |
<authors><author><name>sven rothe</name><user>minubo</user><email>sven@minubo.com</email></author></authors>
|
13 |
-
<date>2015-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magecommunity"><dir name="Minubo"><dir name="Interface"><dir name="Block"><dir name="Adminhtml"><file name="Authhash.php" hash="c98e63efd5e4e42a6bc1c223a75176c3"/><file name="Lastchangedate.php" hash="c82ee55fad83d848f47a8594bd25c5af"/><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="c288b69aa22cc9ff5e978ff2b89646e9"/></dir></dir></dir><file name="Version.php" hash="31db32eca5dcaf3ad86c747bb3e11efc"/></dir></dir><dir name="Helper"><file name="Data.php" hash="d9cf690ff97d2014cd3e443c07ab4ea7"/></dir><dir name="Model"><dir name="Export"><file name="Abstractcsv.php" hash="94a1b9c669ff01892994faa507152f9c"/><file name="Csv.php" hash="c3788d63aaa16a83b2f280cfbd40c2f1"/><file name="Status.php" hash="cef67926aef558b87d4e3bcb02386743"/></dir><dir name="Mysql4"><file name="Categories.php" hash="7aaf0b687f5127bd07a2d7b0c8fb47ba"/><file name="Creditmemoitems.php" hash="c59bc4b0e25753bf458fee5583ca6d0a"/><file name="Creditmemos.php" hash="1f9106985961671c236853c563d6a49f"/><file name="Customeraddresses.php" hash="22abe6badaf89f6e172f5f36d7db38ed"/><file name="Customers.php" hash="0d4f8919dfdcc86106a462ca85446390"/><file name="Invoiceitems.php" hash="0273220176bcf5487b6975fbb485b1cd"/><file name="Invoices.php" hash="8f467284eadc5d1885d1df00d007fdd5"/><file name="Orderaddresses.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Minubo_Interface</name>
|
4 |
+
<version>1.1.31</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Minubo Interface connects your Magento Shop to the All-In-One eCommerce Cloud BI Solution at minubo.com</summary>
|
10 |
<description>Minubo Interface connects your Magento Shop to the All-In-One eCommerce Cloud BI Solution at minubo.com. With this Extension in your Magento Shop your minubo Account at minubo.com can be configured to poll the newest data - of cause without any personalization - every day to bring the information to your screen, which you need to optimize your sales business. See more about minubo at minubo.com Minubo Interface supports Magento 1.5 (or newer). In Backend you can configure the Minubo Interface at System/Configuration/Sales/Minubo Interface (enable/disable, generate access key and see information about last export). Right now, the Minubo Interface is at the end of beta status and you have to change in the Magento Connect Backend the setting to allow download of other than stable releases.</description>
|
11 |
+
<notes>Bugfix orders / customers with email in different lower/uppercase spelling</notes>
|
12 |
<authors><author><name>sven rothe</name><user>minubo</user><email>sven@minubo.com</email></author></authors>
|
13 |
+
<date>2015-09-21</date>
|
14 |
+
<time>18:23:56</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Minubo"><dir name="Interface"><dir name="Block"><dir name="Adminhtml"><file name="Authhash.php" hash="c98e63efd5e4e42a6bc1c223a75176c3"/><file name="Lastchangedate.php" hash="c82ee55fad83d848f47a8594bd25c5af"/><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="c288b69aa22cc9ff5e978ff2b89646e9"/></dir></dir></dir><file name="Version.php" hash="31db32eca5dcaf3ad86c747bb3e11efc"/></dir></dir><dir name="Helper"><file name="Data.php" hash="d9cf690ff97d2014cd3e443c07ab4ea7"/></dir><dir name="Model"><dir name="Export"><file name="Abstractcsv.php" hash="94a1b9c669ff01892994faa507152f9c"/><file name="Csv.php" hash="c3788d63aaa16a83b2f280cfbd40c2f1"/><file name="Status.php" hash="cef67926aef558b87d4e3bcb02386743"/></dir><dir name="Mysql4"><file name="Categories.php" hash="7aaf0b687f5127bd07a2d7b0c8fb47ba"/><file name="Creditmemoitems.php" hash="c59bc4b0e25753bf458fee5583ca6d0a"/><file name="Creditmemos.php" hash="1f9106985961671c236853c563d6a49f"/><file name="Customeraddresses.php" hash="22abe6badaf89f6e172f5f36d7db38ed"/><file name="Customers.php" hash="0d4f8919dfdcc86106a462ca85446390"/><file name="Invoiceitems.php" hash="0273220176bcf5487b6975fbb485b1cd"/><file name="Invoices.php" hash="8f467284eadc5d1885d1df00d007fdd5"/><file name="Orderaddresses.php" hash="403f9e5f0af547d7a2c9044008fbcd6a"/><file name="Orderitems.php" hash="75d14acbb7c45a369549bceb24b3c108"/><file name="Orders.php" hash="681cb973f53b76ada82c8c47720a7136"/><file name="Productattributes.php" hash="6a4c275d6fabcfae4a901a78ba621856"/><file name="Productcategories.php" hash="56a00cecf2cfe994fdeae9db947f653d"/><file name="Products.php" hash="4b7ebada1f3f291058a356e1765243a3"/><file name="Regions.php" hash="f1575516572fbd9a58e8c025fefa95d4"/></dir><dir name="Options"><file name="Options.php" hash="b696a731d9daa7f53c8375f19ad3838f"/><file name="Version.php" hash="fafcca0d77fbbe7fb26b869a845963bf"/></dir><dir name="Read"><file name="Collections.php" hash="3fbc08cae92c333488d43b307a1a07a0"/><file name="Common.php" hash="18b089bb03cbb226b95db428a7c31ef2"/></dir><file name="Tables.php" hash="e0f2ee1d70cc61cac2ad428b09ecf6e7"/></dir><dir name="controllers"><file name="ExportController.php" hash="823f5a1991cd884e5ef4609ba92ee742"/><file name="ExportController.php.bak" hash="b54973c1a9b0c4e47298f9852a0e9cce"/></dir><dir name="etc"><file name="adminhtml.xml" hash="375c548aacaf6f1bfdf4de3af7b29dfb"/><file name="config.xml" hash="0c5ee6d0ec1e7f4a32846ed88021c4e8"/><file name="system.xml" hash="2ebbd93c3bfaacfcd6530e6ccdfa4173"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="minubo"><dir name="system"><dir name="config"><file name="button.phtml" hash=""/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Minubo_Interface.xml" hash=""/></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|