Mage_Econda - Version 1.5.5

Version Notes

Integration of econda Web Controlling functions.

Download this release

Release Info

Developer Magento Core Team
Extension Mage_Econda
Version 1.5.5
Comparing to
See all releases


Code changes from version 1.5.4 to 1.5.5

app/code/local/Mage/Econda/Block/Econda.php CHANGED
@@ -57,7 +57,7 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
57
  $storeCode = Mage::app()->getStore()->getCode();
58
  $storeName = Mage::getModel('core/store_group')->load($storeId)->getName();
59
  $this->realUrl = Mage::helper('core/url')->getCurrentUrl();
60
- $langValue = 'econda/econda/tracking_language';
61
  $this->eLang = Mage::helper('econda/data')->getTranslation();
62
  $cLang = Mage::getStoreConfig($langValue, $storeId);
63
  if($cLang == '1') {
@@ -232,7 +232,7 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
232
  /**
233
  * Display script code
234
  */
235
- $emosString = "\n\n<!-- Start Econda-Monitor M154 -->\n";
236
  $emosString .= $emos->toString();
237
  $emosString .= "<!-- End Econda-Monitor -->\n\n";
238
 
57
  $storeCode = Mage::app()->getStore()->getCode();
58
  $storeName = Mage::getModel('core/store_group')->load($storeId)->getName();
59
  $this->realUrl = Mage::helper('core/url')->getCurrentUrl();
60
+ $langValue = 'econda/econda_settings/tracking_language';
61
  $this->eLang = Mage::helper('econda/data')->getTranslation();
62
  $cLang = Mage::getStoreConfig($langValue, $storeId);
63
  if($cLang == '1') {
232
  /**
233
  * Display script code
234
  */
235
+ $emosString = "\n\n<!-- Start Econda-Monitor M155 -->\n";
236
  $emosString .= $emos->toString();
237
  $emosString .= "<!-- End Econda-Monitor -->\n\n";
238
 
app/code/local/Mage/Econda/Block/EcondaOp.php CHANGED
@@ -45,7 +45,7 @@ class Mage_Econda_Block_EcondaOp extends Mage_Core_Block_Template
45
  $setPageId = md5($splitSessionData[0]);
46
  $setSiteID = $this->dataFormat($splitSessionData[1]);
47
  $setLangID = $splitSessionData[2];
48
- $langValueOP = 'econda/econda/tracking_language';
49
  $cLangOp = Mage::getStoreConfig($langValueOP, $storeIdOp);
50
  if($cLangOp == '1') {
51
  $lang = 0;
@@ -66,7 +66,7 @@ class Mage_Econda_Block_EcondaOp extends Mage_Core_Block_Template
66
  $emosLogin .= " emospro.login = [['".$customerId."','0']];\n";
67
  $opsession->setData('econda_logged','2');
68
  }
69
- $emosOut = "\n\n<!-- Start Econda-Monitor M154 -->\n";
70
  $emosOut .= "<script type=\"text/javascript\">\n//<![CDATA[\n";
71
  $emosOut .= " window.emosTrackVersion = 2;\n";
72
  $emosOut .= "//]]>\n</script>";
45
  $setPageId = md5($splitSessionData[0]);
46
  $setSiteID = $this->dataFormat($splitSessionData[1]);
47
  $setLangID = $splitSessionData[2];
48
+ $langValueOP = 'econda/econda_settings/tracking_language';
49
  $cLangOp = Mage::getStoreConfig($langValueOP, $storeIdOp);
50
  if($cLangOp == '1') {
51
  $lang = 0;
66
  $emosLogin .= " emospro.login = [['".$customerId."','0']];\n";
67
  $opsession->setData('econda_logged','2');
68
  }
69
+ $emosOut = "\n\n<!-- Start Econda-Monitor M155 -->\n";
70
  $emosOut .= "<script type=\"text/javascript\">\n//<![CDATA[\n";
71
  $emosOut .= " window.emosTrackVersion = 2;\n";
72
  $emosOut .= "//]]>\n</script>";
app/code/local/Mage/Econda/Model/Base.php CHANGED
@@ -40,7 +40,7 @@ class Mage_Econda_Model_Base extends Mage_Core_Model_Abstract
40
  $this->realUrl = Mage::helper('core/url')->getCurrentUrl();
41
  $this->session = Mage::getSingleton('checkout/session');
42
  $storeId = Mage::app()->getStore()->getId();
43
- $langValue = 'econda/econda/tracking_language';
44
  $this->eLang = Mage::helper('econda/data')->getTranslation();
45
  $cLang = Mage::getStoreConfig($langValue, $storeId);
46
  if($cLang == '1') {
@@ -93,7 +93,7 @@ class Mage_Econda_Model_Base extends Mage_Core_Model_Abstract
93
  */
94
  public function getSiteId($storeId)
95
  {
96
- $siteidOv = Mage::getStoreConfig('econda/econda/tracking_siteid', $storeId);
97
  if(!empty($siteidOv) && trim($siteidOv) != "") {
98
  $siteName = trim($siteidOv);
99
  }
40
  $this->realUrl = Mage::helper('core/url')->getCurrentUrl();
41
  $this->session = Mage::getSingleton('checkout/session');
42
  $storeId = Mage::app()->getStore()->getId();
43
+ $langValue = 'econda/econda_settings/tracking_language';
44
  $this->eLang = Mage::helper('econda/data')->getTranslation();
45
  $cLang = Mage::getStoreConfig($langValue, $storeId);
46
  if($cLang == '1') {
93
  */
94
  public function getSiteId($storeId)
95
  {
96
+ $siteidOv = Mage::getStoreConfig('econda/econda_settings/tracking_siteid', $storeId);
97
  if(!empty($siteidOv) && trim($siteidOv) != "") {
98
  $siteName = trim($siteidOv);
99
  }
app/code/local/Mage/Econda/Model/Basket.php CHANGED
@@ -40,7 +40,7 @@ class Mage_Econda_Model_Basket extends Mage_Core_Model_Abstract
40
  $this->realUrl = Mage::helper('core/url')->getCurrentUrl();
41
  $this->session = Mage::getSingleton('checkout/session');
42
  $storeId = Mage::app()->getStore()->getId();
43
- $langValue = 'econda/econda/tracking_language';
44
  $this->eLang = Mage::helper('econda/data')->getTranslation();
45
  $cLang = Mage::getStoreConfig($langValue, $storeId);
46
  if($cLang == '1') {
@@ -147,21 +147,23 @@ class Mage_Econda_Model_Basket extends Mage_Core_Model_Abstract
147
  else {
148
  $prodGroup = $this->eLang[39][$this->lang];
149
  }
 
 
150
  if(Mage::getStoreConfig($billingOption, $storeId) == '1') {
151
- if(Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), false, null, null, $item->getTaxClassId(), $storeId, true) != 0) {
152
- $priceTax = Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), false, null, null, $item->getTaxClassId(), $storeId, true); // with tax
153
  }
154
  else {
155
- $priceTax = Mage::helper('tax')->getPrice($item, $item->getPrice(), false, null, null, $item->getTaxClassId(), $storeId, true); // with tax
156
  }
157
  }
158
  else {
159
- if(Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), false, null, null, $item->getTaxClassId(), $storeId, false) != 0) {
160
- $priceTax = Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), false, null, null, $item->getTaxClassId(), $storeId, false); // with tax
161
  }
162
  else {
163
- $priceTax = Mage::helper('tax')->getPrice($item, $item->getPrice(), false, null, null, $item->getTaxClassId(), $storeId, false); // with tax
164
- }
165
  }
166
  $eItem = Mage::getModel('econda/item');
167
  $eItem->productName = trim($item->getName());
@@ -180,21 +182,8 @@ class Mage_Econda_Model_Basket extends Mage_Core_Model_Abstract
180
  public function getProductAddRmv($message, $storeId)
181
  {
182
  $isAddBasket = false;
183
- $billingOption = 'econda/econda/billing_total';
184
  $basketActions = Array();
185
-
186
- // bugfix for basket after customer re-login
187
- if(Mage::getSingleton('customer/session')->isLoggedIn() == 1) {
188
- if($this->session->getData('econda_logged') != 1) {
189
- $oldBasket = true;
190
- }
191
- else{
192
- $oldBasket = false;
193
- }
194
- }
195
- else{
196
- $oldBasket = false;
197
- }
198
  $nIdArray = array();
199
  $nQtyArray = array();
200
  $nNmeArray = array();
@@ -220,105 +209,105 @@ class Mage_Econda_Model_Basket extends Mage_Core_Model_Abstract
220
  $oNmeArray = $this->session->getData('econda_card_nme');
221
  $eStarter = 0;
222
  }
223
- if(!$oldBasket) {
224
- if($eStarter == 1) {
225
- foreach($this->session->getQuote()->getAllItems() as $item) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  $getGroup = $this->getProductCategory($item->getproductId());
227
  if($getGroup) $prodGroup = $getGroup;
228
  else $prodGroup = $this->eLang[39][$this->lang];
229
  $eItem = Mage::getModel('econda/item');
230
  $eItem->productName = trim($item->getName());
231
  $eItem->productID = $item->getproductId();
232
- // calculate tax
233
  if(Mage::getStoreConfig($billingOption, $storeId) == '1') {
234
  if(Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), true, null, null, $item->getTaxClassId(), $storeId, true) != 0) {
235
- $priceTax = Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), true, null, null, $item->getTaxClassId(), $storeId, true);
236
  }
237
- else {
238
- $priceTax = Mage::helper('tax')->getPrice($item, $item->getPrice(), true, null, null, $item->getTaxClassId(), $storeId, true);
239
  }
240
  }
241
  else {
242
  if(Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), true, null, null, $item->getTaxClassId(), $storeId, false) != 0) {
243
- $priceTax = Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), true, null, null, $item->getTaxClassId(), $storeId, false);
244
  }
245
  else {
246
- $priceTax = Mage::helper('tax')->getPrice($item, $item->getPrice(), true, null, null, $item->getTaxClassId(), $storeId, false);
247
  }
248
  }
249
  $eItem->price = $this->convertPrice($priceTax);
250
- $eItem->quantity = $item->getQty();
251
  $eItem->productGroup = $prodGroup.'/'.trim($item->getName());
252
- if($eItem->price != '0.00') {
253
  $basketActions[] = Array('add', $eItem);
254
- }
255
- $isAddBasket = true;
256
- }
257
- }
258
- else {
259
- foreach($this->session->getQuote()->getAllItems() as $item) {
260
- $emosAction = false;
261
- $addRmv = false;
262
- $idKey = array_search($item->getItemId(),$oNmeArray);
263
- if($idKey == false) {
264
- $emosAction = 'addBasket';
265
- $basketQty = $item->getQty();
266
- }
267
- if($idKey != false) {
268
- if($oQtyArray[$idKey] != $item->getQty()) {
269
- if($oQtyArray[$idKey] > $item->getQty() && $oNmeArray[$idKey] == $item->getItemId()) {
270
- $emosAction = 'rmvBasket';
271
- $basketQty = $oQtyArray[$idKey] - $item->getQty();
272
- }
273
- if($oQtyArray[$idKey] < $item->getQty() && $oNmeArray[$idKey] == $item->getItemId()) {
274
- $emosAction = 'addBasket';
275
- $basketQty = $item->getQty() - $oQtyArray[$idKey];
276
- }
277
  }
278
  }
279
- if($emosAction != false) {
280
- $getGroup = $this->getProductCategory($item->getproductId());
281
- if($getGroup) $prodGroup = $getGroup;
282
- else $prodGroup = $this->eLang[39][$this->lang];
283
- $eItem = Mage::getModel('econda/item');
284
- $eItem->productName = trim($item->getName());
285
- $eItem->productID = $item->getproductId();
286
- if(Mage::getStoreConfig($billingOption, $storeId) == '1') {
287
- if(Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), true, null, null, $item->getTaxClassId(), $storeId, true) != 0) {
288
- $priceTax = Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), true, null, null, $item->getTaxClassId(), $storeId, true); // with tax
289
- }
290
- else {
291
- $priceTax = Mage::helper('tax')->getPrice($item, $item->getPrice(), true, null, null, $item->getTaxClassId(), $storeId, true); // with tax
292
- }
293
- }
294
- else {
295
- if(Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), true, null, null, $item->getTaxClassId(), $storeId, false) != 0) {
296
- $priceTax = Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), true, null, null, $item->getTaxClassId(), $storeId, false); // with tax
297
- }
298
- else {
299
- $priceTax = Mage::helper('tax')->getPrice($item, $item->getPrice(), true, null, null, $item->getTaxClassId(), $storeId, false); // with tax
300
- }
301
- }
302
- $eItem->price = $this->convertPrice($priceTax);
303
- $eItem->quantity = $basketQty;
304
- $eItem->productGroup = $prodGroup.'/'.trim($item->getName());
305
- if($emosAction == 'addBasket' && stristr($message,'error-msg') == false && $eItem->price != '0.00') {
306
- $basketActions[] = Array('add', $eItem);
307
- $isAddBasket = true;
308
- if(stristr($this->realUrl,'checkout/cart') == false) {
309
- $addRmv = true;
310
- }
311
- }
312
- if($emosAction == 'rmvBasket' && stristr($message,'error-msg') == false && $eItem->price != '0.00') {
313
- if(!$addRmv) {
314
- $basketActions[] = Array('rmv', $eItem);
315
- }
316
- $isAddBasket = true;
317
  }
 
318
  }
319
  }
320
  }
321
  }
 
322
  $this->session->setData('econda_card_qty',$nQtyArray);
323
  $this->session->setData('econda_card_id',$nIdArray);
324
  $this->session->setData('econda_card_nme',$nNmeArray);
40
  $this->realUrl = Mage::helper('core/url')->getCurrentUrl();
41
  $this->session = Mage::getSingleton('checkout/session');
42
  $storeId = Mage::app()->getStore()->getId();
43
+ $langValue = 'econda/econda_settings/tracking_language';
44
  $this->eLang = Mage::helper('econda/data')->getTranslation();
45
  $cLang = Mage::getStoreConfig($langValue, $storeId);
46
  if($cLang == '1') {
147
  else {
148
  $prodGroup = $this->eLang[39][$this->lang];
149
  }
150
+
151
+
152
  if(Mage::getStoreConfig($billingOption, $storeId) == '1') {
153
+ if(Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), false) != 0) {
154
+ $priceTax = Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), false);
155
  }
156
  else {
157
+ $priceTax = Mage::helper('tax')->getPrice($item, $item->getPrice(), false);
158
  }
159
  }
160
  else {
161
+ if(Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), true) != 0) {
162
+ $priceTax = Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), true);
163
  }
164
  else {
165
+ $priceTax = Mage::helper('tax')->getPrice($item, $item->getPrice(), true);
166
+ }
167
  }
168
  $eItem = Mage::getModel('econda/item');
169
  $eItem->productName = trim($item->getName());
182
  public function getProductAddRmv($message, $storeId)
183
  {
184
  $isAddBasket = false;
185
+ $billingOption = 'econda/econda_settings/billing_total';
186
  $basketActions = Array();
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  $nIdArray = array();
188
  $nQtyArray = array();
189
  $nNmeArray = array();
209
  $oNmeArray = $this->session->getData('econda_card_nme');
210
  $eStarter = 0;
211
  }
212
+
213
+ if($eStarter == 1) {
214
+ foreach($this->session->getQuote()->getAllItems() as $item) {
215
+ $getGroup = $this->getProductCategory($item->getproductId());
216
+ if($getGroup) $prodGroup = $getGroup;
217
+ else $prodGroup = $this->eLang[39][$this->lang];
218
+ $eItem = Mage::getModel('econda/item');
219
+ $eItem->productName = trim($item->getName());
220
+ $eItem->productID = $item->getproductId();
221
+ // calculate tax
222
+ if(Mage::getStoreConfig($billingOption, $storeId) == '1') {
223
+ if(Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), true, null, null, $item->getTaxClassId(), $storeId, true) != 0) {
224
+ $priceTax = Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), true, null, null, $item->getTaxClassId(), $storeId, true);
225
+ }
226
+ else {
227
+ $priceTax = Mage::helper('tax')->getPrice($item, $item->getPrice(), true, null, null, $item->getTaxClassId(), $storeId, true);
228
+ }
229
+ }
230
+ else {
231
+ if(Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), true, null, null, $item->getTaxClassId(), $storeId, false) != 0) {
232
+ $priceTax = Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), true, null, null, $item->getTaxClassId(), $storeId, false);
233
+ }
234
+ else {
235
+ $priceTax = Mage::helper('tax')->getPrice($item, $item->getPrice(), true, null, null, $item->getTaxClassId(), $storeId, false);
236
+ }
237
+ }
238
+ $eItem->price = $this->convertPrice($priceTax);
239
+ $eItem->quantity = $item->getQty();
240
+ $eItem->productGroup = $prodGroup.'/'.trim($item->getName());
241
+ if($eItem->price != '0.00') {
242
+ $basketActions[] = Array('add', $eItem);
243
+ }
244
+ $isAddBasket = true;
245
+ }
246
+ }
247
+ else {
248
+ foreach($this->session->getQuote()->getAllItems() as $item) {
249
+ $emosAction = false;
250
+ $addRmv = false;
251
+ $idKey = array_search($item->getItemId(),$oNmeArray);
252
+ if($idKey == false) {
253
+ $emosAction = 'addBasket';
254
+ $basketQty = $item->getQty();
255
+ }
256
+ if($idKey != false) {
257
+ if($oQtyArray[$idKey] != $item->getQty()) {
258
+ if($oQtyArray[$idKey] > $item->getQty() && $oNmeArray[$idKey] == $item->getItemId()) {
259
+ $emosAction = 'rmvBasket';
260
+ $basketQty = $oQtyArray[$idKey] - $item->getQty();
261
+ }
262
+ if($oQtyArray[$idKey] < $item->getQty() && $oNmeArray[$idKey] == $item->getItemId()) {
263
+ $emosAction = 'addBasket';
264
+ $basketQty = $item->getQty() - $oQtyArray[$idKey];
265
+ }
266
+ }
267
+ }
268
+ if($emosAction != false) {
269
  $getGroup = $this->getProductCategory($item->getproductId());
270
  if($getGroup) $prodGroup = $getGroup;
271
  else $prodGroup = $this->eLang[39][$this->lang];
272
  $eItem = Mage::getModel('econda/item');
273
  $eItem->productName = trim($item->getName());
274
  $eItem->productID = $item->getproductId();
 
275
  if(Mage::getStoreConfig($billingOption, $storeId) == '1') {
276
  if(Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), true, null, null, $item->getTaxClassId(), $storeId, true) != 0) {
277
+ $priceTax = Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), true, null, null, $item->getTaxClassId(), $storeId, true); // with tax
278
  }
279
+ else {
280
+ $priceTax = Mage::helper('tax')->getPrice($item, $item->getPrice(), true, null, null, $item->getTaxClassId(), $storeId, true); // with tax
281
  }
282
  }
283
  else {
284
  if(Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), true, null, null, $item->getTaxClassId(), $storeId, false) != 0) {
285
+ $priceTax = Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), true, null, null, $item->getTaxClassId(), $storeId, false); // with tax
286
  }
287
  else {
288
+ $priceTax = Mage::helper('tax')->getPrice($item, $item->getPrice(), true, null, null, $item->getTaxClassId(), $storeId, false); // with tax
289
  }
290
  }
291
  $eItem->price = $this->convertPrice($priceTax);
292
+ $eItem->quantity = $basketQty;
293
  $eItem->productGroup = $prodGroup.'/'.trim($item->getName());
294
+ if($emosAction == 'addBasket' && stristr($message,'error-msg') == false && $eItem->price != '0.00') {
295
  $basketActions[] = Array('add', $eItem);
296
+ $isAddBasket = true;
297
+ if(stristr($this->realUrl,'checkout/cart') == false) {
298
+ $addRmv = true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
299
  }
300
  }
301
+ if($emosAction == 'rmvBasket' && stristr($message,'error-msg') == false && $eItem->price != '0.00') {
302
+ if(!$addRmv) {
303
+ $basketActions[] = Array('rmv', $eItem);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
304
  }
305
+ $isAddBasket = true;
306
  }
307
  }
308
  }
309
  }
310
+
311
  $this->session->setData('econda_card_qty',$nQtyArray);
312
  $this->session->setData('econda_card_id',$nIdArray);
313
  $this->session->setData('econda_card_nme',$nNmeArray);
app/code/local/Mage/Econda/Model/Cancellation.php ADDED
@@ -0,0 +1,188 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Mage
16
+ * @package Mage_Econda
17
+ * @copyright Copyright (c) 2010 econda GmbH (http://www.econda.de)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Generate standard tracking values
23
+ */
24
+ class Mage_Econda_Model_Cancellation extends Mage_Core_Model_Abstract
25
+ {
26
+ /**
27
+ * Default param
28
+ *
29
+ */
30
+ private $_wsdl = "Cancellation.wsdl";
31
+ private $_headers = array();
32
+ private $_response = null;
33
+ private $_client = null;
34
+ private $_data = null;
35
+ private $_dataArray = null;
36
+ private $_responseSize = 0;
37
+ private $_connSuccess = false;
38
+
39
+ /**
40
+ * Set wsdl file
41
+ *
42
+ * @param wsdl|url
43
+ * @return void
44
+ */
45
+ public function setWsdl($wsdlFile)
46
+ {
47
+ $this->_wsdl = $wsdlFile;
48
+ return;
49
+ }
50
+
51
+ /**
52
+ * Initialize web service
53
+ *
54
+ * @param user|password|client id
55
+ * @return void
56
+ */
57
+ public function openWebservice($username, $password, $client)
58
+ {
59
+ try {
60
+ $this->_client = new SoapClient($this->_wsdl);
61
+ }
62
+ catch(Exception $e) {
63
+ $this->_response .= "The Webservice could not be established! Probably wsdl file is not found.";
64
+ return;
65
+ }
66
+ $this->_connSuccess = true;
67
+ $this->_setHeaders($username, $password, $client);
68
+ return;
69
+ }
70
+
71
+ /**
72
+ * Set headers for connection
73
+ *
74
+ * @param user|password|client id
75
+ * @return void
76
+ */
77
+ private function _setHeaders($username, $password, $client)
78
+ {
79
+ if($this->_connSuccess) {
80
+ $this->_headers[] = new SoapHeader('webservices.econda.de', 'username', $username);
81
+ $this->_headers[] = new SoapHeader('webservices.econda.de', 'password', $password);
82
+ $this->_headers[] = new SoapHeader('webservices.econda.de', 'client', $client);
83
+ $this->_client->__setSoapHeaders($this->_headers);
84
+ }
85
+ return;
86
+ }
87
+
88
+ /**
89
+ * Submit single cancellation
90
+ *
91
+ * @param order id|order sum|cancellation type
92
+ * @return void
93
+ */
94
+ public function doCancellation($order, $sum, $type = 'Storno')
95
+ {
96
+ if($this->_connSuccess) {
97
+ $order = strval($order);
98
+ $type = strval(utf8_encode($type));
99
+ $gregorianDate = date("Y-m-d")."T".date("H:i:s");
100
+ $this->_data = array("data" => array("cancellationDate" => $gregorianDate,
101
+ "cancellationSum" => $this->_convertPrice($sum),
102
+ "cancellationType" => $type,
103
+ "orderNo" => $order));
104
+ $this->_response = $this->_client->doCancellation($this->_data);
105
+ }
106
+ return;
107
+ }
108
+
109
+ /**
110
+ * Submit multi cancellations
111
+ *
112
+ * @param cancellation array
113
+ * @return void;
114
+ */
115
+ public function doCancellations($cancellations)
116
+ {
117
+ if($this->_connSuccess) {
118
+ $stornoArray = array();
119
+ $gregorianDate = date("Y-m-d")."T".date("H:i:s");
120
+ for($i=0,$count=sizeof($cancellations);$i<$count;$i++) {
121
+ $order = strval($cancellations[$i][0]);
122
+ $type = strval(utf8_encode($cancellations[$i][2]));
123
+ $sum = $cancellations[$i][1];
124
+ $stornoArray[] = array("cancellationDate" => $gregorianDate,
125
+ "cancellationSum" => $this->_convertPrice($sum),
126
+ "cancellationType" => $type,
127
+ "orderNo" => $order
128
+ );
129
+ }
130
+ $this->_responseSize = sizeof($cancellations);
131
+ $this->_dataArray = array("dataArray" => $stornoArray);
132
+ $this->_response = $this->_client->doCancellations($this->_dataArray);
133
+ }
134
+ return;
135
+ }
136
+
137
+ /**
138
+ * Get response from webservice
139
+ *
140
+ * @return string
141
+ */
142
+ public function getResponse()
143
+ {
144
+ if($this->_connSuccess) {
145
+ $retString = "Response from econda Webservice:<br />";
146
+ if($this->_responseSize > 0) {
147
+ for($i=0; $i<$this->_responseSize; $i++) {
148
+ $retString .= $this->_response->doCancellationsReturn->messages->item[$i]->type.": ";
149
+ $retString .= $this->_response->doCancellationsReturn->messages->item[$i]->code." - ";;
150
+ $retString .= $this->_response->doCancellationsReturn->messages->item[$i]->message."<br />";
151
+ }
152
+ }
153
+ else {
154
+ $retString .= $this->_response->doCancellationReturn->messages->item->type.": ";
155
+ $retString .= $this->_response->doCancellationReturn->messages->item->code." - ";;
156
+ $retString .= $this->_response->doCancellationReturn->messages->item->message."<br />";
157
+ }
158
+ return $retString;
159
+ }
160
+ else {
161
+ return $this->_response;
162
+ }
163
+ }
164
+
165
+ /**
166
+ * Format price
167
+ *
168
+ * @param price string
169
+ * @return number
170
+ */
171
+ private function _convertPrice($price)
172
+ {
173
+ $price = preg_replace('/[^0-9,.]/i','',$price);
174
+ $price = str_replace(',','.',$price);
175
+ $priceArr = explode('.', $price);
176
+ $priceCorr = $price;
177
+ if(count($priceArr) > 2) {
178
+ $priceCorr = "";
179
+ for($i=0; $i<=count($priceArr)-2; $i++) {
180
+ $priceCorr .= $priceArr[$i];
181
+ }
182
+ $priceCorr .= ".".$priceArr[count($priceArr)-1];
183
+ }
184
+ $priceCorr = number_format($priceCorr,2,".","");
185
+ return $priceCorr;
186
+ }
187
+ }
188
+ ?>
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mage_Econda</name>
4
- <version>1.5.4</version>
5
  <stability>stable</stability>
6
- <license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Bindet econda Web Shop Controlling in Magento ein. Inserts econda Web Shop Contolling into Magento.</summary>
10
  <description>Bindet econda Web Shop Controlling in Magento ein. Weitere Informationen unter http://www.econda.de. Inserts econda Web Shop Contolling into Magento. For further information visit http://www.econda.de/</description>
11
  <notes>Integration of econda Web Controlling functions.</notes>
12
  <authors><author><name>ecdev</name><user>auto-converted</user><email>bebop30@gmx.net</email></author></authors>
13
- <date>2011-01-14</date>
14
- <time>16:08:51</time>
15
- <contents><target name="magelocale"><dir name="de_AT"><file name="Mage_Econda.csv" hash="3d7fa85b5b0937ed6aebdeacd4baee86"/></dir><dir name="de_CH"><file name="Mage_Econda.csv" hash="3d7fa85b5b0937ed6aebdeacd4baee86"/></dir><dir name="de_DE"><file name="Mage_Econda.csv" hash="3d7fa85b5b0937ed6aebdeacd4baee86"/></dir><dir name="en_US"><file name="Mage_Econda.csv" hash="19027c08d453acf6f88d9d4866203a94"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="econda.xml" hash="b246d7ac21ddf846533cad0063521669"/></dir><dir name="template"><dir name="econda"><file name="tracker.phtml" hash="396ed7d4cfa91e3192f9deaa09376d91"/></dir></dir></dir></dir><dir name="default"><dir name="default"><dir name="layout"><file name="econda.xml" hash="b246d7ac21ddf846533cad0063521669"/></dir><dir name="template"><dir name="econda"><file name="tracker.phtml" hash="396ed7d4cfa91e3192f9deaa09376d91"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="tracker"><file name="emos2.js" hash="9063366f40aa9cb4065d5f1091a47f6a"/><file name="emosop.js" hash="a3c52bc5a3378e42754a9d90eff63b33"/></dir></dir></target><target name="magelocal"><dir name="Mage"><dir name="Econda"><dir name="Block"><file name="Econda.php" hash="ff7e2ac59a1c450eaaf416d78599ab16"/><file name="EcondaOp.php" hash="7f84dd08da5f7a34b6b07337f6585ec3"/><file name="Emos.php" hash="5eb0b8e1a041c7b0b62b1bdc1cae3025"/></dir><dir name="etc"><file name="config.xml" hash="fb954334f5208688216d454845c3ccf2"/><file name="system.xml" hash="34b54d956d9c28aeb21b68303d2e9c1b"/></dir><dir name="Helper"><file name="Data.php" hash="594c19902a006cc55aeb4914fca3a559"/></dir><dir name="Model"><file name="Base.php" hash="91762ca25a2fba82b22a1366e65de181"/><file name="Basket.php" hash="3bf648cd2aab7db7b3293c26124322cd"/><file name="Item.php" hash="93603c0b98675697e723d54f51afc2e0"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Billing.php" hash="fc5b34406e5c5365ab5eb055dbeb9027"/><file name="Language.php" hash="6d0080dab0fe91d6a77f2a699b5e6f62"/><file name="Siteid.php" hash="6d496050d9aafae7d10f29ac544567e5"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mage_Econda.xml" hash="bd9c935d379e7343bd91e79372bc426e"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mage_Econda</name>
4
+ <version>1.5.5</version>
5
  <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/bsd-license.php">BSD</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Bindet econda Web Shop Controlling in Magento ein. Inserts econda Web Shop Contolling into Magento.</summary>
10
  <description>Bindet econda Web Shop Controlling in Magento ein. Weitere Informationen unter http://www.econda.de. Inserts econda Web Shop Contolling into Magento. For further information visit http://www.econda.de/</description>
11
  <notes>Integration of econda Web Controlling functions.</notes>
12
  <authors><author><name>ecdev</name><user>auto-converted</user><email>bebop30@gmx.net</email></author></authors>
13
+ <date>2011-02-14</date>
14
+ <time>16:34:40</time>
15
+ <contents><target name="magelocale"><dir name="de_AT"><file name="Mage_Econda.csv" hash="3d7fa85b5b0937ed6aebdeacd4baee86"/></dir><dir name="de_CH"><file name="Mage_Econda.csv" hash="3d7fa85b5b0937ed6aebdeacd4baee86"/></dir><dir name="de_DE"><file name="Mage_Econda.csv" hash="3d7fa85b5b0937ed6aebdeacd4baee86"/></dir><dir name="en_US"><file name="Mage_Econda.csv" hash="19027c08d453acf6f88d9d4866203a94"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="econda.xml" hash="b246d7ac21ddf846533cad0063521669"/></dir><dir name="template"><dir name="econda"><file name="tracker.phtml" hash="396ed7d4cfa91e3192f9deaa09376d91"/></dir></dir></dir></dir><dir name="default"><dir name="default"><dir name="layout"><file name="econda.xml" hash="b246d7ac21ddf846533cad0063521669"/></dir><dir name="template"><dir name="econda"><file name="tracker.phtml" hash="396ed7d4cfa91e3192f9deaa09376d91"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="tracker"><file name="emos2.js" hash="9063366f40aa9cb4065d5f1091a47f6a"/><file name="emosop.js" hash="a3c52bc5a3378e42754a9d90eff63b33"/></dir></dir></target><target name="magelocal"><dir name="Mage"><dir name="Econda"><dir name="Block"><file name="Econda.php" hash="b92b94c5baae0fa6875383cb33fbf2b4"/><file name="EcondaOp.php" hash="e5480ec3005bf6d83af0a7e571d17884"/><file name="Emos.php" hash="5eb0b8e1a041c7b0b62b1bdc1cae3025"/></dir><dir name="etc"><file name="config.xml" hash="fb954334f5208688216d454845c3ccf2"/><file name="system.xml" hash="34b54d956d9c28aeb21b68303d2e9c1b"/></dir><dir name="Helper"><file name="Data.php" hash="594c19902a006cc55aeb4914fca3a559"/></dir><dir name="Model"><file name="Base.php" hash="11714bdcc028c22d4b64637a598c08c1"/><file name="Basket.php" hash="278a60d060d7066f1f2682bec64b6fd8"/><file name="Cancellation.php" hash="f8e8c5b4f9a218a0a58af06c4e256ef8"/><file name="Item.php" hash="93603c0b98675697e723d54f51afc2e0"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Billing.php" hash="fc5b34406e5c5365ab5eb055dbeb9027"/><file name="Language.php" hash="6d0080dab0fe91d6a77f2a699b5e6f62"/><file name="Siteid.php" hash="6d496050d9aafae7d10f29ac544567e5"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mage_Econda.xml" hash="bd9c935d379e7343bd91e79372bc426e"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>