BeezUP_Module_feed_and_tracker - Version 4.6.2

Version Notes

New features :
> Feed pagination
> Minor bugs

Download this release

Release Info

Developer BeezUP
Extension BeezUP_Module_feed_and_tracker
Version 4.6.2
Comparing to
See all releases


Code changes from version 4.6.1 to 4.6.2

app/code/community/BeezUp/Block/Adminhtml/System/Config/Log.php CHANGED
@@ -6,7 +6,7 @@ class Beezup_Block_Adminhtml_System_Config_Log extends Mage_Adminhtml_Block_Syst
6
  protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
7
  {
8
 
9
- $logDir = Mage::getModuleDir('', 'BeezUp')."/log/";
10
  // $log1 = file_get_contents();
11
  $ret = array();
12
  if (file_exists($logDir."/log.txt")) {
6
  protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
7
  {
8
 
9
+ $logDir = Mage::getBaseDir('base').'/beezup/';
10
  // $log1 = file_get_contents();
11
  $ret = array();
12
  if (file_exists($logDir."/log.txt")) {
app/code/community/BeezUp/Block/Omstatus.php CHANGED
@@ -1,8 +1,8 @@
1
  <?php
2
- require_once dirname ( __FILE__ ) . "/../lib/KLogger.php";
3
- require_once dirname ( __FILE__ ) . "/../lib/bootstrap.php";
4
- require_once dirname ( __FILE__ ) . "/../lib/BeezupRepository.php";
5
- require_once dirname ( __FILE__ ) . "/../lib/BeezupMageOrders.php";
6
 
7
  class Beezup_Block_Omstatus extends Mage_core_block_text {
8
  protected $repository = null;
1
  <?php
2
+ require_once Mage::getModuleDir('', 'BeezUp') . DS . 'lib' . DS ."KLogger.php";
3
+ require_once Mage::getModuleDir('', 'BeezUp') . DS . 'lib' . DS ."bootstrap.php";
4
+ require_once Mage::getModuleDir('', 'BeezUp') . DS . 'lib' . DS ."BeezupRepository.php";
5
+ require_once Mage::getModuleDir('', 'BeezUp') . DS . 'lib' . DS ."BeezupMageOrders.php";
6
 
7
  class Beezup_Block_Omstatus extends Mage_core_block_text {
8
  protected $repository = null;
app/code/community/BeezUp/Block/Order.php CHANGED
@@ -1,8 +1,8 @@
1
  <?php
2
- require_once dirname ( __FILE__ ) . "/../lib/KLogger.php";
3
- require_once dirname ( __FILE__ ) . "/../lib/bootstrap.php";
4
- require_once dirname ( __FILE__ ) . "/../lib/BeezupRepository.php";
5
- require_once dirname ( __FILE__ ) . "/../lib/BeezupMageOrders.php";
6
 
7
  class Beezup_Block_Order extends Mage_core_block_text {
8
 
@@ -18,8 +18,26 @@
18
  private $beezup_order_id;
19
  private $mage_order_id = false;
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  public function createOrderFromLink($account_id, $marketplace_code, $beezup_order_id) {
22
- $logDir = Mage::getModuleDir('', 'BeezUp')."/log/";
 
23
  if(file_exists($logDir."log2.txt")) {
24
  if(filesize($logDir."/log2.txt") >=3000000) {
25
  unlink($logDir."log2.txt");
@@ -73,17 +91,17 @@
73
  echo "<script>window.location='".Mage::helper('adminhtml')->getUrl("adminhtml/sales_order/view", array('order_id'=> $this->mage_order_id))."';</script>";
74
  }
75
  // die("Order Importation finalized");
76
-
77
  }
78
 
79
  }
80
  $configModel->saveConfig('beezup/marketplace/sync_status',0);
81
  //die("Error, Order data incorrect");
82
- echo $this->_showLog();
83
  }
84
 
85
  public function _showLog() {
86
- $logDir = Mage::getModuleDir('', 'BeezUp')."/log/";
87
  // $log1 = file_get_contents();
88
  $ret = array();
89
  if (file_exists($logDir."/log.txt")) {
@@ -144,10 +162,10 @@
144
 
145
  public function executeCron() {
146
 
147
-
148
 
149
  set_time_limit(0);
150
- $logDir = Mage::getModuleDir('', 'BeezUp')."/log/";
151
  if(file_exists($logDir."log2.txt")) {
152
  if(filesize($logDir."/log2.txt") >=3000000) {
153
  unlink($logDir."log2.txt");
@@ -208,7 +226,7 @@
208
 
209
 
210
  public function getLog() {
211
- $logDir = Mage::getModuleDir('', 'BeezUp')."/log/";
212
  $log1 = file_get_contents($logDir."/log2.txt");
213
 
214
  echo "<pre>";
@@ -229,1130 +247,1130 @@
229
  }
230
 
231
  public function getBeezupOrderId(){
232
- $oIdentifier = new BeezupOMOrderIdentifier();
233
- $oIdentifier
234
- ->setAccountId($this->account_id)
235
- ->setMarketplaceTechnicalCode($this->marketplace_code)
236
- ->setBeezupOrderUUID($this->beezup_order_id);
237
- return $oIdentifier;
238
  }
239
 
240
 
241
  public function createOrder($oBeezupOrderResponse) {
242
-
243
- $etag = $oBeezupOrderResponse->getETag();
244
- $final_order = $oBeezupOrderResponse->getResult();
245
-
246
- $orderid = $final_order->getOrderMarketPlaceOrderId();
247
- $this->orderid = $orderid;
248
- //customer Info
249
- $order_address = $final_order->getOrderBuyerAddressCity();
250
- $order_country = $final_order->getOrderBuyerAddressCountryName();
251
- $order_country_iso = $final_order->getOrderBuyerAddressCountryIsoCodeAlpha2();
252
- $order_address = $this->getBeezupBuyerAddress($final_order);
253
- $order_postalCode = $final_order->getOrderBuyerAddressPostalCode();
254
- $order_customer = $final_order->getOrderBuyerName();
255
- $order_customer_email = $final_order->getOrderBuyerEmail();
256
- $order_customer_phone = $final_order->getOrderBuyerPhone();
257
- $order_customer_mobile = $final_order->getOrderBuyerMobilePhone();
258
- $order_comment = $final_order->getOrderComment();
259
- $order_company = $final_order->getOrderBuyerCompanyName();
260
- $order_city = $final_order->getOrderBuyerAddressCity();
261
- $order_region = $final_order->getOrderBuyerStateOrRegion();
262
- $order_status = $final_order->getOrderStatusBeezUPOrderStatus();
263
- //shipping information
264
- $shipping_city = $final_order->getOrderShippingAddressCity();
265
- $shipping_country = $final_order->getOrderShippingAddressCountryName();
266
- $shipping_country_iso = $final_order->getOrderShippingAddressCountryIsoCodeAlpha2();
267
- $shipping_address = $this->getBeezupShippingAddress($final_order);
268
- $shipping_name = $final_order->getOrderShippingAddressName();
269
- $shipping_postalCode = $final_order->getOrderShippingAddressPostalCode();
270
- $shipping_email = $final_order->getOrderShippingEmail();
271
- $shipping_phone = $final_order->getOrderShippingPhone();
272
- $shipping_mobile = $final_order->getOrderShippingMobilePhone();
273
- $shipping_company = $final_order->getOrderShippingCompanyName();
274
- $shipping_region = $final_order->getOrderShippingAddressStateOrRegion();
275
- $order_currency_code = $final_order->getOrderCurrencyCode();
276
- //order Info
277
- $order_totalPrice = $final_order->getOrderTotalPrice();
278
- $order_shippingPrice = $final_order->getOrderShippingPrice();
279
-
280
- $name_parts = explode(" ", $order_customer);
281
- $order_first_name = array_shift( $name_parts);
282
- $order_last_name = implode(" ", $name_parts);
283
-
284
-
285
- $name_parts = explode(" ", $shipping_name);
286
- $shipping_first_name = array_shift( $name_parts);
287
- $shipping_last_name = implode(" ", $name_parts);
288
-
289
-
290
- //marketplace information
291
- $marketplace_business_code = $final_order->getMarketPlaceBusinessCode();
292
- $marketplace = $final_order->getMarketPlaceTechnicalCode();
293
-
294
- //productInfo
295
-
296
- $mage_productIds = $this->prescanOrder($final_order);
297
-
298
-
299
- if(!$this->checkEtagExists($etag)) {
300
- if(empty($order_customer_email)) {
301
- $order_customer_email = $this->generateEmail($final_order);
302
- }
303
- elseif(!filter_var($order_customer_email, FILTER_VALIDATE_EMAIL)) {
304
- $order_customer_email = $this->generateEmail($final_order);
305
- }
306
-
307
- $mage_productIds = $this->prescanOrder($final_order);
308
- if($mage_productIds) {
309
- $order_data = array(
310
- "etag" => $etag,
311
- "account_id" => $account_id,
312
- "order_status" => $order_status,
313
- "products" => $mage_productIds['products'],
314
- "storeid" => $mage_productIds['store'],
315
- "order_currency" => $order_currency_code ,
316
- "order_address" => $order_adress,
317
- "order_country" => $order_country,
318
- "order_country_iso" => $order_country_iso ,
319
- "order_address" => $order_address ,
320
- "order_postalCode" => $order_postalCode ,
321
- "order_customer" => $order_first_name ,
322
- "order_lastname" => $order_last_name ,
323
- "order_customer_email" => $order_customer_email ,
324
- "order_customer_phone" => $this->getPhone($order_customer_phone, $order_customer_mobile) ,
325
- "order_comment" => $order_comment ,
326
- "order_company" => $order_company ,
327
- "shipping_city" => $shipping_city ,
328
- "shipping_country" => $shipping_country ,
329
- "shipping_country_iso" => $shipping_country_iso ,
330
- "shipping_address" => $shipping_address ,
331
- "shipping_name" => $shipping_first_name ,
332
- "shipping_lastname" => $shipping_last_name ,
333
- "shipping_postalCode" => $shipping_postalCode ,
334
- "shipping_region" =>$shipping_region,
335
- "shipping_email" => $shipping_email ,
336
- "shipping_phone" => $this->getPhone($shipping_phone, $shipping_mobile) ,
337
- "shipping_company" => $shipping_company ,
338
- "order_totalPrice" => $order_totalPrice ,
339
- "order_shippingPrice" => $order_shippingPrice ,
340
- "order_city" => $order_city,
341
- "order_region" => $order_region,
342
- "marketplace" => $marketplace,
343
- "discounts" => $mage_productIds['discounts'],
344
- "marketplace_business_code" => $marketplace_business_code
345
- );
346
-
347
-
348
-
349
- //check if order exists
350
- $Mageorder = $this->loadMageOrder();
351
- if ($Mageorder) {
352
- //if order exists
353
- $this->updateEtag($etag);
354
- $this->updateBilling($Mageorder, $order_data );
355
- $this->updateBeezupInfoTab($Mageorder, $final_order, $order_data);
356
- $this->debugLog("Order Already exists Mage Order ID: " .$Mageorder->getId());
357
- $status1 = $Mageorder->getStatusLabel();
358
- $status = $this->getStatus($status1);
359
- if($status !== $order_status) {
360
- //if order exits and status has changed we update order status
361
- $this->debugLog("Updating Order Status from: ".$status1." to: ".$order_status );
362
- $this->setStatus( $order_status, $Mageorder);
363
- }
364
-
365
- $id_order = $Mageorder->getId();
366
- $BeezupMageOrder = new BeezupMageOrders($id_order);
367
- $BeezupMageOrder->setData(array("shipping" =>(float) $order_data['order_shippingPrice']));
368
- $BeezupMageOrder->updateShippingInfo();
369
- } else {
370
- //if not we create order
371
-
372
-
373
- $this->debugLog("Generating Order");
374
- $this->addOrder($order_data,$final_order );
375
- //die();
376
-
377
- }
378
-
379
-
380
- } else {
381
- //order could not be imported
382
-
383
-
384
- }
385
-
386
-
387
- } else {
388
- //etag has not changed
389
- $this->debugLog("Order Etag has not changed");
390
-
391
- }
392
-
393
-
394
-
395
-
396
-
397
  }
398
 
399
 
400
 
401
  public function generateEmail(BeezupOMOrderResult $oBeezupOrder)
402
  {
403
- $sRawValue = $oBeezupOrder->getBeezupOrderUUID ();
404
- $sFakeDomain = preg_replace ( '/\W/', '', $oBeezupOrder->getMarketPlaceTechnicalCode () ) . '.com';
405
- return 'fakeemail' . md5 ( $sFakeDomain . $sRawValue ) . '@' . strtolower ( $sFakeDomain );
406
  }
407
 
408
 
409
 
410
  public function getOrderList($orderList = null) {
411
- if($orderList == null) {
412
- $data = $this->createRepository()->createOrderListRequest();
413
- $oRequest = $this->getOrderService()->getClientProxy()->getOrderList($data);
414
- $orderList = $oRequest->getResult();
415
- }
416
- $oPagination = $orderList->getPaginationResult();
417
- if(!empty($oPagination)) {
418
- $oLinksTotal = $oPagination->getLinks();
419
- } else {
420
- $configModel = Mage::getModel('core/config');
421
- $configModel->saveConfig('beezup/marketplace/sync_status',0);
422
- die("No more orders to import");
423
- }
424
-
425
- //$header = $orderList->getOrderHeaders();
426
- foreach($orderList->getOrderHeaders() as $order) {
427
- $order_status = $order->getBeezupOrderState();
428
- $orderLinks = $order->getLinks();
429
- $etag = $order->getETag();
430
- $beezup_order_id = $order->getBeezupOrderUUID();
431
- $account_id = $order->getAccountId();
432
- $orderdata = $this->getOrderService()->getClientProxy()->getOrderByLink($orderLinks[0]);
433
- $this->debugLog("Initializing Order - Link: ".$orderLinks[0]->getHref());
434
- $this->createOrder($orderdata, $oLinksTotal);
435
-
436
- }
437
-
438
- if(!empty($oLinksTotal)) {
439
- //we check if there is next link and get next orders
440
- foreach($oLinksTotal as $link) {
441
- if( $link->getRel() == "next") {
442
-
443
- $this->log->LogInfo("Initializing New Order List ->". $link->getHref());
444
- $this->log2->LogInfo("Initializing New Order List ->". $link->getHref());
445
- $oRequest = $this->getOrderService()->getClientProxy()->getOrderListByLink($link);
446
- $orderList = $oRequest->getResult();
447
- $this->getOrderList($orderList);
448
- }
449
-
450
- }
451
- }
452
-
453
  }
454
 
455
 
456
 
457
  public function updateBeezupInfoTab($order, $oLink, $data) {
458
- $beezup_last_modification_date = $oLink->getOrderLastModificationUtcDate();
459
- $beezup_last_modification_date = $beezup_last_modification_date->date;
460
- $beezup_marketplace_last_modification_date = $oLink->getOrderMarketPlaceLastModificationUtcDate();
461
- $beezup_marketplace_last_modification_date = $beezup_marketplace_last_modification_date->date;
462
- $beezup_comission = $oLink->getOrderTotalCommission()." ".$data['order_currency'];
463
- $tot_comm = $oLink->getOrderTotalCommission();
464
- if(empty($tot_comm ) || $tot_comm == 0) {
465
- $beezup_comission = 0;
466
- }
467
- $updateData = array("beezup_status" => $data['order_status'],
468
- "beezup_last_modification_date" => $beezup_last_modification_date,
469
- "beezup_marketplace_last_modification_date" => $beezup_marketplace_last_modification_date ,
470
- "beezup_total_paid" => $oLink->getOrderTotalPrice()." ".$data['order_currency'],
471
- "beezup_comission" => $beezup_comission,
472
- "beezup_marketplace_status" => $oLink->getOrderStatusMarketPlaceStatus());
473
- $orderId = $order->getId();
474
- $beezupMageOrder = new BeezupMageOrders($orderId);
475
- $beezupMageOrder->setData($updateData);
476
- $beezupMageOrder->updateBeezupInfo();
477
-
478
-
479
  }
480
 
481
  public function getPhone($phone, $phone2) {
482
- $retorno = "";
483
- if(!empty($phone) && $phone !== "") {
484
- $retorno .= $phone;
485
- }
486
- if(!empty($phone2) && $phone2 !=="") {
487
- if(empty($phone) || $phone == "") {
488
- $retorno = $phone2;
489
-
490
- } else {
491
- $retorno .= " - ".$phone2;
492
- }
493
- }
494
- return $retorno;
495
  }
496
 
497
 
498
  public function getBeezupBuyerAddress($order) {
499
- $add1=$order->getOrderBuyerAddressLine1();
500
- $add2=$order->getOrderBuyerAddressLine2();
501
- $add3=$order->getOrderBuyerAddressLine3();
502
- $retorno = "";
503
- if(!empty($add1)) {
504
- $retorno = $order->getOrderBuyerAddressLine1();
505
- }
506
- if(!empty($add2)) {
507
- if(empty($add1)) {
508
- $retorno .= $order->getOrderBuyerAddressLine2();
509
- } else {
510
- $retorno .= " - ". $order->getOrderBuyerAddressLine2();
511
- }
512
- }
513
- if(!empty($add3)){
514
- if(empty($add1) && empty($add2)) {
515
- $retorno .= $order->getOrderBuyerAddressLine3();
516
- } else {
517
- $retorno .= " - ". $order->getOrderBuyerAddressLine3();
518
- }
519
- }
520
- return $retorno;
521
  }
522
 
523
 
524
  public function getBeezupShippingAddress($order) {
525
- $add1 = $order->getOrderShippingAddressLine1();
526
- $add2 = $order->getOrderShippingAddressLine2();
527
- $add3=$order->getOrderBuyerAddressLine3();
528
- $retorno = "";
529
- if(!empty($add1 )) {
530
- $retorno = $order->getOrderShippingAddressLine1();
531
- }
532
- if(!empty($add2)) {
533
- if(empty($add1)) {
534
- $retorno .= $order->getOrderShippingAddressLine2();
535
- } else {
536
- $retorno .= " - ". $order->getOrderShippingAddressLine2();
537
- }
538
- }
539
- if(!empty($add3)){
540
- if(empty($add1) && empty($add2)) {
541
- $retorno .= $order->getOrderShippingAddressLine3();
542
- } else {
543
- $retorno .= " - ". $order->getOrderShippingAddressLine3();
544
- }
545
- }
546
- return $retorno;
547
  }
548
 
549
  public function checkEtagExists($etag) {
550
- $resource = Mage::getSingleton('core/resource');
551
- $readConnection = $resource->getConnection('core_read');
552
- $table = $resource->getTableName('sales/order_grid');
553
- $query = 'SELECT increment_id FROM ' . $table . ' WHERE beezup_etag = \''
554
- . $etag . '\' LIMIT 1';
555
- $order = $readConnection->fetchOne($query);
556
- if($order && !empty($order)) {
557
- return true;
558
- }
559
- return false;
560
-
561
  }
562
 
563
 
564
  public function updateEtag($etag) {
565
- $this->debugLog("Updating Etag");
566
- $resource = Mage::getSingleton('core/resource');
567
- $writeConnection = $resource->getConnection('core_write');
568
- $table = $resource->getTableName('sales/order_grid');
569
- $query = "UPDATE {$table} SET beezup_etag = '{$etag}' where beezup_market_order_id = '{$this->orderid}' ";
570
- $writeConnection->query($query);
571
-
572
  }
573
 
574
 
575
 
576
  public function updateBilling($order, $data) {
577
-
578
-
579
- $addressData = array(
580
- 'billing_firstname' => ($data['order_customer']) ? $data['order_customer'] : "empty",
581
- 'billing_lastname' => ($data['order_lastname']) ? $data['order_lastname'] : "empty",
582
- 'billing_street' => ($data['order_address']) ? $data['order_address'] : "empty",
583
- 'billing_city' => ($data['order_city']) ? $data['order_city'] : "empty",
584
- 'billing_postcode' => ($data['order_postalCode']) ? $data['order_postalCode'] : "empty",
585
- 'billing_telephone' => ($data['order_customer_phone']) ? $data['order_customer_phone'] : "empty",
586
- 'billing_country_id' => ($data['order_country_iso']) ? $data['order_country_iso'] : "empty",
587
- 'billing_region_id' => ($data['order_region ']) ? substr($data['order_region '], 0,2) : "EM",
588
- 'shipping_firstname' => ($data['shipping_name']) ? $data['shipping_name'] : "empty",
589
- 'shipping_lastname' => ($data['shipping_lastname']) ? $data['shipping_lastname'] : "empty",
590
- 'shipping_street' => ($data['shipping_address']) ? $data['shipping_address'] : "empty",
591
- 'shipping_city' => ($data['shipping_city']) ? $data['shipping_city'] : "empty",
592
- 'shipping_postcode' => ($data['shipping_postalCode']) ? $data['shipping_postalCode'] : "empty",
593
- 'shipping_telephone' => ($data['shipping_phone']) ? $data['shipping_phone'] : "empty",
594
- 'shipping_country_id' => ($data['shipping_country_iso']) ? $data['shipping_country_iso'] : "empty",
595
- 'shipping_region_id' => ($data['shipping_region']) ? substr($data['shipping_region'], 0, 2) : "EM" // id from directory_country_region table
596
- );
597
-
598
- $shippingData = array(
599
-
600
- );
601
- // Get the id of the orders shipping address
602
- $orderId = $order->getId();
603
- $beezupMageOrder = new BeezupMageOrders($orderId);
604
- $beezupMageOrder->setData($addressData);
605
- $beezupMageOrder->updateAdresses();
606
  }
607
 
608
  public function updateAddresses($shippingData, $address) {
609
- if($shippingData['firstname'] !==$address['firstname']) {
610
- $address->setFirstname($shippingData['firstname']);
611
- }
612
- if($shippingData['lastname'] !==$address['lastname']) {
613
- $address->setLastname($shippingData['lastname']);
614
- }
615
- if($shippingData['street'] !==$address['street']) {
616
- $address->setStreet($shippingData['street']);
617
- }
618
- if($shippingData['city'] !==$address['city']) {
619
- $address->setCity($shippingData['city']);
620
- }
621
- if($shippingData['postcode'] !==$address['postcode']) {
622
- $address->setPostcode($shippingData['postcode']);
623
- }
624
- if($shippingData['telephone'] !==$address['telephone']) {
625
- $address->setTelephone($shippingData['telephone']);
626
- }
627
- $address->save();
628
-
629
-
630
  }
631
 
632
 
633
  public function loadMageOrder() {
634
- $Mageorder = Mage::getModel('sales/order')->loadByIncrementId($this->orderid);
635
- if ($Mageorder->getId()) {
636
- return $Mageorder;
637
- } else {
638
- //we get order from marketplace orderid
639
- $orderInc = $this->checkMarketOrderExists($this->orderid);
640
- if($orderInc) {
641
- // if exists
642
- $Mageorder = Mage::getModel('sales/order')->loadByIncrementId($orderInc);
643
- if ($Mageorder->getId()) {
644
- return $Mageorder;
645
- }
646
- }
647
- }
648
- return false;
649
  }
650
 
651
 
652
  private function debugLog($message) {
653
-
654
- if($this->orderid !== "") {
655
- $message = $this->orderid." | ".$message;
656
- }
657
- $this->log->LogInfo($message);
658
-
659
- $this->log2->LogInfo($message);
660
  }
661
 
662
  public function prescanOrder(BeezupOMOrderResult $order) {
663
- $retorno = array();
664
- $orderItems = $order->getOrderItems();
665
- foreach ($orderItems as $item)
666
- {
667
-
668
- if ($item->getOrderItemOrderItemType () !== 'Product')
669
- {
670
- // continue;
671
- }
672
- $beezup_store = $item->getOrderItemBeezUPStoreId(); //beezup storeid
673
- $mage_storeid = $this->checkOrderStore($beezup_store); //magento storeid
674
- $marketplace_orderid = $item->getOrderItemMarketPlaceProductId();
675
- if(!$mage_storeid) {
676
-
677
- if(strpos($marketplace_orderid,'INTERETBCA') !== false || strpos($marketplace_orderid,'interetbca') !== false) { }
678
- else {
679
- $this->log->LogError($this->orderid." | No mapping for store ".$beezup_store);
680
- $this->log2->LogError($this->orderid." | No mapping for store ".$beezup_store);
681
- return false;
682
- }
683
-
684
- }
685
- // $retorno['store'] = 1;
686
- $retorno['store'] = $mage_storeid;
687
- $this->debugLog("Store Matching succesful, Beezup Store: ".$beezup_store." , Magento Store Id: ".$mage_storeid);
688
- $product_ImportedMerchantId = $item->getOrderItemMerchantImportedProductId();
689
- $product_MerchantId = $item->getOrderItemMerchantProductId();
690
-
691
- $product_quantity = $item->getOrderItemQuantity();
692
- $product_price = $item->getOrderItemItemPrice();
693
- $product_title = $item->getOrderItemTitle();
694
- $product_image = $item->getOrderItemImageUrl();
695
- if(strpos($marketplace_orderid,'INTERETBCA') !== false || strpos($marketplace_orderid,'interetbca') !== false) {
696
- $retorno['discounts']= $item->getOrderItemTotalPrice();
697
- } else {
698
- $product = $this->getMageProduct($product_ImportedMerchantId , $product_MerchantId , $beezup_store );
699
- if($product) {
700
- $mage_productId = $product->getId();
701
- $stocklevel = (int)Mage::getModel('cataloginventory/stock_item')
702
- ->loadByProduct($product)->getQty();
703
-
704
- $retorno['products'][] = array("id" => $mage_productId, "qty" => $product_quantity, "price" => $product_price, "curr_stock" => $stocklevel);
705
- //producto existe
706
- } else {
707
- //vendria if de si activada opcion de crear producto creamos
708
- if(!$this->debug) {
709
- return false;
710
- }
711
- $product_data = array(
712
- "sku" => $product_ImportedMerchantId,
713
- "sku2" => $product_MerchantId,
714
- "qty" => $product_quantity,
715
- "price" => $product_price,
716
- "title" => $product_title,
717
- "image" => $product_image,
718
- "storeId" => $mage_storeid
719
- );
720
- $product = $this->createProduct($product_data);
721
- if(!$product) {
722
- return false;
723
- }
724
- $stocklevel = (int)Mage::getModel('cataloginventory/stock_item')
725
- ->loadByProduct($product)->getQty();
726
- $mage_productId = $product->getId();
727
- $retorno['products'][] = array("id" => $mage_productId, "qty" => $product_quantity, "price" => $product_price, "curr_stock" => $stocklevel);
728
- }
729
- }
730
- }
731
-
732
- return $retorno;
733
  }
734
 
735
 
736
 
737
  public function matchProductAttributes($importedId, $storeId) {
738
- $product = null;
739
- $helper = Mage::helper('beezup');
740
- $attributes = $helper->getConfig('beezup/marketplace/attributes');
741
- $attributes = unserialize ($attributes);
742
-
743
- foreach($attributes['attributes'][$storeId ] as $attribute) {
744
- $att = explode("|", $attribute);
745
- if($storeId == $att[1]) {
746
-
747
- $product=Mage::getModel('catalog/product')->loadByAttribute($att[0],$importedId);
748
- if($product) {
749
- break;
750
- }
751
- }
752
- }
753
-
754
- return $product;
755
  }
756
 
757
 
758
 
759
  public function getMageProduct($importedId, $merchantId, $storeId){
760
- try {
761
- $product=Mage::getModel('catalog/product')->load($importedId);
762
- if (!$product->getId() || $product->getId() !== $importedId ){
763
- $product = $this->matchProductAttributes($importedId, $storeId);
764
- if($product == null || !is_object($product)) {
765
- $product=Mage::getModel('catalog/product')->load($merchantId);
766
- if(!$product->getId() || $product->getId() !== $merchantId ) {
767
- $product = $this->matchProductAttributes($merchantId, $storeId);
768
-
769
- }
770
- }
771
- }
772
-
773
- if(is_object($product)) {
774
- if($product->getId()) {
775
- $this->debugLog("Product Matching succesful, Beezup Imported Id: ".$importedId." , Magento Product Id: ".$product->getId());
776
- return $product;
777
- }}
778
- $this->log->LogError($this->orderid. "| No Product Matching, Product ".$importedId." could not be found");
779
- $this->log2->LogError($this->orderid. "| No Product Matching, Product ".$importedId." could not be found");
780
- return false;
781
- }catch(Exception $e){
782
- $this->log->LogError($this->orderid. "| Product ".$importedId." could not be found, error: ".$e->getMessage());
783
- $this->log2->LogError($this->orderid. "| Product ".$importedId." could not be found, error: ".$e->getMessage());
784
- return false;
785
- //error no se pudo crear la orden
786
-
787
- }
788
  }
789
 
790
 
791
  public function checkOrderStore($storeId ) {
792
- $helper = Mage::helper('beezup');
793
- $stores = $helper->getConfig('beezup/marketplace/stores');
794
- $stores = unserialize ($stores);
795
- foreach($stores as $store) {
796
- if(isset($store[$storeId]) && $store[$storeId] > 0) {
797
- return $store[$storeId];
798
- }
799
- }
800
- return false;
801
  }
802
 
803
 
804
 
805
  /**
806
- * @return BeezupOMOrderService
807
  */
808
  public function getOrderService(){
809
- if ($this->oOrderService === null){
810
- $this->oOrderService = $this->createOrderService();
811
- // enchufamos debug mode, esta activado? false true $this->oOrderService->setDebugMode(false);
812
- }
813
- return $this->oOrderService;
814
  }
815
 
816
  /**
817
- * @return BeezupOMOrderService
818
  */
819
  protected function createOrderService(){
820
-
821
- return new BeezupOMOrderService($this->createRepository() );
822
  }
823
 
824
  protected function createRepository() {
825
- if ($this->repository == null) {
826
- $this->repository = new BeezupRepository();
827
- }
828
- return $this->repository;
829
-
830
  }
831
 
832
 
833
 
834
 
835
  private function createCustomer($customer_email , $data) {
836
- $password = $this->orderid;
837
- $this->debugLog("Creating new Customer");
838
- $customer = Mage::getModel('customer/customer');
839
- $customer->setWebsiteId(Mage::app()->getWebsite()->getId());
840
- $customer->loadByEmail($customer_email);
841
- if(!$customer->getId()) {
842
- $customer->setEmail($customer_email);
843
- $customer->setFirstname($data['firstname']);
844
- $customer->setLastname($data['lastname']);
845
- $customer->setPassword($password);
846
- try {
847
- $customer->save();
848
- $customer->setConfirmation(null);
849
- $customer->save();
850
- $this->debugLog("Customer created succesfully");
851
- return $customer;
852
- //Make a "login" of new customer
853
- // Mage::getSingleton('customer/session')->loginById($customer->getId());
854
- }
855
-
856
- catch (Exception $ex) {
857
- //Zend_Debug::dump($ex->getMessage());
858
- //GUARDAR ERROR CREACION USUARIO
859
- $this->log2->LogError($this->orderid. " | Customer importation failed: ".$ex->getMessage());
860
- return false;
861
- }
862
-
863
- } else {
864
- $this->debugLog("Creating already exists, returning customer object");
865
- return $customer;
866
- }
867
  }
868
 
869
 
870
 
871
  public function addOrder($data, $oLink, $stop = false) {
872
-
873
-
874
- try {
875
- $helper = Mage::helper('beezup');
876
- $addStock = $helper->getConfig('beezup/marketplace/available_products');
877
- $baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
878
- $quote = Mage::getModel('sales/quote')
879
- ->setStoreId($data['storeid']);
880
- $quote->setCustomerEmail($data['order_customer_email']);
881
-
882
-
883
- $currency = Mage::getModel('directory/currency')->load($data['order_currency']);
884
- $quote->setForcedCurrency($currency);
885
-
886
- $blnCreate = true;
887
- $total_new_price = 0;
888
- foreach($data['products'] as $prod) {
889
- if($prod['qty']==0) {
890
- $blnCreate = false;
891
- break;
892
- }
893
- $prod_totality_price = $prod['price']*$prod['qty'];
894
- $total_new_price = $total_new_price + $prod_totality_price;
895
- $product = Mage::getModel('catalog/product')->load($prod['id']);
896
- $buyInfo = array(
897
- 'qty' => $prod['qty'],
898
- );
899
- $this->debugLog("Adding ".$prod['qty']." product/s with id ".$product->getId()." to order, with Beezup Price: ".$prod['price']);
900
- //echo "Product ".$product->getId()."<br><br>";
901
- //para no perder stock:
902
- //Mage::getModel('cataloginventory/stock')->backItemQty($productId,$new_qty);
903
-
904
-
905
- if($addStock == 1) {
906
- $stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
907
-
908
- if ($stock->getQty() < $prod['qty'] && $product->getStockItem()->getMaxSaleQty() >= $prod['qty']) {
909
- $this->debugLog("Product ".$product->getId()." Stock = 0, Updating to ".$prod['qty']." to generate Order");
910
- // Mage::getModel('cataloginventory/stock')->backItemQty($product->getId(),$prod['qty']);
911
- //$this->_updateStocks(array("id_product" => $product->getId(), "qty" => $prod['qty']));
912
- $product->setStockData(
913
- array(
914
- 'is_in_stock' => 1,
915
- 'qty' => $prod['qty'],
916
- 'manage_stock' => 1,
917
- 'use_config_notify_stock_qty' => 1
918
- )
919
- );
920
- $product->save();
921
- $product = Mage::getModel('catalog/product')->load($product->getId());
922
-
923
- }
924
- }
925
- //fin para no perder stock
926
-
927
- /*
928
- $tax_class = $product->getTaxClassId();
929
- $product->setTaxClassId(0);
930
- $product->getResource()->saveAttribute($product, 'tax_class_id'); */
931
- $price = $prod['price'];
932
-
933
- $quote_item = Mage::getModel('beezup/quote_item');
934
- $quote_item
935
- ->setProduct($product)
936
- ->setPrice((float) $price )
937
- ->setCustomPrice((float)$price )
938
- ->setOriginalCustomPrice((float) $price )
939
- ->setQuote($quote)
940
- ->setQty((integer) $prod['qty'])
941
- ->setBeezupPrice((float) $price );
942
-
943
-
944
- $quote->addItem($quote_item);
945
-
946
- //$quote->addProduct($product, new Varien_Object($buyInfo))->setOriginalCustomPrice($price)->setCustomPrice($price);
947
-
948
- /*
949
- $product->setTaxClassId($tax_class);
950
-
951
- $product->getResource()->saveAttribute($product, 'tax_class_id');
952
- */
953
- }
954
-
955
- if($blnCreate) {
956
- $addressData = array(
957
- 'firstname' => ($data['order_customer']) ? $data['order_customer'] : "empty",
958
- 'lastname' => ($data['order_lastname']) ? $data['order_lastname'] : "empty",
959
- 'street' => ($data['order_address']) ? $data['order_address'] : "empty",
960
- 'city' => ($data['order_city']) ? $data['order_city'] : "empty",
961
- 'postcode' => ($data['order_postalCode']) ? $data['order_postalCode'] : "empty",
962
- 'telephone' => ($data['order_customer_phone']) ? $data['order_customer_phone'] : "empty",
963
- 'country_id' => ($data['order_country_iso']) ? $data['order_country_iso'] : "empty",
964
- 'region_id' => ($data['order_region ']) ? substr($data['order_region '], 0,2) : "EM"// id from directory_country_region table
965
- );
966
-
967
- $shippingData = array(
968
- 'firstname' => ($data['shipping_name']) ? $data['shipping_name'] : "empty",
969
- 'lastname' => ($data['shipping_lastname']) ? $data['shipping_lastname'] : "empty",
970
- 'street' => ($data['shipping_address']) ? $data['shipping_address'] : "empty",
971
- 'city' => ($data['shipping_city']) ? $data['shipping_city'] : "empty",
972
- 'postcode' => ($data['shipping_postalCode']) ? $data['shipping_postalCode'] : "empty",
973
- 'telephone' => ($data['shipping_phone']) ? $data['shipping_phone'] : "empty",
974
- 'country_id' => ($data['shipping_country_iso']) ? $data['shipping_country_iso'] : "empty",
975
- 'region_id' => ($data['shipping_region']) ? substr($data['shipping_region'], 0, 2) : "EM" // id from directory_country_region table
976
- );
977
-
978
- if($this->blnCreateCustomer) {
979
-
980
- $mage_customer = $this->createCustomer($data['order_customer_email'], $addressData);
981
- $quote->assignCustomer($mage_customer);
982
- }
983
-
984
-
985
- $payment_method = $helper->getConfig('beezup/marketplace/payment_method');
986
- $billingAddress = $quote->getBillingAddress()->addData($addressData);
987
- $shippingAddress = $quote->getShippingAddress()->addData($shippingData);
988
- $shipping_cost = (float) $data['order_shippingPrice'];
989
- if($data['order_shippingPrice'] == 0) {
990
- $shipping_cost = 20000;
991
- }
992
- $total_new_price = $total_new_price + $data['order_shippingPrice'] ;
993
- Mage::unregister('shipping_cost');
994
- Mage::register('shipping_cost', $shipping_cost);
995
- $this->debugLog("Adding Order Shipping Cost: ". $data['order_shippingPrice']);
996
-
997
- $shippingAddress->setCollectShippingRates(true)->collectShippingRates()
998
- ->setShippingMethod('flatrate_flatrate')
999
- ->setPaymentMethod($payment_method);
1000
-
1001
- //$shippingAddress->addTotal(array("code" => "specialfee", "title" => "Special Fee", "value" => 20));
1002
- $quote->getPayment()->importData(array('method' => $payment_method));
1003
-
1004
- $quote->collectTotals()->save();
1005
-
1006
- $service = Mage::getModel('sales/service_quote', $quote);
1007
- $service->submitAll();
1008
- $order = $service->getOrder();
1009
-
1010
-
1011
-
1012
- $quoteId = $order->getQuoteId();
1013
- //$this->setStatus($data['order_status'], $order);
1014
-
1015
- $orderid = $order->getId();
1016
-
1017
- $resource = Mage::getSingleton('core/resource');
1018
- $writeConnection = $resource->getConnection('core_write');
1019
- $table = $resource->getTableName('sales/order_grid');
1020
- $this->debugLog("Adding Beezup Marketplace Information to Order");
1021
- $marketplace = $data['marketplace'];
1022
- $marketplace_business_code = ucfirst(strtolower($data['marketplace_business_code']));
1023
- $beezup_name = $data['order_customer'];
1024
- $market_order_id =$this->orderid;
1025
- $beezup_order_id = $oLink->getBeezupOrderUUID();
1026
- $beezup_status = $data['order_status'];
1027
- $beezup_last_modification_date = $oLink->getOrderLastModificationUtcDate();
1028
- $beezup_last_modification_date = $beezup_last_modification_date->date;
1029
- $beezup_marketplace_status = $oLink->getOrderStatusMarketPlaceStatus();
1030
- $beezup_purchase_date = $oLink->getOrderPurchaseUtcDate();
1031
- $beezup_purchase_date = $beezup_purchase_date->date;
1032
- $beezup_marketplace_last_modification_date = $oLink->getOrderMarketPlaceLastModificationUtcDate();
1033
- $beezup_marketplace_last_modification_date = $beezup_marketplace_last_modification_date->date;
1034
- /* $date = new DateTime($$beezup_marketplace_last_modification_date);
1035
- $beezup_marketplace_last_modification_date = $date->format('d-m-Y H:i:s'). "(UTC Time)";
1036
- */
1037
-
1038
- $beezup_total_paid = $oLink->getOrderTotalPrice()." ".$data['order_currency'];
1039
- $beezup_account_id = $oLink->getAccountId();
1040
- $beezup_comission = $oLink->getOrderTotalCommission()." ".$data['order_currency'];
1041
- $tot_comm = $oLink->getOrderTotalCommission();
1042
- if(empty($tot_comm ) || $tot_comm == 0) {
1043
- $beezup_comission = 0;
1044
- }
1045
- $query = "UPDATE {$table} SET beezup_marketplace = '{$marketplace}', beezup_name = '{$beezup_account_id}', beezup_order = 1, beezup_market_order_id = '{$market_order_id}',
1046
- beezup_order_id = '{$beezup_order_id}', beezup_status = '{$beezup_status}', beezup_last_modification_date = '{$beezup_last_modification_date}',
1047
- beezup_marketplace_status = '{$beezup_marketplace_status}', beezup_purchase_date = '{$beezup_purchase_date}', beezup_marketplace_last_modification_date = '{$beezup_marketplace_last_modification_date}',
1048
- beezup_total_paid = '{$beezup_total_paid}', beezup_etag = '{$data['etag']}' , beezup_comission = '{$beezup_comission}', beezup_marketplace_business_code = '{$marketplace_business_code}'
1049
- WHERE entity_id = ". (int)$orderid;
1050
- $writeConnection->query($query);
1051
- $disc_price = 0;
1052
- if(!empty($data['discounts']) && $data['discounts'] >0) {
1053
-
1054
-
1055
- $disc_price = round($data['discounts'],2);
1056
- $total_new_price = $total_new_price+$disc_price;
1057
- $table_address = $resource->getTableName("sales/quote_address");
1058
-
1059
- $query = "update {$table_address} set beezup_fee = '{$disc_price}' where quote_id = '{$quoteId}' and address_type = 'shipping'";
1060
- $writeConnection->query($query);
1061
- $this->debugLog("Adding CDISCOUNT products with total price: ".$disc_price);
1062
- }
1063
-
1064
- //if order id exists and has been created
1065
- if ($orderid)
1066
- {
1067
- //we send order id to beezup
1068
- $this->debugLog("Sending Magento Order Id to Beezup, Magento Order Id: ".$orderid);
1069
- $oResult = new BeezupOMSetOrderIdValues ();
1070
- $oResult->setOrderMerchantOrderId ( $orderid )->setOrderMerchantECommerceSoftwareName ( 'Magento' )->setOrderMerchantECommerceSoftwareVersion ( Mage::getVersion() );
1071
- $sendRequest = $this->getOrderService()->getClientProxy()->setOrderMerchantIdByLink($oLink->getLinkByRel('setMerchantOrderId'), $oResult);
1072
- }
1073
-
1074
- $grand_total = $order->getGrandTotal();
1075
- $beezup_price = $oLink->getOrderTotalPrice() - $disc_price;
1076
- if($grand_total != (float) $beezup_price && $beezup_price > 0) {
1077
- $order->setGrandTotal((float) $beezup_price);
1078
- $order->setBaseGrandTotal((float) $beezup_price);
1079
- $diff = (((float) $beezup_price) - $grand_total);
1080
-
1081
- $order->setTaxAmount($order->getTaxAmount() + $diff);
1082
- $order->save();
1083
- }elseif($grand_total != (float)$beezup_price && $beezup_price < 1) {
1084
-
1085
- $order->setGrandTotal((float) $total_new_price);
1086
- $order->setBaseGrandTotal((float) $total_new_price);
1087
- $diff = (((float) $total_new_price) - $grand_total);
1088
-
1089
- $order->setTaxAmount($order->getTaxAmount() + $diff);
1090
- $order->save();
1091
- }
1092
-
1093
- $products = Mage::getResourceModel('sales/order_item_collection')
1094
- ->setOrderFilter($orderid);
1095
- foreach($products as $product) {
1096
- $product->setBaseOriginalPrice($product->getOriginalPrice());
1097
- $product->setBaseTaxAmount($product->getTaxAmount());
1098
- $product->setBaseTaxInvoiced($product->getTaxAmount());
1099
- $product->setBasePriceInclTax($product->getPriceInclTax());
1100
- $product->setBaseRowTotalInclTax($product->getRowTotalInclTax());
1101
- $product->save();
1102
- }
1103
- $order->setBaseTaxAmount($order->getTaxAmount());
1104
- $order->setBaseTaxInvoiced($order->getTaxAmount());
1105
- $order->setBaseTotalInvoiced($order->getTotalPaid());
1106
- $order->setBaseTotalPaid($order->getTotalPaid());
1107
- $order->setBaseGrandTotal($order->getTotalPaid());
1108
- $order->setBaseSubtotalInclTax($order->getSubtotalInclTax());
1109
- $order->save();
1110
-
1111
- $this->setStatus($data['order_status'], $order);
1112
- $this->mage_order_id = $orderid;
1113
- $this->debugLog("Order imported succesfully, Magento Order Id: ".$orderid);
1114
- } else {
1115
- //product stock = 0 we dont create order
1116
- $this->log->LogError($this->orderid. "| Order ".$data['market_place_order_id']." could not be imported, error: Stock from Beezup product = 0 ");
1117
- $this->log2->LogError($this->orderid. "| Order ".$data['market_place_order_id']." could not be imported, error: Stock from Beezup product = 0 ");
1118
- }
1119
- }catch(Exception $e){
1120
-
1121
-
1122
- if($stop) {
1123
- $this->log->LogError($this->orderid. "| Order ".$data['market_place_order_id']." could not be imported, error: ".$e->getMessage());
1124
- $this->log2->LogError($this->orderid. "| Order ".$data['market_place_order_id']." could not be imported, error: ".$e->getMessage());
1125
- $this->restoreStock($data);
1126
- } else {
1127
- $this->debugLog("Order Import failed, Trying to import Order Again");
1128
- $this->addOrder($data, $oLink, true);
1129
-
1130
- }
1131
- //error no se pudo crear la orden
1132
-
1133
- }
1134
-
1135
-
1136
-
1137
  }
 
 
 
 
 
 
 
 
 
 
1138
 
1139
 
1140
-
1141
- public function restoreStock($data) {
1142
-
1143
- try {
1144
- foreach($data['products'] as $prod) {
1145
- $product = Mage::getModel('catalog/product')->load($prod['id']);
1146
- $stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
1147
- if ($stock->getQty() != $prod['curr_stock'] ) {
1148
- $this->debugLog("Restoring Stock from Product ".$product->getId()." to: ".$prod['curr_stock'] ." due to Order Fail");
1149
- $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
1150
- $stockItem->setData('is_in_stock', 0);
1151
- $stockItem->setData('qty', $prod['curr_stock']);
1152
- $stockItem->save();
1153
- $product->save();
1154
- }
1155
-
1156
- }
1157
- } catch(Exception $e){
1158
- $this->log->LogError($this->orderid. "| Failed Restoring Product Stock: ".$e->getMessage());
1159
- $this->log2->LogError($this->orderid. "| Failed Restoring Product Stock: ".$e->getMessage());
1160
- }
1161
-
1162
- }
1163
-
1164
-
1165
-
1166
- private function createProduct($data) {
1167
-
1168
- $sku = $data['sku'];
1169
- if(empty($data['sku'])) {
1170
- $sku = $data['sku2'];
1171
- }
1172
-
1173
- Mage::app()->setCurrentStore($data['storeId']);
1174
- $product = Mage::getModel('catalog/product');
1175
- // if(!$product->getIdBySku('testsku61')):
1176
-
1177
- try{
1178
- $product
1179
- // ->setStoreId(1) //you can set data in store scope
1180
- ->setWebsiteIds(array($data['storeId'])) //website ID the product is assigned to, as an array
1181
- ->setAttributeSetId($product->getDefaultAttributeSetId()) //ID of a attribute set named 'default'
1182
- ->setTypeId('simple') //product type
1183
- ->setCreatedAt(strtotime('now')) //product creation time
1184
- ->setSku($sku ) //SKU
1185
- ->setWeight(0)
1186
- ->setName($data['title']) //product name
1187
- ->setStatus(1) //product status (1 - enabled, 2 - disabled)
1188
- ->setTaxClassId(4) //tax class (0 - none, 1 - default, 2 - taxable, 4 - shipping)
1189
- ->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE ) //catalog and search visibility
1190
- ->setPrice($data['price']) //price in form 11.22
1191
- ->setMsrpEnabled(1) //enable MAP
1192
- ->setMsrpDisplayActualPriceType(1) //display actual price (1 - on gesture, 2 - in cart, 3 - before order confirmation, 4 - use config)
1193
- ->setMsrp(0) //Manufacturer's Suggested Retail Price
1194
- ->setMetaTitle('')
1195
- ->setMetaKeyword('')
1196
- ->setMetaDescription('')
1197
- ->setDescription($data['title'])
1198
- ->setShortDescription($data['title'])
1199
- // ->setMediaGallery (array('images'=>array (), 'values'=>array ())) //media gallery initialization
1200
- //->addImageToMediaGallery('media/catalog/product/1/0/10243-1.png', array('image','thumbnail','small_image'), false, false) //assigning image, thumb and small image to media gallery
1201
- ->setStockData(array(
1202
- 'use_config_manage_stock' => 0, //'Use config settings' checkbox
1203
- 'manage_stock'=>1, //manage stock
1204
- 'min_sale_qty'=>1, //Minimum Qty Allowed in Shopping Cart
1205
- 'max_sale_qty'=>2, //Maximum Qty Allowed in Shopping Cart
1206
- 'is_in_stock' => 1, //Stock Availability
1207
- 'qty' => 1 //qty
1208
- )
1209
- );
1210
- $product->save();
1211
- return $product;
1212
-
1213
- }catch(Exception $e){
1214
- //log exception
1215
- $this->log->LogError($this->orderid."| Product ".$sku." could not be created, error: ".$e->getMessage());
1216
- $this->log2->LogError($this->orderid."| Product ".$sku." could not be created, error: ".$e->getMessage());
1217
- return false;
1218
- }
1219
- }
1220
-
1221
-
1222
-
1223
- public function setStatus($status, $order) {
1224
- $helper = Mage::helper('beezup');
1225
- $retorno = "";
1226
- $blnCancel = false;
1227
- $blnHold = false;
1228
- switch($status) {
1229
- case "New" :
1230
- $this->debugLog("Setting Order Status to New");
1231
- $retorno = $helper->getConfig('beezup/marketplace/status_new');
1232
- break;
1233
- case "InProgress" :
1234
- $this->debugLog("Setting Order Status to InProgress");
1235
- $retorno = $helper->getConfig('beezup/marketplace/status_progress');
1236
- $this->payOrder($order);
1237
- break;
1238
- case "Aborted" :
1239
- $this->debugLog("Setting Order Status to Aborted");
1240
- $retorno = $helper->getConfig('beezup/marketplace/status_aborted');
1241
- $blnHold = true;
1242
-
1243
-
1244
- break;
1245
- case "Closed" :
1246
- $this->debugLog("Setting Order Status to Closed");
1247
- $blnCancel =true;
1248
- $retorno = $helper->getConfig('beezup/marketplace/status_closed');
1249
- $this->payOrder($order);
1250
- break;
1251
- case "Canceled" :
1252
- $this->debugLog("Setting Order Status to Cancelled");
1253
- $retorno = $helper->getConfig('beezup/marketplace/status_cancelled');
1254
-
1255
- break;
1256
- case "Shipped" :
1257
- $this->debugLog("Setting Order Status to Shipped");
1258
- $retorno = $helper->getConfig('beezup/marketplace/status_shipped');
1259
- $this->payOrder($order);
1260
- break;
1261
-
1262
- }
1263
- $order->setData('state',$retorno);
1264
- $order->setStatus($retorno);
1265
- $history = $order->addStatusHistoryComment('Order was set to '.$retorno.' by Beezup.', false);
1266
- $history->setIsCustomerNotified(false);
1267
- $order->save();
1268
- if($blnCancel) {
1269
- $order->cancel()->save();
1270
- }
1271
- if($blnHold) {
1272
- $order->hold()->save();
1273
- }
1274
-
1275
- return $retorno;
1276
-
1277
- }
1278
-
1279
-
1280
- public function getStatus($status1) {
1281
- $helper = Mage::helper('beezup');
1282
- $retorno = "";
1283
- $status = strtolower($status1);
1284
-
1285
- if($status == strtolower($helper->getConfig('beezup/marketplace/status_new') )) {
1286
- $retorno = "New";
1287
-
1288
- } elseif($status == strtolower($helper->getConfig('beezup/marketplace/status_progress') ) ){
1289
- $retorno = "InProgress";
1290
-
1291
-
1292
- }
1293
- elseif($status == strtolower($helper->getConfig('beezup/marketplace/status_aborted') )) {
1294
-
1295
- $retorno = "Aborted" ;
1296
- }
1297
- elseif($status == strtolower($helper->getConfig('beezup/marketplace/status_closed') )) {
1298
- $retorno = "Closed";
1299
-
1300
- }
1301
- elseif($status == strtolower($helper->getConfig('beezup/marketplace/status_cancelled')) ) {
1302
-
1303
- $retorno = "Canceled";
1304
- }
1305
- elseif($status == strtolower($helper->getConfig('beezup/marketplace/status_shipped') )) {
1306
-
1307
- $retorno = "Shipped";
1308
- }
1309
-
1310
-
1311
- return $retorno;
1312
-
1313
- }
1314
-
1315
-
1316
- public function checkMarketOrderExists($orderid) {
1317
- $resource = Mage::getSingleton('core/resource');
1318
- $readConnection = $resource->getConnection('core_read');
1319
- $table = $resource->getTableName('sales/order_grid');
1320
- $query = 'SELECT increment_id FROM ' . $table . ' WHERE beezup_order = 1 and beezup_market_order_id = \''
1321
- . $orderid . '\' LIMIT 1';
1322
- $order = $readConnection->fetchOne($query);
1323
- if($order && !empty($order) && $this->orderId !== "") {
1324
- return $order;
1325
- }
1326
- return false;
1327
-
1328
- }
1329
-
1330
- public function payOrder($order) {
1331
- try {
1332
- $this->debugLog("Generating Order Payment Invoice");
1333
- if($order->canInvoice()) {
1334
- $invoice = $order->prepareInvoice()
1335
- ->setTransactionId($order->getId())
1336
- ->addComment("Invoice created from Beezup.")
1337
- ->register()
1338
- ->pay();
1339
- $transaction_save = Mage::getModel('core/resource_transaction')
1340
- ->addObject($invoice)
1341
- ->addObject($invoice->getOrder());
1342
- $transaction_save->save();
1343
- $this->debugLog("Order Payment Invoice Generated Succesfully");
1344
- }
1345
- }
1346
- catch(Exception $e){
1347
- //log exception
1348
- $this->log->LogError($this->orderid."| Order Payment Invoice could not be generated, error: ".$e->getMessage());
1349
- $this->log2->LogError($this->orderid."| Order Payment Invoice could not be generated, error: ".$e->getMessage());
1350
- }
1351
- }
1352
-
1353
-
1354
-
1355
-
1356
-
1357
-
1358
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
+ require_once Mage::getModuleDir('', 'BeezUp') . DS . 'lib' . DS ."KLogger.php";
3
+ require_once Mage::getModuleDir('', 'BeezUp') . DS . 'lib' . DS ."bootstrap.php";
4
+ require_once Mage::getModuleDir('', 'BeezUp') . DS . 'lib' . DS ."BeezupRepository.php";
5
+ require_once Mage::getModuleDir('', 'BeezUp') . DS . 'lib' . DS ."BeezupMageOrders.php";
6
 
7
  class Beezup_Block_Order extends Mage_core_block_text {
8
 
18
  private $beezup_order_id;
19
  private $mage_order_id = false;
20
 
21
+
22
+ private function makeDir() {
23
+
24
+ if (file_exists(Mage::getBaseDir('base').'/beezup/tmp')) { return true;}
25
+
26
+ if (!mkdir(Mage::getBaseDir('base').'/beezup/tmp', 0777, true))
27
+ {
28
+ echo "[ERROR] : Seems we can't create 'beezup' directory inside your root directory."."<br/>"
29
+ ."You can try one of these solutions :"."<br/>"
30
+ ."1 - Create by yourself the beezup/tmp inside your root directory with 777 permissions"."<br/>"
31
+ ."2 - Change the permissions on your root directory (777)"."<br/>"
32
+ ."3 - Change the 'cache delay' option to 'None' inside beezup plugin settings"."<br/>";
33
+ return false;
34
+ }
35
+ return true;
36
+
37
+ }
38
  public function createOrderFromLink($account_id, $marketplace_code, $beezup_order_id) {
39
+ $this->makeDir();
40
+ $logDir = Mage::getBaseDir('base').'/beezup/';
41
  if(file_exists($logDir."log2.txt")) {
42
  if(filesize($logDir."/log2.txt") >=3000000) {
43
  unlink($logDir."log2.txt");
91
  echo "<script>window.location='".Mage::helper('adminhtml')->getUrl("adminhtml/sales_order/view", array('order_id'=> $this->mage_order_id))."';</script>";
92
  }
93
  // die("Order Importation finalized");
94
+
95
  }
96
 
97
  }
98
  $configModel->saveConfig('beezup/marketplace/sync_status',0);
99
  //die("Error, Order data incorrect");
100
+ echo $this->_showLog();
101
  }
102
 
103
  public function _showLog() {
104
+ $logDir = Mage::getBaseDir('base').'/beezup/';
105
  // $log1 = file_get_contents();
106
  $ret = array();
107
  if (file_exists($logDir."/log.txt")) {
162
 
163
  public function executeCron() {
164
 
165
+ $this->makeDir();
166
 
167
  set_time_limit(0);
168
+ $logDir = Mage::getBaseDir('base').'/beezup/';
169
  if(file_exists($logDir."log2.txt")) {
170
  if(filesize($logDir."/log2.txt") >=3000000) {
171
  unlink($logDir."log2.txt");
226
 
227
 
228
  public function getLog() {
229
+ $logDir = Mage::getBaseDir('base').'/beezup/';
230
  $log1 = file_get_contents($logDir."/log2.txt");
231
 
232
  echo "<pre>";
247
  }
248
 
249
  public function getBeezupOrderId(){
250
+ $oIdentifier = new BeezupOMOrderIdentifier();
251
+ $oIdentifier
252
+ ->setAccountId($this->account_id)
253
+ ->setMarketplaceTechnicalCode($this->marketplace_code)
254
+ ->setBeezupOrderUUID($this->beezup_order_id);
255
+ return $oIdentifier;
256
  }
257
 
258
 
259
  public function createOrder($oBeezupOrderResponse) {
260
+
261
+ $etag = $oBeezupOrderResponse->getETag();
262
+ $final_order = $oBeezupOrderResponse->getResult();
263
+
264
+ $orderid = $final_order->getOrderMarketPlaceOrderId();
265
+ $this->orderid = $orderid;
266
+ //customer Info
267
+ $order_address = $final_order->getOrderBuyerAddressCity();
268
+ $order_country = $final_order->getOrderBuyerAddressCountryName();
269
+ $order_country_iso = $final_order->getOrderBuyerAddressCountryIsoCodeAlpha2();
270
+ $order_address = $this->getBeezupBuyerAddress($final_order);
271
+ $order_postalCode = $final_order->getOrderBuyerAddressPostalCode();
272
+ $order_customer = $final_order->getOrderBuyerName();
273
+ $order_customer_email = $final_order->getOrderBuyerEmail();
274
+ $order_customer_phone = $final_order->getOrderBuyerPhone();
275
+ $order_customer_mobile = $final_order->getOrderBuyerMobilePhone();
276
+ $order_comment = $final_order->getOrderComment();
277
+ $order_company = $final_order->getOrderBuyerCompanyName();
278
+ $order_city = $final_order->getOrderBuyerAddressCity();
279
+ $order_region = $final_order->getOrderBuyerStateOrRegion();
280
+ $order_status = $final_order->getOrderStatusBeezUPOrderStatus();
281
+ //shipping information
282
+ $shipping_city = $final_order->getOrderShippingAddressCity();
283
+ $shipping_country = $final_order->getOrderShippingAddressCountryName();
284
+ $shipping_country_iso = $final_order->getOrderShippingAddressCountryIsoCodeAlpha2();
285
+ $shipping_address = $this->getBeezupShippingAddress($final_order);
286
+ $shipping_name = $final_order->getOrderShippingAddressName();
287
+ $shipping_postalCode = $final_order->getOrderShippingAddressPostalCode();
288
+ $shipping_email = $final_order->getOrderShippingEmail();
289
+ $shipping_phone = $final_order->getOrderShippingPhone();
290
+ $shipping_mobile = $final_order->getOrderShippingMobilePhone();
291
+ $shipping_company = $final_order->getOrderShippingCompanyName();
292
+ $shipping_region = $final_order->getOrderShippingAddressStateOrRegion();
293
+ $order_currency_code = $final_order->getOrderCurrencyCode();
294
+ //order Info
295
+ $order_totalPrice = $final_order->getOrderTotalPrice();
296
+ $order_shippingPrice = $final_order->getOrderShippingPrice();
297
+
298
+ $name_parts = explode(" ", $order_customer);
299
+ $order_first_name = array_shift( $name_parts);
300
+ $order_last_name = implode(" ", $name_parts);
301
+
302
+
303
+ $name_parts = explode(" ", $shipping_name);
304
+ $shipping_first_name = array_shift( $name_parts);
305
+ $shipping_last_name = implode(" ", $name_parts);
306
+
307
+
308
+ //marketplace information
309
+ $marketplace_business_code = $final_order->getMarketPlaceBusinessCode();
310
+ $marketplace = $final_order->getMarketPlaceTechnicalCode();
311
+
312
+ //productInfo
313
+
314
+ $mage_productIds = $this->prescanOrder($final_order);
315
+
316
+
317
+ if(!$this->checkEtagExists($etag)) {
318
+ if(empty($order_customer_email)) {
319
+ $order_customer_email = $this->generateEmail($final_order);
320
+ }
321
+ elseif(!filter_var($order_customer_email, FILTER_VALIDATE_EMAIL)) {
322
+ $order_customer_email = $this->generateEmail($final_order);
323
+ }
324
+
325
+ $mage_productIds = $this->prescanOrder($final_order);
326
+ if($mage_productIds) {
327
+ $order_data = array(
328
+ "etag" => $etag,
329
+ "account_id" => $account_id,
330
+ "order_status" => $order_status,
331
+ "products" => $mage_productIds['products'],
332
+ "storeid" => $mage_productIds['store'],
333
+ "order_currency" => $order_currency_code ,
334
+ "order_address" => $order_adress,
335
+ "order_country" => $order_country,
336
+ "order_country_iso" => $order_country_iso ,
337
+ "order_address" => $order_address ,
338
+ "order_postalCode" => $order_postalCode ,
339
+ "order_customer" => $order_first_name ,
340
+ "order_lastname" => $order_last_name ,
341
+ "order_customer_email" => $order_customer_email ,
342
+ "order_customer_phone" => $this->getPhone($order_customer_phone, $order_customer_mobile) ,
343
+ "order_comment" => $order_comment ,
344
+ "order_company" => $order_company ,
345
+ "shipping_city" => $shipping_city ,
346
+ "shipping_country" => $shipping_country ,
347
+ "shipping_country_iso" => $shipping_country_iso ,
348
+ "shipping_address" => $shipping_address ,
349
+ "shipping_name" => $shipping_first_name ,
350
+ "shipping_lastname" => $shipping_last_name ,
351
+ "shipping_postalCode" => $shipping_postalCode ,
352
+ "shipping_region" =>$shipping_region,
353
+ "shipping_email" => $shipping_email ,
354
+ "shipping_phone" => $this->getPhone($shipping_phone, $shipping_mobile) ,
355
+ "shipping_company" => $shipping_company ,
356
+ "order_totalPrice" => $order_totalPrice ,
357
+ "order_shippingPrice" => $order_shippingPrice ,
358
+ "order_city" => $order_city,
359
+ "order_region" => $order_region,
360
+ "marketplace" => $marketplace,
361
+ "discounts" => $mage_productIds['discounts'],
362
+ "marketplace_business_code" => $marketplace_business_code
363
+ );
364
+
365
+
366
+
367
+ //check if order exists
368
+ $Mageorder = $this->loadMageOrder();
369
+ if ($Mageorder) {
370
+ //if order exists
371
+ $this->updateEtag($etag);
372
+ $this->updateBilling($Mageorder, $order_data );
373
+ $this->updateBeezupInfoTab($Mageorder, $final_order, $order_data);
374
+ $this->debugLog("Order Already exists Mage Order ID: " .$Mageorder->getId());
375
+ $status1 = $Mageorder->getStatusLabel();
376
+ $status = $this->getStatus($status1);
377
+ if($status !== $order_status) {
378
+ //if order exits and status has changed we update order status
379
+ $this->debugLog("Updating Order Status from: ".$status1." to: ".$order_status );
380
+ $this->setStatus( $order_status, $Mageorder);
381
+ }
382
+
383
+ $id_order = $Mageorder->getId();
384
+ $BeezupMageOrder = new BeezupMageOrders($id_order);
385
+ $BeezupMageOrder->setData(array("shipping" =>(float) $order_data['order_shippingPrice']));
386
+ $BeezupMageOrder->updateShippingInfo();
387
+ } else {
388
+ //if not we create order
389
+
390
+
391
+ $this->debugLog("Generating Order");
392
+ $this->addOrder($order_data,$final_order );
393
+ //die();
394
+
395
+ }
396
+
397
+
398
+ } else {
399
+ //order could not be imported
400
+
401
+
402
+ }
403
+
404
+
405
+ } else {
406
+ //etag has not changed
407
+ $this->debugLog("Order Etag has not changed");
408
+
409
+ }
410
+
411
+
412
+
413
+
414
+
415
  }
416
 
417
 
418
 
419
  public function generateEmail(BeezupOMOrderResult $oBeezupOrder)
420
  {
421
+ $sRawValue = $oBeezupOrder->getBeezupOrderUUID ();
422
+ $sFakeDomain = preg_replace ( '/\W/', '', $oBeezupOrder->getMarketPlaceTechnicalCode () ) . '.com';
423
+ return 'fakeemail' . md5 ( $sFakeDomain . $sRawValue ) . '@' . strtolower ( $sFakeDomain );
424
  }
425
 
426
 
427
 
428
  public function getOrderList($orderList = null) {
429
+ if($orderList == null) {
430
+ $data = $this->createRepository()->createOrderListRequest();
431
+ $oRequest = $this->getOrderService()->getClientProxy()->getOrderList($data);
432
+ $orderList = $oRequest->getResult();
433
+ }
434
+ $oPagination = $orderList->getPaginationResult();
435
+ if(!empty($oPagination)) {
436
+ $oLinksTotal = $oPagination->getLinks();
437
+ } else {
438
+ $configModel = Mage::getModel('core/config');
439
+ $configModel->saveConfig('beezup/marketplace/sync_status',0);
440
+ die("No more orders to import");
441
+ }
442
+
443
+ //$header = $orderList->getOrderHeaders();
444
+ foreach($orderList->getOrderHeaders() as $order) {
445
+ $order_status = $order->getBeezupOrderState();
446
+ $orderLinks = $order->getLinks();
447
+ $etag = $order->getETag();
448
+ $beezup_order_id = $order->getBeezupOrderUUID();
449
+ $account_id = $order->getAccountId();
450
+ $orderdata = $this->getOrderService()->getClientProxy()->getOrderByLink($orderLinks[0]);
451
+ $this->debugLog("Initializing Order - Link: ".$orderLinks[0]->getHref());
452
+ $this->createOrder($orderdata, $oLinksTotal);
453
+
454
+ }
455
+
456
+ if(!empty($oLinksTotal)) {
457
+ //we check if there is next link and get next orders
458
+ foreach($oLinksTotal as $link) {
459
+ if( $link->getRel() == "next") {
460
+
461
+ $this->log->LogInfo("Initializing New Order List ->". $link->getHref());
462
+ $this->log2->LogInfo("Initializing New Order List ->". $link->getHref());
463
+ $oRequest = $this->getOrderService()->getClientProxy()->getOrderListByLink($link);
464
+ $orderList = $oRequest->getResult();
465
+ $this->getOrderList($orderList);
466
+ }
467
+
468
+ }
469
+ }
470
+
471
  }
472
 
473
 
474
 
475
  public function updateBeezupInfoTab($order, $oLink, $data) {
476
+ $beezup_last_modification_date = $oLink->getOrderLastModificationUtcDate();
477
+ $beezup_last_modification_date = $beezup_last_modification_date->date;
478
+ $beezup_marketplace_last_modification_date = $oLink->getOrderMarketPlaceLastModificationUtcDate();
479
+ $beezup_marketplace_last_modification_date = $beezup_marketplace_last_modification_date->date;
480
+ $beezup_comission = $oLink->getOrderTotalCommission()." ".$data['order_currency'];
481
+ $tot_comm = $oLink->getOrderTotalCommission();
482
+ if(empty($tot_comm ) || $tot_comm == 0) {
483
+ $beezup_comission = 0;
484
+ }
485
+ $updateData = array("beezup_status" => $data['order_status'],
486
+ "beezup_last_modification_date" => $beezup_last_modification_date,
487
+ "beezup_marketplace_last_modification_date" => $beezup_marketplace_last_modification_date ,
488
+ "beezup_total_paid" => $oLink->getOrderTotalPrice()." ".$data['order_currency'],
489
+ "beezup_comission" => $beezup_comission,
490
+ "beezup_marketplace_status" => $oLink->getOrderStatusMarketPlaceStatus());
491
+ $orderId = $order->getId();
492
+ $beezupMageOrder = new BeezupMageOrders($orderId);
493
+ $beezupMageOrder->setData($updateData);
494
+ $beezupMageOrder->updateBeezupInfo();
495
+
496
+
497
  }
498
 
499
  public function getPhone($phone, $phone2) {
500
+ $retorno = "";
501
+ if(!empty($phone) && $phone !== "") {
502
+ $retorno .= $phone;
503
+ }
504
+ if(!empty($phone2) && $phone2 !=="") {
505
+ if(empty($phone) || $phone == "") {
506
+ $retorno = $phone2;
507
+
508
+ } else {
509
+ $retorno .= " - ".$phone2;
510
+ }
511
+ }
512
+ return $retorno;
513
  }
514
 
515
 
516
  public function getBeezupBuyerAddress($order) {
517
+ $add1=$order->getOrderBuyerAddressLine1();
518
+ $add2=$order->getOrderBuyerAddressLine2();
519
+ $add3=$order->getOrderBuyerAddressLine3();
520
+ $retorno = "";
521
+ if(!empty($add1)) {
522
+ $retorno = $order->getOrderBuyerAddressLine1();
523
+ }
524
+ if(!empty($add2)) {
525
+ if(empty($add1)) {
526
+ $retorno .= $order->getOrderBuyerAddressLine2();
527
+ } else {
528
+ $retorno .= " - ". $order->getOrderBuyerAddressLine2();
529
+ }
530
+ }
531
+ if(!empty($add3)){
532
+ if(empty($add1) && empty($add2)) {
533
+ $retorno .= $order->getOrderBuyerAddressLine3();
534
+ } else {
535
+ $retorno .= " - ". $order->getOrderBuyerAddressLine3();
536
+ }
537
+ }
538
+ return $retorno;
539
  }
540
 
541
 
542
  public function getBeezupShippingAddress($order) {
543
+ $add1 = $order->getOrderShippingAddressLine1();
544
+ $add2 = $order->getOrderShippingAddressLine2();
545
+ $add3=$order->getOrderBuyerAddressLine3();
546
+ $retorno = "";
547
+ if(!empty($add1 )) {
548
+ $retorno = $order->getOrderShippingAddressLine1();
549
+ }
550
+ if(!empty($add2)) {
551
+ if(empty($add1)) {
552
+ $retorno .= $order->getOrderShippingAddressLine2();
553
+ } else {
554
+ $retorno .= " - ". $order->getOrderShippingAddressLine2();
555
+ }
556
+ }
557
+ if(!empty($add3)){
558
+ if(empty($add1) && empty($add2)) {
559
+ $retorno .= $order->getOrderShippingAddressLine3();
560
+ } else {
561
+ $retorno .= " - ". $order->getOrderShippingAddressLine3();
562
+ }
563
+ }
564
+ return $retorno;
565
  }
566
 
567
  public function checkEtagExists($etag) {
568
+ $resource = Mage::getSingleton('core/resource');
569
+ $readConnection = $resource->getConnection('core_read');
570
+ $table = $resource->getTableName('sales/order_grid');
571
+ $query = 'SELECT increment_id FROM ' . $table . ' WHERE beezup_etag = \''
572
+ . $etag . '\' LIMIT 1';
573
+ $order = $readConnection->fetchOne($query);
574
+ if($order && !empty($order)) {
575
+ return true;
576
+ }
577
+ return false;
578
+
579
  }
580
 
581
 
582
  public function updateEtag($etag) {
583
+ $this->debugLog("Updating Etag");
584
+ $resource = Mage::getSingleton('core/resource');
585
+ $writeConnection = $resource->getConnection('core_write');
586
+ $table = $resource->getTableName('sales/order_grid');
587
+ $query = "UPDATE {$table} SET beezup_etag = '{$etag}' where beezup_market_order_id = '{$this->orderid}' ";
588
+ $writeConnection->query($query);
589
+
590
  }
591
 
592
 
593
 
594
  public function updateBilling($order, $data) {
595
+
596
+
597
+ $addressData = array(
598
+ 'billing_firstname' => ($data['order_customer']) ? $data['order_customer'] : "empty",
599
+ 'billing_lastname' => ($data['order_lastname']) ? $data['order_lastname'] : "empty",
600
+ 'billing_street' => ($data['order_address']) ? $data['order_address'] : "empty",
601
+ 'billing_city' => ($data['order_city']) ? $data['order_city'] : "empty",
602
+ 'billing_postcode' => ($data['order_postalCode']) ? $data['order_postalCode'] : "empty",
603
+ 'billing_telephone' => ($data['order_customer_phone']) ? $data['order_customer_phone'] : "empty",
604
+ 'billing_country_id' => ($data['order_country_iso']) ? $data['order_country_iso'] : "empty",
605
+ 'billing_region_id' => ($data['order_region ']) ? substr($data['order_region '], 0,2) : "EM",
606
+ 'shipping_firstname' => ($data['shipping_name']) ? $data['shipping_name'] : "empty",
607
+ 'shipping_lastname' => ($data['shipping_lastname']) ? $data['shipping_lastname'] : "empty",
608
+ 'shipping_street' => ($data['shipping_address']) ? $data['shipping_address'] : "empty",
609
+ 'shipping_city' => ($data['shipping_city']) ? $data['shipping_city'] : "empty",
610
+ 'shipping_postcode' => ($data['shipping_postalCode']) ? $data['shipping_postalCode'] : "empty",
611
+ 'shipping_telephone' => ($data['shipping_phone']) ? $data['shipping_phone'] : "empty",
612
+ 'shipping_country_id' => ($data['shipping_country_iso']) ? $data['shipping_country_iso'] : "empty",
613
+ 'shipping_region_id' => ($data['shipping_region']) ? substr($data['shipping_region'], 0, 2) : "EM" // id from directory_country_region table
614
+ );
615
+
616
+ $shippingData = array(
617
+
618
+ );
619
+ // Get the id of the orders shipping address
620
+ $orderId = $order->getId();
621
+ $beezupMageOrder = new BeezupMageOrders($orderId);
622
+ $beezupMageOrder->setData($addressData);
623
+ $beezupMageOrder->updateAdresses();
624
  }
625
 
626
  public function updateAddresses($shippingData, $address) {
627
+ if($shippingData['firstname'] !==$address['firstname']) {
628
+ $address->setFirstname($shippingData['firstname']);
629
+ }
630
+ if($shippingData['lastname'] !==$address['lastname']) {
631
+ $address->setLastname($shippingData['lastname']);
632
+ }
633
+ if($shippingData['street'] !==$address['street']) {
634
+ $address->setStreet($shippingData['street']);
635
+ }
636
+ if($shippingData['city'] !==$address['city']) {
637
+ $address->setCity($shippingData['city']);
638
+ }
639
+ if($shippingData['postcode'] !==$address['postcode']) {
640
+ $address->setPostcode($shippingData['postcode']);
641
+ }
642
+ if($shippingData['telephone'] !==$address['telephone']) {
643
+ $address->setTelephone($shippingData['telephone']);
644
+ }
645
+ $address->save();
646
+
647
+
648
  }
649
 
650
 
651
  public function loadMageOrder() {
652
+ $Mageorder = Mage::getModel('sales/order')->loadByIncrementId($this->orderid);
653
+ if ($Mageorder->getId()) {
654
+ return $Mageorder;
655
+ } else {
656
+ //we get order from marketplace orderid
657
+ $orderInc = $this->checkMarketOrderExists($this->orderid);
658
+ if($orderInc) {
659
+ // if exists
660
+ $Mageorder = Mage::getModel('sales/order')->loadByIncrementId($orderInc);
661
+ if ($Mageorder->getId()) {
662
+ return $Mageorder;
663
+ }
664
+ }
665
+ }
666
+ return false;
667
  }
668
 
669
 
670
  private function debugLog($message) {
671
+
672
+ if($this->orderid !== "") {
673
+ $message = $this->orderid." | ".$message;
674
+ }
675
+ $this->log->LogInfo($message);
676
+
677
+ $this->log2->LogInfo($message);
678
  }
679
 
680
  public function prescanOrder(BeezupOMOrderResult $order) {
681
+ $retorno = array();
682
+ $orderItems = $order->getOrderItems();
683
+ foreach ($orderItems as $item)
684
+ {
685
+
686
+ if ($item->getOrderItemOrderItemType () !== 'Product')
687
+ {
688
+ // continue;
689
+ }
690
+ $beezup_store = $item->getOrderItemBeezUPStoreId(); //beezup storeid
691
+ $mage_storeid = $this->checkOrderStore($beezup_store); //magento storeid
692
+ $marketplace_orderid = $item->getOrderItemMarketPlaceProductId();
693
+ if(!$mage_storeid) {
694
+
695
+ if(strpos($marketplace_orderid,'INTERETBCA') !== false || strpos($marketplace_orderid,'interetbca') !== false) { }
696
+ else {
697
+ $this->log->LogError($this->orderid." | No mapping for store ".$beezup_store);
698
+ $this->log2->LogError($this->orderid." | No mapping for store ".$beezup_store);
699
+ return false;
700
+ }
701
+
702
+ }
703
+ // $retorno['store'] = 1;
704
+ $retorno['store'] = $mage_storeid;
705
+ $this->debugLog("Store Matching succesful, Beezup Store: ".$beezup_store." , Magento Store Id: ".$mage_storeid);
706
+ $product_ImportedMerchantId = $item->getOrderItemMerchantImportedProductId();
707
+ $product_MerchantId = $item->getOrderItemMerchantProductId();
708
+
709
+ $product_quantity = $item->getOrderItemQuantity();
710
+ $product_price = $item->getOrderItemItemPrice();
711
+ $product_title = $item->getOrderItemTitle();
712
+ $product_image = $item->getOrderItemImageUrl();
713
+ if(strpos($marketplace_orderid,'INTERETBCA') !== false || strpos($marketplace_orderid,'interetbca') !== false) {
714
+ $retorno['discounts']= $item->getOrderItemTotalPrice();
715
+ } else {
716
+ $product = $this->getMageProduct($product_ImportedMerchantId , $product_MerchantId , $beezup_store );
717
+ if($product) {
718
+ $mage_productId = $product->getId();
719
+ $stocklevel = (int)Mage::getModel('cataloginventory/stock_item')
720
+ ->loadByProduct($product)->getQty();
721
+
722
+ $retorno['products'][] = array("id" => $mage_productId, "qty" => $product_quantity, "price" => $product_price, "curr_stock" => $stocklevel);
723
+ //producto existe
724
+ } else {
725
+ //vendria if de si activada opcion de crear producto creamos
726
+ if(!$this->debug) {
727
+ return false;
728
+ }
729
+ $product_data = array(
730
+ "sku" => $product_ImportedMerchantId,
731
+ "sku2" => $product_MerchantId,
732
+ "qty" => $product_quantity,
733
+ "price" => $product_price,
734
+ "title" => $product_title,
735
+ "image" => $product_image,
736
+ "storeId" => $mage_storeid
737
+ );
738
+ $product = $this->createProduct($product_data);
739
+ if(!$product) {
740
+ return false;
741
+ }
742
+ $stocklevel = (int)Mage::getModel('cataloginventory/stock_item')
743
+ ->loadByProduct($product)->getQty();
744
+ $mage_productId = $product->getId();
745
+ $retorno['products'][] = array("id" => $mage_productId, "qty" => $product_quantity, "price" => $product_price, "curr_stock" => $stocklevel);
746
+ }
747
+ }
748
+ }
749
+
750
+ return $retorno;
751
  }
752
 
753
 
754
 
755
  public function matchProductAttributes($importedId, $storeId) {
756
+ $product = null;
757
+ $helper = Mage::helper('beezup');
758
+ $attributes = $helper->getConfig('beezup/marketplace/attributes');
759
+ $attributes = unserialize ($attributes);
760
+
761
+ foreach($attributes['attributes'][$storeId ] as $attribute) {
762
+ $att = explode("|", $attribute);
763
+ if($storeId == $att[1]) {
764
+
765
+ $product=Mage::getModel('catalog/product')->loadByAttribute($att[0],$importedId);
766
+ if($product) {
767
+ break;
768
+ }
769
+ }
770
+ }
771
+
772
+ return $product;
773
  }
774
 
775
 
776
 
777
  public function getMageProduct($importedId, $merchantId, $storeId){
778
+ try {
779
+ $product=Mage::getModel('catalog/product')->load($importedId);
780
+ if (!$product->getId() || $product->getId() !== $importedId ){
781
+ $product = $this->matchProductAttributes($importedId, $storeId);
782
+ if($product == null || !is_object($product)) {
783
+ $product=Mage::getModel('catalog/product')->load($merchantId);
784
+ if(!$product->getId() || $product->getId() !== $merchantId ) {
785
+ $product = $this->matchProductAttributes($merchantId, $storeId);
786
+
787
+ }
788
+ }
789
+ }
790
+
791
+ if(is_object($product)) {
792
+ if($product->getId()) {
793
+ $this->debugLog("Product Matching succesful, Beezup Imported Id: ".$importedId." , Magento Product Id: ".$product->getId());
794
+ return $product;
795
+ }}
796
+ $this->log->LogError($this->orderid. "| No Product Matching, Product ".$importedId." could not be found");
797
+ $this->log2->LogError($this->orderid. "| No Product Matching, Product ".$importedId." could not be found");
798
+ return false;
799
+ }catch(Exception $e){
800
+ $this->log->LogError($this->orderid. "| Product ".$importedId." could not be found, error: ".$e->getMessage());
801
+ $this->log2->LogError($this->orderid. "| Product ".$importedId." could not be found, error: ".$e->getMessage());
802
+ return false;
803
+ //error no se pudo crear la orden
804
+
805
+ }
806
  }
807
 
808
 
809
  public function checkOrderStore($storeId ) {
810
+ $helper = Mage::helper('beezup');
811
+ $stores = $helper->getConfig('beezup/marketplace/stores');
812
+ $stores = unserialize ($stores);
813
+ foreach($stores as $store) {
814
+ if(isset($store[$storeId]) && $store[$storeId] > 0) {
815
+ return $store[$storeId];
816
+ }
817
+ }
818
+ return false;
819
  }
820
 
821
 
822
 
823
  /**
824
+ * @return BeezupOMOrderService
825
  */
826
  public function getOrderService(){
827
+ if ($this->oOrderService === null){
828
+ $this->oOrderService = $this->createOrderService();
829
+ // enchufamos debug mode, esta activado? false true $this->oOrderService->setDebugMode(false);
830
+ }
831
+ return $this->oOrderService;
832
  }
833
 
834
  /**
835
+ * @return BeezupOMOrderService
836
  */
837
  protected function createOrderService(){
838
+
839
+ return new BeezupOMOrderService($this->createRepository() );
840
  }
841
 
842
  protected function createRepository() {
843
+ if ($this->repository == null) {
844
+ $this->repository = new BeezupRepository();
845
+ }
846
+ return $this->repository;
847
+
848
  }
849
 
850
 
851
 
852
 
853
  private function createCustomer($customer_email , $data) {
854
+ $password = $this->orderid;
855
+ $this->debugLog("Creating new Customer");
856
+ $customer = Mage::getModel('customer/customer');
857
+ $customer->setWebsiteId(Mage::app()->getWebsite()->getId());
858
+ $customer->loadByEmail($customer_email);
859
+ if(!$customer->getId()) {
860
+ $customer->setEmail($customer_email);
861
+ $customer->setFirstname($data['firstname']);
862
+ $customer->setLastname($data['lastname']);
863
+ $customer->setPassword($password);
864
+ try {
865
+ $customer->save();
866
+ $customer->setConfirmation(null);
867
+ $customer->save();
868
+ $this->debugLog("Customer created succesfully");
869
+ return $customer;
870
+ //Make a "login" of new customer
871
+ // Mage::getSingleton('customer/session')->loginById($customer->getId());
872
+ }
873
+
874
+ catch (Exception $ex) {
875
+ //Zend_Debug::dump($ex->getMessage());
876
+ //GUARDAR ERROR CREACION USUARIO
877
+ $this->log2->LogError($this->orderid. " | Customer importation failed: ".$ex->getMessage());
878
+ return false;
879
+ }
880
+
881
+ } else {
882
+ $this->debugLog("Creating already exists, returning customer object");
883
+ return $customer;
884
+ }
885
  }
886
 
887
 
888
 
889
  public function addOrder($data, $oLink, $stop = false) {
890
+
891
+
892
+ try {
893
+ $helper = Mage::helper('beezup');
894
+ $addStock = $helper->getConfig('beezup/marketplace/available_products');
895
+ $baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
896
+ $quote = Mage::getModel('sales/quote')
897
+ ->setStoreId($data['storeid']);
898
+ $quote->setCustomerEmail($data['order_customer_email']);
899
+
900
+
901
+ $currency = Mage::getModel('directory/currency')->load($data['order_currency']);
902
+ $quote->setForcedCurrency($currency);
903
+
904
+ $blnCreate = true;
905
+ $total_new_price = 0;
906
+ foreach($data['products'] as $prod) {
907
+ if($prod['qty']==0) {
908
+ $blnCreate = false;
909
+ break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
910
  }
911
+ $prod_totality_price = $prod['price']*$prod['qty'];
912
+ $total_new_price = $total_new_price + $prod_totality_price;
913
+ $product = Mage::getModel('catalog/product')->load($prod['id']);
914
+ $buyInfo = array(
915
+ 'qty' => $prod['qty'],
916
+ );
917
+ $this->debugLog("Adding ".$prod['qty']." product/s with id ".$product->getId()." to order, with Beezup Price: ".$prod['price']);
918
+ //echo "Product ".$product->getId()."<br><br>";
919
+ //para no perder stock:
920
+ //Mage::getModel('cataloginventory/stock')->backItemQty($productId,$new_qty);
921
 
922
 
923
+ if($addStock == 1) {
924
+ $stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
925
+
926
+ if ($stock->getQty() < $prod['qty'] && $product->getStockItem()->getMaxSaleQty() >= $prod['qty']) {
927
+ $this->debugLog("Product ".$product->getId()." Stock = 0, Updating to ".$prod['qty']." to generate Order");
928
+ // Mage::getModel('cataloginventory/stock')->backItemQty($product->getId(),$prod['qty']);
929
+ //$this->_updateStocks(array("id_product" => $product->getId(), "qty" => $prod['qty']));
930
+ $product->setStockData(
931
+ array(
932
+ 'is_in_stock' => 1,
933
+ 'qty' => $prod['qty'],
934
+ 'manage_stock' => 1,
935
+ 'use_config_notify_stock_qty' => 1
936
+ )
937
+ );
938
+ $product->save();
939
+ $product = Mage::getModel('catalog/product')->load($product->getId());
940
+
941
+ }
942
+ }
943
+ //fin para no perder stock
944
+
945
+ /*
946
+ $tax_class = $product->getTaxClassId();
947
+ $product->setTaxClassId(0);
948
+ $product->getResource()->saveAttribute($product, 'tax_class_id'); */
949
+ $price = $prod['price'];
950
+
951
+ $quote_item = Mage::getModel('beezup/quote_item');
952
+ $quote_item
953
+ ->setProduct($product)
954
+ ->setPrice((float) $price )
955
+ ->setCustomPrice((float)$price )
956
+ ->setOriginalCustomPrice((float) $price )
957
+ ->setQuote($quote)
958
+ ->setQty((integer) $prod['qty'])
959
+ ->setBeezupPrice((float) $price );
960
+
961
+
962
+ $quote->addItem($quote_item);
963
+
964
+ //$quote->addProduct($product, new Varien_Object($buyInfo))->setOriginalCustomPrice($price)->setCustomPrice($price);
965
+
966
+ /*
967
+ $product->setTaxClassId($tax_class);
968
+
969
+ $product->getResource()->saveAttribute($product, 'tax_class_id');
970
+ */
971
+ }
972
+
973
+ if($blnCreate) {
974
+ $addressData = array(
975
+ 'firstname' => ($data['order_customer']) ? $data['order_customer'] : "empty",
976
+ 'lastname' => ($data['order_lastname']) ? $data['order_lastname'] : "empty",
977
+ 'street' => ($data['order_address']) ? $data['order_address'] : "empty",
978
+ 'city' => ($data['order_city']) ? $data['order_city'] : "empty",
979
+ 'postcode' => ($data['order_postalCode']) ? $data['order_postalCode'] : "empty",
980
+ 'telephone' => ($data['order_customer_phone']) ? $data['order_customer_phone'] : "empty",
981
+ 'country_id' => ($data['order_country_iso']) ? $data['order_country_iso'] : "empty",
982
+ 'region_id' => ($data['order_region ']) ? substr($data['order_region '], 0,2) : "EM"// id from directory_country_region table
983
+ );
984
+
985
+ $shippingData = array(
986
+ 'firstname' => ($data['shipping_name']) ? $data['shipping_name'] : "empty",
987
+ 'lastname' => ($data['shipping_lastname']) ? $data['shipping_lastname'] : "empty",
988
+ 'street' => ($data['shipping_address']) ? $data['shipping_address'] : "empty",
989
+ 'city' => ($data['shipping_city']) ? $data['shipping_city'] : "empty",
990
+ 'postcode' => ($data['shipping_postalCode']) ? $data['shipping_postalCode'] : "empty",
991
+ 'telephone' => ($data['shipping_phone']) ? $data['shipping_phone'] : "empty",
992
+ 'country_id' => ($data['shipping_country_iso']) ? $data['shipping_country_iso'] : "empty",
993
+ 'region_id' => ($data['shipping_region']) ? substr($data['shipping_region'], 0, 2) : "EM" // id from directory_country_region table
994
+ );
995
+
996
+ if($this->blnCreateCustomer) {
997
+
998
+ $mage_customer = $this->createCustomer($data['order_customer_email'], $addressData);
999
+ $quote->assignCustomer($mage_customer);
1000
+ }
1001
+
1002
+
1003
+ $payment_method = $helper->getConfig('beezup/marketplace/payment_method');
1004
+ $billingAddress = $quote->getBillingAddress()->addData($addressData);
1005
+ $shippingAddress = $quote->getShippingAddress()->addData($shippingData);
1006
+ $shipping_cost = (float) $data['order_shippingPrice'];
1007
+ if($data['order_shippingPrice'] == 0) {
1008
+ $shipping_cost = 20000;
1009
+ }
1010
+ $total_new_price = $total_new_price + $data['order_shippingPrice'] ;
1011
+ Mage::unregister('shipping_cost');
1012
+ Mage::register('shipping_cost', $shipping_cost);
1013
+ $this->debugLog("Adding Order Shipping Cost: ". $data['order_shippingPrice']);
1014
+
1015
+ $shippingAddress->setCollectShippingRates(true)->collectShippingRates()
1016
+ ->setShippingMethod('flatrate_flatrate')
1017
+ ->setPaymentMethod($payment_method);
1018
+
1019
+ //$shippingAddress->addTotal(array("code" => "specialfee", "title" => "Special Fee", "value" => 20));
1020
+ $quote->getPayment()->importData(array('method' => $payment_method));
1021
+
1022
+ $quote->collectTotals()->save();
1023
+
1024
+ $service = Mage::getModel('sales/service_quote', $quote);
1025
+ $service->submitAll();
1026
+ $order = $service->getOrder();
1027
+
1028
+
1029
+
1030
+ $quoteId = $order->getQuoteId();
1031
+ //$this->setStatus($data['order_status'], $order);
1032
+
1033
+ $orderid = $order->getId();
1034
+
1035
+ $resource = Mage::getSingleton('core/resource');
1036
+ $writeConnection = $resource->getConnection('core_write');
1037
+ $table = $resource->getTableName('sales/order_grid');
1038
+ $this->debugLog("Adding Beezup Marketplace Information to Order");
1039
+ $marketplace = $data['marketplace'];
1040
+ $marketplace_business_code = ucfirst(strtolower($data['marketplace_business_code']));
1041
+ $beezup_name = $data['order_customer'];
1042
+ $market_order_id =$this->orderid;
1043
+ $beezup_order_id = $oLink->getBeezupOrderUUID();
1044
+ $beezup_status = $data['order_status'];
1045
+ $beezup_last_modification_date = $oLink->getOrderLastModificationUtcDate();
1046
+ $beezup_last_modification_date = $beezup_last_modification_date->date;
1047
+ $beezup_marketplace_status = $oLink->getOrderStatusMarketPlaceStatus();
1048
+ $beezup_purchase_date = $oLink->getOrderPurchaseUtcDate();
1049
+ $beezup_purchase_date = $beezup_purchase_date->date;
1050
+ $beezup_marketplace_last_modification_date = $oLink->getOrderMarketPlaceLastModificationUtcDate();
1051
+ $beezup_marketplace_last_modification_date = $beezup_marketplace_last_modification_date->date;
1052
+ /* $date = new DateTime($$beezup_marketplace_last_modification_date);
1053
+ $beezup_marketplace_last_modification_date = $date->format('d-m-Y H:i:s'). "(UTC Time)";
1054
+ */
1055
+
1056
+ $beezup_total_paid = $oLink->getOrderTotalPrice()." ".$data['order_currency'];
1057
+ $beezup_account_id = $oLink->getAccountId();
1058
+ $beezup_comission = $oLink->getOrderTotalCommission()." ".$data['order_currency'];
1059
+ $tot_comm = $oLink->getOrderTotalCommission();
1060
+ if(empty($tot_comm ) || $tot_comm == 0) {
1061
+ $beezup_comission = 0;
1062
+ }
1063
+ $query = "UPDATE {$table} SET beezup_marketplace = '{$marketplace}', beezup_name = '{$beezup_account_id}', beezup_order = 1, beezup_market_order_id = '{$market_order_id}',
1064
+ beezup_order_id = '{$beezup_order_id}', beezup_status = '{$beezup_status}', beezup_last_modification_date = '{$beezup_last_modification_date}',
1065
+ beezup_marketplace_status = '{$beezup_marketplace_status}', beezup_purchase_date = '{$beezup_purchase_date}', beezup_marketplace_last_modification_date = '{$beezup_marketplace_last_modification_date}',
1066
+ beezup_total_paid = '{$beezup_total_paid}', beezup_etag = '{$data['etag']}' , beezup_comission = '{$beezup_comission}', beezup_marketplace_business_code = '{$marketplace_business_code}'
1067
+ WHERE entity_id = ". (int)$orderid;
1068
+ $writeConnection->query($query);
1069
+ $disc_price = 0;
1070
+ if(!empty($data['discounts']) && $data['discounts'] >0) {
1071
+
1072
+
1073
+ $disc_price = round($data['discounts'],2);
1074
+ $total_new_price = $total_new_price+$disc_price;
1075
+ $table_address = $resource->getTableName("sales/quote_address");
1076
+
1077
+ $query = "update {$table_address} set beezup_fee = '{$disc_price}' where quote_id = '{$quoteId}' and address_type = 'shipping'";
1078
+ $writeConnection->query($query);
1079
+ $this->debugLog("Adding CDISCOUNT products with total price: ".$disc_price);
1080
+ }
1081
+
1082
+ //if order id exists and has been created
1083
+ if ($orderid)
1084
+ {
1085
+ //we send order id to beezup
1086
+ $this->debugLog("Sending Magento Order Id to Beezup, Magento Order Id: ".$orderid);
1087
+ $oResult = new BeezupOMSetOrderIdValues ();
1088
+ $oResult->setOrderMerchantOrderId ( $orderid )->setOrderMerchantECommerceSoftwareName ( 'Magento' )->setOrderMerchantECommerceSoftwareVersion ( Mage::getVersion() );
1089
+ $sendRequest = $this->getOrderService()->getClientProxy()->setOrderMerchantIdByLink($oLink->getLinkByRel('setMerchantOrderId'), $oResult);
1090
+ }
1091
+
1092
+ $grand_total = $order->getGrandTotal();
1093
+ $beezup_price = $oLink->getOrderTotalPrice() - $disc_price;
1094
+ if($grand_total != (float) $beezup_price && $beezup_price > 0) {
1095
+ $order->setGrandTotal((float) $beezup_price);
1096
+ $order->setBaseGrandTotal((float) $beezup_price);
1097
+ $diff = (((float) $beezup_price) - $grand_total);
1098
+
1099
+ $order->setTaxAmount($order->getTaxAmount() + $diff);
1100
+ $order->save();
1101
+ }elseif($grand_total != (float)$beezup_price && $beezup_price < 1) {
1102
+
1103
+ $order->setGrandTotal((float) $total_new_price);
1104
+ $order->setBaseGrandTotal((float) $total_new_price);
1105
+ $diff = (((float) $total_new_price) - $grand_total);
1106
+
1107
+ $order->setTaxAmount($order->getTaxAmount() + $diff);
1108
+ $order->save();
1109
+ }
1110
+
1111
+ $products = Mage::getResourceModel('sales/order_item_collection')
1112
+ ->setOrderFilter($orderid);
1113
+ foreach($products as $product) {
1114
+ $product->setBaseOriginalPrice($product->getOriginalPrice());
1115
+ $product->setBaseTaxAmount($product->getTaxAmount());
1116
+ $product->setBaseTaxInvoiced($product->getTaxAmount());
1117
+ $product->setBasePriceInclTax($product->getPriceInclTax());
1118
+ $product->setBaseRowTotalInclTax($product->getRowTotalInclTax());
1119
+ $product->save();
1120
+ }
1121
+ $order->setBaseTaxAmount($order->getTaxAmount());
1122
+ $order->setBaseTaxInvoiced($order->getTaxAmount());
1123
+ $order->setBaseTotalInvoiced($order->getTotalPaid());
1124
+ $order->setBaseTotalPaid($order->getTotalPaid());
1125
+ $order->setBaseGrandTotal($order->getTotalPaid());
1126
+ $order->setBaseSubtotalInclTax($order->getSubtotalInclTax());
1127
+ $order->save();
1128
+
1129
+ $this->setStatus($data['order_status'], $order);
1130
+ $this->mage_order_id = $orderid;
1131
+ $this->debugLog("Order imported succesfully, Magento Order Id: ".$orderid);
1132
+ } else {
1133
+ //product stock = 0 we dont create order
1134
+ $this->log->LogError($this->orderid. "| Order ".$data['market_place_order_id']." could not be imported, error: Stock from Beezup product = 0 ");
1135
+ $this->log2->LogError($this->orderid. "| Order ".$data['market_place_order_id']." could not be imported, error: Stock from Beezup product = 0 ");
1136
+ }
1137
+ }catch(Exception $e){
1138
+
1139
+
1140
+ if($stop) {
1141
+ $this->log->LogError($this->orderid. "| Order ".$data['market_place_order_id']." could not be imported, error: ".$e->getMessage());
1142
+ $this->log2->LogError($this->orderid. "| Order ".$data['market_place_order_id']." could not be imported, error: ".$e->getMessage());
1143
+ $this->restoreStock($data);
1144
+ } else {
1145
+ $this->debugLog("Order Import failed, Trying to import Order Again");
1146
+ $this->addOrder($data, $oLink, true);
1147
+
1148
+ }
1149
+ //error no se pudo crear la orden
1150
+
1151
+ }
1152
+
1153
+
1154
+
1155
+ }
1156
+
1157
+
1158
+
1159
+ public function restoreStock($data) {
1160
+
1161
+ try {
1162
+ foreach($data['products'] as $prod) {
1163
+ $product = Mage::getModel('catalog/product')->load($prod['id']);
1164
+ $stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
1165
+ if ($stock->getQty() != $prod['curr_stock'] ) {
1166
+ $this->debugLog("Restoring Stock from Product ".$product->getId()." to: ".$prod['curr_stock'] ." due to Order Fail");
1167
+ $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
1168
+ $stockItem->setData('is_in_stock', 0);
1169
+ $stockItem->setData('qty', $prod['curr_stock']);
1170
+ $stockItem->save();
1171
+ $product->save();
1172
+ }
1173
+
1174
+ }
1175
+ } catch(Exception $e){
1176
+ $this->log->LogError($this->orderid. "| Failed Restoring Product Stock: ".$e->getMessage());
1177
+ $this->log2->LogError($this->orderid. "| Failed Restoring Product Stock: ".$e->getMessage());
1178
+ }
1179
+
1180
+ }
1181
+
1182
+
1183
+
1184
+ private function createProduct($data) {
1185
+
1186
+ $sku = $data['sku'];
1187
+ if(empty($data['sku'])) {
1188
+ $sku = $data['sku2'];
1189
+ }
1190
+
1191
+ Mage::app()->setCurrentStore($data['storeId']);
1192
+ $product = Mage::getModel('catalog/product');
1193
+ // if(!$product->getIdBySku('testsku61')):
1194
+
1195
+ try{
1196
+ $product
1197
+ // ->setStoreId(1) //you can set data in store scope
1198
+ ->setWebsiteIds(array($data['storeId'])) //website ID the product is assigned to, as an array
1199
+ ->setAttributeSetId($product->getDefaultAttributeSetId()) //ID of a attribute set named 'default'
1200
+ ->setTypeId('simple') //product type
1201
+ ->setCreatedAt(strtotime('now')) //product creation time
1202
+ ->setSku($sku ) //SKU
1203
+ ->setWeight(0)
1204
+ ->setName($data['title']) //product name
1205
+ ->setStatus(1) //product status (1 - enabled, 2 - disabled)
1206
+ ->setTaxClassId(4) //tax class (0 - none, 1 - default, 2 - taxable, 4 - shipping)
1207
+ ->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE ) //catalog and search visibility
1208
+ ->setPrice($data['price']) //price in form 11.22
1209
+ ->setMsrpEnabled(1) //enable MAP
1210
+ ->setMsrpDisplayActualPriceType(1) //display actual price (1 - on gesture, 2 - in cart, 3 - before order confirmation, 4 - use config)
1211
+ ->setMsrp(0) //Manufacturer's Suggested Retail Price
1212
+ ->setMetaTitle('')
1213
+ ->setMetaKeyword('')
1214
+ ->setMetaDescription('')
1215
+ ->setDescription($data['title'])
1216
+ ->setShortDescription($data['title'])
1217
+ // ->setMediaGallery (array('images'=>array (), 'values'=>array ())) //media gallery initialization
1218
+ //->addImageToMediaGallery('media/catalog/product/1/0/10243-1.png', array('image','thumbnail','small_image'), false, false) //assigning image, thumb and small image to media gallery
1219
+ ->setStockData(array(
1220
+ 'use_config_manage_stock' => 0, //'Use config settings' checkbox
1221
+ 'manage_stock'=>1, //manage stock
1222
+ 'min_sale_qty'=>1, //Minimum Qty Allowed in Shopping Cart
1223
+ 'max_sale_qty'=>2, //Maximum Qty Allowed in Shopping Cart
1224
+ 'is_in_stock' => 1, //Stock Availability
1225
+ 'qty' => 1 //qty
1226
+ )
1227
+ );
1228
+ $product->save();
1229
+ return $product;
1230
+
1231
+ }catch(Exception $e){
1232
+ //log exception
1233
+ $this->log->LogError($this->orderid."| Product ".$sku." could not be created, error: ".$e->getMessage());
1234
+ $this->log2->LogError($this->orderid."| Product ".$sku." could not be created, error: ".$e->getMessage());
1235
+ return false;
1236
+ }
1237
+ }
1238
+
1239
+
1240
+
1241
+ public function setStatus($status, $order) {
1242
+ $helper = Mage::helper('beezup');
1243
+ $retorno = "";
1244
+ $blnCancel = false;
1245
+ $blnHold = false;
1246
+ switch($status) {
1247
+ case "New" :
1248
+ $this->debugLog("Setting Order Status to New");
1249
+ $retorno = $helper->getConfig('beezup/marketplace/status_new');
1250
+ break;
1251
+ case "InProgress" :
1252
+ $this->debugLog("Setting Order Status to InProgress");
1253
+ $retorno = $helper->getConfig('beezup/marketplace/status_progress');
1254
+ $this->payOrder($order);
1255
+ break;
1256
+ case "Aborted" :
1257
+ $this->debugLog("Setting Order Status to Aborted");
1258
+ $retorno = $helper->getConfig('beezup/marketplace/status_aborted');
1259
+ $blnHold = true;
1260
+
1261
+
1262
+ break;
1263
+ case "Closed" :
1264
+ $this->debugLog("Setting Order Status to Closed");
1265
+ $blnCancel =true;
1266
+ $retorno = $helper->getConfig('beezup/marketplace/status_closed');
1267
+ $this->payOrder($order);
1268
+ break;
1269
+ case "Canceled" :
1270
+ $this->debugLog("Setting Order Status to Cancelled");
1271
+ $retorno = $helper->getConfig('beezup/marketplace/status_cancelled');
1272
+
1273
+ break;
1274
+ case "Shipped" :
1275
+ $this->debugLog("Setting Order Status to Shipped");
1276
+ $retorno = $helper->getConfig('beezup/marketplace/status_shipped');
1277
+ $this->payOrder($order);
1278
+ break;
1279
+
1280
+ }
1281
+ $order->setData('state',$retorno);
1282
+ $order->setStatus($retorno);
1283
+ $history = $order->addStatusHistoryComment('Order was set to '.$retorno.' by Beezup.', false);
1284
+ $history->setIsCustomerNotified(false);
1285
+ $order->save();
1286
+ if($blnCancel) {
1287
+ $order->cancel()->save();
1288
+ }
1289
+ if($blnHold) {
1290
+ $order->hold()->save();
1291
+ }
1292
+
1293
+ return $retorno;
1294
+
1295
+ }
1296
+
1297
+
1298
+ public function getStatus($status1) {
1299
+ $helper = Mage::helper('beezup');
1300
+ $retorno = "";
1301
+ $status = strtolower($status1);
1302
+
1303
+ if($status == strtolower($helper->getConfig('beezup/marketplace/status_new') )) {
1304
+ $retorno = "New";
1305
+
1306
+ } elseif($status == strtolower($helper->getConfig('beezup/marketplace/status_progress') ) ){
1307
+ $retorno = "InProgress";
1308
+
1309
+
1310
+ }
1311
+ elseif($status == strtolower($helper->getConfig('beezup/marketplace/status_aborted') )) {
1312
+
1313
+ $retorno = "Aborted" ;
1314
+ }
1315
+ elseif($status == strtolower($helper->getConfig('beezup/marketplace/status_closed') )) {
1316
+ $retorno = "Closed";
1317
+
1318
+ }
1319
+ elseif($status == strtolower($helper->getConfig('beezup/marketplace/status_cancelled')) ) {
1320
+
1321
+ $retorno = "Canceled";
1322
+ }
1323
+ elseif($status == strtolower($helper->getConfig('beezup/marketplace/status_shipped') )) {
1324
+
1325
+ $retorno = "Shipped";
1326
+ }
1327
+
1328
+
1329
+ return $retorno;
1330
+
1331
+ }
1332
+
1333
+
1334
+ public function checkMarketOrderExists($orderid) {
1335
+ $resource = Mage::getSingleton('core/resource');
1336
+ $readConnection = $resource->getConnection('core_read');
1337
+ $table = $resource->getTableName('sales/order_grid');
1338
+ $query = 'SELECT increment_id FROM ' . $table . ' WHERE beezup_order = 1 and beezup_market_order_id = \''
1339
+ . $orderid . '\' LIMIT 1';
1340
+ $order = $readConnection->fetchOne($query);
1341
+ if($order && !empty($order) && $this->orderId !== "") {
1342
+ return $order;
1343
+ }
1344
+ return false;
1345
+
1346
+ }
1347
+
1348
+ public function payOrder($order) {
1349
+ try {
1350
+ $this->debugLog("Generating Order Payment Invoice");
1351
+ if($order->canInvoice()) {
1352
+ $invoice = $order->prepareInvoice()
1353
+ ->setTransactionId($order->getId())
1354
+ ->addComment("Invoice created from Beezup.")
1355
+ ->register()
1356
+ ->pay();
1357
+ $transaction_save = Mage::getModel('core/resource_transaction')
1358
+ ->addObject($invoice)
1359
+ ->addObject($invoice->getOrder());
1360
+ $transaction_save->save();
1361
+ $this->debugLog("Order Payment Invoice Generated Succesfully");
1362
+ }
1363
+ }
1364
+ catch(Exception $e){
1365
+ //log exception
1366
+ $this->log->LogError($this->orderid."| Order Payment Invoice could not be generated, error: ".$e->getMessage());
1367
+ $this->log2->LogError($this->orderid."| Order Payment Invoice could not be generated, error: ".$e->getMessage());
1368
+ }
1369
+ }
1370
+
1371
+
1372
+
1373
+
1374
+
1375
+
1376
+ }
app/code/community/BeezUp/Block/Xml.php CHANGED
@@ -6,8 +6,9 @@
6
  /**
7
  Xml permet de r�cup�rer tous les produits simples
8
  **/
9
- public function getXml()
10
  {
 
11
  $base_url = Mage::getBaseUrl();
12
  /* Load Model and Helper */
13
  $beezup = Mage::getModel('beezup/products');
@@ -48,7 +49,7 @@
48
  $xml = "\xEF\xBB\xBF";
49
  $xml .= '<?xml version="1.0" encoding="utf-8"?>' . PHP_EOL . '<catalog>' . PHP_EOL;
50
 
51
- $products = $beezup->getProducts();
52
  if($many_images == 1) {
53
  $backendModel = $products->getResource()->getAttribute('media_gallery')->getBackend();
54
  }
@@ -161,7 +162,7 @@
161
  /**
162
  Configurable permet de r�cup�rer tous les produits (p�re, enfant et simple)
163
  **/
164
- public function getXmlConfigurable()
165
  {
166
  $base_url = Mage::getBaseUrl();
167
  /* Load Model and Helper */
@@ -202,8 +203,8 @@
202
  $xml .= '<?xml version="1.0" encoding="utf-8"?>' . PHP_EOL . '<catalog>' . PHP_EOL;
203
 
204
  //r�cup�re tous les produits
205
- $products = $beezup->getProducts();
206
- $childs = $beezup->getConfigurableProducts(true);
207
  $backendModel = $products->getResource()->getAttribute('media_gallery')->getBackend();
208
  $products->addAttributeToFilter('type_id', Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE);
209
 
@@ -408,7 +409,7 @@
408
  }
409
  }
410
 
411
- $product_simple = $beezup->getProductsSimple();
412
  $backendModelSimple = $product_simple->getResource()->getAttribute('media_gallery')->getBackend();
413
  foreach ($product_simple as $p) {
414
 
@@ -503,7 +504,7 @@
503
  /**
504
  Children permet de r�cup�rer tous les produits enfants
505
  **/
506
- public function getXmlChild()
507
  {
508
  /* Load Model and Helper */
509
  $beezup = Mage::getModel('beezup/products');
@@ -542,7 +543,7 @@
542
  $xml = "\xEF\xBB\xBF";
543
  $xml .= '<?xml version="1.0" encoding="utf-8"?>' . PHP_EOL . '<catalog>' . PHP_EOL;
544
 
545
- $childs = $beezup->getConfigurableProducts(false);
546
 
547
  foreach ($childs as $c) {
548
 
@@ -797,7 +798,7 @@
797
 
798
  protected function createFile($type, $xmlData)
799
  {
800
- $fp = fopen('beezup/tmp/'.$type, 'w');
801
  if ($fp == false)
802
  {
803
  echo 'Fail to create file';
@@ -808,7 +809,7 @@
808
 
809
  protected function deleteFeed($type)
810
  {
811
- unlink('beezup/tmp/'.$type);
812
  }
813
 
814
  protected function needRefreshing($type)
@@ -817,7 +818,7 @@
817
 
818
  $delay = $helper->getConfig('beezup/flux/cachedelay') * 60;
819
  $nowtime = time();
820
- $fileTime = filemtime('beezup/tmp/'.$type);
821
  if (($nowtime - $fileTime) >= $delay)
822
  return (true);
823
  else
@@ -858,14 +859,14 @@
858
  /*
859
  $this->getAssociatedProducto(true);
860
  return;*/
861
-
862
  if (!$this->createFolder()) // Si on rencontre des probl�mes de cr�ation de dossier on retourne rien
863
  return;
864
  if ($this->getConfigurable()){ // Appel de l'url http://site.com/beezup/catalog/configurable
865
  if ($this->needRefreshing('configurable')){
866
  if (file_exists('beezup/tmp/configurable'))
867
  $this->deleteFeed('configurable');
868
- $xmlData = $this->getXmlConfigurable();
869
  $this->addText($xmlData);
870
  if ($helper->getConfig('beezup/flux/cachedelay') != 0)
871
  $this->createFile('configurable', $xmlData);
@@ -877,7 +878,7 @@
877
  if ($this->needRefreshing('child')){
878
  if (file_exists('beezup/tmp/child'))
879
  $this->deleteFeed('child');
880
- $xmlData = $this->getXmlChild();
881
  $this->addText($xmlData);
882
  if ($helper->getConfig('beezup/flux/cachedelay') != 0)
883
  $this->createFile('child', $xmlData);
@@ -889,7 +890,7 @@
889
  if ($this->needRefreshing('xml')){
890
  if (file_exists('beezup/tmp/xml'))
891
  $this->deleteFeed('xml');
892
- $xmlData = $this->getXml();
893
  $this->addText($xmlData);
894
  if ($helper->getConfig('beezup/flux/cachedelay') != 0)
895
  $this->createFile('xml', $xmlData);
6
  /**
7
  Xml permet de r�cup�rer tous les produits simples
8
  **/
9
+ public function getXml($paginate = false)
10
  {
11
+
12
  $base_url = Mage::getBaseUrl();
13
  /* Load Model and Helper */
14
  $beezup = Mage::getModel('beezup/products');
49
  $xml = "\xEF\xBB\xBF";
50
  $xml .= '<?xml version="1.0" encoding="utf-8"?>' . PHP_EOL . '<catalog>' . PHP_EOL;
51
 
52
+ $products = $beezup->getProducts(false, $paginate);
53
  if($many_images == 1) {
54
  $backendModel = $products->getResource()->getAttribute('media_gallery')->getBackend();
55
  }
162
  /**
163
  Configurable permet de r�cup�rer tous les produits (p�re, enfant et simple)
164
  **/
165
+ public function getXmlConfigurable($paginate = false)
166
  {
167
  $base_url = Mage::getBaseUrl();
168
  /* Load Model and Helper */
203
  $xml .= '<?xml version="1.0" encoding="utf-8"?>' . PHP_EOL . '<catalog>' . PHP_EOL;
204
 
205
  //r�cup�re tous les produits
206
+ $products = $beezup->getProducts(false, $paginate);
207
+ $childs = $beezup->getConfigurableProducts(true, $paginate);
208
  $backendModel = $products->getResource()->getAttribute('media_gallery')->getBackend();
209
  $products->addAttributeToFilter('type_id', Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE);
210
 
409
  }
410
  }
411
 
412
+ $product_simple = $beezup->getProductsSimple($paginate);
413
  $backendModelSimple = $product_simple->getResource()->getAttribute('media_gallery')->getBackend();
414
  foreach ($product_simple as $p) {
415
 
504
  /**
505
  Children permet de r�cup�rer tous les produits enfants
506
  **/
507
+ public function getXmlChild($paginate = false)
508
  {
509
  /* Load Model and Helper */
510
  $beezup = Mage::getModel('beezup/products');
543
  $xml = "\xEF\xBB\xBF";
544
  $xml .= '<?xml version="1.0" encoding="utf-8"?>' . PHP_EOL . '<catalog>' . PHP_EOL;
545
 
546
+ $childs = $beezup->getConfigurableProducts(false, $paginate);
547
 
548
  foreach ($childs as $c) {
549
 
798
 
799
  protected function createFile($type, $xmlData)
800
  {
801
+ $fp = fopen(Mage::getBaseDir('base').'/beezup/tmp/'.$type, 'w');
802
  if ($fp == false)
803
  {
804
  echo 'Fail to create file';
809
 
810
  protected function deleteFeed($type)
811
  {
812
+ unlink(Mage::getBaseDir('base').'/beezup/tmp/'.$type);
813
  }
814
 
815
  protected function needRefreshing($type)
818
 
819
  $delay = $helper->getConfig('beezup/flux/cachedelay') * 60;
820
  $nowtime = time();
821
+ $fileTime = filemtime(Mage::getBaseDir('base').'/beezup/tmp/'.$type);
822
  if (($nowtime - $fileTime) >= $delay)
823
  return (true);
824
  else
859
  /*
860
  $this->getAssociatedProducto(true);
861
  return;*/
862
+ $paginate = $this->getPagination();
863
  if (!$this->createFolder()) // Si on rencontre des probl�mes de cr�ation de dossier on retourne rien
864
  return;
865
  if ($this->getConfigurable()){ // Appel de l'url http://site.com/beezup/catalog/configurable
866
  if ($this->needRefreshing('configurable')){
867
  if (file_exists('beezup/tmp/configurable'))
868
  $this->deleteFeed('configurable');
869
+ $xmlData = $this->getXmlConfigurable($paginate);
870
  $this->addText($xmlData);
871
  if ($helper->getConfig('beezup/flux/cachedelay') != 0)
872
  $this->createFile('configurable', $xmlData);
878
  if ($this->needRefreshing('child')){
879
  if (file_exists('beezup/tmp/child'))
880
  $this->deleteFeed('child');
881
+ $xmlData = $this->getXmlChild($paginate);
882
  $this->addText($xmlData);
883
  if ($helper->getConfig('beezup/flux/cachedelay') != 0)
884
  $this->createFile('child', $xmlData);
890
  if ($this->needRefreshing('xml')){
891
  if (file_exists('beezup/tmp/xml'))
892
  $this->deleteFeed('xml');
893
+ $xmlData = $this->getXml($paginate);
894
  $this->addText($xmlData);
895
  if ($helper->getConfig('beezup/flux/cachedelay') != 0)
896
  $this->createFile('xml', $xmlData);
app/code/community/BeezUp/Model/Products.php CHANGED
@@ -9,7 +9,7 @@
9
  * @param bool $configurable
10
  * @return Mage_Catalog_Model_Resource_Product_Collection?
11
  */
12
- public function getProducts($configurable = false)
13
  {
14
  $products = Mage::getResourceModel('catalog/product_collection')
15
  ->addAttributeToFilter('status', 1)
@@ -57,8 +57,9 @@
57
  if($configurable) $products->addAttributeToFilter('type_id', Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE);
58
 
59
  if(Mage::getStoreConfig('beezup/flux/stock')){
60
- $products= $products->joinField('inventory_in_stock', 'cataloginventory_stock_item', 'is_in_stock', 'product_id=entity_id','is_in_stock>=0', 'left')
61
- ->addAttributeToFilter('inventory_in_stock', array('neq' => 0));
 
62
  }
63
 
64
  $attributes = explode(',', Mage::getStoreConfig('beezup/flux/attributes'));
@@ -66,6 +67,12 @@
66
 
67
  if (Mage::getStoreConfig('beezup/flux/debug_flux')) $products->setPageSize(10);
68
 
 
 
 
 
 
 
69
  return $products;
70
  }
71
 
@@ -80,7 +87,7 @@
80
  return $products;
81
  }
82
 
83
- public function getProductsSimple()
84
  {
85
  $products = Mage::getResourceModel('catalog/product_collection')
86
  ->addAttributeToFilter('status', 1)
@@ -129,8 +136,9 @@
129
  $products->addAttributeToFilter('type_id', Mage_Catalog_Model_Product_Type::TYPE_SIMPLE);
130
 
131
  if(Mage::getStoreConfig('beezup/flux/stock')){
132
- $products= $products->joinField('inventory_in_stock', 'cataloginventory_stock_item', 'is_in_stock', 'product_id=entity_id','is_in_stock>=0', 'left')
133
- ->addAttributeToFilter('inventory_in_stock', array('neq' => 0));
 
134
  }
135
 
136
  $attributes = explode(',', Mage::getStoreConfig('beezup/flux/attributes'));
@@ -138,6 +146,11 @@
138
 
139
  if (Mage::getStoreConfig('beezup/flux/debug_flux')) $products->setPageSize(10);
140
 
 
 
 
 
 
141
  return $products;
142
  }
143
 
@@ -146,7 +159,7 @@
146
  *
147
  * @return Mage_Catalog_Model_Resource_Product_Collection?
148
  */
149
- public function getConfigurableProducts($config = true) {
150
  $products = Mage::getResourceModel('catalog/product_type_configurable_product_collection')
151
  ->addAttributeToFilter('status', 1)
152
  ->addAttributeToFilter('price', array('neq' => 0))
@@ -167,13 +180,18 @@
167
  ->addStoreFilter();
168
 
169
  if(Mage::getStoreConfig('beezup/flux/stock')){
170
- $products= $products->joinField('inventory_in_stock', 'cataloginventory_stock_item', 'is_in_stock', 'product_id=entity_id','is_in_stock>=0', 'left')
171
- ->addAttributeToFilter('inventory_in_stock', array('neq' => 0));
 
172
  }
173
 
174
  $attributes = explode(',', Mage::getStoreConfig('beezup/flux/attributes'));
175
  foreach ($attributes as $a) $products->addAttributeToSelect($a);
176
 
 
 
 
 
177
  $productsArray = $products;
178
 
179
  //si on est dans le cas o� on veut les p�res et les fils
@@ -181,332 +199,332 @@
181
  $productsArray = array();
182
 
183
  foreach($products as $p) {
184
- $productsArray[$p->getParentId()][] = $p;
185
- }
186
  }
187
-
188
- return $productsArray;
189
- }
190
-
191
-
192
- /*
193
- * Collect options applicable to the configurable product for Varation Theme
194
- *
195
- * @param Mage_Catalog_Model_Product $product
196
- * @return String
197
- */
198
-
199
- public function getOptions($product) {
200
- $childs = $this->getConfigurableProducts();
201
-
202
- //si c'est un parent
203
- if(isset($childs[$product->getId()])) {
 
204
  $productAttributeOptions = $product->getTypeInstance(true)->getConfigurableAttributesAsArray($product);
205
 
206
  $attributeOptions = array();
207
 
208
  foreach ($productAttributeOptions as $productAttribute) {
209
- $attributeOptions[] = ucfirst($productAttribute['attribute_code']);
210
  }
211
 
212
  return implode('',$attributeOptions);
213
- }
214
- }
215
-
216
- /*
217
- * Retrieve products stock
218
- *
219
- * @param int $id
220
- * @param int $qty
221
- * @return int
222
- */
223
- public function getQty($productId, $qty = 0)
224
- {
225
- $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($productId);
226
- if ($stockItem->getManageStock()) {
227
  if ($stockItem->getIsInStock()) {
228
- $qty = intval($stockItem->getQty());
229
- $qty = ($qty <= 0) ? 0 : $qty;
230
  }
231
  } else {
232
  $qty = 100;
233
- }
234
- return $qty;
235
- }
236
-
237
- /*
238
- * Retrieve product shipping amount
239
- *
240
- * @param float $weight
241
- * @param Mage_Shipping_Model_Mysql4_Carrier_Tablerate_Collection $tablerates
242
- * @return float
243
- */
244
- public function getShippingAmount($weight, $tablerates)
245
- {
246
- $shipping_amount = 0;
247
-
248
- if ($tablerates && $tablerates instanceof Mage_Shipping_Model_Mysql4_Carrier_Tablerate_Collection) {
249
  foreach ($tablerates as $t) {
250
- if ($weight <= $t->getConditionValue()) $shipping_amount = $t->getPrice();
251
  }
252
  } else {
253
  $shipping_amount = preg_replace('(\,+)', '.', trim(Mage::getStoreConfig('beezup/flux/ship')));
254
  if (!is_numeric($shipping_amount)) $shipping_amount = 0;
255
- }
256
- return $shipping_amount;
257
- }
258
-
259
- /*
260
- * Retrieve Tablerates
261
- *
262
- * @return Mage_Shipping_Model_Mysql4_Carrier_Tablerate_Collection
263
- */
264
- public function getTablerates()
265
- {
266
- return Mage::getResourceModel('shipping/carrier_tablerate_collection')->setOrder('condition_value', 'desc');
267
- }
268
-
269
- /*
270
- * Retrieve product is in stock
271
- *
272
- * @param float $qty
273
- * @return string
274
- */
275
- public function getIsInStock($qty)
276
- {
277
- return ($qty > 0) ? Mage::helper('beezup')->__('In Stock') : Mage::helper('beezup')->__('Out of Stock');
278
- }
279
-
280
- /*
281
- * Retrieve product delivery
282
- *
283
- * @param float $qty
284
- * @return string
285
- */
286
- public function getDelivery($qty)
287
- {
288
- return ($qty > 0) ? Mage::getStoreConfig('beezup/flux/days_in') : Mage::getStoreConfig('beezup/flux/days_out');
289
- }
290
-
291
- /*
292
- * Retrieve store categories as array (recursive)
293
- *
294
- * @param Varien_Data_Tree_Node_Collection $categories
295
- * @param string $parent
296
- * @param array $cats
297
- * @return string
298
- */
299
- public function getCategoriesAsArray($categories, $logic = false, $parent = '', &$cats = array())
300
- {
301
- if($logic) {
302
  $parent = 0;
303
  $i = 0;
304
  $tl_name = '';
305
  $_categories = $categories;
306
  foreach($_categories as $_category){
307
-
308
- if($i==0 ) {
309
- $par_cat = Mage::getModel('catalog/category')->load($_category->getId())->getParentCategory();
310
-
311
- $cats[$par_cat->getId()] = array("name" => $tl_name.$par_cat->getName(), "id" => $par_cat->getId(), "parent" => $par_cat->getParentId());
312
- }
313
-
314
-
315
- //$_category = Mage::getModel('catalog/category')->load($_category->getId());
316
- $cats[$_category->getId()] = array("name" => $tl_name.$_category->getName(), "id" => $_category->getId(), "parent" => $_category->getParentId() ); //Toplevel auslesen
317
- $i++;
318
- $_category = Mage::getModel('catalog/category')->load($_category->getId());
319
- $subcats = $this->getChildCategories($_category);
320
-
321
- foreach($subcats as $c) {
322
-
323
- $cats[$c['id']] = array("name" => $tl_name.$c['name'], "id" => $c['id'] , "parent" => $c['parent']);
324
- }
325
  }
326
  return $cats;
327
 
328
  } else {
329
  foreach ($categories as $c) {
330
- $cats[$c['entity_id']] = $parent . $c['name'];
331
-
332
- if (!Mage::helper('catalog/category_flat')->isEnabled()) {
333
- if ($childs = $c->getChildren()) {
334
- $this->getCategoriesAsArray($childs, $logic, $parent . $c['name'] . '||', $cats);
 
 
 
 
 
 
335
  }
336
- } else {
337
- if (isset($c['children_nodes'])) {
338
- $this->getCategoriesAsArray($c['children_nodes'], $logic, $parent . $c['name'] . '||', $cats);
339
- }
340
- }
341
- }
342
- }
343
- return $cats;
344
- }
345
-
346
-
347
- public $_catIds = array();
348
- public function getChildCategories($categoryObject){
349
- $categories = $categoryObject->getChildrenCategories();
350
- foreach ($categories as $catgory){
351
  if($catgory->hasChildren()){
352
- $this->getChildCategories($catgory);
353
  }
354
  $this->_catIds[] = array("id" => $catgory->getId(), "name" => $catgory->getName(), "parent" => $catgory->getParentId());
355
- }
356
- return $this->_catIds;
357
- }
358
-
359
- /*
360
- * Retrieve product categories
361
- *
362
- * @param Mage_Catalog_Model_Product $product
363
- * @param array $categories
364
- * @return array
365
- */
366
- public function getProductsCategories($product,$categories)
367
- {
368
-
369
-
370
- $_categories = $product->getCategoryIds();
371
-
372
- sort($_categories);
373
- $result = array();
374
- if(count($_categories)) {
375
  $_count = 0;
376
  foreach($_categories as $c) {
377
- if(isset($categories[$c])) {
378
- if(count(explode('||',$categories[$c])) > $_count) $result = explode('||',$categories[$c]);
379
- $_count = count($result);
380
- }
381
  }
382
- }
383
-
384
- return $result;
385
- }
386
-
387
-
388
- /*
389
- * Retrieve product categories
390
- *
391
- * @param Mage_Catalog_Model_Product $product
392
- * @param array $categories
393
- * @return array
394
- */
395
- public function getProductsCategories2($product,$categories)
396
- {
397
- $result = array();
398
- $_categories = $product->getCategoryIds();
399
- $parent_id = 0;
400
- $parent_id = 0;
401
- $i = 0;
402
- sort($_categories);
403
-
404
- if(count($_categories)) {
405
  $_count = 0;
406
  foreach($_categories as $c) {
407
- if(isset($categories[$c])) {
408
- if( $parent_id == $categories[$c]['parent'] || $i <= 1) {
409
- $result[] = $categories[$c]['name'];
410
-
411
-
412
- $parent_id = $categories[$c]['id'];
413
-
414
- }
415
- $i++;
416
- // if(count(explode('||',$categories[$c])) > $_count) $result = explode('||',$categories[$c]);
417
- $_count = count($result);
418
- }
419
- }
420
  }
421
- return $result;
422
- }
423
-
424
-
425
- /*
426
- * Retrieve current store
427
- *
428
- * @return Mage_Core_Model_Store
429
- */
430
- public function getStore()
431
- {
432
- return Mage::app()->getStore();
433
- }
434
-
435
-
436
-
437
-
438
-
439
- /**
440
- * Get shipping price
441
- *
442
- * @param Mage_Catalog_Model_Product $product_instance
443
- * @param string $carrierValue
444
- * @param string $countryCode
445
- *
446
- * @return mixed
447
- */
448
- public function _getShippingPrice($product_instance, $carrierValue, $countryCode = 'FR')
449
- {
450
- $carrierTab = explode('_', $carrierValue);
451
- list($carrierCode, $methodCode) = $carrierTab;
452
- $shipping = Mage::getModel('shipping/shipping');
453
- $methodModel = $shipping->getCarrierByCode($carrierCode);
454
- if($methodModel) {
 
455
  $result = $methodModel->collectRates($this->_getShippingRateRequest($product_instance, $countryCode));
456
  if($result != NULL) {
457
- if($result->getError()) {
458
- return 0;
459
- } else {
460
- foreach($result->getAllRates() as $rate) {
461
- return $rate->getPrice();
462
- }
463
- }
464
- } else {
465
- return 0;
466
  }
467
- }
468
- return 0;
469
- }
470
-
471
- /**
472
- * Get Shipping rate request
473
- *
474
- * @param Mage_Catalog_Model_Product $product_instance
475
- * @param string $countryCode
476
- *
477
- * @return Mage_Shipping_Model_Rate_Request
478
- */
479
- protected function _getShippingRateRequest($product_instance, $countryCode = 'FR')
480
- {
481
- /** @var $request Mage_Shipping_Model_Rate_Request */
482
- $request = Mage::getModel('shipping/rate_request');
483
- $storeId = $request->getStoreId();
484
- if (!$request->getOrig()) {
485
  $request->setCountryId($countryCode)
486
  ->setRegionId('')
487
  ->setCity('')
488
  ->setPostcode('');
489
- }
490
- $item = Mage::getModel('sales/quote_item');
491
- $item->setStoreId($storeId);
492
- $item->setOptions($product_instance->getCustomOptions())
493
- ->setProduct($product_instance);
494
- $request->setAllItems(array($item));
495
- $request->setDestCountryId($countryCode);
496
- $request->setDestRegionId('');
497
- $request->setDestRegionCode('');
498
- $request->setDestPostcode('');
499
- $request->setPackageValue($product_instance->getPrice());
500
- $request->setPackageValueWithDiscount($product_instance->getFinalPrice());
501
- $request->setPackageWeight($product_instance->getWeight());
502
- $request->setFreeMethodWeight(0);
503
- $request->setPackageQty(1);
504
- $request->setStoreId(Mage::app()->getStore()->getId());
505
- $request->setWebsiteId(Mage::app()->getStore()->getWebsiteId());
506
- $request->setBaseCurrency(Mage::app()->getStore()->getBaseCurrency());
507
- $request->setPackageCurrency(Mage::app()->getStore()->getCurrentCurrency());
508
- return $request;
509
- }
510
-
511
-
512
- }
9
  * @param bool $configurable
10
  * @return Mage_Catalog_Model_Resource_Product_Collection?
11
  */
12
+ public function getProducts($configurable = false, $pagination= false)
13
  {
14
  $products = Mage::getResourceModel('catalog/product_collection')
15
  ->addAttributeToFilter('status', 1)
57
  if($configurable) $products->addAttributeToFilter('type_id', Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE);
58
 
59
  if(Mage::getStoreConfig('beezup/flux/stock')){
60
+ Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($products);
61
+ //$products= $products->joinField('inventory_in_stock', 'cataloginventory_stock_item', 'is_in_stock', 'product_id=entity_id','is_in_stock>=0', 'left')
62
+ //->addAttributeToFilter('inventory_in_stock', array('neq' => 0));
63
  }
64
 
65
  $attributes = explode(',', Mage::getStoreConfig('beezup/flux/attributes'));
67
 
68
  if (Mage::getStoreConfig('beezup/flux/debug_flux')) $products->setPageSize(10);
69
 
70
+ if($pagination) {
71
+
72
+ $products->setPageSize((int)$pagination['limit'])->setCurPage((int)$pagination['page']);
73
+
74
+ }
75
+
76
  return $products;
77
  }
78
 
87
  return $products;
88
  }
89
 
90
+ public function getProductsSimple($pagination= false)
91
  {
92
  $products = Mage::getResourceModel('catalog/product_collection')
93
  ->addAttributeToFilter('status', 1)
136
  $products->addAttributeToFilter('type_id', Mage_Catalog_Model_Product_Type::TYPE_SIMPLE);
137
 
138
  if(Mage::getStoreConfig('beezup/flux/stock')){
139
+ Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($products);
140
+ //$products= $products->joinField('inventory_in_stock', 'cataloginventory_stock_item', 'is_in_stock', 'product_id=entity_id','is_in_stock>=0', 'left')
141
+ //->addAttributeToFilter('inventory_in_stock', array('neq' => 0));
142
  }
143
 
144
  $attributes = explode(',', Mage::getStoreConfig('beezup/flux/attributes'));
146
 
147
  if (Mage::getStoreConfig('beezup/flux/debug_flux')) $products->setPageSize(10);
148
 
149
+ if($pagination) {
150
+ $products->setPageSize($pagination['limit'])->setCurPage($pagination['page']);
151
+
152
+ }
153
+
154
  return $products;
155
  }
156
 
159
  *
160
  * @return Mage_Catalog_Model_Resource_Product_Collection?
161
  */
162
+ public function getConfigurableProducts($config = true, $pagination= false) {
163
  $products = Mage::getResourceModel('catalog/product_type_configurable_product_collection')
164
  ->addAttributeToFilter('status', 1)
165
  ->addAttributeToFilter('price', array('neq' => 0))
180
  ->addStoreFilter();
181
 
182
  if(Mage::getStoreConfig('beezup/flux/stock')){
183
+ Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($products);
184
+ //$products= $products->joinField('inventory_in_stock', 'cataloginventory_stock_item', 'is_in_stock', 'product_id=entity_id','is_in_stock>=0', 'left')
185
+ //->addAttributeToFilter('inventory_in_stock', array('neq' => 0));
186
  }
187
 
188
  $attributes = explode(',', Mage::getStoreConfig('beezup/flux/attributes'));
189
  foreach ($attributes as $a) $products->addAttributeToSelect($a);
190
 
191
+ if($pagination) {
192
+ $products->setPageSize($pagination['limit'])->setCurPage($pagination['page']);
193
+ }
194
+
195
  $productsArray = $products;
196
 
197
  //si on est dans le cas o� on veut les p�res et les fils
199
  $productsArray = array();
200
 
201
  foreach($products as $p) {
202
+ $productsArray[$p->getParentId()][] = $p;
 
203
  }
204
+ }
205
+
206
+ return $productsArray;
207
+ }
208
+
209
+
210
+ /*
211
+ * Collect options applicable to the configurable product for Varation Theme
212
+ *
213
+ * @param Mage_Catalog_Model_Product $product
214
+ * @return String
215
+ */
216
+
217
+ public function getOptions($product) {
218
+ $childs = $this->getConfigurableProducts();
219
+
220
+ //si c'est un parent
221
+ if(isset($childs[$product->getId()])) {
222
  $productAttributeOptions = $product->getTypeInstance(true)->getConfigurableAttributesAsArray($product);
223
 
224
  $attributeOptions = array();
225
 
226
  foreach ($productAttributeOptions as $productAttribute) {
227
+ $attributeOptions[] = ucfirst($productAttribute['attribute_code']);
228
  }
229
 
230
  return implode('',$attributeOptions);
231
+ }
232
+ }
233
+
234
+ /*
235
+ * Retrieve products stock
236
+ *
237
+ * @param int $id
238
+ * @param int $qty
239
+ * @return int
240
+ */
241
+ public function getQty($productId, $qty = 0)
242
+ {
243
+ $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($productId);
244
+ if ($stockItem->getManageStock()) {
245
  if ($stockItem->getIsInStock()) {
246
+ $qty = intval($stockItem->getQty());
247
+ $qty = ($qty <= 0) ? 0 : $qty;
248
  }
249
  } else {
250
  $qty = 100;
251
+ }
252
+ return $qty;
253
+ }
254
+
255
+ /*
256
+ * Retrieve product shipping amount
257
+ *
258
+ * @param float $weight
259
+ * @param Mage_Shipping_Model_Mysql4_Carrier_Tablerate_Collection $tablerates
260
+ * @return float
261
+ */
262
+ public function getShippingAmount($weight, $tablerates)
263
+ {
264
+ $shipping_amount = 0;
265
+
266
+ if ($tablerates && $tablerates instanceof Mage_Shipping_Model_Mysql4_Carrier_Tablerate_Collection) {
267
  foreach ($tablerates as $t) {
268
+ if ($weight <= $t->getConditionValue()) $shipping_amount = $t->getPrice();
269
  }
270
  } else {
271
  $shipping_amount = preg_replace('(\,+)', '.', trim(Mage::getStoreConfig('beezup/flux/ship')));
272
  if (!is_numeric($shipping_amount)) $shipping_amount = 0;
273
+ }
274
+ return $shipping_amount;
275
+ }
276
+
277
+ /*
278
+ * Retrieve Tablerates
279
+ *
280
+ * @return Mage_Shipping_Model_Mysql4_Carrier_Tablerate_Collection
281
+ */
282
+ public function getTablerates()
283
+ {
284
+ return Mage::getResourceModel('shipping/carrier_tablerate_collection')->setOrder('condition_value', 'desc');
285
+ }
286
+
287
+ /*
288
+ * Retrieve product is in stock
289
+ *
290
+ * @param float $qty
291
+ * @return string
292
+ */
293
+ public function getIsInStock($qty)
294
+ {
295
+ return ($qty > 0) ? Mage::helper('beezup')->__('In Stock') : Mage::helper('beezup')->__('Out of Stock');
296
+ }
297
+
298
+ /*
299
+ * Retrieve product delivery
300
+ *
301
+ * @param float $qty
302
+ * @return string
303
+ */
304
+ public function getDelivery($qty)
305
+ {
306
+ return ($qty > 0) ? Mage::getStoreConfig('beezup/flux/days_in') : Mage::getStoreConfig('beezup/flux/days_out');
307
+ }
308
+
309
+ /*
310
+ * Retrieve store categories as array (recursive)
311
+ *
312
+ * @param Varien_Data_Tree_Node_Collection $categories
313
+ * @param string $parent
314
+ * @param array $cats
315
+ * @return string
316
+ */
317
+ public function getCategoriesAsArray($categories, $logic = false, $parent = '', &$cats = array())
318
+ {
319
+ if($logic) {
320
  $parent = 0;
321
  $i = 0;
322
  $tl_name = '';
323
  $_categories = $categories;
324
  foreach($_categories as $_category){
325
+
326
+ if($i==0 ) {
327
+ $par_cat = Mage::getModel('catalog/category')->load($_category->getId())->getParentCategory();
328
+
329
+ $cats[$par_cat->getId()] = array("name" => $tl_name.$par_cat->getName(), "id" => $par_cat->getId(), "parent" => $par_cat->getParentId());
330
+ }
331
+
332
+
333
+ //$_category = Mage::getModel('catalog/category')->load($_category->getId());
334
+ $cats[$_category->getId()] = array("name" => $tl_name.$_category->getName(), "id" => $_category->getId(), "parent" => $_category->getParentId() ); //Toplevel auslesen
335
+ $i++;
336
+ $_category = Mage::getModel('catalog/category')->load($_category->getId());
337
+ $subcats = $this->getChildCategories($_category);
338
+
339
+ foreach($subcats as $c) {
340
+
341
+ $cats[$c['id']] = array("name" => $tl_name.$c['name'], "id" => $c['id'] , "parent" => $c['parent']);
342
+ }
343
  }
344
  return $cats;
345
 
346
  } else {
347
  foreach ($categories as $c) {
348
+ $cats[$c['entity_id']] = $parent . $c['name'];
349
+
350
+ if (!Mage::helper('catalog/category_flat')->isEnabled()) {
351
+ if ($childs = $c->getChildren()) {
352
+ $this->getCategoriesAsArray($childs, $logic, $parent . $c['name'] . '||', $cats);
353
+ }
354
+ } else {
355
+ if (isset($c['children_nodes'])) {
356
+ $this->getCategoriesAsArray($c['children_nodes'], $logic, $parent . $c['name'] . '||', $cats);
357
+ }
358
+ }
359
  }
360
+ }
361
+ return $cats;
362
+ }
363
+
364
+
365
+ public $_catIds = array();
366
+ public function getChildCategories($categoryObject){
367
+ $categories = $categoryObject->getChildrenCategories();
368
+ foreach ($categories as $catgory){
 
 
 
 
 
 
369
  if($catgory->hasChildren()){
370
+ $this->getChildCategories($catgory);
371
  }
372
  $this->_catIds[] = array("id" => $catgory->getId(), "name" => $catgory->getName(), "parent" => $catgory->getParentId());
373
+ }
374
+ return $this->_catIds;
375
+ }
376
+
377
+ /*
378
+ * Retrieve product categories
379
+ *
380
+ * @param Mage_Catalog_Model_Product $product
381
+ * @param array $categories
382
+ * @return array
383
+ */
384
+ public function getProductsCategories($product,$categories)
385
+ {
386
+
387
+
388
+ $_categories = $product->getCategoryIds();
389
+
390
+ sort($_categories);
391
+ $result = array();
392
+ if(count($_categories)) {
393
  $_count = 0;
394
  foreach($_categories as $c) {
395
+ if(isset($categories[$c])) {
396
+ if(count(explode('||',$categories[$c])) > $_count) $result = explode('||',$categories[$c]);
397
+ $_count = count($result);
398
+ }
399
  }
400
+ }
401
+
402
+ return $result;
403
+ }
404
+
405
+
406
+ /*
407
+ * Retrieve product categories
408
+ *
409
+ * @param Mage_Catalog_Model_Product $product
410
+ * @param array $categories
411
+ * @return array
412
+ */
413
+ public function getProductsCategories2($product,$categories)
414
+ {
415
+ $result = array();
416
+ $_categories = $product->getCategoryIds();
417
+ $parent_id = 0;
418
+ $parent_id = 0;
419
+ $i = 0;
420
+ sort($_categories);
421
+
422
+ if(count($_categories)) {
423
  $_count = 0;
424
  foreach($_categories as $c) {
425
+ if(isset($categories[$c])) {
426
+ if( $parent_id == $categories[$c]['parent'] || $i <= 1) {
427
+ $result[] = $categories[$c]['name'];
428
+
429
+
430
+ $parent_id = $categories[$c]['id'];
431
+
432
+ }
433
+ $i++;
434
+ // if(count(explode('||',$categories[$c])) > $_count) $result = explode('||',$categories[$c]);
435
+ $_count = count($result);
436
+ }
 
437
  }
438
+ }
439
+ return $result;
440
+ }
441
+
442
+
443
+ /*
444
+ * Retrieve current store
445
+ *
446
+ * @return Mage_Core_Model_Store
447
+ */
448
+ public function getStore()
449
+ {
450
+ return Mage::app()->getStore();
451
+ }
452
+
453
+
454
+
455
+
456
+
457
+ /**
458
+ * Get shipping price
459
+ *
460
+ * @param Mage_Catalog_Model_Product $product_instance
461
+ * @param string $carrierValue
462
+ * @param string $countryCode
463
+ *
464
+ * @return mixed
465
+ */
466
+ public function _getShippingPrice($product_instance, $carrierValue, $countryCode = 'FR')
467
+ {
468
+ $carrierTab = explode('_', $carrierValue);
469
+ list($carrierCode, $methodCode) = $carrierTab;
470
+ $shipping = Mage::getModel('shipping/shipping');
471
+ $methodModel = $shipping->getCarrierByCode($carrierCode);
472
+ if($methodModel) {
473
  $result = $methodModel->collectRates($this->_getShippingRateRequest($product_instance, $countryCode));
474
  if($result != NULL) {
475
+ if($result->getError()) {
476
+ return 0;
477
+ } else {
478
+ foreach($result->getAllRates() as $rate) {
479
+ return $rate->getPrice();
480
+ }
481
+ }
482
+ } else {
483
+ return 0;
484
  }
485
+ }
486
+ return 0;
487
+ }
488
+
489
+ /**
490
+ * Get Shipping rate request
491
+ *
492
+ * @param Mage_Catalog_Model_Product $product_instance
493
+ * @param string $countryCode
494
+ *
495
+ * @return Mage_Shipping_Model_Rate_Request
496
+ */
497
+ protected function _getShippingRateRequest($product_instance, $countryCode = 'FR')
498
+ {
499
+ /** @var $request Mage_Shipping_Model_Rate_Request */
500
+ $request = Mage::getModel('shipping/rate_request');
501
+ $storeId = $request->getStoreId();
502
+ if (!$request->getOrig()) {
503
  $request->setCountryId($countryCode)
504
  ->setRegionId('')
505
  ->setCity('')
506
  ->setPostcode('');
507
+ }
508
+ $item = Mage::getModel('sales/quote_item');
509
+ $item->setStoreId($storeId);
510
+ $item->setOptions($product_instance->getCustomOptions())
511
+ ->setProduct($product_instance);
512
+ $request->setAllItems(array($item));
513
+ $request->setDestCountryId($countryCode);
514
+ $request->setDestRegionId('');
515
+ $request->setDestRegionCode('');
516
+ $request->setDestPostcode('');
517
+ $request->setPackageValue($product_instance->getPrice());
518
+ $request->setPackageValueWithDiscount($product_instance->getFinalPrice());
519
+ $request->setPackageWeight($product_instance->getWeight());
520
+ $request->setFreeMethodWeight(0);
521
+ $request->setPackageQty(1);
522
+ $request->setStoreId(Mage::app()->getStore()->getId());
523
+ $request->setWebsiteId(Mage::app()->getStore()->getWebsiteId());
524
+ $request->setBaseCurrency(Mage::app()->getStore()->getBaseCurrency());
525
+ $request->setPackageCurrency(Mage::app()->getStore()->getCurrentCurrency());
526
+ return $request;
527
+ }
528
+
529
+
530
+ }
app/code/community/BeezUp/Model/System/Config/Backend/Credentials.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
- require_once dirname ( __FILE__ ) . "/../../../../lib/bootstrap.php";
4
- require_once dirname ( __FILE__ ) . "/../../../../lib/BeezupRepository.php";
5
 
6
 
7
  class Beezup_Model_System_Config_Backend_Credentials extends Mage_Core_Model_Config_Data
1
  <?php
2
 
3
+ require_once Mage::getModuleDir('', 'BeezUp') . DS . 'lib' . DS ."bootstrap.php";
4
+ require_once Mage::getModuleDir('', 'BeezUp') . DS . 'lib' . DS ."BeezupRepository.php";
5
 
6
 
7
  class Beezup_Model_System_Config_Backend_Credentials extends Mage_Core_Model_Config_Data
app/code/community/BeezUp/controllers/CatalogController.php CHANGED
@@ -1,38 +1,60 @@
1
  <?php
2
-
3
- class BeezUp_CatalogController extends Mage_Core_Controller_Front_Action
4
- {
5
-
6
- public function preDispatch()
7
- {
8
- Mage::app()->loadAreaPart(Mage_Core_Model_App_Area::AREA_FRONTEND,Mage_Core_Model_App_Area::PART_EVENTS);
9
- parent::preDispatch();
10
-
11
- $helper = Mage::helper('beezup');
12
-
13
- $_active = $helper->getConfig('beezup/flux/active');
14
- $_ip = $helper->getConfig('beezup/flux/ip');
15
- $_key = $helper->getConfig('beezup/flux/key');
16
-
17
- if (!$_active || ($_ip && $_ip != $helper->getRemoteAddr()) || ($_key && $this->getRequest()->getParam('key') != $_key)) {
18
- $this->norouteAction();
19
- }
20
- }
21
-
22
- public function xmlAction()
23
- {
24
-
25
- $this->getResponse()->setHeader('Content-Type', 'text/xml')->setBody($this->getLayout()->createBlock('beezup/xml')->setConfigurable(false)->setChildXML(false)->toHtml());
26
- }
27
-
28
- public function configurableAction()
29
- {
30
- $this->getResponse()->setHeader('Content-Type', 'text/xml')->setBody($this->getLayout()->createBlock('beezup/xml')->setConfigurable(true)->setChildXML(false)->toHtml());
31
- }
32
 
33
- public function childAction()
34
- {
35
- $this->getResponse()->setHeader('Content-Type', 'text/xml')->setBody($this->getLayout()->createBlock('beezup/xml')->setConfigurable(false)->setChildXML(true)->toHtml());
36
- }
37
-
38
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
+ class BeezUp_CatalogController extends Mage_Core_Controller_Front_Action
4
+ {
5
+
6
+ public function preDispatch()
7
+ {
8
+ Mage::app()->loadAreaPart(Mage_Core_Model_App_Area::AREA_FRONTEND,Mage_Core_Model_App_Area::PART_EVENTS);
9
+ parent::preDispatch();
10
+
11
+ $helper = Mage::helper('beezup');
12
+
13
+ $_active = $helper->getConfig('beezup/flux/active');
14
+ $_ip = $helper->getConfig('beezup/flux/ip');
15
+ $_key = $helper->getConfig('beezup/flux/key');
16
+
17
+ if (!$_active || ($_ip && $_ip != $helper->getRemoteAddr()) || ($_key && $this->getRequest()->getParam('key') != $_key)) {
18
+ $this->norouteAction();
19
+ }
20
+ }
21
+
22
+ public function xmlAction()
23
+ {
24
+
25
+ $this->getResponse()->setHeader('Content-Type', 'text/xml')->setBody($this->getLayout()->createBlock('beezup/xml')->setConfigurable(false)->setChildXML(false)->setPagination(false)->toHtml());
26
+ }
27
+
28
+ public function configurableAction()
29
+ {
30
+ $this->getResponse()->setHeader('Content-Type', 'text/xml')->setBody($this->getLayout()->createBlock('beezup/xml')->setConfigurable(true)->setChildXML(false)->setPagination(false)->toHtml());
31
+ }
32
+
33
+ public function childAction()
34
+ {
35
+ $this->getResponse()->setHeader('Content-Type', 'text/xml')->setBody($this->getLayout()->createBlock('beezup/xml')->setConfigurable(false)->setChildXML(true)->setPagination(false)->toHtml());
36
+ }
37
+
38
+
39
+ public function paginateAction() {
40
+ $feed = $this->getRequest()->getParam('feed');
41
+ $limit = $this->getRequest()->getParam('limit');
42
+ $page = $this->getRequest()->getParam('page');
43
+ if(empty($feed) || empty($limit) || empty($page) || !is_numeric($limit) || !is_numeric($page)) {
44
+ echo "Error you need to specify: feed, limit and page";
45
+ die();
46
+ }
47
+
48
+ $pagination = array("limit" => (int)$limit, "page" => (int)$page);
49
+ if($feed == "xml") {
50
+ $this->getResponse()->setHeader('Content-Type', 'text/xml')->setBody($this->getLayout()->createBlock('beezup/xml')->setConfigurable(false)->setChildXML(false)->setPagination($pagination)->toHtml());
51
+ } elseif($feed == "configurable") {
52
+ $this->getResponse()->setHeader('Content-Type', 'text/xml')->setBody($this->getLayout()->createBlock('beezup/xml')->setConfigurable(true)->setChildXML(false)->setPagination($pagination)->toHtml());
53
+ } elseif($feed == "child") {
54
+ $this->getResponse()->setHeader('Content-Type', 'text/xml')->setBody($this->getLayout()->createBlock('beezup/xml')->setConfigurable(false)->setChildXML(true)->setPagination($pagination)->toHtml());
55
+
56
+ }
57
+ }
58
+
59
+
60
+ }
app/code/community/BeezUp/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <BeezUp>
5
- <version>4.6.1</version>
6
  </BeezUp>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <BeezUp>
5
+ <version>4.6.2</version>
6
  </BeezUp>
7
  </modules>
8
  <global>
app/code/community/BeezUp/etc/system.xml CHANGED
@@ -13,7 +13,7 @@
13
  <tracking translate="label">
14
  <label>Tracking</label>
15
  <frontend_type>text</frontend_type>
16
- <comment><![CDATA[<div style="font-size:11px;padding:3px;margin-bottom:20px;background:#FFF9E9;border:1px solid #EEE2BE">Support BeezUP : <a href="mailto:help@beezup.com">help@beezup.com</a> (Magento BeezUP v4.6.1) - <a href="http://go.beezup.com" target="_blank">My BeezUP Account</a></div>]]></comment>
17
  <sort_order>1</sort_order>
18
  <show_in_default>1</show_in_default>
19
  <show_in_website>1</show_in_website>
@@ -77,7 +77,7 @@
77
  <marketplace tanslate="label">
78
  <label>Marketplace</label>
79
  <frontend_type>text</frontend_type>
80
- <comment><![CDATA[<div style="font-size:11px;padding:3px;margin-bottom:20px;background:#FFF9E9;border:1px solid #EEE2BE">Support BeezUP : <a href="mailto:help@beezup.com">help@beezup.com</a> (Magento BeezUP v4.6.1) - <a href="http://go.beezup.com" target="_blank">My BeezUP Account</a></div>]]></comment>
81
  <sort_order>2</sort_order>
82
  <show_in_default>1</show_in_default>
83
  <show_in_website>1</show_in_website>
@@ -409,7 +409,7 @@
409
  <flux translate="label">
410
  <label>Catalog Flow</label>
411
  <frontend_type>text</frontend_type>
412
- <comment><![CDATA[<div style="font-size:11px;padding:3px;margin-bottom:20px;background:#FFF9E9;border:1px solid #EEE2BE">Support BeezUP : <a href="mailto:help@beezup.com">help@beezup.com</a> (Magento BeezUP v4.6.1) - <a href="http://go.beezup.com" target="_blank">My BeezUP Account</a></div>]]></comment>
413
  <sort_order>2</sort_order>
414
  <show_in_default>1</show_in_default>
415
  <show_in_website>1</show_in_website>
13
  <tracking translate="label">
14
  <label>Tracking</label>
15
  <frontend_type>text</frontend_type>
16
+ <comment><![CDATA[<div style="font-size:11px;padding:3px;margin-bottom:20px;background:#FFF9E9;border:1px solid #EEE2BE">Support BeezUP : <a href="mailto:help@beezup.com">help@beezup.com</a> (Magento BeezUP v4.6.2) - <a href="http://go.beezup.com" target="_blank">My BeezUP Account</a></div>]]></comment>
17
  <sort_order>1</sort_order>
18
  <show_in_default>1</show_in_default>
19
  <show_in_website>1</show_in_website>
77
  <marketplace tanslate="label">
78
  <label>Marketplace</label>
79
  <frontend_type>text</frontend_type>
80
+ <comment><![CDATA[<div style="font-size:11px;padding:3px;margin-bottom:20px;background:#FFF9E9;border:1px solid #EEE2BE">Support BeezUP : <a href="mailto:help@beezup.com">help@beezup.com</a> (Magento BeezUP v4.6.2) - <a href="http://go.beezup.com" target="_blank">My BeezUP Account</a></div>]]></comment>
81
  <sort_order>2</sort_order>
82
  <show_in_default>1</show_in_default>
83
  <show_in_website>1</show_in_website>
409
  <flux translate="label">
410
  <label>Catalog Flow</label>
411
  <frontend_type>text</frontend_type>
412
+ <comment><![CDATA[<div style="font-size:11px;padding:3px;margin-bottom:20px;background:#FFF9E9;border:1px solid #EEE2BE">Support BeezUP : <a href="mailto:help@beezup.com">help@beezup.com</a> (Magento BeezUP v4.6.2) - <a href="http://go.beezup.com" target="_blank">My BeezUP Account</a></div>]]></comment>
413
  <sort_order>2</sort_order>
414
  <show_in_default>1</show_in_default>
415
  <show_in_website>1</show_in_website>
app/code/community/BeezUp/log/log.txt DELETED
@@ -1,16 +0,0 @@
1
- 2016-03-18 16:15:55 | INFO | Initializing OM Importation
2
- 2016-03-18 16:15:56 | INFO | 404-3346486-8692320 | Store Matching succesful, Beezup Store: bdd7b7cf-558c-48a1-984b-00303aecdc34 , Magento Store Id: 1
3
- 2016-03-18 16:15:56 | ERROR | 404-3346486-8692320| No Product Matching, Product 14328 could not be found
4
- 2016-03-18 16:15:57 | INFO | 404-3346486-8692320 | Store Matching succesful, Beezup Store: bdd7b7cf-558c-48a1-984b-00303aecdc34 , Magento Store Id: 1
5
- 2016-03-18 16:15:57 | INFO | 404-3346486-8692320 | Product Matching succesful, Beezup Imported Id: 14328 , Magento Product Id: 1019
6
- 2016-03-18 16:15:57 | INFO | 404-3346486-8692320 | Generating Order
7
- 2016-03-18 16:15:57 | INFO | 404-3346486-8692320 | Adding 1 product/s with id 1019 to order, with Beezup Price: 10
8
- 2016-03-18 16:15:57 | INFO | 404-3346486-8692320 | Creating new Customer
9
- 2016-03-18 16:15:58 | INFO | 404-3346486-8692320 | Customer created succesfully
10
- 2016-03-18 16:15:58 | INFO | 404-3346486-8692320 | Adding Order Shipping Cost: 3
11
- 2016-03-18 16:16:00 | INFO | 404-3346486-8692320 | Adding Beezup Marketplace Information to Order
12
- 2016-03-18 16:16:00 | INFO | 404-3346486-8692320 | Sending Magento Order Id to Beezup, Magento Order Id: 241
13
- 2016-03-18 16:16:02 | INFO | 404-3346486-8692320 | Setting Order Status to InProgress
14
- 2016-03-18 16:16:02 | INFO | 404-3346486-8692320 | Generating Order Payment Invoice
15
- 2016-03-18 16:16:03 | INFO | 404-3346486-8692320 | Order Payment Invoice Generated Succesfully
16
- 2016-03-18 16:16:03 | INFO | 404-3346486-8692320 | Order imported succesfully, Magento Order Id: 241
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/BeezUp/log/log2.txt DELETED
@@ -1,293 +0,0 @@
1
- 2016-02-14 11:21:20 | INFO | Initializing OM Importation
2
- 2016-02-14 11:21:24 | INFO | 238381552 | Initializing Order - Link: /orders/v1/7fa50176-b2e9-4570-9cce-20b2ff7bd6d0/PriceMinister/1426/8D32AC4F06A92E81db86394d9904b83a949d134c2258e00
3
- 2016-02-14 11:21:24 | INFO | 238381552 | Store Matching succesful, Beezup Store: c466247e-aadf-443c-b8ed-dedce8b281b7 , Magento Store Id: 1
4
- 2016-02-14 11:21:25 | ERROR | 238381552| No Product Matching, Product 4800000 could not be found
5
- 2016-02-14 11:21:30 | INFO | 238381552 | Generating Order
6
- 2016-02-14 11:21:30 | INFO | 238381552 | Adding 1 product/s with id 1008 to order, with Beezup Price: 50.4
7
- 2016-02-14 11:21:31 | INFO | 238381552 | Creating new Customer
8
- 2016-02-14 11:21:31 | ERROR | 238381552 | Customer importation failed: Customer email is required
9
- 2016-02-14 11:29:12 | INFO | Initializing OM Importation
10
- 2016-02-14 11:29:15 | INFO | 238381552 | Initializing Order - Link: /orders/v1/7fa50176-b2e9-4570-9cce-20b2ff7bd6d0/PriceMinister/1426/8D32AC4F06A92E81db86394d9904b83a949d134c2258e00
11
- 2016-02-14 11:29:15 | INFO | 238381552 | Store Matching succesful, Beezup Store: c466247e-aadf-443c-b8ed-dedce8b281b7 , Magento Store Id: 1
12
- 2016-02-14 11:29:15 | INFO | 238381552 | Product Matching succesful, Beezup Imported Id: 4800000 , Magento Product Id: 1008
13
- 2016-02-14 11:29:15 | INFO | 238381552 | Generating Order
14
- 2016-02-14 11:29:15 | INFO | 238381552 | Adding 1 product/s with id 1008 to order, with Beezup Price: 50.4
15
- 2016-02-14 11:30:06 | INFO | Initializing OM Importation
16
- 2016-02-14 11:30:09 | INFO | 238381552 | Initializing Order - Link: /orders/v1/7fa50176-b2e9-4570-9cce-20b2ff7bd6d0/PriceMinister/1426/8D32AC4F06A92E81db86394d9904b83a949d134c2258e00
17
- 2016-02-14 11:30:09 | INFO | 238381552 | Store Matching succesful, Beezup Store: c466247e-aadf-443c-b8ed-dedce8b281b7 , Magento Store Id: 1
18
- 2016-02-14 11:30:10 | INFO | 238381552 | Product Matching succesful, Beezup Imported Id: 4800000 , Magento Product Id: 1008
19
- 2016-02-14 11:30:11 | INFO | 238381552 | Generating Order
20
- 2016-02-14 11:30:11 | INFO | 238381552 | Adding 1 product/s with id 1008 to order, with Beezup Price: 50.4
21
- 2016-02-14 11:30:54 | INFO | Initializing OM Importation
22
- 2016-02-14 11:30:57 | INFO | 238381552 | Initializing Order - Link: /orders/v1/7fa50176-b2e9-4570-9cce-20b2ff7bd6d0/PriceMinister/1426/8D32AC4F06A92E81db86394d9904b83a949d134c2258e00
23
- 2016-02-14 11:30:57 | INFO | 238381552 | Store Matching succesful, Beezup Store: c466247e-aadf-443c-b8ed-dedce8b281b7 , Magento Store Id: 1
24
- 2016-02-14 11:30:57 | INFO | 238381552 | Product Matching succesful, Beezup Imported Id: 4800000 , Magento Product Id: 1008
25
- 2016-02-14 11:30:57 | INFO | 238381552 | Generating Order
26
- 2016-02-14 11:30:57 | INFO | 238381552 | Adding 1 product/s with id 1008 to order, with Beezup Price: 50.4
27
- 2016-02-14 11:42:23 | INFO | Initializing OM Importation
28
- 2016-02-14 11:42:27 | INFO | 238381552 | Initializing Order - Link: /orders/v1/7fa50176-b2e9-4570-9cce-20b2ff7bd6d0/PriceMinister/1426/8D32AC4F06A92E81db86394d9904b83a949d134c2258e00
29
- 2016-02-14 11:42:27 | INFO | 238381552 | Store Matching succesful, Beezup Store: c466247e-aadf-443c-b8ed-dedce8b281b7 , Magento Store Id: 1
30
- 2016-02-14 11:42:27 | INFO | 238381552 | Product Matching succesful, Beezup Imported Id: 4800000 , Magento Product Id: 1008
31
- 2016-02-14 11:42:27 | INFO | 238381552 | Generating Order
32
- 2016-02-14 11:42:27 | INFO | 238381552 | Adding 1 product/s with id 1008 to order, with Beezup Price: 50.4
33
- 2016-02-14 11:47:45 | INFO | Initializing OM Importation
34
- 2016-02-14 11:47:48 | INFO | 238381552 | Initializing Order - Link: /orders/v1/7fa50176-b2e9-4570-9cce-20b2ff7bd6d0/PriceMinister/1426/8D32AC4F06A92E81db86394d9904b83a949d134c2258e00
35
- 2016-02-14 11:47:48 | INFO | 238381552 | Store Matching succesful, Beezup Store: c466247e-aadf-443c-b8ed-dedce8b281b7 , Magento Store Id: 1
36
- 2016-02-14 11:47:48 | INFO | 238381552 | Product Matching succesful, Beezup Imported Id: 4800000 , Magento Product Id: 1008
37
- 2016-02-14 11:47:48 | INFO | 238381552 | Generating Order
38
- 2016-02-14 11:47:48 | INFO | 238381552 | Adding 1 product/s with id 1008 to order, with Beezup Price: 50.4
39
- 2016-02-14 11:47:48 | INFO | 238381552 | Creating new Customer
40
- 2016-02-14 11:47:49 | INFO | 238381552 | Creating created succesfully
41
- 2016-02-14 11:47:49 | INFO | 238381552 | Adding Order Shipping Cost: 8.05
42
- 2016-02-14 11:47:51 | INFO | 238381552 | Adding Beezup Marketplace Information to Order
43
- 2016-02-14 11:47:51 | INFO | 238381552 | Sending Magento Order Id to Beezup, Magento Order Id: 230
44
- 2016-02-14 11:47:53 | INFO | 238381552 | Setting Order Status to Shipped
45
- 2016-02-14 11:47:53 | INFO | 238381552 | Generating Order Payment Invoice
46
- 2016-02-14 11:47:53 | INFO | 238381552 | Order Payment Invoice Generated Succesfully
47
- 2016-02-14 11:47:53 | INFO | 238381552 | Order imported succesfully, Magento Order Id: 230
48
- 2016-02-14 12:02:53 | INFO | Initializing OM Importation
49
- 2016-02-14 12:04:22 | INFO | Initializing OM Importation
50
- 2016-02-15 17:33:20 | INFO | Initializing OM Importation
51
- 2016-02-15 17:34:48 | INFO | Initializing OM Importation
52
- 2016-02-15 17:35:27 | INFO | Initializing OM Importation
53
- 2016-02-15 17:36:53 | INFO | Initializing OM Importation
54
- 2016-02-15 17:36:56 | INFO | Initializing Order - Link: /orders/v1/7fa50176-b2e9-4570-9cce-20b2ff7bd6d0/PriceMinister/1426/8D32AC4F06A92E81db86394d9904b83a949d134c2258e00
55
- 2016-02-15 17:36:56 | INFO | 238381552 | Store Matching succesful, Beezup Store: c466247e-aadf-443c-b8ed-dedce8b281b7 , Magento Store Id: 1
56
- 2016-02-15 17:36:56 | INFO | 238381552 | Product Matching succesful, Beezup Imported Id: 4800000 , Magento Product Id: 1008
57
- 2016-02-15 17:36:56 | INFO | 238381552 | Updating Etag
58
- 2016-02-15 17:36:56 | INFO | 238381552 | Order Already exists Mage Order ID: 230
59
- 2016-02-15 17:36:57 | INFO | 238381552 | Updating Order Status from: Complete to:
60
- 2016-02-15 17:36:59 | INFO | 238381552 | Initializing Order - Link: /orders/v1/7fa50176-b2e9-4570-9cce-20b2ff7bd6d0/Amazon/827/8D335F739A64E5586803046162340789f3fe9543f1c6c9d
61
- 2016-02-15 17:36:59 | INFO | 404-4178672-2473153 | Store Matching succesful, Beezup Store: c466247e-aadf-443c-b8ed-dedce8b281b7 , Magento Store Id: 1
62
- 2016-02-15 17:36:59 | ERROR | 404-4178672-2473153| No Product Matching, Product 180800000 could not be found
63
- 2016-02-15 17:37:00 | INFO | 404-4178672-2473153 | Generating Order
64
- 2016-02-15 17:37:00 | INFO | 404-4178672-2473153 | Adding 1 product/s with id 1009 to order, with Beezup Price: 166.8
65
- 2016-02-15 17:37:01 | INFO | 404-4178672-2473153 | Creating new Customer
66
- 2016-02-15 17:37:01 | INFO | 404-4178672-2473153 | Customer created succesfully
67
- 2016-02-15 17:37:01 | INFO | 404-4178672-2473153 | Adding Order Shipping Cost: 2.01
68
- 2016-02-15 17:37:03 | INFO | 404-4178672-2473153 | Adding Beezup Marketplace Information to Order
69
- 2016-02-15 17:37:03 | INFO | 404-4178672-2473153 | Sending Magento Order Id to Beezup, Magento Order Id: 231
70
- 2016-02-15 17:37:04 | INFO | 404-4178672-2473153 | Order imported succesfully, Magento Order Id: 231
71
- 2016-02-15 18:08:34 | INFO | Initializing OM Importation
72
- 2016-02-15 18:08:41 | ERROR | 403-3063642-5478711 | No mapping for store bdd7b7cf-558c-48a1-984b-00303aecdc34
73
- 2016-02-15 18:09:57 | INFO | Initializing OM Importation
74
- 2016-02-15 18:10:04 | INFO | 403-3063642-5478711 | Store Matching succesful, Beezup Store: bdd7b7cf-558c-48a1-984b-00303aecdc34 , Magento Store Id: 1
75
- 2016-02-15 18:10:04 | ERROR | 403-3063642-5478711| No Product Matching, Product 16711 could not be found
76
- 2016-02-15 18:10:05 | INFO | 403-3063642-5478711 | Generating Order
77
- 2016-02-15 18:10:05 | INFO | 403-3063642-5478711 | Adding 1 product/s with id 1010 to order, with Beezup Price: 26
78
- 2016-02-15 18:10:05 | INFO | 403-3063642-5478711 | Creating new Customer
79
- 2016-02-15 18:10:05 | INFO | 403-3063642-5478711 | Customer created succesfully
80
- 2016-02-15 18:10:05 | INFO | 403-3063642-5478711 | Adding Order Shipping Cost: 3
81
- 2016-02-15 18:10:06 | INFO | 403-3063642-5478711 | Adding Beezup Marketplace Information to Order
82
- 2016-02-15 18:10:06 | INFO | 403-3063642-5478711 | Sending Magento Order Id to Beezup, Magento Order Id: 232
83
- 2016-02-15 18:10:07 | INFO | 403-3063642-5478711 | Order imported succesfully, Magento Order Id: 232
84
- 2016-02-15 18:15:50 | INFO | Initializing OM Importation
85
- 2016-02-15 18:15:57 | INFO | 403-3063642-5478711 | Order Etag has not changed
86
- 2016-02-15 18:16:47 | INFO | Initializing OM Importation
87
- 2016-02-15 18:16:53 | INFO | 403-3063642-5478711 | Store Matching succesful, Beezup Store: bdd7b7cf-558c-48a1-984b-00303aecdc34 , Magento Store Id: 1
88
- 2016-02-15 18:16:53 | INFO | 403-3063642-5478711 | Product Matching succesful, Beezup Imported Id: 16711 , Magento Product Id: 1010
89
- 2016-02-15 18:16:53 | INFO | 403-3063642-5478711 | Updating Etag
90
- 2016-02-15 18:16:53 | INFO | 403-3063642-5478711 | Order Already exists Mage Order ID: 232
91
- 2016-02-15 18:16:53 | INFO | 403-3063642-5478711 | Updating Order Status from: to: InProgress
92
- 2016-02-15 18:16:53 | INFO | 403-3063642-5478711 | Setting Order Status to InProgress
93
- 2016-02-15 18:16:53 | INFO | 403-3063642-5478711 | Generating Order Payment Invoice
94
- 2016-02-15 18:16:54 | INFO | 403-3063642-5478711 | Order Payment Invoice Generated Succesfully
95
- 2016-02-16 18:11:48 | INFO | Initializing OM Importation
96
- 2016-02-16 18:11:53 | INFO | 403-3063642-5478711 | Store Matching succesful, Beezup Store: bdd7b7cf-558c-48a1-984b-00303aecdc34 , Magento Store Id: 1
97
- 2016-02-16 18:11:53 | INFO | 403-3063642-5478711 | Product Matching succesful, Beezup Imported Id: 16711 , Magento Product Id: 1010
98
- 2016-02-16 18:11:53 | INFO | 403-3063642-5478711 | Updating Etag
99
- 2016-02-16 18:11:53 | INFO | 403-3063642-5478711 | Order Already exists Mage Order ID: 232
100
- 2016-02-16 18:11:53 | INFO | 403-3063642-5478711 | Updating Order Status from: Processing to: Shipped
101
- 2016-02-16 18:11:53 | INFO | 403-3063642-5478711 | Setting Order Status to Shipped
102
- 2016-02-16 18:11:53 | INFO | 403-3063642-5478711 | Generating Order Payment Invoice
103
- 2016-02-17 17:04:01 | INFO | Initializing OM Importation
104
- 2016-02-17 17:04:06 | INFO | 402-4016744-7374764 | Store Matching succesful, Beezup Store: bdd7b7cf-558c-48a1-984b-00303aecdc34 , Magento Store Id: 1
105
- 2016-02-17 17:04:06 | ERROR | 402-4016744-7374764| No Product Matching, Product 15777 could not be found
106
- 2016-02-17 17:04:10 | INFO | 402-4016744-7374764 | Generating Order
107
- 2016-02-17 17:04:10 | INFO | 402-4016744-7374764 | Adding 1 product/s with id 1011 to order, with Beezup Price: 9
108
- 2016-02-17 17:04:11 | INFO | 402-4016744-7374764 | Creating new Customer
109
- 2016-02-17 17:04:11 | INFO | 402-4016744-7374764 | Customer created succesfully
110
- 2016-02-17 17:04:11 | INFO | 402-4016744-7374764 | Adding Order Shipping Cost: 3
111
- 2016-02-17 17:04:14 | INFO | 402-4016744-7374764 | Adding Beezup Marketplace Information to Order
112
- 2016-02-17 17:04:14 | INFO | 402-4016744-7374764 | Sending Magento Order Id to Beezup, Magento Order Id: 233
113
- 2016-02-17 17:04:15 | INFO | 402-4016744-7374764 | Setting Order Status to Shipped
114
- 2016-02-17 17:04:15 | INFO | 402-4016744-7374764 | Generating Order Payment Invoice
115
- 2016-02-17 17:04:16 | INFO | 402-4016744-7374764 | Order Payment Invoice Generated Succesfully
116
- 2016-02-17 17:04:16 | INFO | 402-4016744-7374764 | Order imported succesfully, Magento Order Id: 233
117
- 2016-02-17 17:29:06 | INFO | Initializing OM Importation
118
- 2016-02-17 17:29:12 | INFO | 403-9673370-4170700 | Store Matching succesful, Beezup Store: bdd7b7cf-558c-48a1-984b-00303aecdc34 , Magento Store Id: 1
119
- 2016-02-17 17:29:12 | ERROR | 403-9673370-4170700| No Product Matching, Product 15460 could not be found
120
- 2016-02-17 17:29:13 | INFO | 403-9673370-4170700 | Generating Order
121
- 2016-02-17 17:29:13 | INFO | 403-9673370-4170700 | Adding 1 product/s with id 1012 to order, with Beezup Price: 15
122
- 2016-02-17 17:29:13 | INFO | 403-9673370-4170700 | Creating new Customer
123
- 2016-02-17 17:29:13 | INFO | 403-9673370-4170700 | Customer created succesfully
124
- 2016-02-17 17:29:13 | INFO | 403-9673370-4170700 | Adding Order Shipping Cost: 3
125
- 2016-02-17 17:29:14 | INFO | 403-9673370-4170700 | Adding Beezup Marketplace Information to Order
126
- 2016-02-17 17:29:14 | INFO | 403-9673370-4170700 | Sending Magento Order Id to Beezup, Magento Order Id: 234
127
- 2016-02-17 17:29:15 | INFO | 403-9673370-4170700 | Setting Order Status to InProgress
128
- 2016-02-17 17:29:15 | INFO | 403-9673370-4170700 | Generating Order Payment Invoice
129
- 2016-02-17 17:29:15 | INFO | 403-9673370-4170700 | Order Payment Invoice Generated Succesfully
130
- 2016-02-17 17:29:16 | INFO | 403-9673370-4170700 | Order imported succesfully, Magento Order Id: 234
131
- 2016-03-04 15:01:38 | INFO | Initializing OM Importation
132
- 2016-03-04 15:01:44 | INFO | 402-8076668-0666712 | Store Matching succesful, Beezup Store: bdd7b7cf-558c-48a1-984b-00303aecdc34 , Magento Store Id: 1
133
- 2016-03-04 15:01:44 | ERROR | 402-8076668-0666712| No Product Matching, Product 14452 could not be found
134
- 2016-03-04 15:01:45 | INFO | 402-8076668-0666712 | Generating Order
135
- 2016-03-04 15:01:45 | INFO | 402-8076668-0666712 | Adding 1 product/s with id 1013 to order, with Beezup Price: 18
136
- 2016-03-04 15:01:45 | INFO | 402-8076668-0666712 | Creating new Customer
137
- 2016-03-04 15:01:45 | INFO | 402-8076668-0666712 | Customer created succesfully
138
- 2016-03-04 15:01:45 | INFO | 402-8076668-0666712 | Adding Order Shipping Cost: 3
139
- 2016-03-04 15:01:48 | INFO | 402-8076668-0666712 | Adding Beezup Marketplace Information to Order
140
- 2016-03-04 15:01:48 | INFO | 402-8076668-0666712 | Sending Magento Order Id to Beezup, Magento Order Id: 235
141
- 2016-03-04 15:01:49 | INFO | 402-8076668-0666712 | Setting Order Status to InProgress
142
- 2016-03-04 15:01:49 | INFO | 402-8076668-0666712 | Generating Order Payment Invoice
143
- 2016-03-04 15:01:50 | INFO | 402-8076668-0666712 | Order Payment Invoice Generated Succesfully
144
- 2016-03-04 15:01:50 | INFO | 402-8076668-0666712 | Order imported succesfully, Magento Order Id: 235
145
- 2016-03-04 15:20:50 | INFO | Initializing OM Importation
146
- 2016-03-04 15:20:51 | INFO | MOR-8AD5BM23790272 | Store Matching succesful, Beezup Store: bdd7b7cf-558c-48a1-984b-00303aecdc34 , Magento Store Id: 1
147
- 2016-03-04 15:20:51 | ERROR | MOR-8AD5BM23790272| No Product Matching, Product 15668 could not be found
148
- 2016-03-04 15:20:52 | INFO | MOR-8AD5BM23790272 | Generating Order
149
- 2016-03-04 15:20:52 | INFO | MOR-8AD5BM23790272 | Adding 3 product/s with id 1014 to order, with Beezup Price: 11
150
- 2016-03-04 15:20:52 | INFO | MOR-8AD5BM23790272 | Creating new Customer
151
- 2016-03-04 15:20:53 | INFO | MOR-8AD5BM23790272 | Customer created succesfully
152
- 2016-03-04 15:20:53 | INFO | MOR-8AD5BM23790272 | Adding Order Shipping Cost: 0
153
- 2016-03-04 15:20:53 | INFO | MOR-8AD5BM23790272 | Order Import failed, Trying to import Order Again
154
- 2016-03-04 15:20:53 | INFO | MOR-8AD5BM23790272 | Adding 3 product/s with id 1014 to order, with Beezup Price: 11
155
- 2016-03-04 15:20:53 | INFO | MOR-8AD5BM23790272 | Creating new Customer
156
- 2016-03-04 15:20:53 | INFO | MOR-8AD5BM23790272 | Creating already exists, returning customer object
157
- 2016-03-04 15:20:53 | INFO | MOR-8AD5BM23790272 | Adding Order Shipping Cost: 0
158
- 2016-03-04 15:20:54 | ERROR | MOR-8AD5BM23790272| Order could not be imported, error: Not all products are available in the requested quantity
159
- 2016-03-04 15:23:44 | INFO | Initializing OM Importation
160
- 2016-03-04 15:23:46 | INFO | MOR-8AD5BM23790272 | Store Matching succesful, Beezup Store: bdd7b7cf-558c-48a1-984b-00303aecdc34 , Magento Store Id: 1
161
- 2016-03-04 15:23:46 | INFO | MOR-8AD5BM23790272 | Product Matching succesful, Beezup Imported Id: 15668 , Magento Product Id: 1014
162
- 2016-03-04 15:23:46 | INFO | MOR-8AD5BM23790272 | Generating Order
163
- 2016-03-04 15:23:46 | INFO | MOR-8AD5BM23790272 | Adding 3 product/s with id 1014 to order, with Beezup Price: 11
164
- 2016-03-04 15:23:47 | INFO | MOR-8AD5BM23790272 | Creating new Customer
165
- 2016-03-04 15:23:47 | INFO | MOR-8AD5BM23790272 | Creating already exists, returning customer object
166
- 2016-03-04 15:23:47 | INFO | MOR-8AD5BM23790272 | Adding Order Shipping Cost: 0
167
- 2016-03-04 15:23:47 | INFO | MOR-8AD5BM23790272 | Order Import failed, Trying to import Order Again
168
- 2016-03-04 15:23:47 | INFO | MOR-8AD5BM23790272 | Adding 3 product/s with id 1014 to order, with Beezup Price: 11
169
- 2016-03-04 15:23:47 | INFO | MOR-8AD5BM23790272 | Creating new Customer
170
- 2016-03-04 15:23:47 | INFO | MOR-8AD5BM23790272 | Creating already exists, returning customer object
171
- 2016-03-04 15:23:47 | INFO | MOR-8AD5BM23790272 | Adding Order Shipping Cost: 0
172
- 2016-03-04 15:23:48 | ERROR | MOR-8AD5BM23790272| Order could not be imported, error: Not all products are available in the requested quantity
173
- 2016-03-04 15:25:56 | INFO | Initializing OM Importation
174
- 2016-03-04 15:25:58 | INFO | MOR-8AD5BM23790272 | Store Matching succesful, Beezup Store: bdd7b7cf-558c-48a1-984b-00303aecdc34 , Magento Store Id: 1
175
- 2016-03-04 15:25:58 | INFO | MOR-8AD5BM23790272 | Product Matching succesful, Beezup Imported Id: 15668 , Magento Product Id: 1014
176
- 2016-03-04 15:25:58 | INFO | MOR-8AD5BM23790272 | Generating Order
177
- 2016-03-04 15:25:58 | INFO | MOR-8AD5BM23790272 | Adding 3 product/s with id 1014 to order, with Beezup Price: 11
178
- 2016-03-04 15:25:58 | INFO | MOR-8AD5BM23790272 | Creating new Customer
179
- 2016-03-04 15:25:58 | INFO | MOR-8AD5BM23790272 | Creating already exists, returning customer object
180
- 2016-03-04 15:25:58 | INFO | MOR-8AD5BM23790272 | Adding Order Shipping Cost: 0
181
- 2016-03-04 15:26:00 | INFO | MOR-8AD5BM23790272 | Adding Beezup Marketplace Information to Order
182
- 2016-03-04 15:26:00 | INFO | MOR-8AD5BM23790272 | Sending Magento Order Id to Beezup, Magento Order Id: 236
183
- 2016-03-04 15:26:02 | INFO | MOR-8AD5BM23790272 | Setting Order Status to Shipped
184
- 2016-03-04 15:26:02 | INFO | MOR-8AD5BM23790272 | Generating Order Payment Invoice
185
- 2016-03-04 15:26:02 | INFO | MOR-8AD5BM23790272 | Order Payment Invoice Generated Succesfully
186
- 2016-03-04 15:26:03 | INFO | MOR-8AD5BM23790272 | Order imported succesfully, Magento Order Id: 236
187
- 2016-03-04 15:27:50 | INFO | Initializing OM Importation
188
- 2016-03-04 15:29:16 | INFO | Initializing OM Importation
189
- 2016-03-04 15:29:18 | INFO | MOR-8AD5BM23790272 | Store Matching succesful, Beezup Store: bdd7b7cf-558c-48a1-984b-00303aecdc34 , Magento Store Id: 1
190
- 2016-03-04 15:29:18 | INFO | MOR-8AD5BM23790272 | Product Matching succesful, Beezup Imported Id: 15668 , Magento Product Id: 1014
191
- 2016-03-04 15:29:38 | INFO | Initializing OM Importation
192
- 2016-03-04 15:29:39 | INFO | MOR-8AD5BM23790272 | Store Matching succesful, Beezup Store: bdd7b7cf-558c-48a1-984b-00303aecdc34 , Magento Store Id: 1
193
- 2016-03-04 15:29:39 | INFO | MOR-8AD5BM23790272 | Product Matching succesful, Beezup Imported Id: 15668 , Magento Product Id: 1014
194
- 2016-03-07 10:53:11 | INFO | Initializing OM Importation
195
- 2016-03-07 10:54:06 | INFO | Initializing OM Importation
196
- 2016-03-07 10:54:54 | INFO | Initializing OM Importation
197
- 2016-03-16 15:38:39 | INFO | Initializing OM Importation
198
- 2016-03-16 15:38:40 | INFO | 403-6750959-2690726 | Store Matching succesful, Beezup Store: bdd7b7cf-558c-48a1-984b-00303aecdc34 , Magento Store Id: 1
199
- 2016-03-16 15:38:40 | ERROR | 403-6750959-2690726| No Product Matching, Product 14272 could not be found
200
- 2016-03-16 15:38:41 | INFO | 403-6750959-2690726 | Store Matching succesful, Beezup Store: bdd7b7cf-558c-48a1-984b-00303aecdc34 , Magento Store Id: 1
201
- 2016-03-16 15:38:41 | ERROR | 403-6750959-2690726| No Product Matching, Product 14330 could not be found
202
- 2016-03-16 15:38:42 | INFO | 403-6750959-2690726 | Store Matching succesful, Beezup Store: bdd7b7cf-558c-48a1-984b-00303aecdc34 , Magento Store Id: 1
203
- 2016-03-16 15:38:42 | INFO | 403-6750959-2690726 | Product Matching succesful, Beezup Imported Id: 14272 , Magento Product Id: 1015
204
- 2016-03-16 15:38:42 | INFO | 403-6750959-2690726 | Store Matching succesful, Beezup Store: bdd7b7cf-558c-48a1-984b-00303aecdc34 , Magento Store Id: 1
205
- 2016-03-16 15:38:42 | INFO | 403-6750959-2690726 | Product Matching succesful, Beezup Imported Id: 14330 , Magento Product Id: 1016
206
- 2016-03-16 15:38:42 | INFO | 403-6750959-2690726 | Generating Order
207
- 2016-03-16 15:38:42 | INFO | 403-6750959-2690726 | Adding 1 product/s with id 1015 to order, with Beezup Price: 9
208
- 2016-03-16 15:38:42 | INFO | 403-6750959-2690726 | Adding 1 product/s with id 1016 to order, with Beezup Price: 13
209
- 2016-03-16 15:38:42 | INFO | 403-6750959-2690726 | Creating new Customer
210
- 2016-03-16 15:38:42 | INFO | 403-6750959-2690726 | Customer created succesfully
211
- 2016-03-16 15:38:42 | INFO | 403-6750959-2690726 | Adding Order Shipping Cost: 3
212
- 2016-03-16 15:38:45 | INFO | 403-6750959-2690726 | Adding Beezup Marketplace Information to Order
213
- 2016-03-16 15:38:45 | INFO | 403-6750959-2690726 | Sending Magento Order Id to Beezup, Magento Order Id: 237
214
- 2016-03-16 15:38:46 | INFO | 403-6750959-2690726 | Setting Order Status to InProgress
215
- 2016-03-16 15:38:46 | INFO | 403-6750959-2690726 | Generating Order Payment Invoice
216
- 2016-03-16 15:38:47 | INFO | 403-6750959-2690726 | Order Payment Invoice Generated Succesfully
217
- 2016-03-16 15:38:47 | INFO | 403-6750959-2690726 | Order imported succesfully, Magento Order Id: 237
218
- 2016-03-16 15:41:18 | INFO | Initializing OM Importation
219
- 2016-03-16 15:41:19 | INFO | 403-6750959-2690726 | Store Matching succesful, Beezup Store: bdd7b7cf-558c-48a1-984b-00303aecdc34 , Magento Store Id: 1
220
- 2016-03-16 15:41:19 | INFO | 403-6750959-2690726 | Product Matching succesful, Beezup Imported Id: 14272 , Magento Product Id: 1015
221
- 2016-03-16 15:41:19 | INFO | 403-6750959-2690726 | Store Matching succesful, Beezup Store: bdd7b7cf-558c-48a1-984b-00303aecdc34 , Magento Store Id: 1
222
- 2016-03-16 15:41:19 | INFO | 403-6750959-2690726 | Product Matching succesful, Beezup Imported Id: 14330 , Magento Product Id: 1016
223
- 2016-03-16 15:41:19 | INFO | 403-6750959-2690726 | Order Etag has not changed
224
- 2016-03-16 15:42:52 | INFO | Initializing OM Importation
225
- 2016-03-16 15:42:53 | INFO | 171-5103575-0375518 | Store Matching succesful, Beezup Store: bdd7b7cf-558c-48a1-984b-00303aecdc34 , Magento Store Id: 1
226
- 2016-03-16 15:42:53 | INFO | 171-5103575-0375518 | Product Matching succesful, Beezup Imported Id: 15622 , Magento Product Id: 832
227
- 2016-03-16 15:42:53 | INFO | 171-5103575-0375518 | Store Matching succesful, Beezup Store: bdd7b7cf-558c-48a1-984b-00303aecdc34 , Magento Store Id: 1
228
- 2016-03-16 15:42:53 | INFO | 171-5103575-0375518 | Product Matching succesful, Beezup Imported Id: 15622 , Magento Product Id: 832
229
- 2016-03-16 15:42:53 | INFO | 171-5103575-0375518 | Generating Order
230
- 2016-03-16 15:42:53 | INFO | 171-5103575-0375518 | Adding 1 product/s with id 832 to order, with Beezup Price: 16
231
- 2016-03-16 15:42:53 | INFO | 171-5103575-0375518 | Product 832 Stock = 0, Updating to 1 to generate Order
232
- 2016-03-16 15:42:54 | INFO | 171-5103575-0375518 | Creating new Customer
233
- 2016-03-16 15:42:54 | INFO | 171-5103575-0375518 | Customer created succesfully
234
- 2016-03-16 15:42:54 | INFO | 171-5103575-0375518 | Adding Order Shipping Cost: 3
235
- 2016-03-16 15:42:55 | INFO | 171-5103575-0375518 | Adding Beezup Marketplace Information to Order
236
- 2016-03-16 15:42:55 | INFO | 171-5103575-0375518 | Sending Magento Order Id to Beezup, Magento Order Id: 238
237
- 2016-03-16 15:42:57 | INFO | 171-5103575-0375518 | Setting Order Status to InProgress
238
- 2016-03-16 15:42:57 | INFO | 171-5103575-0375518 | Generating Order Payment Invoice
239
- 2016-03-16 15:42:57 | INFO | 171-5103575-0375518 | Order Payment Invoice Generated Succesfully
240
- 2016-03-16 15:42:58 | INFO | 171-5103575-0375518 | Order imported succesfully, Magento Order Id: 238
241
- 2016-03-16 15:43:31 | INFO | Initializing OM Importation
242
- 2016-03-17 15:22:28 | INFO | Initializing OM Importation
243
- 2016-03-17 15:22:29 | INFO | 402-0432037-5045910 | Store Matching succesful, Beezup Store: bdd7b7cf-558c-48a1-984b-00303aecdc34 , Magento Store Id: 1
244
- 2016-03-17 15:22:29 | ERROR | 402-0432037-5045910| No Product Matching, Product 16336 could not be found
245
- 2016-03-17 15:22:32 | INFO | 402-0432037-5045910 | Store Matching succesful, Beezup Store: bdd7b7cf-558c-48a1-984b-00303aecdc34 , Magento Store Id: 1
246
- 2016-03-17 15:22:32 | INFO | 402-0432037-5045910 | Product Matching succesful, Beezup Imported Id: 16336 , Magento Product Id: 1017
247
- 2016-03-17 15:22:32 | INFO | 402-0432037-5045910 | Generating Order
248
- 2016-03-17 15:22:32 | INFO | 402-0432037-5045910 | Adding 1 product/s with id 1017 to order, with Beezup Price: 12
249
- 2016-03-17 15:22:32 | INFO | 402-0432037-5045910 | Creating new Customer
250
- 2016-03-17 15:22:32 | INFO | 402-0432037-5045910 | Customer created succesfully
251
- 2016-03-17 15:22:32 | INFO | 402-0432037-5045910 | Adding Order Shipping Cost: 3
252
- 2016-03-17 15:22:34 | INFO | 402-0432037-5045910 | Adding Beezup Marketplace Information to Order
253
- 2016-03-17 15:22:34 | INFO | 402-0432037-5045910 | Sending Magento Order Id to Beezup, Magento Order Id: 239
254
- 2016-03-17 15:22:37 | INFO | 402-0432037-5045910 | Setting Order Status to Shipped
255
- 2016-03-17 15:22:37 | INFO | 402-0432037-5045910 | Generating Order Payment Invoice
256
- 2016-03-17 15:22:38 | INFO | 402-0432037-5045910 | Order Payment Invoice Generated Succesfully
257
- 2016-03-17 15:22:38 | INFO | 402-0432037-5045910 | Order imported succesfully, Magento Order Id: 239
258
- 2016-03-17 16:43:03 | INFO | Initializing OM Importation
259
- 2016-03-17 16:43:03 | INFO | 1603162336S0T4A | Store Matching succesful, Beezup Store: bdd7b7cf-558c-48a1-984b-00303aecdc34 , Magento Store Id: 1
260
- 2016-03-17 16:43:04 | ERROR | 1603162336S0T4A| No Product Matching, Product 15434 could not be found
261
- 2016-03-17 16:43:04 | INFO | 1603162336S0T4A | Store Matching succesful, Beezup Store: bdd7b7cf-558c-48a1-984b-00303aecdc34 , Magento Store Id: 1
262
- 2016-03-17 16:43:04 | INFO | 1603162336S0T4A | Product Matching succesful, Beezup Imported Id: 15434 , Magento Product Id: 1018
263
- 2016-03-17 16:43:04 | INFO | 1603162336S0T4A | Generating Order
264
- 2016-03-17 16:43:04 | INFO | 1603162336S0T4A | Adding 1 product/s with id 1018 to order, with Beezup Price: 57
265
- 2016-03-17 16:43:04 | INFO | 1603162336S0T4A | Creating new Customer
266
- 2016-03-17 16:43:04 | INFO | 1603162336S0T4A | Customer created succesfully
267
- 2016-03-17 16:43:05 | INFO | 1603162336S0T4A | Adding Order Shipping Cost: 0
268
- 2016-03-17 16:43:06 | INFO | 1603162336S0T4A | Adding Beezup Marketplace Information to Order
269
- 2016-03-17 16:43:06 | INFO | 1603162336S0T4A | Sending Magento Order Id to Beezup, Magento Order Id: 240
270
- 2016-03-17 16:43:08 | INFO | 1603162336S0T4A | Setting Order Status to Shipped
271
- 2016-03-17 16:43:08 | INFO | 1603162336S0T4A | Generating Order Payment Invoice
272
- 2016-03-17 16:43:08 | INFO | 1603162336S0T4A | Order Payment Invoice Generated Succesfully
273
- 2016-03-17 16:43:09 | INFO | 1603162336S0T4A | Order imported succesfully, Magento Order Id: 240
274
- 2016-03-17 19:33:39 | INFO | Initializing OM Importation
275
- 2016-03-17 19:33:40 | INFO | 402-0432037-5045910 | Store Matching succesful, Beezup Store: bdd7b7cf-558c-48a1-984b-00303aecdc34 , Magento Store Id: 1
276
- 2016-03-17 19:33:40 | INFO | 402-0432037-5045910 | Product Matching succesful, Beezup Imported Id: 16336 , Magento Product Id: 1017
277
- 2016-03-17 19:33:40 | INFO | 402-0432037-5045910 | Order Etag has not changed
278
- 2016-03-18 16:15:55 | INFO | Initializing OM Importation
279
- 2016-03-18 16:15:56 | INFO | 404-3346486-8692320 | Store Matching succesful, Beezup Store: bdd7b7cf-558c-48a1-984b-00303aecdc34 , Magento Store Id: 1
280
- 2016-03-18 16:15:56 | ERROR | 404-3346486-8692320| No Product Matching, Product 14328 could not be found
281
- 2016-03-18 16:15:57 | INFO | 404-3346486-8692320 | Store Matching succesful, Beezup Store: bdd7b7cf-558c-48a1-984b-00303aecdc34 , Magento Store Id: 1
282
- 2016-03-18 16:15:57 | INFO | 404-3346486-8692320 | Product Matching succesful, Beezup Imported Id: 14328 , Magento Product Id: 1019
283
- 2016-03-18 16:15:57 | INFO | 404-3346486-8692320 | Generating Order
284
- 2016-03-18 16:15:57 | INFO | 404-3346486-8692320 | Adding 1 product/s with id 1019 to order, with Beezup Price: 10
285
- 2016-03-18 16:15:57 | INFO | 404-3346486-8692320 | Creating new Customer
286
- 2016-03-18 16:15:58 | INFO | 404-3346486-8692320 | Customer created succesfully
287
- 2016-03-18 16:15:58 | INFO | 404-3346486-8692320 | Adding Order Shipping Cost: 3
288
- 2016-03-18 16:16:00 | INFO | 404-3346486-8692320 | Adding Beezup Marketplace Information to Order
289
- 2016-03-18 16:16:00 | INFO | 404-3346486-8692320 | Sending Magento Order Id to Beezup, Magento Order Id: 241
290
- 2016-03-18 16:16:02 | INFO | 404-3346486-8692320 | Setting Order Status to InProgress
291
- 2016-03-18 16:16:02 | INFO | 404-3346486-8692320 | Generating Order Payment Invoice
292
- 2016-03-18 16:16:03 | INFO | 404-3346486-8692320 | Order Payment Invoice Generated Succesfully
293
- 2016-03-18 16:16:03 | INFO | 404-3346486-8692320 | Order imported succesfully, Magento Order Id: 241
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/BeezUp/sql/beezup_setup/mysql4-install-4.0.0.php CHANGED
@@ -104,12 +104,12 @@ $this->getConnection()->addColumn(
104
 
105
  );
106
 
 
107
  $dir = Mage::getModuleDir("etc", "BeezUp");
108
  $dir = str_replace("etc", "log", $dir);
109
-
110
  $io = new Varien_Io_File();
111
  $io->checkAndCreateFolder($dir);
112
-
113
  $oLastSynchronizationDate = new DateTime ( 'now', new DateTimeZone ( 'UTC' ));
114
  $helper = Mage::getModel('core/config');
115
  $helper->saveConfig('beezup/marketplace/syncro_time',$oLastSynchronizationDate->getTimestamp());
104
 
105
  );
106
 
107
+ /*
108
  $dir = Mage::getModuleDir("etc", "BeezUp");
109
  $dir = str_replace("etc", "log", $dir);
 
110
  $io = new Varien_Io_File();
111
  $io->checkAndCreateFolder($dir);
112
+ */
113
  $oLastSynchronizationDate = new DateTime ( 'now', new DateTimeZone ( 'UTC' ));
114
  $helper = Mage::getModel('core/config');
115
  $helper->saveConfig('beezup/marketplace/syncro_time',$oLastSynchronizationDate->getTimestamp());
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>BeezUP_Module_feed_and_tracker</name>
4
- <version>4.6.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License</license>
7
  <channel>community</channel>
@@ -42,16 +42,12 @@ After Set-up, the following files are added :&lt;/p&gt;&#xD;
42
  &#xD;
43
  &lt;p&gt;By BeezUP &amp; Magentix&lt;/p&gt;</description>
44
  <notes>New features :&#xD;
45
- &gt; Advanced shipping prices&#xD;
46
- &gt; Description HTML Support&#xD;
47
- &gt; New products filtering options&#xD;
48
- &gt; Possibility to retrieve one specific order&#xD;
49
- &gt; Shipment details prefilling&#xD;
50
- &gt; Customer creation option</notes>
51
  <authors><author><name>BeezUP</name><user>BeezUP</user><email>charles@beezup.com</email></author></authors>
52
- <date>2016-03-21</date>
53
- <time>16:05:20</time>
54
- <contents><target name="magecommunity"><dir name="BeezUp"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="e18c65bc83cab8795b4ffd0d46e04c8a"/><dir name="Invoice"><file name="Totals.php" hash="ac065cd586fd2534de7e12762ab9b335"/></dir><file name="Totals.php" hash="5972281aa467d63da56a297a8df3da55"/><dir name="View"><dir name="Tab"><file name="Custom.php" hash="a60f500d604038645b826fa74e9b6619"/></dir></dir></dir><file name="Order.php" hash="c038c302f2c86f79431b49c7282c3f5c"/></dir><dir name="System"><dir name="Config"><file name="Attributes.php" hash="a504265fe4dc2df69b311d8219c88fbf"/><file name="Button.php" hash="476b33034b0c7d36e1bbd85f38b841db"/><file name="Childgroup.php" hash="388d3dee8f9d66a56c43c2790a44b45a"/><file name="Credentials.php" hash="b86f361800bebfd6fcf3564d9fe87c95"/><file name="Cron.php" hash="e1d47b095623593beb7f166d2ad7fecc"/><file name="Filter.php" hash="ad7ba55e18c080e25a08309dc428402a"/><file name="Log.php" hash="3f8e84a9035853447b79d25a6c263dd1"/><file name="Manualcron.php" hash="cbac01f15d256a43f0388f58449bffd0"/><file name="Orderlink.php" hash="9b9242ea9ccc4cfa746036b72aed2cc1"/><file name="Stores.php" hash="4297f4c94f136bb9778c9ddcd0cb336c"/><file name="Syncstatus.php" hash="49164eb19331aadabc0581472cd3c567"/><file name="Time.php" hash="ac5c2e4a40e9c6ff68cea1097dfa1e7b"/></dir></dir></dir><file name="Omstatus.php" hash="a12f1faa15da11fcc5a1abaa0bbd0480"/><file name="Order.php" hash="af2c931132c5b37c97f83713e566d2bf"/><file name="Tracking.php" hash="e6dcd6b89e782b2eb6cb83abfb1b7f56"/><file name="Xml.php" hash="43d6ac203df42e682d2e75cd5f9c82aa"/></dir><dir name="Helper"><file name="Data.php" hash="867a2562b255beaf3faa047d4130304f"/></dir><dir name="Model"><file name="Flatrate.php" hash="27d078203781d9b923605f685bfe5c25"/><file name="Observer.php" hash="3bcb925df1965ef23ef1fb08ab64de08"/><file name="Products.php" hash="862b463a3cff9ee3d74423637f4d8c45"/><dir name="Quote"><file name="Item.php" hash="13cef88e165932990fa032b57e8905a0"/></dir><dir name="Sales"><dir name="Order"><dir name="Pdf"><file name="Invoice.php" hash="9eaf28084db176b41c6007da3d529d18"/></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Attributes.php" hash="174aee475c6a6a8b0b4f2e8e076c6a25"/><file name="Credentials.php" hash="5c5ca91b68bebe3a0354a9b22f5f44f3"/><file name="Time.php" hash="a70e4d748a9b300ec7b718168fa4d5f8"/><file name="Token.php" hash="60247c8b4d5889433ae1f92e998cc889"/></dir><dir name="Source"><file name="Attributes.php" hash="8f57313a41349c7a8132b8d8e2de275e"/><file name="Availableproducts.php" hash="d9d4b3705f5fbd98efbae0289a1b6d6d"/><file name="Cache.php" hash="0ca6ccc2fed56e2c602d76880d062053"/><file name="Carriers.php" hash="8d6a9940891902a0a8d5a99c366432ce"/><file name="Categories.php" hash="c4e9f0a54f1d9c688543f26f02f99142"/><file name="Countries.php" hash="b6f1a9a75d5368d6365f06b42524e002"/><file name="Customercreate.php" hash="ca5d2b2d1ad4e18f9a1135af21b10bc2"/><file name="Debug.php" hash="6538ebc0cd0d61c124e5adc806e71aff"/><file name="Description.php" hash="1746e688692fc99524f02fb18e707dcf"/><file name="Images.php" hash="78fb5e2054bbfaa2e76263b1aa9197cc"/><file name="Montant.php" hash="3a46b8d564f1c2f0ed3b62354ac8964f"/><file name="Payment.php" hash="4bebe8e6ab0f980c1ada872b46e86503"/><file name="Position.php" hash="f1d6f89f5db5bfeedc506c539e76e3a8"/><file name="Price.php" hash="71707a69106cdd4990767351ab78fc04"/><file name="Shipping.php" hash="3b38e6a923d98f2739b70c9960958dd6"/><file name="Status.php" hash="d32004ad97adac6de361703a403a6a97"/><file name="Userid.php" hash="3d028bc3bfcaf7541b57676c014c94db"/><file name="Visibility.php" hash="91c69e8f967c13162eb38306c0391080"/></dir></dir></dir></dir><dir name="controllers"><file name="CacheController.php" hash="512cc26abd39d556104d5e69c0ac8a0d"/><file name="CatalogController.php" hash="f07f18bf6b072c4ebc54f40dfd1594f6"/><file name="CronController.php" hash="026ddcd6df9a51a41037687ca8d53a0b"/><file name="LogController.php" hash="5eff0d0a2c5621456e580e214d05c745"/><file name="OmstatusController.php" hash="95ae171ef21f861a7eaf74931b62a9db"/><file name="OrderController.php" hash="a2b8df2fb01fb4df8e7f04bcd7689bb3"/></dir><dir name="etc"><file name="adminhtml.xml" hash="e50ed10cb5025ff3a6dd7c90a6f7e0a4"/><file name="config.xml" hash="311569cf41985f659272a0a455a3adbf"/><file name="system.xml" hash="b4f7e527d0de904bdd1d372d3ca555ef"/></dir><dir name="img"><file name="ajax-loader.gif" hash="2a6692973429d7a74513bfa8bcb5be20"/></dir><dir name="lib"><file name="BeezupMageOrders.php" hash="cb62e5d5322912447cf829599013c17f"/><file name="BeezupOMDataHandler.php" hash="cf738987179f3125fc0f4626fd70f1a0"/><file name="BeezupOMOrderService.php" hash="47c09c14dce66f914023ff09374cd674"/><file name="BeezupOMOrderServiceInterface.php" hash="9b18485ae224c32f46ae5a2ec5966e5b"/><file name="BeezupOMRepositoryInterface.php" hash="c2a8267c01c3e5def25ed41f715fa4b4"/><file name="BeezupOMRequestData.php" hash="162196502ecc6078ac6b7dec6f068c80"/><file name="BeezupOMResponseData.php" hash="955ce5316129e837190f2ccf9962d74f"/><file name="BeezupOMServiceClientProxy.php" hash="82821826016c467657d56b568a42bd35"/><file name="BeezupOMStatus.php" hash="5ebcc05f1b763887e420c8f4f459bfdb"/><file name="BeezupRepository.php" hash="4a4eaabcd0a5d7427154e93757c3733d"/><dir name="Common"><file name="BeezupOMCredential.php" hash="7f45272d16860058af07005dda39672e"/><file name="BeezupOMErrorSummary.php" hash="418db7b85beb030b2d28aee6c8b35bf1"/><file name="BeezupOMExpectedOrderChangeMetaInfo.php" hash="be802f69a3474d6cc6a5899711c7018c"/><file name="BeezupOMInfoSummaries.php" hash="cdece780cf38e3f09ce2d5550b93a567"/><file name="BeezupOMInfoSummary.php" hash="3b0d49f22882e239c87060aa58beb643"/><file name="BeezupOMLink.php" hash="9fa99dce0b51e235e101259b2f0304f8"/><file name="BeezupOMOrderIdentifier.php" hash="334f410bf0794cb2ce02b4b1e6d3e0f4"/><file name="BeezupOMProcessingStatus.php" hash="b70c4c23a75360b5bee4d9ddec9e7915"/><file name="BeezupOMRequest.php" hash="2497b1ed30c12d179a5629479aee418d"/><file name="BeezupOMResponse.php" hash="690688115873ac9a3172bf67a0d62b50"/><file name="BeezupOMResult.php" hash="5cb890ce4ad4205114dd94cd1f28222d"/><file name="BeezupOMSuccessSummary.php" hash="791c6c186ed15ec1b872905b820cd03c"/><file name="BeezupOMSummary.php" hash="6cc3712480eff9f19b80b0ab887155f0"/><file name="BeezupOMWarningSummary.php" hash="03cfd6a98901b6b460b974b8e938a659"/></dir><dir name="Harvest"><file name="BeezupOMHarvestAbstractReporting.php" hash="3d499a69ea7b646eaeef5b80f0a919f3"/><file name="BeezupOMHarvestClientReporting.php" hash="1e40eca349352912e408718f3b218777"/><file name="BeezupOMHarvestOrderReporting.php" hash="778ba93a7673f35b2072003e3510ba6b"/></dir><file name="KLogger.php" hash="fe1d31bbfdf4d59a858ffd43453536c2"/><dir name="LOV"><file name="BeezupOMLOVRequest.php" hash="165c873b3fea4201a3b35596d24ffe36"/><file name="BeezupOMLOVResponse.php" hash="586749fb17b16d5ff9f07909e516b3c7"/><file name="BeezupOMLOVResult.php" hash="c0e3cc917a1d625ac6094917481a7b52"/><file name="BeezupOMLOVValue.php" hash="0dd13ae88e99c2537df8804f3af248b9"/></dir><dir name="Order"><file name="BeezupOMOrderItem.php" hash="a770b90ae4fcb6535563be6ff59f7528"/><file name="BeezupOMOrderRequest.php" hash="9afa0f18fc0aef344c3f71d054db23a0"/><file name="BeezupOMOrderResponse.php" hash="e8793a8754ec75a92ca6266357462307"/><file name="BeezupOMOrderResult.php" hash="b82fd5d86b578f2eb1d162a1169f3a9b"/></dir><dir name="OrderChange"><file name="BeezupOMOrderChangeMetaInfo.php" hash="abdbdfd6c3bf291fd38f9b3ddc419405"/><file name="BeezupOMOrderChangeRequest.php" hash="f43b9c0a052fe5346a1b309c6d96ae9c"/><file name="BeezupOMOrderChangeResponse.php" hash="bbb4e49e5ddb90991e763daa439a5642"/><file name="BeezupOMOrderChangeResult.php" hash="e7314addf6c2e51196577055d583f350"/></dir><dir name="OrderHistory"><file name="BeezupOMOrderChangeReporting.php" hash="fc7a7d7ee8bc53f8c5b7ed19793a911a"/><file name="BeezupOMOrderHarvestReporting.php" hash="e4cb500ef347d8e8543e0bf278d3d77c"/><file name="BeezupOMOrderHistoryRequest.php" hash="2e39c26d8d9dd4d5a92a2cde06c41353"/><file name="BeezupOMOrderHistoryResponse.php" hash="dc6a0c6dc89bf1f376d1ecfebd052a4b"/><file name="BeezupOMOrderHistoryResult.php" hash="d85d9b4ecf6c0456b5c8453cc3b9cfdd"/></dir><dir name="OrderList"><file name="BeezupOMOrderHeader.php" hash="af366bc39855f1315678f01b53859c1c"/><file name="BeezupOMOrderListRequest.php" hash="817c20c7c82fd5f05e0efb19ee19ec4b"/><file name="BeezupOMOrderListResponse.php" hash="b1b0ed33ba495f6e2c2f3a39ade2a5cd"/><file name="BeezupOMOrderListResult.php" hash="8befe82305a6c6fe3cacf113b3722585"/><file name="BeezupOMPaginationResult.php" hash="1e1ef534ddef8ac43d98839b4ed7f941"/></dir><dir name="SetOrderId"><file name="BeezupOMSetOrderIdRequest.php" hash="40b4a05023396115f582c2e907834e3b"/><file name="BeezupOMSetOrderIdResponse.php" hash="c4cb1f9013ae32dfdff8ca80e4725282"/><file name="BeezupOMSetOrderIdResult.php" hash="8b35abb55c52f6acdfd55bf20b370bf0"/><file name="BeezupOMSetOrderIdValues.php" hash="978b41465512c15bfe160463ca23d24f"/></dir><dir name="Stores"><file name="BeezupOMStore.php" hash="0882efcae2eff339d6cdcceee83135a7"/><file name="BeezupOMStoresRequest.php" hash="a6b1391e306f2ed21fd5e2fcdbcbbec5"/><file name="BeezupOMStoresResponse.php" hash="21535a8957506ef7da343a0526b57b02"/><file name="BeezupOMStoresResult.php" hash="d4ceed947e9e8086638497e75bbd20e8"/></dir><file name="bootstrap.php" hash="9e0e69bc9e9a932c7c80f8480c025bd2"/></dir><dir name="log"><file name="log.txt" hash="b395b6e8e6369519056494878753123c"/><file name="log2.txt" hash="9d32514109ef640516489220c1aada45"/></dir><dir name="sql"><dir name="beezup_setup"><file name="mysql4-install-4.0.0.php" hash="e035e76fe92b063d6cecc9fa2872cfab"/><file name="mysql4-upgrade-4.5.0-4.6.0.php" hash="34d1bc3a9b7658923a389fd6653ed4c9"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="BeezUp.xml" hash="93df32f86c55b57363b9abc62cf68474"/></dir></target><target name="magelocale"><dir name="fr_FR"><file name="BeezUp.csv" hash="3ae5819ffc7157b01772a15a9b16d2a2"/></dir><dir name="en_US"><file name="BeezUp.csv" hash="05b26592c14245824173936807731db4"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="beezup_salestab.xml" hash="784925d72538a1eeb0ca695417147a7a"/></dir><dir name="template"><dir name="beezup"><file name="custom.phtml" hash="ea83d17a2e8814c3a9ae9e056c7926a8"/></dir></dir></dir></dir></dir></target></contents>
55
  <compatible/>
56
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
57
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>BeezUP_Module_feed_and_tracker</name>
4
+ <version>4.6.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License</license>
7
  <channel>community</channel>
42
  &#xD;
43
  &lt;p&gt;By BeezUP &amp; Magentix&lt;/p&gt;</description>
44
  <notes>New features :&#xD;
45
+ &gt; Feed pagination&#xD;
46
+ &gt; Minor bugs</notes>
 
 
 
 
47
  <authors><author><name>BeezUP</name><user>BeezUP</user><email>charles@beezup.com</email></author></authors>
48
+ <date>2016-04-06</date>
49
+ <time>11:53:59</time>
50
+ <contents><target name="magecommunity"><dir name="BeezUp"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="e18c65bc83cab8795b4ffd0d46e04c8a"/><dir name="Invoice"><file name="Totals.php" hash="ac065cd586fd2534de7e12762ab9b335"/></dir><file name="Totals.php" hash="5972281aa467d63da56a297a8df3da55"/><dir name="View"><dir name="Tab"><file name="Custom.php" hash="a60f500d604038645b826fa74e9b6619"/></dir></dir></dir><file name="Order.php" hash="c038c302f2c86f79431b49c7282c3f5c"/></dir><dir name="System"><dir name="Config"><file name="Attributes.php" hash="a504265fe4dc2df69b311d8219c88fbf"/><file name="Button.php" hash="476b33034b0c7d36e1bbd85f38b841db"/><file name="Childgroup.php" hash="388d3dee8f9d66a56c43c2790a44b45a"/><file name="Credentials.php" hash="b86f361800bebfd6fcf3564d9fe87c95"/><file name="Cron.php" hash="e1d47b095623593beb7f166d2ad7fecc"/><file name="Filter.php" hash="ad7ba55e18c080e25a08309dc428402a"/><file name="Log.php" hash="86221765980c0aee2381d5efd740949d"/><file name="Manualcron.php" hash="cbac01f15d256a43f0388f58449bffd0"/><file name="Orderlink.php" hash="9b9242ea9ccc4cfa746036b72aed2cc1"/><file name="Stores.php" hash="4297f4c94f136bb9778c9ddcd0cb336c"/><file name="Syncstatus.php" hash="49164eb19331aadabc0581472cd3c567"/><file name="Time.php" hash="ac5c2e4a40e9c6ff68cea1097dfa1e7b"/></dir></dir></dir><file name="Omstatus.php" hash="a40f2918627077264132594cfe028290"/><file name="Order.php" hash="9952ed2a24816b211fcc1dbcf7488678"/><file name="Tracking.php" hash="e6dcd6b89e782b2eb6cb83abfb1b7f56"/><file name="Xml.php" hash="cd342d8ec7515599f77ed696bd58d1c3"/></dir><dir name="Helper"><file name="Data.php" hash="867a2562b255beaf3faa047d4130304f"/></dir><dir name="Model"><file name="Flatrate.php" hash="27d078203781d9b923605f685bfe5c25"/><file name="Observer.php" hash="3bcb925df1965ef23ef1fb08ab64de08"/><file name="Products.php" hash="22405c3788496f85389bf69e149e9267"/><dir name="Quote"><file name="Item.php" hash="13cef88e165932990fa032b57e8905a0"/></dir><dir name="Sales"><dir name="Order"><dir name="Pdf"><file name="Invoice.php" hash="9eaf28084db176b41c6007da3d529d18"/></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Attributes.php" hash="174aee475c6a6a8b0b4f2e8e076c6a25"/><file name="Credentials.php" hash="09ef9fab57f64eb6415d71ba8aec2412"/><file name="Time.php" hash="a70e4d748a9b300ec7b718168fa4d5f8"/><file name="Token.php" hash="60247c8b4d5889433ae1f92e998cc889"/></dir><dir name="Source"><file name="Attributes.php" hash="8f57313a41349c7a8132b8d8e2de275e"/><file name="Availableproducts.php" hash="d9d4b3705f5fbd98efbae0289a1b6d6d"/><file name="Cache.php" hash="0ca6ccc2fed56e2c602d76880d062053"/><file name="Carriers.php" hash="8d6a9940891902a0a8d5a99c366432ce"/><file name="Categories.php" hash="c4e9f0a54f1d9c688543f26f02f99142"/><file name="Countries.php" hash="b6f1a9a75d5368d6365f06b42524e002"/><file name="Customercreate.php" hash="ca5d2b2d1ad4e18f9a1135af21b10bc2"/><file name="Debug.php" hash="6538ebc0cd0d61c124e5adc806e71aff"/><file name="Description.php" hash="1746e688692fc99524f02fb18e707dcf"/><file name="Images.php" hash="78fb5e2054bbfaa2e76263b1aa9197cc"/><file name="Montant.php" hash="3a46b8d564f1c2f0ed3b62354ac8964f"/><file name="Payment.php" hash="4bebe8e6ab0f980c1ada872b46e86503"/><file name="Position.php" hash="f1d6f89f5db5bfeedc506c539e76e3a8"/><file name="Price.php" hash="71707a69106cdd4990767351ab78fc04"/><file name="Shipping.php" hash="3b38e6a923d98f2739b70c9960958dd6"/><file name="Status.php" hash="d32004ad97adac6de361703a403a6a97"/><file name="Userid.php" hash="3d028bc3bfcaf7541b57676c014c94db"/><file name="Visibility.php" hash="91c69e8f967c13162eb38306c0391080"/></dir></dir></dir></dir><dir name="controllers"><file name="CacheController.php" hash="512cc26abd39d556104d5e69c0ac8a0d"/><file name="CatalogController.php" hash="0b65f6951e26283ea8c60bffa397186d"/><file name="CronController.php" hash="026ddcd6df9a51a41037687ca8d53a0b"/><file name="LogController.php" hash="5eff0d0a2c5621456e580e214d05c745"/><file name="OmstatusController.php" hash="95ae171ef21f861a7eaf74931b62a9db"/><file name="OrderController.php" hash="a2b8df2fb01fb4df8e7f04bcd7689bb3"/></dir><dir name="etc"><file name="adminhtml.xml" hash="e50ed10cb5025ff3a6dd7c90a6f7e0a4"/><file name="config.xml" hash="937cdae8ef0f52eb7157bf388923a378"/><file name="system.xml" hash="75120b04d2e57fb35d95a157863c5c7d"/></dir><dir name="img"><file name="ajax-loader.gif" hash="2a6692973429d7a74513bfa8bcb5be20"/></dir><dir name="lib"><file name="BeezupMageOrders.php" hash="cb62e5d5322912447cf829599013c17f"/><file name="BeezupOMDataHandler.php" hash="cf738987179f3125fc0f4626fd70f1a0"/><file name="BeezupOMOrderService.php" hash="47c09c14dce66f914023ff09374cd674"/><file name="BeezupOMOrderServiceInterface.php" hash="9b18485ae224c32f46ae5a2ec5966e5b"/><file name="BeezupOMRepositoryInterface.php" hash="c2a8267c01c3e5def25ed41f715fa4b4"/><file name="BeezupOMRequestData.php" hash="162196502ecc6078ac6b7dec6f068c80"/><file name="BeezupOMResponseData.php" hash="955ce5316129e837190f2ccf9962d74f"/><file name="BeezupOMServiceClientProxy.php" hash="82821826016c467657d56b568a42bd35"/><file name="BeezupOMStatus.php" hash="5ebcc05f1b763887e420c8f4f459bfdb"/><file name="BeezupRepository.php" hash="4a4eaabcd0a5d7427154e93757c3733d"/><dir name="Common"><file name="BeezupOMCredential.php" hash="7f45272d16860058af07005dda39672e"/><file name="BeezupOMErrorSummary.php" hash="418db7b85beb030b2d28aee6c8b35bf1"/><file name="BeezupOMExpectedOrderChangeMetaInfo.php" hash="be802f69a3474d6cc6a5899711c7018c"/><file name="BeezupOMInfoSummaries.php" hash="cdece780cf38e3f09ce2d5550b93a567"/><file name="BeezupOMInfoSummary.php" hash="3b0d49f22882e239c87060aa58beb643"/><file name="BeezupOMLink.php" hash="9fa99dce0b51e235e101259b2f0304f8"/><file name="BeezupOMOrderIdentifier.php" hash="334f410bf0794cb2ce02b4b1e6d3e0f4"/><file name="BeezupOMProcessingStatus.php" hash="b70c4c23a75360b5bee4d9ddec9e7915"/><file name="BeezupOMRequest.php" hash="2497b1ed30c12d179a5629479aee418d"/><file name="BeezupOMResponse.php" hash="690688115873ac9a3172bf67a0d62b50"/><file name="BeezupOMResult.php" hash="5cb890ce4ad4205114dd94cd1f28222d"/><file name="BeezupOMSuccessSummary.php" hash="791c6c186ed15ec1b872905b820cd03c"/><file name="BeezupOMSummary.php" hash="6cc3712480eff9f19b80b0ab887155f0"/><file name="BeezupOMWarningSummary.php" hash="03cfd6a98901b6b460b974b8e938a659"/></dir><dir name="Harvest"><file name="BeezupOMHarvestAbstractReporting.php" hash="3d499a69ea7b646eaeef5b80f0a919f3"/><file name="BeezupOMHarvestClientReporting.php" hash="1e40eca349352912e408718f3b218777"/><file name="BeezupOMHarvestOrderReporting.php" hash="778ba93a7673f35b2072003e3510ba6b"/></dir><file name="KLogger.php" hash="fe1d31bbfdf4d59a858ffd43453536c2"/><dir name="LOV"><file name="BeezupOMLOVRequest.php" hash="165c873b3fea4201a3b35596d24ffe36"/><file name="BeezupOMLOVResponse.php" hash="586749fb17b16d5ff9f07909e516b3c7"/><file name="BeezupOMLOVResult.php" hash="c0e3cc917a1d625ac6094917481a7b52"/><file name="BeezupOMLOVValue.php" hash="0dd13ae88e99c2537df8804f3af248b9"/></dir><dir name="Order"><file name="BeezupOMOrderItem.php" hash="a770b90ae4fcb6535563be6ff59f7528"/><file name="BeezupOMOrderRequest.php" hash="9afa0f18fc0aef344c3f71d054db23a0"/><file name="BeezupOMOrderResponse.php" hash="e8793a8754ec75a92ca6266357462307"/><file name="BeezupOMOrderResult.php" hash="b82fd5d86b578f2eb1d162a1169f3a9b"/></dir><dir name="OrderChange"><file name="BeezupOMOrderChangeMetaInfo.php" hash="abdbdfd6c3bf291fd38f9b3ddc419405"/><file name="BeezupOMOrderChangeRequest.php" hash="f43b9c0a052fe5346a1b309c6d96ae9c"/><file name="BeezupOMOrderChangeResponse.php" hash="bbb4e49e5ddb90991e763daa439a5642"/><file name="BeezupOMOrderChangeResult.php" hash="e7314addf6c2e51196577055d583f350"/></dir><dir name="OrderHistory"><file name="BeezupOMOrderChangeReporting.php" hash="fc7a7d7ee8bc53f8c5b7ed19793a911a"/><file name="BeezupOMOrderHarvestReporting.php" hash="e4cb500ef347d8e8543e0bf278d3d77c"/><file name="BeezupOMOrderHistoryRequest.php" hash="2e39c26d8d9dd4d5a92a2cde06c41353"/><file name="BeezupOMOrderHistoryResponse.php" hash="dc6a0c6dc89bf1f376d1ecfebd052a4b"/><file name="BeezupOMOrderHistoryResult.php" hash="d85d9b4ecf6c0456b5c8453cc3b9cfdd"/></dir><dir name="OrderList"><file name="BeezupOMOrderHeader.php" hash="af366bc39855f1315678f01b53859c1c"/><file name="BeezupOMOrderListRequest.php" hash="817c20c7c82fd5f05e0efb19ee19ec4b"/><file name="BeezupOMOrderListResponse.php" hash="b1b0ed33ba495f6e2c2f3a39ade2a5cd"/><file name="BeezupOMOrderListResult.php" hash="8befe82305a6c6fe3cacf113b3722585"/><file name="BeezupOMPaginationResult.php" hash="1e1ef534ddef8ac43d98839b4ed7f941"/></dir><dir name="SetOrderId"><file name="BeezupOMSetOrderIdRequest.php" hash="40b4a05023396115f582c2e907834e3b"/><file name="BeezupOMSetOrderIdResponse.php" hash="c4cb1f9013ae32dfdff8ca80e4725282"/><file name="BeezupOMSetOrderIdResult.php" hash="8b35abb55c52f6acdfd55bf20b370bf0"/><file name="BeezupOMSetOrderIdValues.php" hash="978b41465512c15bfe160463ca23d24f"/></dir><dir name="Stores"><file name="BeezupOMStore.php" hash="0882efcae2eff339d6cdcceee83135a7"/><file name="BeezupOMStoresRequest.php" hash="a6b1391e306f2ed21fd5e2fcdbcbbec5"/><file name="BeezupOMStoresResponse.php" hash="21535a8957506ef7da343a0526b57b02"/><file name="BeezupOMStoresResult.php" hash="d4ceed947e9e8086638497e75bbd20e8"/></dir><file name="bootstrap.php" hash="9e0e69bc9e9a932c7c80f8480c025bd2"/></dir><dir name="sql"><dir name="beezup_setup"><file name="mysql4-install-4.0.0.php" hash="75dacb26e3f96975a873c906eb37fbb0"/><file name="mysql4-upgrade-4.5.0-4.6.0.php" hash="34d1bc3a9b7658923a389fd6653ed4c9"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="BeezUp.xml" hash="93df32f86c55b57363b9abc62cf68474"/></dir></target><target name="magelocale"><dir name="fr_FR"><file name="BeezUp.csv" hash="3ae5819ffc7157b01772a15a9b16d2a2"/></dir><dir name="en_US"><file name="BeezUp.csv" hash="05b26592c14245824173936807731db4"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="beezup_salestab.xml" hash="784925d72538a1eeb0ca695417147a7a"/></dir><dir name="template"><dir name="beezup"><file name="custom.phtml" hash="ea83d17a2e8814c3a9ae9e056c7926a8"/></dir></dir></dir></dir></dir></target></contents>
51
  <compatible/>
52
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
53
  </package>