Minubo_Interface - Version 1.1.27

Version Notes

Customer-Adresses incl. CustomerGroupCode; corrected support link

Download this release

Release Info

Developer sven rothe
Extension Minubo_Interface
Version 1.1.27
Comparing to
See all releases


Code changes from version 1.1.25 to 1.1.27

app/code/community/Minubo/Interface/Model/Mysql4/Customers.php CHANGED
@@ -1,65 +1,64 @@
1
  <?php
2
  class Minubo_Interface_Model_Mysql4_Customers extends Mage_Core_Model_Mysql4_Abstract
3
  {
4
- public function _construct()
5
- {
6
- $this->_init('minubo_interface/customers', 'entity_id');
7
- }
8
 
9
- protected function getColumns() {
10
- $r = array('entity_id','entity_type_id','attribute_set_id','website_id','MD5(email) AS Customer_HashCode',
11
- 'group_id','increment_id','store_id','created_at','updated_at','is_active','disable_auto_group_change',
12
- 'cg.customer_group_id','cg.customer_group_code','cg.tax_class_id');
13
- $showemail = Mage::getStoreConfig('minubo_interface/settings/showemail',Mage::app()->getStore());
14
- if($showemail)
15
- $field1 = 'email';
16
- else
17
- $field1 = "'' as email";
18
  return array_merge($r, array($field1));
19
- }
20
 
21
- public function loadByField($field,$value){
22
- $table = $this->getMainTable();
23
- $table2 = $this->getTable('customer_group');
24
- $cond2 = $this->_getReadAdapter()->quoteInto('c.group_id = cg.customer_group_id','');
25
- $where = $this->_getReadAdapter()->quoteInto("$field = ?", $value);
26
- $select = $this->_getReadAdapter()->select()->from(array('c'=>$table))
27
- ->join(array('cg'=>$table2), $cond2)
28
- ->reset('columns')
29
- ->columns($this->getColumns())
30
- ->where($where);
31
- $id = $this->_getReadAdapter()->fetchOne($select);
32
- return $id;
33
- }
34
 
35
- public function loadAllByStoreId($store_id){
36
- $table = $this->getMainTable();
37
- $table2 = $this->getTable('customer_group');
38
- $cond2 = $this->_getReadAdapter()->quoteInto('c.group_id = cg.customer_group_id','');
39
- $where = $this->_getReadAdapter()->quoteInto("c.store_id = ?", $store_id);
40
- $select = $this->_getReadAdapter()->select()->from(array('c'=>$table))
41
- ->join(array('cg'=>$table2), $cond2)
42
- ->reset('columns')
43
- ->columns($this->getColumns())
44
- ->where($where)
45
- ->order('c.entity_id');
46
- return $this->_getReadAdapter()->fetchAll($select);
47
- }
48
 
49
- public function loadLimitedByStoreId($limit, $offset, $store_id){
50
- $table = $this->getMainTable();
51
- $table2 = $this->getTable('customer_group');
52
- $cond2 = $this->_getReadAdapter()->quoteInto('c.group_id = cg.customer_group_id','');
53
- $where = $this->_getReadAdapter()->quoteInto("c.store_id = ?", $store_id);
54
- $select = $this->_getReadAdapter()->select()->from(array('c'=>$table))
55
- ->join(array('cg'=>$table2), $cond2)
56
- ->reset('columns')
57
- ->columns($this->getColumns())
58
- ->where($where)
59
- ->limit($limit, $offset)
60
- ->order('c.entity_id');
61
- return $this->_getReadAdapter()->fetchAll($select);
62
- }
63
 
64
  }
65
  ?>
1
  <?php
2
  class Minubo_Interface_Model_Mysql4_Customers extends Mage_Core_Model_Mysql4_Abstract
3
  {
4
+ public function _construct() {
5
+ $this->_init('minubo_interface/customers', 'entity_id');
6
+ }
 
7
 
8
+ protected function getColumns() {
9
+ $r = array('entity_id','entity_type_id','attribute_set_id','website_id','MD5(email) AS Customer_HashCode',
10
+ 'group_id','increment_id','store_id','created_at','updated_at','is_active','disable_auto_group_change',
11
+ 'cg.customer_group_id','cg.customer_group_code','cg.tax_class_id');
12
+ $showemail = Mage::getStoreConfig('minubo_interface/settings/showemail',Mage::app()->getStore());
13
+ if($showemail)
14
+ $field1 = 'email';
15
+ else
16
+ $field1 = "'' as email";
17
  return array_merge($r, array($field1));
18
+ }
19
 
20
+ public function loadByField($field,$value){
21
+ $table = $this->getMainTable();
22
+ $table2 = $this->getTable('customer_group');
23
+ $cond2 = $this->_getReadAdapter()->quoteInto('c.group_id = cg.customer_group_id','');
24
+ $where = $this->_getReadAdapter()->quoteInto("$field = ?", $value);
25
+ $select = $this->_getReadAdapter()->select()->from(array('c'=>$table))
26
+ ->join(array('cg'=>$table2), $cond2)
27
+ ->reset('columns')
28
+ ->columns($this->getColumns())
29
+ ->where($where);
30
+ $id = $this->_getReadAdapter()->fetchOne($select);
31
+ return $id;
32
+ }
33
 
34
+ public function loadAllByStoreId($store_id){
35
+ $table = $this->getMainTable();
36
+ $table2 = $this->getTable('customer_group');
37
+ $cond2 = $this->_getReadAdapter()->quoteInto('c.group_id = cg.customer_group_id','');
38
+ $where = $this->_getReadAdapter()->quoteInto("c.store_id = ?", $store_id);
39
+ $select = $this->_getReadAdapter()->select()->from(array('c'=>$table))
40
+ ->join(array('cg'=>$table2), $cond2)
41
+ ->reset('columns')
42
+ ->columns($this->getColumns())
43
+ ->where($where)
44
+ ->order('c.entity_id');
45
+ return $this->_getReadAdapter()->fetchAll($select);
46
+ }
47
 
48
+ public function loadLimitedByStoreId($limit, $offset, $store_id){
49
+ $table = $this->getMainTable();
50
+ $table2 = $this->getTable('customer_group');
51
+ $cond2 = $this->_getReadAdapter()->quoteInto('c.group_id = cg.customer_group_id','');
52
+ $where = $this->_getReadAdapter()->quoteInto("c.store_id = ?", $store_id);
53
+ $select = $this->_getReadAdapter()->select()->from(array('c'=>$table))
54
+ ->join(array('cg'=>$table2), $cond2)
55
+ ->reset('columns')
56
+ ->columns($this->getColumns())
57
+ ->where($where)
58
+ ->limit($limit, $offset)
59
+ ->order('c.entity_id');
60
+ return $this->_getReadAdapter()->fetchAll($select);
61
+ }
62
 
63
  }
64
  ?>
app/code/community/Minubo/Interface/Model/Mysql4/Orderaddresses.php CHANGED
@@ -1,82 +1,91 @@
1
  <?php
2
  class Minubo_Interface_Model_Mysql4_Orderaddresses extends Mage_Core_Model_Mysql4_Abstract
3
  {
4
- public function _construct()
5
- {
6
- $this->_init('minubo_interface/orderaddresses', 'entity_id');
7
- }
8
 
9
- protected function getColumns() {
10
- $r = array('oab.entity_id as customerId','o.created_at','oab.customer_address_id as incrementKey','o.store_id',
11
- 'o.store_id as websiteKey','o.store_name','o.customer_group_id','o.customer_dob','oab.prefix',
12
- "ifnull(oab.customer_address_id,concat('g_',oab.entity_id)) as customerNumber",
13
- 'oab.entity_id as billingCustomerAddressKey','oab.entity_id as billingIncrementKey','oab.city',
14
- 'oab.country_id','oab.postcode','oab.region','oab.region_id','oab.address_type',
15
- 'oas.entity_id as shippingIncrementKey','oas.city as shippingCity','oas.country_id as shippingCountry',
16
- 'oas.postcode as shippingPostcode','oas.region as shippingRegion','oas.region_id as shippingRegionId',
17
- 'oas.address_type as shippingAddressType','md5(o.customer_email) as Customer_HashCode');
18
- $showemail = Mage::getStoreConfig('minubo_interface/settings/showemail',Mage::app()->getStore());
19
- if($showemail)
20
- $field1 = 'email';
21
- else
22
- $field1 = 'substring(oab.email,1,0) as email';
23
- return array_merge($r, array($field1));
24
- }
 
25
 
26
- public function loadByField($field,$value){
27
- $table = $this->getMainTable();
28
- $table2 = $this->getTable('sales_flat_order');
29
- $cond2 = $this->_getReadAdapter()->quoteInto('o.billing_address_id = oab.entity_id','');
30
- $table3 = $this->getTable('sales_flat_order_address');
31
- $cond3 = $this->_getReadAdapter()->quoteInto("o.shipping_address_id = oas.entity_id ",'');
32
- $where = $this->_getReadAdapter()->quoteInto("$field = ?", $value);
33
- $select = $this->_getReadAdapter()->select()
34
- ->from(array('oab'=>$table))
35
- ->join(array('o'=>$table2), $cond2)
36
- ->join(array('oas'=>$table3), $cond3)
37
- ->reset('columns')
38
- ->columns($this->getColumns())
39
- ->where($where);
40
- $id = $this->_getReadAdapter()->fetchOne($select);
41
- return $id;
42
- }
 
 
 
43
 
44
- public function loadAllByStoreId($store_id){
45
- $table = $this->getMainTable();
46
- $table2 = $this->getTable('sales_flat_order');
47
- $cond2 = $this->_getReadAdapter()->quoteInto('o.billing_address_id = oab.entity_id','');
48
- $table3 = $this->getTable('sales_flat_order_address');
49
- $cond3 = $this->_getReadAdapter()->quoteInto("o.shipping_address_id = oas.entity_id ",'');
50
- $where = $this->_getReadAdapter()->quoteInto("o.store_id = ?", $store_id);
51
- $select = $this->_getReadAdapter()->select()
52
- ->from(array('oab'=>$table))
53
- ->join(array('o'=>$table2), $cond2)
54
- ->join(array('oas'=>$table3), $cond3)
55
- ->reset('columns')
56
- ->columns($this->getColumns())
57
- ->where($where)
58
- ->order('o.entity_id');
59
- return $this->_getReadAdapter()->fetchAll($select);
60
- }
 
 
 
61
 
62
- public function loadLimitedByStoreId($limit, $offset, $store_id){
63
- $table = $this->getMainTable();
64
- $table2 = $this->getTable('sales_flat_order');
65
- $cond2 = $this->_getReadAdapter()->quoteInto('o.billing_address_id = oab.entity_id','');
66
- $table3 = $this->getTable('sales_flat_order_address');
67
- $cond3 = $this->_getReadAdapter()->quoteInto("o.shipping_address_id = oas.entity_id ",'');
68
- $where = $this->_getReadAdapter()->quoteInto("o.store_id = ?", $store_id);
69
- $select = $this->_getReadAdapter()->select()
70
- ->from(array('oab'=>$table))
71
- ->join(array('o'=>$table2), $cond2)
72
- ->join(array('oas'=>$table3), $cond3)
73
- ->reset('columns')
74
- ->columns($this->getColumns())
75
- ->where($where)
76
- ->limit($limit, $offset)
77
- ->order('o.entity_id');
78
- return $this->_getReadAdapter()->fetchAll($select);
79
- }
 
 
 
80
 
81
  }
82
  ?>
1
  <?php
2
  class Minubo_Interface_Model_Mysql4_Orderaddresses extends Mage_Core_Model_Mysql4_Abstract
3
  {
4
+ public function _construct() {
5
+ $this->_init('minubo_interface/orderaddresses', 'entity_id');
6
+ }
 
7
 
8
+ protected function getColumns() {
9
+ $r = array('oab.entity_id as customerId','o.created_at','oab.customer_address_id as incrementKey','o.store_id',
10
+ 'o.store_id as websiteKey','o.store_name','o.customer_group_id','o.customer_dob','oab.prefix',
11
+ "ifnull(oab.customer_address_id,concat('g_',oab.entity_id)) as customerNumber",
12
+ 'oab.entity_id as billingCustomerAddressKey','oab.entity_id as billingIncrementKey','oab.city',
13
+ 'oab.country_id','oab.postcode','oab.region','oab.region_id','oab.address_type',
14
+ 'oas.entity_id as shippingIncrementKey','oas.city as shippingCity','oas.country_id as shippingCountry',
15
+ 'oas.postcode as shippingPostcode','oas.region as shippingRegion','oas.region_id as shippingRegionId',
16
+ 'oas.address_type as shippingAddressType','md5(o.customer_email) as Customer_HashCode');
17
+ $showemail = Mage::getStoreConfig('minubo_interface/settings/showemail',Mage::app()->getStore());
18
+ if($showemail)
19
+ $field1 = 'email';
20
+ else
21
+ $field1 = 'substring(oab.email,1,0) as email';
22
+ $field2 = 'cg.customer_group_code';
23
+ return array_merge($r, array($field1), array($field2));
24
+ }
25
 
26
+ public function loadByField($field,$value){
27
+ $table = $this->getMainTable();
28
+ $table2 = $this->getTable('sales_flat_order');
29
+ $cond2 = $this->_getReadAdapter()->quoteInto('o.billing_address_id = oab.entity_id','');
30
+ $table3 = $this->getTable('sales_flat_order_address');
31
+ $cond3 = $this->_getReadAdapter()->quoteInto("o.shipping_address_id = oas.entity_id ",'');
32
+ $table4 = $this->getTable('customer_group');
33
+ $cond4 = $this->_getReadAdapter()->quoteInto('o.customer_group_id = cg.customer_group_id','');
34
+ $where = $this->_getReadAdapter()->quoteInto("$field = ?", $value);
35
+ $select = $this->_getReadAdapter()->select()
36
+ ->from(array('oab'=>$table))
37
+ ->join(array('o'=>$table2), $cond2)
38
+ ->join(array('oas'=>$table3), $cond3)
39
+ ->join(array('cg'=>$table4), $cond2)
40
+ ->reset('columns')
41
+ ->columns($this->getColumns())
42
+ ->where($where);
43
+ $id = $this->_getReadAdapter()->fetchOne($select);
44
+ return $id;
45
+ }
46
 
47
+ public function loadAllByStoreId($store_id){
48
+ $table = $this->getMainTable();
49
+ $table2 = $this->getTable('sales_flat_order');
50
+ $cond2 = $this->_getReadAdapter()->quoteInto('o.billing_address_id = oab.entity_id','');
51
+ $table3 = $this->getTable('sales_flat_order_address');
52
+ $cond3 = $this->_getReadAdapter()->quoteInto("o.shipping_address_id = oas.entity_id ",'');
53
+ $table4 = $this->getTable('customer_group');
54
+ $cond4 = $this->_getReadAdapter()->quoteInto('o.customer_group_id = cg.customer_group_id','');
55
+ $where = $this->_getReadAdapter()->quoteInto("o.store_id = ?", $store_id);
56
+ $select = $this->_getReadAdapter()->select()
57
+ ->from(array('oab'=>$table))
58
+ ->join(array('o'=>$table2), $cond2)
59
+ ->join(array('oas'=>$table3), $cond3)
60
+ ->join(array('cg'=>$table4), $cond2)
61
+ ->reset('columns')
62
+ ->columns($this->getColumns())
63
+ ->where($where)
64
+ ->order('o.entity_id');
65
+ return $this->_getReadAdapter()->fetchAll($select);
66
+ }
67
 
68
+ public function loadLimitedByStoreId($limit, $offset, $store_id){
69
+ $table = $this->getMainTable();
70
+ $table2 = $this->getTable('sales_flat_order');
71
+ $cond2 = $this->_getReadAdapter()->quoteInto('o.billing_address_id = oab.entity_id','');
72
+ $table3 = $this->getTable('sales_flat_order_address');
73
+ $cond3 = $this->_getReadAdapter()->quoteInto("o.shipping_address_id = oas.entity_id ",'');
74
+ $table4 = $this->getTable('customer_group');
75
+ $cond4 = $this->_getReadAdapter()->quoteInto('o.customer_group_id = cg.customer_group_id','');
76
+ $where = $this->_getReadAdapter()->quoteInto("o.store_id = ?", $store_id);
77
+ $select = $this->_getReadAdapter()->select()
78
+ ->from(array('oab'=>$table))
79
+ ->join(array('o'=>$table2), $cond2)
80
+ ->join(array('oas'=>$table3), $cond3)
81
+ ->join(array('cg'=>$table4), $cond2)
82
+ ->reset('columns')
83
+ ->columns($this->getColumns())
84
+ ->where($where)
85
+ ->limit($limit, $offset)
86
+ ->order('o.entity_id');
87
+ return $this->_getReadAdapter()->fetchAll($select);
88
+ }
89
 
90
  }
91
  ?>
app/code/community/Minubo/Interface/Model/Mysql4/Orders.php CHANGED
@@ -1,48 +1,46 @@
1
  <?php
2
  class Minubo_Interface_Model_Mysql4_Orders extends Mage_Core_Model_Mysql4_Abstract
3
  {
4
- public function _construct()
5
- {
6
- $this->_init('minubo_interface/orders', 'entity_id');
7
- }
8
-
9
- protected function getColumns() {
10
- $orderaddcost = Mage::getStoreConfig('minubo_interface/settings/orderaddcost',Mage::app()->getStore());
11
- if($orderaddcost) $orderaddcost = '('.$orderaddcost.') as ';
12
 
13
- $r = array('o.entity_id as orderKey','increment_id as orderNumber','created_At','updated_At',"ifnull(oab.customer_address_id,concat('g_',oab.entity_id)) as customerKey",
14
- 'ifnull(oas.postcode,oab.postcode) as shippingAddressPostcode','ifnull(oas.city,oab.city) as shippingAddressCity','ifnull(oas.country_id,oab.country_id) as shippingAddressCountryId',
15
- 'ifnull(oas.entity_id,oab.entity_id) as shippingAddressIncrementId','ifnull(oas.parent_id,oab.parent_id) as shippingAddressParentId',
16
- 'ifnull(oas.region_id,oab.region_id) as shippingAddressRegionId','store_Id','billing_Address_Id','shipping_Address_Id','quote_Id','is_Virtual','customer_Group_Id','customer_Is_Guest',
17
- 'shipping_address_id as shippingAddressAddressId',
18
- 'o.created_at as shippingAddressCreatedAt','o.updated_at as shippingAddressUpdatedAt','tax_Amount','shipping_Amount','discount_Amount','subtotal','grand_Total','total_Paid',
19
- 'total_Refunded','total_Qty_Ordered','total_Canceled','total_Invoiced',
20
- 'base_Tax_Amount',$orderaddcost.'base_Shipping_Amount','base_Discount_Amount','base_Grand_Total','base_Subtotal','base_Total_Paid','base_Total_Refunded',
21
- 'base_Total_Qty_Ordered','base_Total_Canceled','base_Total_Invoiced',
22
- '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',
23
- 'global_Currency_Code','base_Currency_Code','store_Currency_Code',
24
- 'order_Currency_Code','shipping_Method','shipping_Description', /* shippingAddressIsActive */ 'ifnull(oas.address_type,oab.address_type) as shippingAddressAddressType',
25
- 'ifnull(oas.region,oab.region) as shippingAddressRegion','op.method as paymentMethod','oab.customer_address_id','md5(o.customer_email) as Customer_HashCode');
26
 
27
- $fields = Mage::getStoreConfig('minubo_interface/settings/orderfields',Mage::app()->getStore());
28
- $f = explode(',', str_replace(' ','',$fields));
29
- return array_merge($r, $f);
30
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
- /*
33
- 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,
34
- ifnull(oas.postcode,oab.postcode) as shippingAddressPostcode,ifnull(oas.city,oab.city) as shippingAddressCity,ifnull(oas.country_id,oab.country_id) as shippingAddressCountryId,
35
- ifnull(oas.entity_id,oab.entity_id) as shippingAddressIncrementId,ifnull(oas.parent_id,oab.parent_id) as shippingAddressParentId,
36
- ifnull(oas.region_id,oab.region_id) as shippingAddressRegionId,o.store_Id,o.billing_Address_Id,o.shipping_Address_Id,o.quote_Id,o.is_Virtual,o.customer_Group_Id,o.customer_Is_Guest,
37
- shipping_address_id as shippingAddressAddressId,
38
- o.created_at as shippingAddressCreatedAt,o.updated_at as shippingAddressUpdatedAt,o.tax_Amount,o.shipping_Amount,o.discount_Amount,o.subtotal,o.grand_Total,o.total_Paid,
39
- o.total_Refunded,o.total_Qty_Ordered,o.total_Canceled,o.total_Invoiced,
40
- o.base_Tax_Amount,o.base_Shipping_Amount,o.base_Discount_Amount,o.base_Grand_Total,o.base_Subtotal,o.base_Total_Paid,o.base_Total_Refunded,
41
- o.base_Total_Qty_Ordered,o.base_Total_Canceled,o.base_Total_Invoiced,
42
- 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,
43
- o.global_Currency_Code,o.base_Currency_Code,o.store_Currency_Code,
44
- o.order_Currency_Code,o.shipping_Method,o.shipping_Description, ifnull(oas.address_type,oab.address_type) as shippingAddressAddressType,
45
- ifnull(oas.region,oab.region) as shippingAddressRegion,op.method as paymentMethod,oab.customer_address_id,md5(o.customer_email) as Customer_HashCode
46
  FROM `sales_flat_order` o
47
  left outer join sales_flat_order_address oas on o.shipping_address_id = oas.entity_id
48
  left outer join sales_flat_order_payment op on o.entity_id = op.parent_id
@@ -50,67 +48,67 @@ class Minubo_Interface_Model_Mysql4_Orders extends Mage_Core_Model_Mysql4_Abstra
50
  where o.store_id = 1
51
  */
52
 
53
- public function loadByField($field,$value){
54
- $table = $this->getMainTable();
55
- $table2 = $this->getTable('sales_flat_order_address');
56
- $cond2 = $this->_getReadAdapter()->quoteInto('o.shipping_address_id = oas.entity_id ','');
57
- $table3 = $this->getTable('sales_flat_order_payment');
58
- $cond3 = $this->_getReadAdapter()->quoteInto('o.entity_id = op.parent_id ','');
59
- $table4 = $this->getTable('sales_flat_order_address');
60
- $cond4 = $this->_getReadAdapter()->quoteInto("o.billing_address_id = oab.entity_id ",'');
61
- $where = $this->_getReadAdapter()->quoteInto("$field = ?", $value);
62
- $select = $this->_getReadAdapter()->select()->from(array('o'=>$table))
63
- ->joinLeft(array('oas'=>$table2), $cond2)
64
- ->joinLeft(array('op'=>$table3), $cond3)
65
- ->joinLeft(array('oab'=>$table4), $cond4)
66
- ->reset('columns')
67
- ->columns($this->getColumns())
68
- ->where($where);
69
- $id = $this->_getReadAdapter()->fetchOne($select);
70
- return $id;
71
- }
72
 
73
- public function loadAllByStoreId($store_id){
74
- $table = $this->getMainTable();
75
- $table2 = $this->getTable('sales_flat_order_address');
76
- $cond2 = $this->_getReadAdapter()->quoteInto('o.shipping_address_id = oas.entity_id ','');
77
- $table3 = $this->getTable('sales_flat_order_payment');
78
- $cond3 = $this->_getReadAdapter()->quoteInto('o.entity_id = op.parent_id ','');
79
- $table4 = $this->getTable('sales_flat_order_address');
80
- $cond4 = $this->_getReadAdapter()->quoteInto("o.billing_address_id = oab.entity_id ",'');
81
- $where = $this->_getReadAdapter()->quoteInto("o.store_id = ?", $store_id);
82
- $select = $this->_getReadAdapter()->select()->from(array('o'=>$table))
83
- ->joinLeft(array('oas'=>$table2), $cond2)
84
- ->joinLeft(array('op'=>$table3), $cond3)
85
- ->joinLeft(array('oab'=>$table4), $cond4)
86
- ->reset('columns')
87
- ->columns($this->getColumns())
88
- ->where($where)
89
- ->order('o.entity_id');
90
- return $this->_getReadAdapter()->fetchAll($select);
91
- }
92
 
93
- public function loadLimitedByStoreId($limit, $offset, $store_id){
94
- $table = $this->getMainTable();
95
- $table2 = $this->getTable('sales_flat_order_address');
96
- $cond2 = $this->_getReadAdapter()->quoteInto('o.shipping_address_id = oas.entity_id ','');
97
- $table3 = $this->getTable('sales_flat_order_payment');
98
- $cond3 = $this->_getReadAdapter()->quoteInto('o.entity_id = op.parent_id ','');
99
- $table4 = $this->getTable('sales_flat_order_address');
100
- $cond4 = $this->_getReadAdapter()->quoteInto("o.billing_address_id = oab.entity_id ",'');
101
- $where = $this->_getReadAdapter()->quoteInto("o.store_id = ?", $store_id);
102
- $select = $this->_getReadAdapter()->select()
103
- ->from(array('o'=>$table))
104
- ->joinLeft(array('oas'=>$table2), $cond2)
105
- ->joinLeft(array('op'=>$table3), $cond3)
106
- ->joinLeft(array('oab'=>$table4), $cond4)
107
- ->reset('columns')
108
- ->columns($this->getColumns())
109
- ->where($where)
110
- ->limit($limit, $offset)
111
- ->order('o.entity_id');
112
- return $this->_getReadAdapter()->fetchAll($select);
113
- }
114
 
115
  }
116
  ?>
1
  <?php
2
  class Minubo_Interface_Model_Mysql4_Orders extends Mage_Core_Model_Mysql4_Abstract
3
  {
4
+ public function _construct() {
5
+ $this->_init('minubo_interface/orders', 'entity_id');
6
+ }
 
 
 
 
 
7
 
8
+ protected function getColumns() {
9
+ $orderaddcost = Mage::getStoreConfig('minubo_interface/settings/orderaddcost',Mage::app()->getStore());
10
+ if($orderaddcost) $orderaddcost = '('.$orderaddcost.') as ';
 
 
 
 
 
 
 
 
 
 
11
 
12
+ $r = array('o.entity_id as orderKey','increment_id as orderNumber','created_At','updated_At',"ifnull(oab.customer_address_id,concat('g_',oab.entity_id)) as customerKey",
13
+ 'ifnull(oas.postcode,oab.postcode) as shippingAddressPostcode','ifnull(oas.city,oab.city) as shippingAddressCity','ifnull(oas.country_id,oab.country_id) as shippingAddressCountryId',
14
+ 'ifnull(oas.entity_id,oab.entity_id) as shippingAddressIncrementId','ifnull(oas.parent_id,oab.parent_id) as shippingAddressParentId',
15
+ 'ifnull(oas.region_id,oab.region_id) as shippingAddressRegionId','store_Id','billing_Address_Id','shipping_Address_Id','quote_Id','is_Virtual','customer_group_id','customer_is_guest',
16
+ 'shipping_address_id as shippingAddressAddressId',
17
+ 'o.created_at as shippingAddressCreatedAt','o.updated_at as shippingAddressUpdatedAt','tax_Amount','shipping_Amount','discount_Amount','subtotal','grand_Total','total_Paid',
18
+ 'total_Refunded','total_Qty_Ordered','total_Canceled','total_Invoiced',
19
+ 'base_Tax_Amount',$orderaddcost.'base_Shipping_Amount','base_Discount_Amount','base_Grand_Total','base_Subtotal','base_Total_Paid','base_Total_Refunded',
20
+ 'base_Total_Qty_Ordered','base_Total_Canceled','base_Total_Invoiced',
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,
34
+ ifnull(oas.region_id,oab.region_id) as shippingAddressRegionId,o.store_Id,o.billing_Address_Id,o.shipping_Address_Id,o.quote_Id,o.is_Virtual,o.customer_Group_Id,o.customer_Is_Guest,
35
+ shipping_address_id as shippingAddressAddressId,
36
+ o.created_at as shippingAddressCreatedAt,o.updated_at as shippingAddressUpdatedAt,o.tax_Amount,o.shipping_Amount,o.discount_Amount,o.subtotal,o.grand_Total,o.total_Paid,
37
+ o.total_Refunded,o.total_Qty_Ordered,o.total_Canceled,o.total_Invoiced,
38
+ o.base_Tax_Amount,o.base_Shipping_Amount,o.base_Discount_Amount,o.base_Grand_Total,o.base_Subtotal,o.base_Total_Paid,o.base_Total_Refunded,
39
+ o.base_Total_Qty_Ordered,o.base_Total_Canceled,o.base_Total_Invoiced,
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
48
  where o.store_id = 1
49
  */
50
 
51
+ public function loadByField($field,$value){
52
+ $table = $this->getMainTable();
53
+ $table2 = $this->getTable('sales_flat_order_address');
54
+ $cond2 = $this->_getReadAdapter()->quoteInto('o.shipping_address_id = oas.entity_id ','');
55
+ $table3 = $this->getTable('sales_flat_order_payment');
56
+ $cond3 = $this->_getReadAdapter()->quoteInto('o.entity_id = op.parent_id ','');
57
+ $table4 = $this->getTable('sales_flat_order_address');
58
+ $cond4 = $this->_getReadAdapter()->quoteInto("o.billing_address_id = oab.entity_id ",'');
59
+ $where = $this->_getReadAdapter()->quoteInto("$field = ?", $value);
60
+ $select = $this->_getReadAdapter()->select()->from(array('o'=>$table))
61
+ ->joinLeft(array('oas'=>$table2), $cond2)
62
+ ->joinLeft(array('op'=>$table3), $cond3)
63
+ ->joinLeft(array('oab'=>$table4), $cond4)
64
+ ->reset('columns')
65
+ ->columns($this->getColumns())
66
+ ->where($where);
67
+ $id = $this->_getReadAdapter()->fetchOne($select);
68
+ return $id;
69
+ }
70
 
71
+ public function loadAllByStoreId($store_id){
72
+ $table = $this->getMainTable();
73
+ $table2 = $this->getTable('sales_flat_order_address');
74
+ $cond2 = $this->_getReadAdapter()->quoteInto('o.shipping_address_id = oas.entity_id ','');
75
+ $table3 = $this->getTable('sales_flat_order_payment');
76
+ $cond3 = $this->_getReadAdapter()->quoteInto('o.entity_id = op.parent_id ','');
77
+ $table4 = $this->getTable('sales_flat_order_address');
78
+ $cond4 = $this->_getReadAdapter()->quoteInto("o.billing_address_id = oab.entity_id ",'');
79
+ $where = $this->_getReadAdapter()->quoteInto("o.store_id = ?", $store_id);
80
+ $select = $this->_getReadAdapter()->select()->from(array('o'=>$table))
81
+ ->joinLeft(array('oas'=>$table2), $cond2)
82
+ ->joinLeft(array('op'=>$table3), $cond3)
83
+ ->joinLeft(array('oab'=>$table4), $cond4)
84
+ ->reset('columns')
85
+ ->columns($this->getColumns())
86
+ ->where($where)
87
+ ->order('o.entity_id');
88
+ return $this->_getReadAdapter()->fetchAll($select);
89
+ }
90
 
91
+ public function loadLimitedByStoreId($limit, $offset, $store_id){
92
+ $table = $this->getMainTable();
93
+ $table2 = $this->getTable('sales_flat_order_address');
94
+ $cond2 = $this->_getReadAdapter()->quoteInto('o.shipping_address_id = oas.entity_id ','');
95
+ $table3 = $this->getTable('sales_flat_order_payment');
96
+ $cond3 = $this->_getReadAdapter()->quoteInto('o.entity_id = op.parent_id ','');
97
+ $table4 = $this->getTable('sales_flat_order_address');
98
+ $cond4 = $this->_getReadAdapter()->quoteInto("o.billing_address_id = oab.entity_id ",'');
99
+ $where = $this->_getReadAdapter()->quoteInto("o.store_id = ?", $store_id);
100
+ $select = $this->_getReadAdapter()->select()
101
+ ->from(array('o'=>$table))
102
+ ->joinLeft(array('oas'=>$table2), $cond2)
103
+ ->joinLeft(array('op'=>$table3), $cond3)
104
+ ->joinLeft(array('oab'=>$table4), $cond4)
105
+ ->reset('columns')
106
+ ->columns($this->getColumns())
107
+ ->where($where)
108
+ ->limit($limit, $offset)
109
+ ->order('o.entity_id');
110
+ return $this->_getReadAdapter()->fetchAll($select);
111
+ }
112
 
113
  }
114
  ?>
app/code/community/Minubo/Interface/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Minubo_Interface>
5
- <version>1.1.25</version>
6
  </Minubo_Interface>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Minubo_Interface>
5
+ <version>1.1.27</version>
6
  </Minubo_Interface>
7
  </modules>
8
  <global>
app/code/community/Minubo/Interface/etc/system.xml CHANGED
@@ -20,7 +20,7 @@
20
  <![CDATA[
21
  <div style="padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;">
22
  This module was developed by <a href="http://www.minubo.com" target="_blank">www.minubo.com</a> - <b>smart metrics now.</b>
23
- <br/>For docs & examples refer to the minubo <a href="http://www.minubo.com/category/blog-en/">blog</a>.
24
  <br/>Need more features in your minubo desktop? Visit <a href="http://www.minubo.com" target="_blank">minubo - smart metrics now.</a> for more information.</a>
25
  </div>
26
  ]]>
20
  <![CDATA[
21
  <div style="padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;">
22
  This module was developed by <a href="http://www.minubo.com" target="_blank">www.minubo.com</a> - <b>smart metrics now.</b>
23
+ <br/>For docs & examples refer to the <a href="http://support.minubo.com" target="_blank">minubo support zone</a>.
24
  <br/>Need more features in your minubo desktop? Visit <a href="http://www.minubo.com" target="_blank">minubo - smart metrics now.</a> for more information.</a>
25
  </div>
26
  ]]>
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Minubo_Interface</name>
4
- <version>1.1.25</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>Tested and released for magento v1.8 and v1.9</notes>
12
  <authors><author><name>sven rothe</name><user>minubo</user><email>sven@minubo.com</email></author></authors>
13
- <date>2014-10-09</date>
14
- <time>16:07:31</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="4f720e307fd8b8bb2b31b57fcd1809e2"/><file name="Invoiceitems.php" hash="0273220176bcf5487b6975fbb485b1cd"/><file name="Invoices.php" hash="8f467284eadc5d1885d1df00d007fdd5"/><file name="Orderaddresses.php" hash="9c1437a6c5079560f9844bd111749543"/><file name="Orderitems.php" hash="75d14acbb7c45a369549bceb24b3c108"/><file name="Orders.php" hash="201058e7c859fcc75cb1da65e1d8719a"/><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="cd5563418250def3824fc87007763c60"/></dir><dir name="etc"><file name="adminhtml.xml" hash="375c548aacaf6f1bfdf4de3af7b29dfb"/><file name="config.xml" hash="0ef28687bec000088498f603d1bb7767"/><file name="system.xml" hash="1711ddf1324890727e091062bbb9ce58"/></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>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Minubo_Interface</name>
4
+ <version>1.1.27</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>Customer-Adresses incl. CustomerGroupCode; corrected support link</notes>
12
  <authors><author><name>sven rothe</name><user>minubo</user><email>sven@minubo.com</email></author></authors>
13
+ <date>2014-10-24</date>
14
+ <time>14:19:41</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="ebfd75af42a67bf0d203bc04967cdb50"/><file name="Orderitems.php" hash="75d14acbb7c45a369549bceb24b3c108"/><file name="Orders.php" hash="d961f9fd03eee6fe0efcfbd44d6a5c5d"/><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="cd5563418250def3824fc87007763c60"/></dir><dir name="etc"><file name="adminhtml.xml" hash="375c548aacaf6f1bfdf4de3af7b29dfb"/><file name="config.xml" hash="af93a681c53e52bcaba77047f5bb3ca2"/><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>