Targetbay_Tracking - Version 5.1.2

Version Notes

Making every interaction count and engaging customers with relevant messages will improve the chances of conversion exponentially. You can profile and segment users based on various parameters and actions, the data from which will form the basis for your customer engagement objectives.You can create triggers based on customer engagement objectives to deliver personalized messages. Your newsletter campaigns can also be personalized to deliver better customer engagement results. And all of this can be achieved with the help of our ecommerce-based email personalization platform.

Download this release

Release Info

Developer Targetbay
Extension Targetbay_Tracking
Version 5.1.2
Comparing to
See all releases


Code changes from version 5.1.1 to 5.1.2

app/code/community/Targetbay/Tracking/Block/Product/Product.php CHANGED
@@ -11,41 +11,107 @@ class Targetbay_Tracking_Block_Product_Product extends TM_RichSnippets_Block_Pro
11
 
12
  public function getJsonSnippetsProduct()
13
  {
14
- $data = array(
15
- '@context' => 'http://schema.org',
16
- '@type' => 'Product',
17
- 'name' => $this->getProduct()->getName(),
18
- 'image' => (string)Mage::helper('catalog/image')->init($this->getProduct(), 'image'),
19
- 'description' => $this->getProduct()->getShortDescription(),
20
- 'sku' => $this->getProduct()->getSku(),
21
- 'offers' => array(
22
- '@type' => 'Offer',
23
- 'availability' => $this->getStockStatusUrl(),
24
- 'price' => $this->getPriceValues(),
25
- 'priceCurrency' => Mage::app()->getStore()->getCurrentCurrency()->getCode()
26
- )
27
- );
28
-
29
- $aggregateRating = Mage::helper('tracking')->getRichSnippets();
30
- if($aggregateRating['average_score'] != 0) {
31
- $data['aggregateRating']['@type'] = 'AggregateRating';
32
- $data['aggregateRating']['bestRating'] = '100';
33
- $data['aggregateRating']['ratingValue'] = $aggregateRating['average_score'];
34
- $data['aggregateRating']['reviewCount'] = $aggregateRating['reviews_count'];
35
- $data['aggregateRating']['ratingCount'] = $aggregateRating['reviews_count'];
36
- }
37
-
38
- if (is_array($this->getPriceValues())) {
39
- unset($data['offers']['price']);
40
-
41
- $getPriceValues = $this->getPriceValues();
42
- $data['offers']['@type'] = 'AggregateOffer';
43
- $data['offers']['lowPrice'] = $getPriceValues[0];
44
- $data['offers']['highPrice'] = $getPriceValues[1];
45
-
46
- }
47
-
48
- return Mage::helper('core')->jsonEncode($data);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  }
50
  }
51
  }
11
 
12
  public function getJsonSnippetsProduct()
13
  {
14
+ $data = array(
15
+ '@context' => 'http://schema.org',
16
+ '@type' => 'Product',
17
+ 'name' => $this->getProduct()->getName(),
18
+ 'image' => (string)Mage::helper('catalog/image')->init($this->getProduct(), 'image'),
19
+ 'description' => $this->getProduct()->getShortDescription(),
20
+ 'sku' => $this->getProduct()->getSku(),
21
+ 'offers' => array(
22
+ '@type' => 'Offer',
23
+ 'availability' => $this->getStockStatusUrl(),
24
+ 'price' => $this->getPriceValues(),
25
+ 'priceCurrency' => Mage::app()->getStore()->getCurrentCurrency()->getCode()
26
+ )
27
+ );
28
+
29
+ $richSnippets = Mage::helper('tracking')->getRichSnippets();
30
+ if($richSnippets['average_score'] != 0) {
31
+ $data['aggregateRating']['@type'] = 'AggregateRating';
32
+ $data['aggregateRating']['bestRating'] = 5;
33
+ $data['aggregateRating']['worstRating'] = 1;
34
+ $data['aggregateRating']['ratingValue'] = $richSnippets['average_score'];
35
+ $data['aggregateRating']['reviewCount'] = $richSnippets['reviews_count'];
36
+ $data['aggregateRating']['ratingCount'] = $richSnippets['reviews_count'];
37
+ }
38
+
39
+ if($richSnippets['reviews_count'] > 0) {
40
+ foreach($richSnippets['reviews'] as $key => $aggregateReviewDetails) {
41
+ $reviewId = $aggregateReviewDetails->_id;
42
+ $reviewTitle = $aggregateReviewDetails->_source->review_title;
43
+ $review = $aggregateReviewDetails->_source->review;
44
+ $timestamp = $aggregateReviewDetails->_source->timestamp;
45
+ $reviewRating = $aggregateReviewDetails->_source->review_rating;
46
+ $userName = $aggregateReviewDetails->_source->user_name;
47
+
48
+ $reviewData['@type'] = 'Review';
49
+ $reviewData['name'] = $reviewTitle;
50
+ $reviewData['description'] = $review;
51
+ $reviewData['datePublished'] = date('m/d/Y', $timestamp);
52
+ $reviewData['ratingCount'] = $aggregateRating['reviews_count'];
53
+ $reviewData['author'] = $userName;
54
+ $revRating['@type'] = 'Rating';
55
+ $revRating['ratingValue'] = $reviewRating;
56
+ $revRating['worstRating'] = 1;
57
+ $revRating['bestRating'] = 5;
58
+ $reviewData['reviewRating'] = $revRating;
59
+ $data['review'][] = $reviewData;
60
+ }
61
+ }
62
+
63
+ /*$questionSnippets = Mage::helper('tracking')->getQuestionSnippets();
64
+
65
+ if(!empty($questionSnippets) && $questionSnippets['qa_count'] > 0) {
66
+ $authorName = $questionSnippets['qa_author'];
67
+ $i = 1;
68
+ foreach($questionSnippets['qa_details'] as $key => $qasDetails) {
69
+ $qasId = $qasDetails->_id;
70
+ $productName = $qasDetails->_source->product_name;
71
+ $questionName = $qasDetails->_source->questions;
72
+ $qasCreatedDate = $qasDetails->_source->timestamp;
73
+ $qasUsername = $qasDetails->_source->user_name;
74
+ $answerArray = $qasDetails->_source->question_answers;
75
+
76
+ $data['@type'] = 'Question';
77
+ $data['name'] = $productName;
78
+ $data['text'] = $questionName;
79
+ $data['dateCreated'] = date('m/d/Y', $qasCreatedDate);
80
+ $data['author']['@type'] = 'Person';
81
+ $data['author']['name'] = $qasUsername;
82
+ $data['answerCount'] = count($answerArray);
83
+ if(count($answerArray) > 0) {
84
+ $acceptedAnswer['@type'] = 'Answer';
85
+ $acceptedAnswer['upvoteCount'] = $answerArray[0]->upvotes;
86
+ $acceptedAnswer['text'] = $answerArray[0]->answers;
87
+ $acceptedAnswer['dateCreated'] = date('m/d/Y', $answerArray[0]->answer_timestamp);
88
+ $acceptedAnswer['author']['@type'] = 'Person';
89
+ $acceptedAnswer['author']['name'] = $authorName;
90
+ $data['acceptedAnswer'] = $acceptedAnswer;
91
+ foreach($answerArray as $key => $answers) {
92
+ $suggestedAnswer[$i]['@type'] = 'Answer';
93
+ $suggestedAnswer[$i]['upvoteCount'] = $answerArray->upvotes;
94
+ $suggestedAnswer[$i]['text'] = $answerArray->answers;
95
+ $suggestedAnswer[$i]['dateCreated'] = date('m/d/Y', $answerArray->answer_timestamp);
96
+ $suggestedAnswer[$i]['author']['@type'] = 'Person';
97
+ $suggestedAnswer[$i]['author']['name'] = $authorName;
98
+ $data['suggestedAnswer'] = $suggestedAnswer;
99
+ }
100
+ }
101
+ }
102
+ }*/
103
+
104
+ if (is_array($this->getPriceValues())) {
105
+ unset($data['offers']['price']);
106
+
107
+ $getPriceValues = $this->getPriceValues();
108
+ $data['offers']['@type'] = 'AggregateOffer';
109
+ $data['offers']['lowPrice'] = $getPriceValues[0];
110
+ $data['offers']['highPrice'] = $getPriceValues[1];
111
+
112
+ }
113
+
114
+ return Mage::helper('core')->jsonEncode($data);
115
  }
116
  }
117
  }
app/code/community/Targetbay/Tracking/Block/Product/Review.php CHANGED
@@ -14,6 +14,6 @@ class Targetbay_Tracking_Block_Product_Review extends Mage_Core_Block_Template
14
  public function _construct()
15
  {
16
  parent::_construct();
17
- $this->setTemplate('tracking/product/review.phtml');
18
  }
19
  }
14
  public function _construct()
15
  {
16
  parent::_construct();
17
+ $this->setTemplate('tracking/product/review.phtml');
18
  }
19
  }
app/code/community/Targetbay/Tracking/Helper/Data.php CHANGED
@@ -58,6 +58,7 @@ class Targetbay_Tracking_Helper_Data extends Mage_Core_Helper_Abstract
58
  CONST ORDER_SHIPMENT = 'shipment';
59
  CONST ORDER_INVOICE = 'invoice';
60
  CONST ORDER_REFUND = 'creditmemo';
 
61
 
62
  CONST HOST_STAGE = 'https://stage.targetbay.com/api/v1/webhooks/';
63
  CONST HOST_LIVE = 'https://app.targetbay.com/api/v1/webhooks/';
@@ -391,7 +392,7 @@ class Targetbay_Tracking_Helper_Data extends Mage_Core_Helper_Abstract
391
  $data['utm_sources'] = $this->cookie->get('utm_source') ? $this->cookie->get('utm_source') : '';
392
  $data['utm_token'] = $this->cookie->get('utm_token') ? $this->cookie->get('utm_token') : '';
393
  $pageTitle = Mage::app()->getLayout()->getBlock('head') ? Mage::app()->getLayout()->getBlock('head')->getTitle() : Mage::getSingleton('checkout/session')->getTitle();
394
- $data['page_title'] = addslashes($pageTitle);
395
  return $data;
396
  } catch (Exception $e) {
397
  $this->debug('Error message:'.$e->getMessage());
@@ -547,27 +548,61 @@ class Targetbay_Tracking_Helper_Data extends Mage_Core_Helper_Abstract
547
  */
548
  public function getInfo($object)
549
  {
550
- try {
551
- $customer = $object->getCustomer();
552
- $items = $object->getAllVisibleItems();
553
- $data = $this->getSessionInfo($object);
554
- $data['first_name'] = $object->getCustomerFirstname();
555
- $data['last_name'] = $object->getCustomerLastname();
556
- $guestUsername = $object->getCustomerFirstname().' '.$object->getCustomerLastname();
557
- $gName = !empty($guestUsername) ? $guestUsername : self::ANONYMOUS_USER;
558
- $data['user_name'] = $object->getCustomerIsGuest() ? $gName : $data['first_name'] . ' ' . $data['last_name'];
559
- $data['user_mail'] = $object->getCustomerEmail();
560
- $data['order_id'] = $object->getId();
561
- $data['order_price'] = $object->getSubtotal();
562
- $data['order_quantity'] = $object->getData('total_qty_ordered');
563
- $data['shipping_method'] = $object->getData('shipping_description');
564
- $data['shipping_price'] = $object->getData('shipping_amount');
565
- $data['tax_amount'] = $object->getData('tax_amount');
566
- $data['payment_method'] = $object->getPayment()->getMethodInstance()->getTitle();
567
- $data['cart_items'] = $this->getOrderItemsInfo($object);
568
- return $data;
569
  } catch (Exception $e) {
570
- $this->debug('Error message '.$e->getMessage());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
571
  return;
572
  }
573
  }
@@ -591,7 +626,7 @@ class Targetbay_Tracking_Helper_Data extends Mage_Core_Helper_Abstract
591
  }
592
  return $dataItems;
593
  } catch (Exception $e) {
594
- $this->debug('Error message '.$e->getMessage());
595
  return;
596
  }
597
  }
@@ -604,19 +639,19 @@ class Targetbay_Tracking_Helper_Data extends Mage_Core_Helper_Abstract
604
  */
605
  public function getPaymentInfo($orderId, $orderExportApi = false)
606
  {
607
- $paymentTitle = '';$paymentMethod = '';
608
- try {
609
- $paymentCollection = Mage::getModel('sales/order_payment')->getCollection()->addFieldToFilter('parent_id', $orderId);
610
- foreach ($paymentCollection as $paymentDetails) {
611
- $paymentMethod = $paymentDetails->getMethod();
612
- }
613
-
614
- $store = Mage::app()->getStore();
615
- $path = 'payment/' . $paymentMethod . '/title';
616
- $paymentTitle = Mage::getStoreConfig($path, $store);
617
- return $paymentTitle;
618
  } catch (Exception $e) {
619
- $this->debug('Error message '.$e->getMessage());
620
  return;
621
  }
622
  }
@@ -629,25 +664,25 @@ class Targetbay_Tracking_Helper_Data extends Mage_Core_Helper_Abstract
629
  */
630
  public function getItemInfo($item, $actionType = false)
631
  {
632
- $dataItem = array();
633
- try {
634
- $product = Mage::getModel('catalog/product')->load($item->getData('product_id'));
635
- $dataItem['type'] = $item->getProductType();
636
- $dataItem['product_id'] = $item->getProductId();
637
- $dataItem['product_sku'] = $item->getSku();
638
- $dataItem['product_name'] = addslashes($item->getName());
639
- $dataItem['price'] = $actionType ? $item->getProduct()->getPrice() : $item->getPrice();
640
- $dataItem['special_price'] = $product->getSpecialPrice();
641
- $qty = $actionType ? $item->getProduct()->getQty() : $item->getQty();
642
- $dataItem['productimg'] = $this->getImageUrl($product, 'image');
643
-
644
- $dataItem['category'] = $this->getProductCategory($product);
645
- $dataItem['category_name'] = $this->getProductCategoryName($product);
646
- $dataItem['quantity'] = ($item->getData('qty_ordered')) ? $item->getData('qty_ordered') : $qty;
647
- $dataItem['page_url'] = Mage::getUrl($product->getUrlPath());
648
- return $dataItem;
649
  } catch (Exception $e) {
650
- $this->debug('Error message '.$e->getMessage());
651
  return;
652
  }
653
  }
@@ -668,7 +703,7 @@ class Targetbay_Tracking_Helper_Data extends Mage_Core_Helper_Abstract
668
  if (count($categoryIds)) {
669
  foreach ($categoryIds as $categoryId) {
670
  $_category = Mage::getModel('catalog/category')->load($categoryId);
671
- $productCategories[] = $_category->getName();
672
  }
673
 
674
  $categoryName = implode(',', $productCategories);
@@ -719,7 +754,7 @@ class Targetbay_Tracking_Helper_Data extends Mage_Core_Helper_Abstract
719
  $optionsData = array_merge($superAttributeInfo, $customOptionInfo);
720
  return $optionsData;
721
  } catch (Exception $e) {
722
- $this->debug('Error message '.$e->getMessage());
723
  return;
724
  }
725
  }
@@ -733,15 +768,15 @@ class Targetbay_Tracking_Helper_Data extends Mage_Core_Helper_Abstract
733
  public function getOptionValues($options)
734
  {
735
  $optionData = array();
736
- try {
737
- foreach ($options as $option) {
738
- $data['label'] = $option['label'];
739
- $data['value'] = $option['value'];
740
- $optionData[] = $data;
741
- }
742
- return $optionData;
743
  } catch (Exception $e) {
744
- $this->debug('Error message '.$e->getMessage());
745
  return;
746
  }
747
  }
@@ -755,31 +790,31 @@ class Targetbay_Tracking_Helper_Data extends Mage_Core_Helper_Abstract
755
  */
756
  public function getAddressData($object, $type)
757
  {
758
- try {
759
- $address = ($type == self::SHIPPING) ? $object->getShippingAddress() : $object->getBillingAddress();
760
- $addressData = $this->getSessionInfo($object);
761
- $addressData['first_name'] = $address->getFirstname();
762
- $addressData['last_name'] = $address->getLastname();
763
- $guestUsername = $address->getFirstname().' '.$address->getLastname();
764
- $gName = !empty($guestUsername) ? $guestUsername : self::ANONYMOUS_USER;
765
- $addressData['user_name'] = $object->getCustomerIsGuest() ? $gName : $addressData['first_name'] . ' ' . $addressData['last_name'];
766
- $addressData['order_id'] = $object->getId();
767
- $addressData['user_mail'] = $object->getCustomerEmail();
768
- $addressData['address1'] = $address->getStreet(1);
769
- $addressData['address2'] = $address->getStreet(2);
770
- $addressData['city'] = $address->getCity();
771
- $addressData['state'] = $address->getRegion();
772
- $addressData['zipcode'] = $address->getPostcode();
773
- if($address->getCountryId()) {
774
- $countryName = Mage::getModel('directory/country')->loadByCode($address->getCountryId())->getName();
775
- } else {
776
- $countryName = '';
777
- }
778
- $addressData['country'] = isset($countryName) ? $countryName : $address->getCountryId();
779
- $addressData['phone'] = $address->getTelephone();
780
- return $addressData;
781
  } catch (Exception $e) {
782
- $this->debug('Error message '.$e->getMessage());
783
  return;
784
  }
785
  }
@@ -792,45 +827,46 @@ class Targetbay_Tracking_Helper_Data extends Mage_Core_Helper_Abstract
792
  */
793
  public function getProductData($product)
794
  {
795
- $configOptions = array();$customOptions = array();$data = array();
796
- try {
797
- $data['image_url'][] = $this->getProductImages($product);
798
- $data['entity_id'] = $product->getId();
799
- $data['attribute_set_id'] = $product->getEntityTypeId();
800
- $data['type_id'] = $product->getTypeId();
801
- $data['sku'] = $product->getSku();
802
- $data['product_status'] = $product->getStatus();
803
- $data['currency_type'] = Mage::app()->getStore()->getCurrentCurrencyCode();
804
-
805
- $data['stock_count'] = -1;
806
-
807
- if ($stock = $product->getData('stock_data')) {
808
- $data['stock_count'] = !empty($stock['is_in_stock']) ? $stock['qty'] : -1;
809
- }
810
-
811
- $data['visibility'] = $product->getVisibility();
812
- $data['description'] = $product->getDescription();
813
- $data['price'] = $product->getPrice();
814
- $data['special_price'] = $product->getSpecialPrice();
815
- $data['weight'] = $product->getWeight();
816
- $data['name'] = addslashes($product->getName());
817
-
818
- $data['category'] = $this->getProductCategory($product);
819
- $data['url_key'] = $product->getUrlKey();
820
- $data['full_url_key'] = $product->getProductUrl();
821
-
822
- if ($configData = $product->getData('configurable_attributes_data')) {
823
- $configOptions = $this->productOptions($configData, 'label');
824
- }
825
- if ($custOptions = $product->getData('product_options')) {
826
- $customOptions = $this->productOptions($custOptions);
827
- }
828
- $options = array_merge($configOptions, $customOptions);
829
- if (!empty($options))
830
- $data['attributes'] = $options;
831
- return $data;
 
832
  } catch (Exception $e) {
833
- $this->debug('Error message '.$e->getMessage());
834
  return;
835
  }
836
  }
@@ -845,27 +881,27 @@ class Targetbay_Tracking_Helper_Data extends Mage_Core_Helper_Abstract
845
  public function productOptions($configData, $customOption = 'title')
846
  {
847
  $options = array();
848
- try {
849
- foreach ($configData as $cdata) {
850
- $attrLabel = $cdata[$customOption];
851
- if (!isset($cdata['values'])) {
852
- $options[] = array(
853
- 'label' => $attrLabel,
854
- 'value' => $attrLabel
855
- );
856
- continue;
857
- }
858
- foreach ($cdata['values'] as $val) {
859
- $attrVal = $val[$customOption];
860
- $options[] = array(
861
- 'label' => $attrLabel,
862
- 'value' => $attrVal
863
- );
864
- }
865
- }
866
- return $options;
867
  } catch (Exception $e) {
868
- $this->debug('Error message '.$e->getMessage());
869
  return;
870
  }
871
  }
@@ -878,15 +914,15 @@ class Targetbay_Tracking_Helper_Data extends Mage_Core_Helper_Abstract
878
  */
879
  public function getProductImages($product)
880
  {
881
- $images = array();
882
- try {
883
- $images['url'] = $this->getImageUrl($product, 'image');
884
- $images['position'] = 1;
885
- $images['thumbnail_image'] = $this->getImageUrl($product, 'small_image');
886
- $images['medium_image'] = $this->getImageUrl($product, 'thumbnail');
887
- return $images;
888
  } catch (Exception $e) {
889
- $this->debug('Error message '.$e->getMessage());
890
  return;
891
  }
892
  }
@@ -900,13 +936,13 @@ class Targetbay_Tracking_Helper_Data extends Mage_Core_Helper_Abstract
900
  */
901
  public function getImageUrl($product, $imageType)
902
  {
903
- if($product->getData($imageType)) {
904
- $imgPath = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'catalog/product' . $product->getData($imageType);
905
- } else {
906
- $imgPath = '';
907
- }
908
 
909
- return $imgPath;
910
  }
911
 
912
  /**
@@ -916,8 +952,12 @@ class Targetbay_Tracking_Helper_Data extends Mage_Core_Helper_Abstract
916
  */
917
  public function isFullFillmentProcess($params)
918
  {
919
- if (isset($params[self::ORDER_SHIPMENT]) || isset($params[self::ORDER_INVOICE]) || isset($params[self::ORDER_REFUND]))
 
 
 
920
  return true;
 
921
  return false;
922
  }
923
 
@@ -929,27 +969,27 @@ class Targetbay_Tracking_Helper_Data extends Mage_Core_Helper_Abstract
929
  */
930
  public function getWishlistProductInfo($productId)
931
  {
932
- $data = array();
933
- try {
934
- $product = Mage::getModel('catalog/product')->load($productId);
935
- $qty = 1;
936
 
937
- $data['type'] = $product->getTypeId();
938
- $data['product_id'] = $product->getId();
939
- $data['product_sku'] = $product->getSku();
940
- $data['name'] = addslashes($product->getName());
941
- $data['price'] = $product->getPrice();
942
- $data['special_price'] = $product->getSpecialPrice();
943
- $data['productimg'] = $this->getImageUrl($product, 'image');
944
-
945
- $data['category'] = $this->getProductCategory($product);
946
- $data['category_name'] = $this->getProductCategoryName($product);
947
- $data['quantity'] = (Mage::app()->getRequest()->getParam('qty')) ? Mage::app()->getRequest()->getParam('qty') : $qty;
948
- $data['page_url'] = Mage::getUrl($product->getUrlPath());
949
-
950
- return $data;
951
  } catch (Exception $e) {
952
- $this->debug('Error message '.$e->getMessage());
953
  return;
954
  }
955
  }
@@ -963,17 +1003,17 @@ class Targetbay_Tracking_Helper_Data extends Mage_Core_Helper_Abstract
963
  public function getWishlistItemsInfo($wishlistInfo)
964
  {
965
  $dataItems = array();
966
- try {
967
- $wishlistItemCollection = $wishlistInfo->setStoreId(1)->getItemCollection();
968
-
969
- foreach ($wishlistItemCollection as $id => $wishlistItem) {
970
- $product = $wishlistItem->getProduct();
971
- $dataItem = $this->wishlistProductInfo($product);
972
- $dataItems[$id] = $dataItem;
973
- }
974
  return $dataItems;
975
  } catch (Exception $e) {
976
- $this->debug('Error message '.$e->getMessage());
977
  return;
978
  }
979
  }
@@ -986,21 +1026,21 @@ class Targetbay_Tracking_Helper_Data extends Mage_Core_Helper_Abstract
986
  */
987
  public function wishlistProductInfo($product)
988
  {
989
- $dataItem = array();
990
- try {
991
- $product = Mage::getModel('catalog/product')->load($product->getData('entity_id'));
992
- $dataItem['type'] = $product->getTypeId();
993
- $dataItem['product_id'] = $product->getId();
994
- $dataItem['product_name'] = addslashes($product->getName());
995
- $dataItem['price'] = $product->getPrice();
996
- $dataItem['special_price'] = $product->getSpecialPrice();
997
- $dataItem['productimg'] = $this->getImageUrl($product, 'image');
998
- $dataItem['category'] = $this->getProductCategory($product);
999
- $dataItem['category_name'] = $this->getProductCategoryName($product);
1000
- $dataItem['page_url'] = Mage::getUrl($product->getUrlPath());
1001
- return $dataItem;
1002
  } catch (Exception $e) {
1003
- $this->debug('Error message '.$e->getMessage());
1004
  return;
1005
  }
1006
 
@@ -1014,32 +1054,32 @@ class Targetbay_Tracking_Helper_Data extends Mage_Core_Helper_Abstract
1014
  */
1015
  public function getFullFillmentData($order, $params)
1016
  {
1017
- $shipmetItems = array();
1018
- $shipmentsInfo = array();
1019
- try {
1020
- if (isset($params[self::ORDER_SHIPMENT])) {
1021
- $shipmentsInfo['order_id'] = $order->getId();
1022
- $shipmentsInfo['order_status'] = $order->getStatus();
1023
- $shipmentsInfo['total_ordered_qty'] = (int)$order->getData('total_qty_ordered');
1024
- $shipmentsInfo['user_id'] = $order->getData('customer_is_guest') ? self::ANONYMOUS_USER : $order->getData('customer_id');
1025
- $shipmentsInfo['user_mail'] = $order->getData('customer_is_guest') ? $order->getData('customer_email') : $order->getData('customer_email');
1026
- $shipmentsInfo['created_at'] = $order->getData('updated_at');
1027
 
1028
- foreach ($order->getAllVisibleItems() as $item) {
1029
- if ($item->getQtyShipped() == '')
1030
- continue;
1031
- $shipmentItemInfo['product_id'] = $item->getProductId();
1032
- $shipmentItemInfo['name'] = addslashes($item->getName());
1033
- $shipmentItemInfo['sku'] = $item->getSku();
1034
- $shipmentItemInfo['qty_ordered'] = (int)$item->getQtyOrdered();
1035
- $shipmentItemInfo['qty_shipped'] = (int)$item->getQtyShipped();
1036
- $shipmetItems[] = $shipmentItemInfo;
1037
- }
1038
- $shipmentsInfo['shipment_items'] = $shipmetItems;
1039
- return $shipmentsInfo;
1040
- }
1041
  } catch (Exception $e) {
1042
- $this->debug('Error message '.$e->getMessage());
1043
  return;
1044
  }
1045
  }
@@ -1154,30 +1194,55 @@ class Targetbay_Tracking_Helper_Data extends Mage_Core_Helper_Abstract
1154
  */
1155
  public function getProductViewData()
1156
  {
1157
- $data = array();
1158
- // Get the base visit info
1159
- try {
1160
- $data = $this->visitInfo();
1161
- $product = Mage::registry('product');
1162
- $categoryIds = $product->getCategoryIds();
1163
- if (count($categoryIds)) {
1164
- $firstCategoryId = $categoryIds[0];
1165
- $_category = Mage::getModel('catalog/category')->load($firstCategoryId);
1166
- $data['category'] = $_category->getName();
1167
- }
1168
- $data['product_id'] = $product->getId();
1169
- $data['product_name'] = addslashes($product->getName());
1170
- $data['price'] = $product->getPrice();
1171
- $data['special_price'] = $product->getSpecialPrice();
1172
- $data['productimg'] = $product->getImageUrl();
1173
- $data['stock'] = self::OUT_OF_STOCK;
1174
- $stock = $product->getStockItem();
1175
- if ($stock->getIsInStock()) {
1176
- $data['stock'] = self::IN_STOCK;
1177
- }
1178
- return $data;
1179
  } catch (Exception $e) {
1180
- $this->debug('Error message '.$e->getMessage());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1181
  return;
1182
  }
1183
  }
@@ -1190,7 +1255,7 @@ class Targetbay_Tracking_Helper_Data extends Mage_Core_Helper_Abstract
1190
  public function getPageInfo()
1191
  {
1192
  $controllername = Mage::app()->getRequest()->getControllerName();
1193
- $moduleName = Mage::app()->getRequest()->getModuleName();
1194
 
1195
  if ($moduleName == 'cms') {
1196
  $data = $this->getPageVisitData();
@@ -1198,6 +1263,8 @@ class Targetbay_Tracking_Helper_Data extends Mage_Core_Helper_Abstract
1198
  $data = $this->getCategoryViewData();
1199
  } elseif ($controllername == 'product') {
1200
  $data = $this->getProductViewData();
 
 
1201
  }
1202
  $data['index_name'] = $this->getApiIndex();
1203
 
@@ -1212,7 +1279,7 @@ class Targetbay_Tracking_Helper_Data extends Mage_Core_Helper_Abstract
1212
  public function getApiUrl()
1213
  {
1214
  $controllername = Mage::app()->getRequest()->getControllerName();
1215
- $moduleName = Mage::app()->getRequest()->getModuleName();
1216
  $endPointUrl = '';
1217
 
1218
  if ($moduleName == 'cms') {
@@ -1224,6 +1291,9 @@ class Targetbay_Tracking_Helper_Data extends Mage_Core_Helper_Abstract
1224
  } elseif ($controllername == 'product') {
1225
  $type = 'product-view';
1226
  $endPointUrl = $this->getHostname() . $type . '?api_token=' . $this->getApiToken();
 
 
 
1227
  }
1228
 
1229
  return $endPointUrl;
@@ -1344,34 +1414,44 @@ class Targetbay_Tracking_Helper_Data extends Mage_Core_Helper_Abstract
1344
  */
1345
  public function getRichSnippets()
1346
  {
1347
- $data = array();
1348
- $responseData = '';
1349
  $controllername = Mage::app()->getRequest()->getControllerName();
1350
- $moduleName = Mage::app()->getRequest()->getModuleName();
 
1351
  try {
1352
- $type = self::RATINGS_STATS;
1353
- $apiToken = '?api_token=' . $this->getApiToken();
1354
- $feedUrl = $this->getHostname() . $type . $apiToken;
1355
- $data['index_name'] = $this->getApiIndex();
1356
- if($moduleName == 'catalog' && $controllername == 'product') {
1357
- $productId = Mage::registry('product')->getId();
1358
- $data['product_id'] = $productId;
1359
- }
1360
-
1361
- $jsondata = json_encode($data);
1362
- $response = $this->postPageInfo($feedUrl, $jsondata);
1363
 
 
 
 
1364
  $body = json_decode($response);
1365
- if(!empty($body)) {
1366
- $averageScore = $body->reviews_average;
1367
- $reviewsCount = $body->reviews_count;
1368
- $reviewsDetails = $body->reviews;
1369
- $responseData = array( "average_score" => $averageScore, "reviews_count" => $reviewsCount, "reviews" => $reviewsDetails);
1370
- return $responseData;
1371
- }
 
 
 
 
 
 
 
 
 
1372
  } catch(Exception $e) {
1373
- $this->debug('Error message '.$e->getMessage());
1374
- return;
1375
  }
1376
  }
1377
 
@@ -1382,20 +1462,20 @@ class Targetbay_Tracking_Helper_Data extends Mage_Core_Helper_Abstract
1382
  */
1383
  public function getTargetbayReviewId()
1384
  {
1385
- $itemRefData = array();
1386
- $itemRef = '';
1387
  try {
1388
- $trackingSnippet = $this->getRichSnippets();
1389
- if($trackingSnippet['reviews_count'] > 0) {
1390
- foreach($trackingSnippet['reviews'] as $key => $aggregateReviewDetails) {
1391
- $itemRefData[]= 'tb-review-'.$key;
1392
- }
1393
- $itemRef = implode(' ', $itemRefData);
1394
- }
1395
- return $itemRef;
1396
  } catch(Exception $e) {
1397
- $this->debug('Error message '.$e->getMessage());
1398
- return;
1399
  }
1400
  }
1401
 
@@ -1406,28 +1486,86 @@ class Targetbay_Tracking_Helper_Data extends Mage_Core_Helper_Abstract
1406
  */
1407
  public function getSiteReviewSnippets()
1408
  {
1409
- $data = array();
1410
- $responseData = '';
 
1411
  try {
1412
- $type = self::RATINGS_STATS;
1413
- $apiToken = '?api_token=' . $this->getApiToken();
1414
- $feedUrl = $this->getHostname() . $type . $apiToken;
1415
- $data['index_name'] = $this->getApiIndex();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1416
 
1417
- $jsondata = json_encode($data);
1418
- $response = $this->postPageInfo($feedUrl, $jsondata);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1419
 
 
 
 
1420
  $body = json_decode($response);
1421
- if(!empty($body)) {
1422
- $averageScore = $body->reviews_average;
1423
- $reviewsCount = $body->reviews_count;
1424
- $reviewsDetails = $body->reviews;
1425
- $responseData = array( "average_score" => $averageScore, "reviews_count" => $reviewsCount, "reviews" => $reviewsDetails);
1426
- return $responseData;
1427
- }
 
 
 
 
 
 
 
 
 
1428
  } catch(Exception $e) {
1429
- $this->debug('Error message '.$e->getMessage());
1430
- return;
1431
  }
1432
  }
1433
- }
58
  CONST ORDER_SHIPMENT = 'shipment';
59
  CONST ORDER_INVOICE = 'invoice';
60
  CONST ORDER_REFUND = 'creditmemo';
61
+ CONST ORDER_STATUS = 'order-status';
62
 
63
  CONST HOST_STAGE = 'https://stage.targetbay.com/api/v1/webhooks/';
64
  CONST HOST_LIVE = 'https://app.targetbay.com/api/v1/webhooks/';
392
  $data['utm_sources'] = $this->cookie->get('utm_source') ? $this->cookie->get('utm_source') : '';
393
  $data['utm_token'] = $this->cookie->get('utm_token') ? $this->cookie->get('utm_token') : '';
394
  $pageTitle = Mage::app()->getLayout()->getBlock('head') ? Mage::app()->getLayout()->getBlock('head')->getTitle() : Mage::getSingleton('checkout/session')->getTitle();
395
+ $data['page_title'] = str_replace("'", " ", $pageTitle);
396
  return $data;
397
  } catch (Exception $e) {
398
  $this->debug('Error message:'.$e->getMessage());
548
  */
549
  public function getInfo($object)
550
  {
551
+ try {
552
+ $customer = $object->getCustomer();
553
+ $items = $object->getAllVisibleItems();
554
+ $data = $this->getSessionInfo($object);
555
+ $data['first_name'] = $object->getCustomerFirstname();
556
+ $data['last_name'] = $object->getCustomerLastname();
557
+ $guestUsername = $object->getCustomerFirstname().' '.$object->getCustomerLastname();
558
+ $gName = !empty($guestUsername) ? $guestUsername : self::ANONYMOUS_USER;
559
+ $data['user_name'] = $object->getCustomerIsGuest() ? $gName : $data['first_name'] . ' ' . $data['last_name'];
560
+ $data['user_mail'] = $object->getCustomerEmail();
561
+ $data['order_id'] = $object->getId();
562
+ $data['order_price'] = $object->getSubtotal();
563
+ $data['order_quantity'] = $object->getData('total_qty_ordered');
564
+ $data['shipping_method'] = $object->getData('shipping_description');
565
+ $data['shipping_price'] = $object->getData('shipping_amount');
566
+ $data['tax_amount'] = $object->getData('tax_amount');
567
+ $data['payment_method'] = $object->getPayment()->getMethodInstance()->getTitle();
568
+ $data['cart_items'] = $this->getOrderItemsInfo($object);
569
+ return $data;
570
  } catch (Exception $e) {
571
+ $this->debug('Error message '.$e->getMessage());
572
+ return;
573
+ }
574
+ }
575
+
576
+ /**
577
+ * Get the Order data
578
+ *
579
+ * @param unknown $object
580
+ * @return string
581
+ */
582
+ public function getOrderInfo($object)
583
+ {
584
+ try {
585
+ $customer = $object->getCustomer();
586
+ $items = $object->getAllVisibleItems();
587
+ $data['user_id'] = $object->getCustomerIsGuest() ? self::ANONYMOUS_USER : $object->getCustomerId();
588
+ $data['first_name'] = $object->getCustomerFirstname();
589
+ $data['last_name'] = $object->getCustomerLastname();
590
+ $guestUsername = $object->getCustomerFirstname().' '.$object->getCustomerLastname();
591
+ $gName = !empty($guestUsername) ? $guestUsername : self::ANONYMOUS_USER;
592
+ $data['user_name'] = $object->getCustomerIsGuest() ? $gName : $data['first_name'] . ' ' . $data['last_name'];
593
+ $data['user_mail'] = $object->getCustomerEmail();
594
+ $data['order_id'] = $object->getId();
595
+ $data['order_status'] = $object->getStatus();
596
+ $data['order_price'] = $object->getSubtotal();
597
+ $data['order_quantity'] = $object->getData('total_qty_ordered');
598
+ $data['shipping_method'] = $object->getData('shipping_description');
599
+ $data['shipping_price'] = $object->getData('shipping_amount');
600
+ $data['tax_amount'] = $object->getData('tax_amount');
601
+ $data['payment_method'] = $object->getPayment()->getMethodInstance()->getTitle();
602
+ $data['cart_items'] = $this->getOrderItemsInfo($object);
603
+ return $data;
604
+ } catch (Exception $e) {
605
+ $this->debug('Error message '.$e->getMessage());
606
  return;
607
  }
608
  }
626
  }
627
  return $dataItems;
628
  } catch (Exception $e) {
629
+ $this->debug('Error message '.$e->getMessage());
630
  return;
631
  }
632
  }
639
  */
640
  public function getPaymentInfo($orderId, $orderExportApi = false)
641
  {
642
+ $paymentTitle = '';$paymentMethod = '';
643
+ try {
644
+ $paymentCollection = Mage::getModel('sales/order_payment')->getCollection()->addFieldToFilter('parent_id', $orderId);
645
+ foreach ($paymentCollection as $paymentDetails) {
646
+ $paymentMethod = $paymentDetails->getMethod();
647
+ }
648
+
649
+ $store = Mage::app()->getStore();
650
+ $path = 'payment/' . $paymentMethod . '/title';
651
+ $paymentTitle = Mage::getStoreConfig($path, $store);
652
+ return $paymentTitle;
653
  } catch (Exception $e) {
654
+ $this->debug('Error message '.$e->getMessage());
655
  return;
656
  }
657
  }
664
  */
665
  public function getItemInfo($item, $actionType = false)
666
  {
667
+ $dataItem = array();
668
+ try {
669
+ $product = Mage::getModel('catalog/product')->load($item->getData('product_id'));
670
+ $dataItem['type'] = $item->getProductType();
671
+ $dataItem['product_id'] = $item->getProductId();
672
+ $dataItem['product_sku'] = $item->getSku();
673
+ $dataItem['product_name'] = addslashes($item->getName());
674
+ $dataItem['price'] = $actionType ? $item->getProduct()->getPrice() : $item->getPrice();
675
+ $dataItem['special_price'] = $product->getSpecialPrice();
676
+ $qty = $actionType ? $item->getProduct()->getQty() : $item->getQty();
677
+ $dataItem['productimg'] = $this->getImageUrl($product, 'image');
678
+
679
+ $dataItem['category'] = $this->getProductCategory($product);
680
+ $dataItem['category_name'] = $this->getProductCategoryName($product);
681
+ $dataItem['quantity'] = ($item->getData('qty_ordered')) ? $item->getData('qty_ordered') : $qty;
682
+ $dataItem['page_url'] = Mage::getUrl($product->getUrlPath());
683
+ return $dataItem;
684
  } catch (Exception $e) {
685
+ $this->debug('Error message '.$e->getMessage());
686
  return;
687
  }
688
  }
703
  if (count($categoryIds)) {
704
  foreach ($categoryIds as $categoryId) {
705
  $_category = Mage::getModel('catalog/category')->load($categoryId);
706
+ $productCategories[] = str_replace("'", " ", $_category->getName());
707
  }
708
 
709
  $categoryName = implode(',', $productCategories);
754
  $optionsData = array_merge($superAttributeInfo, $customOptionInfo);
755
  return $optionsData;
756
  } catch (Exception $e) {
757
+ $this->debug('Error message '.$e->getMessage());
758
  return;
759
  }
760
  }
768
  public function getOptionValues($options)
769
  {
770
  $optionData = array();
771
+ try {
772
+ foreach ($options as $option) {
773
+ $data['label'] = $option['label'];
774
+ $data['value'] = $option['value'];
775
+ $optionData[] = $data;
776
+ }
777
+ return $optionData;
778
  } catch (Exception $e) {
779
+ $this->debug('Error message '.$e->getMessage());
780
  return;
781
  }
782
  }
790
  */
791
  public function getAddressData($object, $type)
792
  {
793
+ try {
794
+ $address = ($type == self::SHIPPING) ? $object->getShippingAddress() : $object->getBillingAddress();
795
+ $addressData = $this->getSessionInfo($object);
796
+ $addressData['first_name'] = $address->getFirstname();
797
+ $addressData['last_name'] = $address->getLastname();
798
+ $guestUsername = $address->getFirstname().' '.$address->getLastname();
799
+ $gName = !empty($guestUsername) ? $guestUsername : self::ANONYMOUS_USER;
800
+ $addressData['user_name'] = $object->getCustomerIsGuest() ? $gName : $addressData['first_name'] . ' ' . $addressData['last_name'];
801
+ $addressData['order_id'] = $object->getId();
802
+ $addressData['user_mail'] = $object->getCustomerEmail();
803
+ $addressData['address1'] = $address->getStreet(1);
804
+ $addressData['address2'] = $address->getStreet(2);
805
+ $addressData['city'] = $address->getCity();
806
+ $addressData['state'] = $address->getRegion();
807
+ $addressData['zipcode'] = $address->getPostcode();
808
+ if($address->getCountryId()) {
809
+ $countryName = Mage::getModel('directory/country')->loadByCode($address->getCountryId())->getName();
810
+ } else {
811
+ $countryName = '';
812
+ }
813
+ $addressData['country'] = isset($countryName) ? $countryName : $address->getCountryId();
814
+ $addressData['phone'] = $address->getTelephone();
815
+ return $addressData;
816
  } catch (Exception $e) {
817
+ $this->debug('Error message '.$e->getMessage());
818
  return;
819
  }
820
  }
827
  */
828
  public function getProductData($product)
829
  {
830
+ $configOptions = array();$customOptions = array();$data = array();
831
+ try {
832
+ $data['image_url'][] = $this->getProductImages($product);
833
+ $data['entity_id'] = $product->getId();
834
+ $data['attribute_set_id'] = $product->getEntityTypeId();
835
+ $data['type_id'] = $product->getTypeId();
836
+ $data['sku'] = $product->getSku();
837
+ $data['product_status'] = $product->getStatus();
838
+ $data['currency_type'] = Mage::app()->getStore()->getCurrentCurrencyCode();
839
+
840
+ $data['stock_count'] = -1;
841
+
842
+ if($stock = $product->getData('stock_data')) {
843
+ $data['stock_count'] = !empty($stock['is_in_stock']) ? $stock['qty'] : -1;
844
+ }
845
+
846
+ $data['visibility'] = $product->getVisibility();
847
+ $data['description'] = $product->getDescription();
848
+ $data['price'] = $product->getPrice();
849
+ $data['special_price'] = $product->getSpecialPrice();
850
+ $data['weight'] = $product->getWeight();
851
+ $data['name'] = addslashes($product->getName());
852
+
853
+ $data['category'] = $this->getProductCategory($product);
854
+ $data['url_key'] = $product->getUrlKey();
855
+ $data['full_url_key'] = $product->getProductUrl();
856
+
857
+ if($configData = $product->getData('configurable_attributes_data')) {
858
+ $configOptions = $this->productOptions($configData, 'label');
859
+ }
860
+ if($custOptions = $product->getData('product_options')) {
861
+ $customOptions = $this->productOptions($custOptions);
862
+ }
863
+ $options = array_merge($configOptions, $customOptions);
864
+ if(!empty($options)) {
865
+ $data['attributes'] = $options;
866
+ }
867
+ return $data;
868
  } catch (Exception $e) {
869
+ $this->debug('Error message '.$e->getMessage());
870
  return;
871
  }
872
  }
881
  public function productOptions($configData, $customOption = 'title')
882
  {
883
  $options = array();
884
+ try {
885
+ foreach($configData as $cdata) {
886
+ $attrLabel = $cdata[$customOption];
887
+ if(!isset($cdata['values'])) {
888
+ $options[] = array(
889
+ 'label' => $attrLabel,
890
+ 'value' => $attrLabel
891
+ );
892
+ continue;
893
+ }
894
+ foreach($cdata['values'] as $val) {
895
+ $attrVal = $val[$customOption];
896
+ $options[] = array(
897
+ 'label' => $attrLabel,
898
+ 'value' => $attrVal
899
+ );
900
+ }
901
+ }
902
+ return $options;
903
  } catch (Exception $e) {
904
+ $this->debug('Error message '.$e->getMessage());
905
  return;
906
  }
907
  }
914
  */
915
  public function getProductImages($product)
916
  {
917
+ $images = array();
918
+ try {
919
+ $images['url'] = $this->getImageUrl($product, 'image');
920
+ $images['position'] = 1;
921
+ $images['thumbnail_image'] = $this->getImageUrl($product, 'small_image');
922
+ $images['medium_image'] = $this->getImageUrl($product, 'thumbnail');
923
+ return $images;
924
  } catch (Exception $e) {
925
+ $this->debug('Error message '.$e->getMessage());
926
  return;
927
  }
928
  }
936
  */
937
  public function getImageUrl($product, $imageType)
938
  {
939
+ if($product->getData($imageType)) {
940
+ $imgPath = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'catalog/product' . $product->getData($imageType);
941
+ } else {
942
+ $imgPath = '';
943
+ }
944
 
945
+ return $imgPath;
946
  }
947
 
948
  /**
952
  */
953
  public function isFullFillmentProcess($params)
954
  {
955
+ if(isset($params[self::ORDER_SHIPMENT]) ||
956
+ isset($params[self::ORDER_INVOICE]) ||
957
+ isset($params[self::ORDER_REFUND])
958
+ ) {
959
  return true;
960
+ }
961
  return false;
962
  }
963
 
969
  */
970
  public function getWishlistProductInfo($productId)
971
  {
972
+ $data = array();
973
+ try {
974
+ $product = Mage::getModel('catalog/product')->load($productId);
975
+ $qty = 1;
976
 
977
+ $data['type'] = $product->getTypeId();
978
+ $data['product_id'] = $product->getId();
979
+ $data['product_sku'] = $product->getSku();
980
+ $data['name'] = addslashes($product->getName());
981
+ $data['price'] = $product->getPrice();
982
+ $data['special_price'] = $product->getSpecialPrice();
983
+ $data['productimg'] = $this->getImageUrl($product, 'image');
984
+
985
+ $data['category'] = $this->getProductCategory($product);
986
+ $data['category_name'] = $this->getProductCategoryName($product);
987
+ $data['quantity'] = (Mage::app()->getRequest()->getParam('qty')) ? Mage::app()->getRequest()->getParam('qty') : $qty;
988
+ $data['page_url'] = Mage::getUrl($product->getUrlPath());
989
+
990
+ return $data;
991
  } catch (Exception $e) {
992
+ $this->debug('Error message '.$e->getMessage());
993
  return;
994
  }
995
  }
1003
  public function getWishlistItemsInfo($wishlistInfo)
1004
  {
1005
  $dataItems = array();
1006
+ try {
1007
+ $wishlistItemCollection = $wishlistInfo->setStoreId(1)->getItemCollection();
1008
+
1009
+ foreach ($wishlistItemCollection as $id => $wishlistItem) {
1010
+ $product = $wishlistItem->getProduct();
1011
+ $dataItem = $this->wishlistProductInfo($product);
1012
+ $dataItems[$id] = $dataItem;
1013
+ }
1014
  return $dataItems;
1015
  } catch (Exception $e) {
1016
+ $this->debug('Error message '.$e->getMessage());
1017
  return;
1018
  }
1019
  }
1026
  */
1027
  public function wishlistProductInfo($product)
1028
  {
1029
+ $dataItem = array();
1030
+ try {
1031
+ $product = Mage::getModel('catalog/product')->load($product->getData('entity_id'));
1032
+ $dataItem['type'] = $product->getTypeId();
1033
+ $dataItem['product_id'] = $product->getId();
1034
+ $dataItem['product_name'] = addslashes($product->getName());
1035
+ $dataItem['price'] = $product->getPrice();
1036
+ $dataItem['special_price'] = $product->getSpecialPrice();
1037
+ $dataItem['productimg'] = $this->getImageUrl($product, 'image');
1038
+ $dataItem['category'] = $this->getProductCategory($product);
1039
+ $dataItem['category_name'] = $this->getProductCategoryName($product);
1040
+ $dataItem['page_url'] = Mage::getUrl($product->getUrlPath());
1041
+ return $dataItem;
1042
  } catch (Exception $e) {
1043
+ $this->debug('Error message '.$e->getMessage());
1044
  return;
1045
  }
1046
 
1054
  */
1055
  public function getFullFillmentData($order, $params)
1056
  {
1057
+ $shipmetItems = array();
1058
+ $shipmentsInfo = array();
1059
+ try {
1060
+ if (isset($params[self::ORDER_SHIPMENT])) {
1061
+ $shipmentsInfo['order_id'] = $order->getId();
1062
+ $shipmentsInfo['order_status'] = $order->getStatus();
1063
+ $shipmentsInfo['total_ordered_qty'] = (int)$order->getData('total_qty_ordered');
1064
+ $shipmentsInfo['user_id'] = $order->getData('customer_is_guest') ? self::ANONYMOUS_USER : $order->getData('customer_id');
1065
+ $shipmentsInfo['user_mail'] = $order->getData('customer_is_guest') ? $order->getData('customer_email') : $order->getData('customer_email');
1066
+ $shipmentsInfo['created_at'] = $order->getData('updated_at');
1067
 
1068
+ foreach ($order->getAllVisibleItems() as $item) {
1069
+ if ($item->getQtyShipped() == '')
1070
+ continue;
1071
+ $shipmentItemInfo['product_id'] = $item->getProductId();
1072
+ $shipmentItemInfo['name'] = addslashes($item->getName());
1073
+ $shipmentItemInfo['sku'] = $item->getSku();
1074
+ $shipmentItemInfo['qty_ordered'] = (int)$item->getQtyOrdered();
1075
+ $shipmentItemInfo['qty_shipped'] = (int)$item->getQtyShipped();
1076
+ $shipmetItems[] = $shipmentItemInfo;
1077
+ }
1078
+ $shipmentsInfo['shipment_items'] = $shipmetItems;
1079
+ return $shipmentsInfo;
1080
+ }
1081
  } catch (Exception $e) {
1082
+ $this->debug('Error message '.$e->getMessage());
1083
  return;
1084
  }
1085
  }
1194
  */
1195
  public function getProductViewData()
1196
  {
1197
+ $data = array();
1198
+ // Get the base visit info
1199
+ try {
1200
+ $data = $this->visitInfo();
1201
+ $product = Mage::registry('product');
1202
+ $categoryIds = $product->getCategoryIds();
1203
+ if (count($categoryIds)) {
1204
+ $firstCategoryId = $categoryIds[0];
1205
+ $_category = Mage::getModel('catalog/category')->load($firstCategoryId);
1206
+ $data['category'] = $_category->getName();
1207
+ }
1208
+ $data['product_id'] = $product->getId();
1209
+ $data['product_name'] = addslashes($product->getName());
1210
+ $data['price'] = $product->getPrice();
1211
+ $data['special_price'] = $product->getSpecialPrice();
1212
+ $data['productimg'] = $product->getImageUrl();
1213
+ $data['stock'] = self::OUT_OF_STOCK;
1214
+ $stock = $product->getStockItem();
1215
+ if ($stock->getIsInStock()) {
1216
+ $data['stock'] = self::IN_STOCK;
1217
+ }
1218
+ return $data;
1219
  } catch (Exception $e) {
1220
+ $this->debug('Error message '.$e->getMessage());
1221
+ return;
1222
+ }
1223
+ }
1224
+
1225
+ /**
1226
+ * Catalog search result page
1227
+ *
1228
+ * @param Varien_Event_Observer $observer
1229
+ *
1230
+ * @return void
1231
+ */
1232
+ public function getCatalogSearchResultData()
1233
+ {
1234
+ $data = array();
1235
+
1236
+ try {
1237
+ $keyword = Mage::app()->getRequest()->getParam('q');
1238
+ if (empty($keyword)) {
1239
+ return false;
1240
+ }
1241
+ $data = $this->visitInfo();
1242
+ $data['keyword'] = $keyword;
1243
+ return $data;
1244
+ } catch (Exception $e) {
1245
+ $this->debug('Error message '.$e->getMessage());
1246
  return;
1247
  }
1248
  }
1255
  public function getPageInfo()
1256
  {
1257
  $controllername = Mage::app()->getRequest()->getControllerName();
1258
+ $moduleName = Mage::app()->getRequest()->getModuleName();
1259
 
1260
  if ($moduleName == 'cms') {
1261
  $data = $this->getPageVisitData();
1263
  $data = $this->getCategoryViewData();
1264
  } elseif ($controllername == 'product') {
1265
  $data = $this->getProductViewData();
1266
+ } elseif ($moduleName == 'catalogsearch') {
1267
+ $data = $this->getCatalogSearchResultData();
1268
  }
1269
  $data['index_name'] = $this->getApiIndex();
1270
 
1279
  public function getApiUrl()
1280
  {
1281
  $controllername = Mage::app()->getRequest()->getControllerName();
1282
+ $moduleName = Mage::app()->getRequest()->getModuleName();
1283
  $endPointUrl = '';
1284
 
1285
  if ($moduleName == 'cms') {
1291
  } elseif ($controllername == 'product') {
1292
  $type = 'product-view';
1293
  $endPointUrl = $this->getHostname() . $type . '?api_token=' . $this->getApiToken();
1294
+ } elseif ($moduleName == 'catalogsearch') {
1295
+ $type = 'searched';
1296
+ $endPointUrl = $this->getHostname() . $type . '?api_token=' . $this->getApiToken();
1297
  }
1298
 
1299
  return $endPointUrl;
1414
  */
1415
  public function getRichSnippets()
1416
  {
1417
+ $data = array();
1418
+ $responseData = '';
1419
  $controllername = Mage::app()->getRequest()->getControllerName();
1420
+ $moduleName = Mage::app()->getRequest()->getModuleName();
1421
+ $productReviewCount = Mage::getSingleton('core/session')->getProductReview();
1422
  try {
1423
+ $type = self::RATINGS_STATS;
1424
+ $apiToken = '?api_token=' . $this->getApiToken();
1425
+ $feedUrl = $this->getHostname() . $type . $apiToken;
1426
+ $data['index_name'] = $this->getApiIndex();
1427
+ if($moduleName == 'catalog' && $controllername == 'product') {
1428
+ $productId = Mage::registry('product')->getId();
1429
+ $data['product_id'] = $productId;
1430
+ }
 
 
 
1431
 
1432
+ if($productReviewCount < 1 || $productReviewCount == '') {
1433
+ $jsondata = json_encode($data);
1434
+ $response = $this->postPageInfo($feedUrl, $jsondata);
1435
  $body = json_decode($response);
1436
+
1437
+ if($body->reviews_count > 1) {
1438
+ $_SESSION['last_session'] = time();
1439
+ Mage::getSingleton('core/session')->setProductReview($body->reviews_count);
1440
+ Mage::getSingleton('core/session')->setProductReviewResponse($body);
1441
+ }
1442
+ }
1443
+
1444
+ $responseBody = Mage::getSingleton('core/session')->getProductReviewResponse();
1445
+ if(!empty($responseBody)) {
1446
+ $averageScore = $responseBody->reviews_average;
1447
+ $reviewsCount = $responseBody->reviews_count;
1448
+ $reviewsDetails = $responseBody->reviews;
1449
+ $responseData = array( "average_score" => $averageScore, "reviews_count" => $reviewsCount, "reviews" => $reviewsDetails);
1450
+ return $responseData;
1451
+ }
1452
  } catch(Exception $e) {
1453
+ $this->debug('Error message '.$e->getMessage());
1454
+ return;
1455
  }
1456
  }
1457
 
1462
  */
1463
  public function getTargetbayReviewId()
1464
  {
1465
+ $itemRefData = array();
1466
+ $itemRef = '';
1467
  try {
1468
+ $trackingSnippet = $this->getRichSnippets();
1469
+ if($trackingSnippet['reviews_count'] > 0) {
1470
+ foreach($trackingSnippet['reviews'] as $key => $aggregateReviewDetails) {
1471
+ $itemRefData[]= 'tb-review-'.$key;
1472
+ }
1473
+ $itemRef = implode(' ', $itemRefData);
1474
+ }
1475
+ return $itemRef;
1476
  } catch(Exception $e) {
1477
+ $this->debug('Error message '.$e->getMessage());
1478
+ return;
1479
  }
1480
  }
1481
 
1486
  */
1487
  public function getSiteReviewSnippets()
1488
  {
1489
+ $data = array();
1490
+ $responseData = '';
1491
+ $siteReviewCount = Mage::getSingleton('core/session')->getSiteReview();
1492
  try {
1493
+ $type = self::RATINGS_STATS;
1494
+ $apiToken = '?api_token=' . $this->getApiToken();
1495
+ $feedUrl = $this->getHostname() . $type . $apiToken;
1496
+ $data['index_name'] = $this->getApiIndex();
1497
+
1498
+ if($siteReviewCount < 1 || $siteReviewCount == '') {
1499
+ $jsondata = json_encode($data);
1500
+ $response = $this->postPageInfo($feedUrl, $jsondata);
1501
+ $body = json_decode($response);
1502
+
1503
+ if($body->reviews_count > 1) {
1504
+ Mage::getSingleton('core/session')->setSiteReview($body->reviews_count);
1505
+ Mage::getSingleton('core/session')->setSiteReviewResponse($body);
1506
+ $_SESSION['last_session'] = time();
1507
+ }
1508
+ }
1509
+
1510
+ $responseBody = Mage::getSingleton('core/session')->getSiteReviewResponse();
1511
+ if(!empty($responseBody)) {
1512
+ $averageScore = $responseBody->reviews_average;
1513
+ $reviewsCount = $responseBody->reviews_count;
1514
+ $reviewsDetails = $responseBody->reviews;
1515
+ $responseData = array( "average_score" => $averageScore, "reviews_count" => $reviewsCount, "reviews" => $reviewsDetails);
1516
+ return $responseData;
1517
+ }
1518
+ } catch(Exception $e) {
1519
+ $this->debug('Error message '.$e->getMessage());
1520
+ return;
1521
+ }
1522
+ }
1523
 
1524
+ /**
1525
+ * Get the targetbay review count and rating for product
1526
+ *
1527
+ * @return array
1528
+ */
1529
+ public function getQuestionSnippets()
1530
+ {
1531
+ $data = array();
1532
+ $responseData = '';
1533
+ $controllername = Mage::app()->getRequest()->getControllerName();
1534
+ $moduleName = Mage::app()->getRequest()->getModuleName();
1535
+ $qaReviewCount = Mage::getSingleton('core/session')->getQaReview();
1536
+ try {
1537
+ $type = self::QUESTION_STATS;
1538
+ $apiToken = '?api_token=' . $this->getApiToken();
1539
+ $feedUrl = $this->getHostname() . $type . $apiToken;
1540
+ $data['index_name'] = $this->getApiIndex();
1541
+ if($moduleName == 'catalog' && $controllername == 'product') {
1542
+ $productId = Mage::registry('product')->getId();
1543
+ $data['product_id'] = $productId;
1544
+ }
1545
 
1546
+ if($qaReviewCount < 1 || $qaReviewCount == '') {
1547
+ $jsondata = json_encode($data);
1548
+ $response = $this->postPageInfo($feedUrl, $jsondata);
1549
  $body = json_decode($response);
1550
+
1551
+ if($body->qa_count > 1) {
1552
+ Mage::getSingleton('core/session')->setQaReview($body->qa_count);
1553
+ Mage::getSingleton('core/session')->setQaReviewResponse($body);
1554
+ $_SESSION['last_session'] = time();
1555
+ }
1556
+ }
1557
+
1558
+ $responseBody = Mage::getSingleton('core/session')->getQaReviewResponse();
1559
+ if(!empty($responseBody)) {
1560
+ $qaCount = $responseBody->qa_count;
1561
+ $qaDetails = $responseBody->qas;
1562
+ $qaAuthor = $responseBody->client;
1563
+ $responseData = array("qa_count" => $qaCount, "qa_details" => $qaDetails, "qa_author" => $qaAuthor);
1564
+ return $responseData;
1565
+ }
1566
  } catch(Exception $e) {
1567
+ $this->debug('Error message '.$e->getMessage());
1568
+ return;
1569
  }
1570
  }
1571
+ }
app/code/community/Targetbay/Tracking/Model/Api2/Cartitem/Rest/Guest/V1.php CHANGED
@@ -54,7 +54,7 @@ class Targetbay_Tracking_Model_Api2_Cartitem_Rest_Guest_V1 extends Targetbay_Tra
54
  ;
55
  $collection->getSelect()->join(array('Q2'=> $quoteTable), '`main_table`.`entity_id` = `Q2`.`quote_id`', array('*'))->group('Q2.quote_id');
56
 
57
- $collection->getSelect()->limit($limit, $page_num);
58
  return $collection;
59
  }
60
  }
54
  ;
55
  $collection->getSelect()->join(array('Q2'=> $quoteTable), '`main_table`.`entity_id` = `Q2`.`quote_id`', array('*'))->group('Q2.quote_id');
56
 
57
+ $collection->getSelect()->limit($limit, $page_num);
58
  return $collection;
59
  }
60
  }
app/code/community/Targetbay/Tracking/Model/Api2/Product/Rest/Admin/V1.php CHANGED
@@ -24,11 +24,9 @@ class Targetbay_Tracking_Model_Api2_Product_Rest_Admin_V1 extends Mage_Catalog_M
24
  $store = $this->_getStore();
25
  $collection->setStoreId($store->getId());
26
  $collection->addAttributeToSelect(array_keys($this->getAvailableAttributes($this->getUserType(), Mage_Api2_Model_Resource::OPERATION_ATTRIBUTE_READ)));
27
- $collection->addStoreFilter($store->getId())->addPriceData($this->_getCustomerGroupId(), $store->getWebsiteId())->addAttributeToSelect(array_diff($availableAttributes, $entityOnlyAttributes))->addAttributeToFilter('visibility', array(
28
- 'neq' => Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE
29
- ))->addAttributeToFilter('status', array(
30
- 'eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED
31
- ));
32
  $this->_applyCategoryFilter($collection);
33
  $this->_applyCollectionModifiers( $collection);
34
  $products = $collection->load()->toArray();
@@ -52,8 +50,8 @@ class Targetbay_Tracking_Model_Api2_Product_Rest_Admin_V1 extends Mage_Catalog_M
52
  $products[$id]['status'] = $product->getStatus();
53
  $products[$id]['website_id'] = $product->getWebsiteIds();
54
  $products[$id]['store_id'] = $product->getStoreIds();
55
- $products[$id]['price'] = Mage::helper('core')->currency($product->getPrice(), true, false);
56
- $products[$id]['special_price'] = Mage::helper('core')->currency($product->getSpecialPrice(), true, false);
57
  $products[$id]['image_url'] = (string) Mage::helper('catalog/image')->init($product, 'image');
58
 
59
  $configOptions = array();
@@ -88,7 +86,7 @@ class Targetbay_Tracking_Model_Api2_Product_Rest_Admin_V1 extends Mage_Catalog_M
88
  $products[$id]['child_items'] = $childProductData;
89
  $products[$id]['parent_id'] = $product->getId();
90
  }
91
- s
92
  if($custOptions = Mage::getModel('catalog/product')->load($product->getId())->getOptions()) {
93
  $customOptions = Mage::helper('tracking')->productOptions($custOptions);
94
  }
24
  $store = $this->_getStore();
25
  $collection->setStoreId($store->getId());
26
  $collection->addAttributeToSelect(array_keys($this->getAvailableAttributes($this->getUserType(), Mage_Api2_Model_Resource::OPERATION_ATTRIBUTE_READ)));
27
+
28
+ $collection->addStoreFilter($store->getId())->addPriceData($this->_getCustomerGroupId(), $store->getWebsiteId())->addAttributeToSelect(array_diff($availableAttributes, $entityOnlyAttributes));
29
+
 
 
30
  $this->_applyCategoryFilter($collection);
31
  $this->_applyCollectionModifiers( $collection);
32
  $products = $collection->load()->toArray();
50
  $products[$id]['status'] = $product->getStatus();
51
  $products[$id]['website_id'] = $product->getWebsiteIds();
52
  $products[$id]['store_id'] = $product->getStoreIds();
53
+ $products[$id]['price'] = $product->getFinalPrice();
54
+ $products[$id]['special_price'] = $product->getSpecialPrice();
55
  $products[$id]['image_url'] = (string) Mage::helper('catalog/image')->init($product, 'image');
56
 
57
  $configOptions = array();
86
  $products[$id]['child_items'] = $childProductData;
87
  $products[$id]['parent_id'] = $product->getId();
88
  }
89
+
90
  if($custOptions = Mage::getModel('catalog/product')->load($product->getId())->getOptions()) {
91
  $customOptions = Mage::helper('tracking')->productOptions($custOptions);
92
  }
app/code/community/Targetbay/Tracking/Model/Api2/Product/Rest/Guest/V1.php CHANGED
@@ -27,15 +27,12 @@ class Targetbay_Tracking_Model_Api2_Product_Rest_Guest_V1 extends Mage_Catalog_M
27
 
28
  // available attributes not contain image attribute, but it needed for get image_url
29
  $availableAttributes[] = 'image';
30
- $collection->addStoreFilter($store->getId())->addPriceData($this->_getCustomerGroupId(), $store->getWebsiteId())->addAttributeToSelect(array_diff($availableAttributes, $entityOnlyAttributes))->addAttributeToFilter('visibility', array(
31
- 'neq' => Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE
32
- ))->addAttributeToFilter('status', array(
33
- 'eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED
34
- ));
35
  $this->_applyCategoryFilter($collection);
36
  $this->_applyCollectionModifiers($collection);
 
37
  $products = $collection->load();
38
-
39
  /**
40
  *
41
  * @var Mage_Catalog_Model_Product $product
@@ -77,7 +74,8 @@ class Targetbay_Tracking_Model_Api2_Product_Rest_Guest_V1 extends Mage_Catalog_M
77
  $productData['store_id'] = $product->getStoreIds();
78
  $productData['url'] = $product->getUrlKey();
79
  $productData['url_key'] = $product->getUrlKey();
80
- $productData['special_price'] = Mage::helper('core')->currency($product->getSpecialPrice(), true, false);
 
81
 
82
  /**
83
  *
27
 
28
  // available attributes not contain image attribute, but it needed for get image_url
29
  $availableAttributes[] = 'image';
30
+ $collection->addStoreFilter($store->getId())->addAttributeToSelect(array_diff($availableAttributes, $entityOnlyAttributes));
31
+
 
 
 
32
  $this->_applyCategoryFilter($collection);
33
  $this->_applyCollectionModifiers($collection);
34
+ Mage::helper('tracking')->debug($collection->getSelect()->__toString());
35
  $products = $collection->load();
 
36
  /**
37
  *
38
  * @var Mage_Catalog_Model_Product $product
74
  $productData['store_id'] = $product->getStoreIds();
75
  $productData['url'] = $product->getUrlKey();
76
  $productData['url_key'] = $product->getUrlKey();
77
+ $productData['price'] = $product->getFinalPrice();
78
+ $productData['special_price'] = $product->getSpecialPrice();
79
 
80
  /**
81
  *
app/code/community/Targetbay/Tracking/Model/Api2/Review/Rest/Admin/V1.php CHANGED
@@ -17,10 +17,11 @@ class Targetbay_Tracking_Model_Api2_Review_Rest_Admin_V1 extends Mage_Api2_Model
17
  $limit = Mage::app()->getRequest()->getParam('limit');
18
 
19
  $reviewCollection = Mage::getModel('review/review')->getResourceCollection()
20
- ->setDateOrder()
21
- ->addRateVotes()
22
- ->load();
23
- $reviewCollection->getSelect()->limit($limit, $page_num);
 
24
 
25
  $review_data = array();
26
  $review_datas = array();
17
  $limit = Mage::app()->getRequest()->getParam('limit');
18
 
19
  $reviewCollection = Mage::getModel('review/review')->getResourceCollection()
20
+ ->setPageSize($limit)
21
+ ->setCurPage($page_num)
22
+ ->setDateOrder()
23
+ ->addRateVotes()
24
+ ->load();
25
 
26
  $review_data = array();
27
  $review_datas = array();
app/code/community/Targetbay/Tracking/Model/Api2/Review/Rest/Guest/V1.php CHANGED
@@ -17,14 +17,16 @@ class Targetbay_Tracking_Model_Api2_Review_Rest_Guest_V1 extends Mage_Api2_Model
17
  $limit = Mage::app()->getRequest()->getParam('limit');
18
 
19
  $reviewCollection = Mage::getModel('review/review')->getResourceCollection()
20
- ->setDateOrder()
21
- ->addRateVotes()
22
- ->load();
23
- $reviewCollection->getSelect()->limit($limit, $page_num);
 
24
 
25
  $review_data = array();
26
  $review_datas = array();
27
  $sku = '';
 
28
  foreach($reviewCollection as $review)
29
  {
30
  $storeId = Mage::getModel('review/review')->load($review->getId())->getStoreId();
@@ -67,7 +69,7 @@ class Targetbay_Tracking_Model_Api2_Review_Rest_Guest_V1 extends Mage_Api2_Model
67
  $review_datas[$review->getId()][] = $review_data;
68
  }
69
  }
70
-
71
  return $review_datas;
72
  }
73
  }
17
  $limit = Mage::app()->getRequest()->getParam('limit');
18
 
19
  $reviewCollection = Mage::getModel('review/review')->getResourceCollection()
20
+ ->setPageSize($limit)
21
+ ->setCurPage($page_num)
22
+ ->setDateOrder()
23
+ ->addRateVotes()
24
+ ->load();
25
 
26
  $review_data = array();
27
  $review_datas = array();
28
  $sku = '';
29
+
30
  foreach($reviewCollection as $review)
31
  {
32
  $storeId = Mage::getModel('review/review')->load($review->getId())->getStoreId();
69
  $review_datas[$review->getId()][] = $review_data;
70
  }
71
  }
72
+
73
  return $review_datas;
74
  }
75
  }
app/code/community/Targetbay/Tracking/Model/Api2/Totalproductinfo/Rest/Admin/V1.php CHANGED
@@ -20,11 +20,7 @@ class Targetbay_Tracking_Model_Api2_Totalproductinfo_Rest_Admin_V1 extends Targe
20
 
21
  // available attributes not contain image attribute, but it needed for get image_url
22
  $availableAttributes[] = 'image';
23
- $collection->addAttributeToSelect(array_diff($availableAttributes, $entityOnlyAttributes))->addAttributeToFilter('visibility', array(
24
- 'neq' => Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE
25
- ))->addAttributeToFilter('status', array(
26
- 'eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED
27
- ));
28
 
29
  $totals = array (
30
  'total_products' => $collection->getSize()
20
 
21
  // available attributes not contain image attribute, but it needed for get image_url
22
  $availableAttributes[] = 'image';
23
+ $collection->addAttributeToSelect(array_diff($availableAttributes, $entityOnlyAttributes));
 
 
 
 
24
 
25
  $totals = array (
26
  'total_products' => $collection->getSize()
app/code/community/Targetbay/Tracking/Model/Api2/Totalproductinfo/Rest/Guest/V1.php CHANGED
@@ -20,11 +20,7 @@ class Targetbay_Tracking_Model_Api2_Totalproductinfo_Rest_Guest_V1 extends Targe
20
 
21
  // available attributes not contain image attribute, but it needed for get image_url
22
  $availableAttributes[] = 'image';
23
- $collection->addAttributeToSelect(array_diff($availableAttributes, $entityOnlyAttributes))->addAttributeToFilter('visibility', array(
24
- 'neq' => Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE
25
- ))->addAttributeToFilter('status', array(
26
- 'eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED
27
- ));
28
 
29
  $totals = array (
30
  'total_products' => $collection->getSize()
20
 
21
  // available attributes not contain image attribute, but it needed for get image_url
22
  $availableAttributes[] = 'image';
23
+ $collection->addAttributeToSelect(array_diff($availableAttributes, $entityOnlyAttributes));
 
 
 
 
24
 
25
  $totals = array (
26
  'total_products' => $collection->getSize()
app/code/community/Targetbay/Tracking/Model/Observer.php CHANGED
@@ -16,6 +16,9 @@ class Targetbay_Tracking_Model_Observer
16
  */
17
  public function __construct()
18
  {
 
 
 
19
  $this->helper = Mage::helper('tracking');
20
  $this->apiToken = '?api_token=' . $this->helper->getApiToken();
21
  $this->indexName = $this->helper->getApiIndex();
@@ -32,6 +35,20 @@ class Targetbay_Tracking_Model_Observer
32
  Mage::getModel('core/cookie')->set('user_loggedin', true, null, null, null, null, false);
33
  Mage::getModel('core/cookie')->set('afterlogin_session_id', Mage::getSingleton('core/session')->getCustomerSessionId(), null, null, null, null, false);
34
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  }
36
 
37
  /**
@@ -100,7 +117,7 @@ class Targetbay_Tracking_Model_Observer
100
 
101
  if ($this->helper->eventAlreadyTracked($observer->getEvent()->getControllerAction()->getFullActionName())) {
102
  return false;
103
- }
104
 
105
  // Set Token Values
106
  if (isset($_GET['utm_source']) && !$this->helper->cookie->get('utm_source')) {
@@ -137,7 +154,7 @@ class Targetbay_Tracking_Model_Observer
137
  $request = Mage::app()->getRequest();
138
  $trackingType = $this->helper->getTrackingType();
139
  $identifier = Mage::getSingleton('cms/page')->getIdentifier();
140
- $moduleName = $request->getModuleName();
141
 
142
  // Page Visit Tracking
143
  $data = $this->helper->visitInfo();
@@ -166,45 +183,45 @@ class Targetbay_Tracking_Model_Observer
166
  //if ($item->getParentItem())
167
  //$item = $item->getParentItem();
168
 
169
- $productInfo = $observer->getProduct();
170
 
171
- $productEventInfo = $observer->getEvent()->getProduct();
172
- $quote = Mage::getModel('checkout/cart')->getQuote();
173
- $item = $quote->getItemByProduct( $productEventInfo );
174
 
175
- if($productInfo->getData('type_id') == 'grouped') {
176
- $productIds = Mage::app()->getRequest()->getParam('super_group');
177
- $dataItem = array(); $productData= array();
178
- foreach($productIds as $id => $qty) {
179
- if($qty < 1)
180
- continue;
181
- $product = Mage::getModel('catalog/product')->load($id);
182
- $productData['type'] = $product->getTypeId();
183
- $productData['product_id'] = $id;
184
- $productData['product_sku'] = $product->getSku();
185
- $productData['product_name'] = addslashes($product->getName());
186
- $productData['price'] = $product->getPrice()*$qty;
187
- $productData['special_price'] = $product->getSpecialPrice();
188
- $productData['productimg'] = $this->helper->getImageUrl($product, 'image');
189
-
190
- $productData['category'] = $this->helper->getProductCategory($product);
191
- $productData['category_name'] = $this->helper->getProductCategoryName($product);
192
- $productData['quantity'] = $qty;
193
- $productData['page_url'] = Mage::getUrl($product->getUrlPath());
194
- $productData['attributes'] = '';
195
- $dataItem[] = $productData;
196
- }
197
- $data = $this->helper->getCartInfo();
198
- $data['product_type'] = $productInfo->getData('type_id');
199
- $data['cart_item'] = $dataItem;
200
- } else{
201
- $data = array_merge($this->helper->getCartInfo(), $this->helper->getItemInfo($item, Targetbay_Tracking_Helper_Data::ADDTOCART));
202
- $data['product_type'] = $item->getProductType();
203
- $data['price'] = $item->getProduct()->getFinalPrice();
204
- if ($customOptions = $this->helper->getCustomOptionsInfo($item, null)) {
205
- $data['attributes'] = $customOptions;
206
- }
207
- }
208
 
209
  $this->pushPages($data, Targetbay_Tracking_Helper_Data::ADDTOCART);
210
 
@@ -311,10 +328,6 @@ class Targetbay_Tracking_Model_Observer
311
  return false;
312
  }
313
 
314
- if ($this->helper->eventAlreadyTracked($observer->getEvent()->getControllerAction()->getFullActionName())) {
315
- return false;
316
- }
317
-
318
  // Set Token Values
319
  if (isset($_GET['utm_source']) && !$this->helper->cookie->get('utm_source')) {
320
  $this->helper->cookie->set('utm_source', $_GET['utm_source'], null, null, null, null, false);
@@ -344,13 +357,17 @@ class Targetbay_Tracking_Model_Observer
344
  */
345
  public function pushBillingAddressData(Varien_Event_Observer $observer)
346
  {
347
- if (!$this->helper->canTrackPages(Targetbay_Tracking_Helper_Data::BILLING)) {
348
- return false;
 
 
 
 
 
 
 
 
349
  }
350
- Mage::getSingleton('checkout/session')->setTitle('Checkout Billing');
351
- $quote = Mage::getSingleton('checkout/session')->getQuote();
352
- $billingInfo = $this->helper->getAddressData($quote, Targetbay_Tracking_Helper_Data::BILLING);
353
- $this->pushPages($billingInfo, Targetbay_Tracking_Helper_Data::BILLING);
354
 
355
  return;
356
  }
@@ -364,13 +381,17 @@ class Targetbay_Tracking_Model_Observer
364
  */
365
  public function pushShippingAddressData(Varien_Event_Observer $observer)
366
  {
367
- if (!$this->helper->canTrackPages(Targetbay_Tracking_Helper_Data::SHIPPING)) {
368
- return false;
 
 
 
 
 
 
 
 
369
  }
370
- Mage::getSingleton('checkout/session')->setTitle('Checkout Shipping');
371
- $quote = Mage::getSingleton('checkout/session')->getQuote();
372
- $shippingInfo = $this->helper->getAddressData($quote, Targetbay_Tracking_Helper_Data::SHIPPING);
373
- $this->pushPages($shippingInfo, Targetbay_Tracking_Helper_Data::SHIPPING);
374
 
375
  return;
376
  }
@@ -385,29 +406,92 @@ class Targetbay_Tracking_Model_Observer
385
  */
386
  public function pushOrderData(Varien_Event_Observer $observer)
387
  {
388
- if (!Mage::registry('order_pushed')) {
389
- Mage::register('order_pushed', true);
390
- if (!$this->helper->canTrackPages(Targetbay_Tracking_Helper_Data::ORDER_ITEMS)) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
391
  return false;
392
  }
393
  $order = $observer->getEvent()->getOrder();
394
- $params = Mage::app()->getFrontController()->getRequest()->getParams();
395
 
396
- if ($this->pushShipmentData($order, $params))
397
- return false; // order shipment process so no need to make order submit api.
398
-
399
- // Captute the customer registration.
400
- if ($customer = $this->helper->isRegisterCheckout($order)) {
401
- $this->pushRegisterData($customer);
 
 
 
 
 
402
  }
403
-
404
- // Order Data Push to the Tag Manager
405
- $orderInfo = $this->helper->getInfo($order);
406
- $this->pushPages($orderInfo, Targetbay_Tracking_Helper_Data::ORDER_ITEMS);
407
  }
408
 
409
  return;
410
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
411
 
412
  /**
413
  * Push the shipment data
@@ -417,13 +501,17 @@ class Targetbay_Tracking_Model_Observer
417
  * @return boolean
418
  */
419
  public function pushShipmentData($order, $params) {
420
- if ($this->helper->isFullFillmentProcess($params)) {
421
- $data = $this->helper->getFullFillmentData($order, $params);
422
- $this->pushPages($data, Targetbay_Tracking_Helper_Data::ORDER_SHIPMENT);
423
- return true;
424
- }
 
 
 
 
425
 
426
- return false;
427
  }
428
 
429
  /**
@@ -434,20 +522,23 @@ class Targetbay_Tracking_Model_Observer
434
  * @return boolean
435
  */
436
  public function pushOrderShipmentData(Varien_Event_Observer $observer)
437
- {
438
- if (!$this->helper->canTrackPages(Targetbay_Tracking_Helper_Data::ORDER_SHIPMENT)) {
439
- return false;
440
- }
441
-
442
- $shipment = $observer->getEvent()->getShipment();
443
- $order = $shipment->getOrder();
444
- $params = Mage::app()->getFrontController()->getRequest()->getParams();
445
 
446
- if ($this->helper->isFullFillmentProcess($params)) {
447
- $data = $this->helper->getFullFillmentData($order, $params);
448
- $this->pushPages($data, Targetbay_Tracking_Helper_Data::ORDER_SHIPMENT);
 
 
 
 
 
 
449
  }
450
- return;
451
  }
452
 
453
  /**
@@ -557,18 +648,18 @@ class Targetbay_Tracking_Model_Observer
557
  return false;
558
  }
559
 
560
- $webstieId = Mage::app()->getStore()->getWebsiteId();
561
- $customerModel = Mage::getModel('customer/customer');
562
 
563
  if (Mage::app()->getRequest()->getParam('email')) {
564
  $email = Mage::app()->getRequest()->getParam('email');
565
- $customerData = $customerModel->setWebsiteId($webstieId)->loadByEmail($email);
566
- $customerId = $customerData->getEntityId();
567
  } else {
568
- $customerId = Mage::getSingleton('customer/session')->getCustomer()->getId();
569
- $customerData = $customerModel->load($customerId);
570
- $email = '';
571
- }
572
 
573
  $data = $this->helper->visitInfo();
574
 
@@ -621,21 +712,25 @@ class Targetbay_Tracking_Model_Observer
621
  */
622
  public function pushProductData(Varien_Event_Observer $observer)
623
  {
624
- if (!$this->helper->canTrackPages(Targetbay_Tracking_Helper_Data::ADD_PRODUCT)) {
625
- return false;
626
- }
627
- $param = Mage::app()->getRequest()->getParams();
628
- $product = $observer->getEvent()->getProduct();
629
- if ($product->getId()) {
630
- $type = Targetbay_Tracking_Helper_Data::ADD_PRODUCT;
631
- if ($param['id']) {
632
- if (!$this->helper->canTrackPages(Targetbay_Tracking_Helper_Data::UPDATE_PRODUCT)) {
633
- return false;
 
 
 
634
  }
635
- $type = Targetbay_Tracking_Helper_Data::UPDATE_PRODUCT;
 
636
  }
637
- $data = $this->helper->getProductData($product);
638
- $this->pushPages($data, $type);
639
  }
640
 
641
  return;
@@ -650,25 +745,29 @@ class Targetbay_Tracking_Model_Observer
650
  */
651
  public function pushDeleteProductData(Varien_Event_Observer $observer)
652
  {
653
- if (!$this->helper->canTrackPages(Targetbay_Tracking_Helper_Data::DELETE_PRODUCT)) {
654
- return false;
655
- }
656
- $params = Mage::app()->getRequest()->getParams();
 
657
 
658
- if ($params) {
659
- $data['entity_id'] = Mage::app()->getRequest()->getParam('id');
660
- $data['user_name'] = Targetbay_Tracking_Helper_Data::ANONYMOUS_USER;
661
- $data['user_id'] = strtotime(date('Y-m-d H:i:s'));
662
- $data['session_id'] = strtotime(date('Y-m-d H:i:s'));
663
- if ($this->helper->cookie->get('trackingsession')) {
664
- $data['user_id'] = $this->helper->cookie->get('trackingsession');
665
- $data['session_id'] = $this->helper->cookie->get('trackingsession');
 
 
 
 
 
 
666
  }
667
- $data['date'] = $this->helper->date->date('Y-m-d');
668
- $data['timestamp'] = strtotime($this->helper->date->date('Y-m-d'));
669
- $data['time'] = $this->helper->date->date('H:i');
670
- $data['user_mail'] = Targetbay_Tracking_Helper_Data::ANONYMOUS_USER;
671
- $this->pushPages($data, Targetbay_Tracking_Helper_Data::DELETE_PRODUCT);
672
  }
673
 
674
  return;
@@ -756,9 +855,14 @@ class Targetbay_Tracking_Model_Observer
756
  if (empty($keyword)) {
757
  return false;
758
  }
 
759
  $data = $this->helper->visitInfo();
760
  $data['keyword'] = $keyword;
761
- $this->pushPages($data, Targetbay_Tracking_Helper_Data::CATALOG_SEARCH);
 
 
 
 
762
 
763
  return;
764
  }
@@ -930,12 +1034,12 @@ class Targetbay_Tracking_Model_Observer
930
  if (!$this->helper->canTrackPages(Targetbay_Tracking_Helper_Data::CUSTOMER_ACCOUNT)) {
931
  return false;
932
  }
933
- Mage::getSingleton('customer/session')->setTitle('Account Information');
934
  $data = $this->helper->visitInfo();
935
- $data['customer_id'] = Mage::getSingleton('customer/session')->getCustomer()->getId();
936
- $data['firstname'] = Mage::getSingleton('customer/session')->getCustomer()->getFirstname();
937
- $data['lastname'] = Mage::getSingleton('customer/session')->getCustomer()->getLastname();
938
- $data['email'] = Mage::getSingleton('customer/session')->getCustomer()->getEmail();
939
  $data['account_updated'] = Mage::getModel('core/date')->date('Y-m-d');
940
  $this->pushPages($data, Targetbay_Tracking_Helper_Data::CUSTOMER_ACCOUNT);
941
  return;
@@ -951,8 +1055,25 @@ class Targetbay_Tracking_Model_Observer
951
  if (!$this->helper->canTrackPages(Targetbay_Tracking_Helper_Data::PAGE_REFERRAL)) {
952
  return false;
953
  }
954
- if ($referrerData = $this->helper->getRefererData()) {
955
- $this->pushPages($referrerData, Targetbay_Tracking_Helper_Data::PAGE_REFERRAL);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
956
  }
957
  }
958
 
@@ -973,4 +1094,4 @@ class Targetbay_Tracking_Model_Observer
973
  $this->helper->debug($type ."ERROR:" . $e->getMessage());
974
  }
975
  }
976
- }
16
  */
17
  public function __construct()
18
  {
19
+ //$expireAfter = 10;
20
+ $expireAfter = 1380;
21
+
22
  $this->helper = Mage::helper('tracking');
23
  $this->apiToken = '?api_token=' . $this->helper->getApiToken();
24
  $this->indexName = $this->helper->getApiIndex();
35
  Mage::getModel('core/cookie')->set('user_loggedin', true, null, null, null, null, false);
36
  Mage::getModel('core/cookie')->set('afterlogin_session_id', Mage::getSingleton('core/session')->getCustomerSessionId(), null, null, null, null, false);
37
  }
38
+
39
+ if(isset($_SESSION['last_session'])) {
40
+
41
+ $secondsInactive = time() - $_SESSION['last_session'];
42
+ $expireAfterSeconds = $expireAfter * 60;
43
+ if($secondsInactive > $expireAfterSeconds){
44
+ Mage::getSingleton('core/session')->unsProductReview();
45
+ Mage::getSingleton('core/session')->unsProductReviewResponse();
46
+ Mage::getSingleton('core/session')->unsSiteReview();
47
+ Mage::getSingleton('core/session')->unsSiteReviewResponse();
48
+ Mage::getSingleton('core/session')->unsQaReview();
49
+ Mage::getSingleton('core/session')->unsQaReviewResponse();
50
+ }
51
+ }
52
  }
53
 
54
  /**
117
 
118
  if ($this->helper->eventAlreadyTracked($observer->getEvent()->getControllerAction()->getFullActionName())) {
119
  return false;
120
+ }
121
 
122
  // Set Token Values
123
  if (isset($_GET['utm_source']) && !$this->helper->cookie->get('utm_source')) {
154
  $request = Mage::app()->getRequest();
155
  $trackingType = $this->helper->getTrackingType();
156
  $identifier = Mage::getSingleton('cms/page')->getIdentifier();
157
+ $moduleName = $request->getModuleName();
158
 
159
  // Page Visit Tracking
160
  $data = $this->helper->visitInfo();
183
  //if ($item->getParentItem())
184
  //$item = $item->getParentItem();
185
 
186
+ $productInfo = $observer->getProduct();
187
 
188
+ $productEventInfo = $observer->getEvent()->getProduct();
189
+ $quote = Mage::getModel('checkout/cart')->getQuote();
190
+ $item = $quote->getItemByProduct( $productEventInfo );
191
 
192
+ if($productInfo->getData('type_id') == 'grouped') {
193
+ $productIds = Mage::app()->getRequest()->getParam('super_group');
194
+ $dataItem = array(); $productData= array();
195
+ foreach($productIds as $id => $qty) {
196
+ if($qty < 1)
197
+ continue;
198
+ $product = Mage::getModel('catalog/product')->load($id);
199
+ $productData['type'] = $product->getTypeId();
200
+ $productData['product_id'] = $id;
201
+ $productData['product_sku'] = $product->getSku();
202
+ $productData['product_name'] = addslashes($product->getName());
203
+ $productData['price'] = $product->getPrice()*$qty;
204
+ $productData['special_price'] = $product->getSpecialPrice();
205
+ $productData['productimg'] = $this->helper->getImageUrl($product, 'image');
206
+
207
+ $productData['category'] = $this->helper->getProductCategory($product);
208
+ $productData['category_name'] = $this->helper->getProductCategoryName($product);
209
+ $productData['quantity'] = $qty;
210
+ $productData['page_url'] = Mage::getUrl($product->getUrlPath());
211
+ $productData['attributes'] = '';
212
+ $dataItem[] = $productData;
213
+ }
214
+ $data = $this->helper->getCartInfo();
215
+ $data['product_type'] = $productInfo->getData('type_id');
216
+ $data['cart_item'] = $dataItem;
217
+ } else{
218
+ $data = array_merge($this->helper->getCartInfo(), $this->helper->getItemInfo($item, Targetbay_Tracking_Helper_Data::ADDTOCART));
219
+ $data['product_type'] = $item->getProductType();
220
+ $data['price'] = $item->getProduct()->getFinalPrice();
221
+ if ($customOptions = $this->helper->getCustomOptionsInfo($item, null)) {
222
+ $data['attributes'] = $customOptions;
223
+ }
224
+ }
225
 
226
  $this->pushPages($data, Targetbay_Tracking_Helper_Data::ADDTOCART);
227
 
328
  return false;
329
  }
330
 
 
 
 
 
331
  // Set Token Values
332
  if (isset($_GET['utm_source']) && !$this->helper->cookie->get('utm_source')) {
333
  $this->helper->cookie->set('utm_source', $_GET['utm_source'], null, null, null, null, false);
357
  */
358
  public function pushBillingAddressData(Varien_Event_Observer $observer)
359
  {
360
+ try {
361
+ if (!$this->helper->canTrackPages(Targetbay_Tracking_Helper_Data::BILLING)) {
362
+ return false;
363
+ }
364
+ Mage::getSingleton('checkout/session')->setTitle('Checkout Billing');
365
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
366
+ $billingInfo = $this->helper->getAddressData($quote, Targetbay_Tracking_Helper_Data::BILLING);
367
+ $this->pushPages($billingInfo, Targetbay_Tracking_Helper_Data::BILLING);
368
+ } catch (Exception $e) {
369
+ $this->helper->debug("ERROR: " . $e->getMessage());
370
  }
 
 
 
 
371
 
372
  return;
373
  }
381
  */
382
  public function pushShippingAddressData(Varien_Event_Observer $observer)
383
  {
384
+ try {
385
+ if (!$this->helper->canTrackPages(Targetbay_Tracking_Helper_Data::SHIPPING)) {
386
+ return false;
387
+ }
388
+ Mage::getSingleton('checkout/session')->setTitle('Checkout Shipping');
389
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
390
+ $shippingInfo = $this->helper->getAddressData($quote, Targetbay_Tracking_Helper_Data::SHIPPING);
391
+ $this->pushPages($shippingInfo, Targetbay_Tracking_Helper_Data::SHIPPING);
392
+ } catch (Exception $e) {
393
+ $this->helper->debug("ERROR: " . $e->getMessage());
394
  }
 
 
 
 
395
 
396
  return;
397
  }
406
  */
407
  public function pushOrderData(Varien_Event_Observer $observer)
408
  {
409
+ try {
410
+ if (!Mage::registry('order_pushed')) {
411
+ Mage::register('order_pushed', true);
412
+ if (!$this->helper->canTrackPages(Targetbay_Tracking_Helper_Data::ORDER_ITEMS)) {
413
+ return false;
414
+ }
415
+ $order = $observer->getEvent()->getOrder();
416
+ $params = Mage::app()->getFrontController()->getRequest()->getParams();
417
+
418
+ if ($this->pushShipmentData($order, $params))
419
+ return false; // order shipment process so no need to make order submit api.
420
+
421
+ // Captute the customer registration.
422
+ if ($customer = $this->helper->isRegisterCheckout($order)) {
423
+ $this->pushRegisterData($customer);
424
+ }
425
+
426
+ // Order Data Push to the Tag Manager
427
+ $orderInfo = $this->helper->getInfo($order);
428
+ $this->pushPages($orderInfo, Targetbay_Tracking_Helper_Data::ORDER_ITEMS);
429
+ Mage::getSingleton('checkout/session')->unsQuoteMerged();
430
+ }
431
+ } catch (Exception $e) {
432
+ $this->helper->debug("ERROR: " . $e->getMessage());
433
+ }
434
+
435
+ return;
436
+ }
437
+
438
+ /**
439
+ * Order status change data
440
+ *
441
+ * @param Varien_Event_Observer $observer
442
+ * @return Targetbay_Tracking_Model_Observer
443
+ *
444
+ * @return void|boolean
445
+ */
446
+ public function pushOrderStatusData(Varien_Event_Observer $observer)
447
+ {
448
+ try {
449
+ if (!$this->helper->canTrackPages(Targetbay_Tracking_Helper_Data::ORDER_STATUS)) {
450
  return false;
451
  }
452
  $order = $observer->getEvent()->getOrder();
 
453
 
454
+ $data = $this->helper->getSessionInfo($order);
455
+ $data['first_name'] = $order->getCustomerFirstname();
456
+ $data['last_name'] = $order->getCustomerLastname();
457
+ $guestUsername = $order->getCustomerFirstname().' '.$order->getCustomerLastname();
458
+ $gName = !empty($guestUsername) ? $guestUsername : self::ANONYMOUS_USER;
459
+ $data['user_name'] = $order->getCustomerIsGuest() ? $gName : $data['first_name'] . ' ' . $data['last_name'];
460
+ $data['user_mail'] = $order->getCustomerEmail();
461
+ $data['order_id'] = $order->getId();
462
+ $data['status'] = $order->getStatus();
463
+ if($data['status'] === null) {
464
+ return false;
465
  }
466
+ $this->pushPages($data, Targetbay_Tracking_Helper_Data::ORDER_STATUS);
467
+ } catch (Exception $e) {
468
+ $this->helper->debug("ERROR: " . $e->getMessage());
 
469
  }
470
 
471
  return;
472
  }
473
+
474
+ /**
475
+ * Abandoned cart merge for logged in user
476
+ *
477
+ * @param Varien_Event_Observer $observer
478
+ *
479
+ * @return void
480
+ */
481
+ public function quoteMergeData(Varien_Event_Observer $observer)
482
+ {
483
+ $abandonedMail = Mage::getSingleton('core/session')->getAbandonedMail();
484
+ $cart = Mage::getModel('checkout/cart');
485
+ if($abandonedMail) {
486
+ try {
487
+ $this->helper->debug('MergeObs');
488
+ $cart->truncate();
489
+ } catch(\Exception $e) {
490
+ $this->helper->debug('Error:'.$e->getMessage());
491
+ }
492
+ }
493
+ return;
494
+ }
495
 
496
  /**
497
  * Push the shipment data
501
  * @return boolean
502
  */
503
  public function pushShipmentData($order, $params) {
504
+ try {
505
+ if ($this->helper->isFullFillmentProcess($params)) {
506
+ $data = $this->helper->getFullFillmentData($order, $params);
507
+ $this->pushPages($data, Targetbay_Tracking_Helper_Data::ORDER_SHIPMENT);
508
+ return true;
509
+ }
510
+ } catch (Exception $e) {
511
+ $this->helper->debug("ERROR: " . $e->getMessage());
512
+ }
513
 
514
+ return false;
515
  }
516
 
517
  /**
522
  * @return boolean
523
  */
524
  public function pushOrderShipmentData(Varien_Event_Observer $observer)
525
+ {
526
+ try {
527
+ if (!$this->helper->canTrackPages(Targetbay_Tracking_Helper_Data::ORDER_SHIPMENT)) {
528
+ return false;
529
+ }
 
 
 
530
 
531
+ $shipment = $observer->getEvent()->getShipment();
532
+ $order = $shipment->getOrder();
533
+ $params[Targetbay_Tracking_Helper_Data::ORDER_SHIPMENT] = true;
534
+ if ($this->helper->isFullFillmentProcess($params)) {
535
+ $data = $this->helper->getFullFillmentData($order, $params);
536
+ $this->pushPages($data, Targetbay_Tracking_Helper_Data::ORDER_SHIPMENT);
537
+ }
538
+ } catch (Exception $e) {
539
+ $this->helper->debug("ERROR: " . $e->getMessage());
540
  }
541
+ return;
542
  }
543
 
544
  /**
648
  return false;
649
  }
650
 
651
+ $webstieId = Mage::app()->getStore()->getWebsiteId();
652
+ $customerModel = Mage::getModel('customer/customer');
653
 
654
  if (Mage::app()->getRequest()->getParam('email')) {
655
  $email = Mage::app()->getRequest()->getParam('email');
656
+ $customerData = $customerModel->setWebsiteId($webstieId)->loadByEmail($email);
657
+ $customerId = $customerData->getEntityId();
658
  } else {
659
+ $customerId = Mage::getSingleton('customer/session')->getCustomer()->getId();
660
+ $customerData = $customerModel->load($customerId);
661
+ $email = '';
662
+ }
663
 
664
  $data = $this->helper->visitInfo();
665
 
712
  */
713
  public function pushProductData(Varien_Event_Observer $observer)
714
  {
715
+ try {
716
+ if (!$this->helper->canTrackPages(Targetbay_Tracking_Helper_Data::ADD_PRODUCT)) {
717
+ return false;
718
+ }
719
+ $param = Mage::app()->getRequest()->getParams();
720
+ $product = $observer->getEvent()->getProduct();
721
+ if ($product->getId()) {
722
+ $type = Targetbay_Tracking_Helper_Data::ADD_PRODUCT;
723
+ if ($param['id']) {
724
+ if (!$this->helper->canTrackPages(Targetbay_Tracking_Helper_Data::UPDATE_PRODUCT)) {
725
+ return false;
726
+ }
727
+ $type = Targetbay_Tracking_Helper_Data::UPDATE_PRODUCT;
728
  }
729
+ $data = $this->helper->getProductData($product);
730
+ $this->pushPages($data, $type);
731
  }
732
+ } catch (Exception $e) {
733
+ $this->helper->debug("ERROR: " . $e->getMessage());
734
  }
735
 
736
  return;
745
  */
746
  public function pushDeleteProductData(Varien_Event_Observer $observer)
747
  {
748
+ try {
749
+ if (!$this->helper->canTrackPages(Targetbay_Tracking_Helper_Data::DELETE_PRODUCT)) {
750
+ return false;
751
+ }
752
+ $params = Mage::app()->getRequest()->getParams();
753
 
754
+ if ($params) {
755
+ $data['entity_id'] = Mage::app()->getRequest()->getParam('id');
756
+ $data['user_name'] = Targetbay_Tracking_Helper_Data::ANONYMOUS_USER;
757
+ $data['user_id'] = strtotime(date('Y-m-d H:i:s'));
758
+ $data['session_id'] = strtotime(date('Y-m-d H:i:s'));
759
+ if ($this->helper->cookie->get('trackingsession')) {
760
+ $data['user_id'] = $this->helper->cookie->get('trackingsession');
761
+ $data['session_id'] = $this->helper->cookie->get('trackingsession');
762
+ }
763
+ $data['date'] = $this->helper->date->date('Y-m-d');
764
+ $data['timestamp'] = strtotime($this->helper->date->date('Y-m-d'));
765
+ $data['time'] = $this->helper->date->date('H:i');
766
+ $data['user_mail'] = Targetbay_Tracking_Helper_Data::ANONYMOUS_USER;
767
+ $this->pushPages($data, Targetbay_Tracking_Helper_Data::DELETE_PRODUCT);
768
  }
769
+ } catch (Exception $e) {
770
+ $this->helper->debug("ERROR: " . $e->getMessage());
 
 
 
771
  }
772
 
773
  return;
855
  if (empty($keyword)) {
856
  return false;
857
  }
858
+
859
  $data = $this->helper->visitInfo();
860
  $data['keyword'] = $keyword;
861
+
862
+ $trackingType = $this->helper->getTrackingType();
863
+ if ($trackingType != 1):
864
+ $this->pushPages($data, Targetbay_Tracking_Helper_Data::CATALOG_SEARCH);
865
+ endif;
866
 
867
  return;
868
  }
1034
  if (!$this->helper->canTrackPages(Targetbay_Tracking_Helper_Data::CUSTOMER_ACCOUNT)) {
1035
  return false;
1036
  }
1037
+ Mage::getSingleton('customer/session')->setTitle('Account Information');
1038
  $data = $this->helper->visitInfo();
1039
+ $data['customer_id'] = Mage::getSingleton('customer/session')->getCustomer()->getId();
1040
+ $data['firstname'] = Mage::getSingleton('customer/session')->getCustomer()->getFirstname();
1041
+ $data['lastname'] = Mage::getSingleton('customer/session')->getCustomer()->getLastname();
1042
+ $data['email'] = Mage::getSingleton('customer/session')->getCustomer()->getEmail();
1043
  $data['account_updated'] = Mage::getModel('core/date')->date('Y-m-d');
1044
  $this->pushPages($data, Targetbay_Tracking_Helper_Data::CUSTOMER_ACCOUNT);
1045
  return;
1055
  if (!$this->helper->canTrackPages(Targetbay_Tracking_Helper_Data::PAGE_REFERRAL)) {
1056
  return false;
1057
  }
1058
+ try {
1059
+ $request = Mage::app()->getRequest();
1060
+ $trackingType = $this->helper->getTrackingType();
1061
+ $identifier = Mage::getSingleton('cms/page')->getIdentifier();
1062
+ $moduleName = $request->getModuleName();
1063
+
1064
+ if ($trackingType == 1 && ($request->getControllerName() == 'product'
1065
+ || $request->getControllerName() == 'category'
1066
+ || $moduleName == 'cms')
1067
+ ){
1068
+ return false;
1069
+ }
1070
+
1071
+ if ($referrerData = $this->helper->getRefererData()) {
1072
+ $this->pushPages($referrerData, Targetbay_Tracking_Helper_Data::PAGE_REFERRAL);
1073
+ }
1074
+ } catch(Exception $e) {
1075
+ $this->debug('Error message '.$e->getMessage());
1076
+ return;
1077
  }
1078
  }
1079
 
1094
  $this->helper->debug($type ."ERROR:" . $e->getMessage());
1095
  }
1096
  }
1097
+ }
app/code/community/Targetbay/Tracking/controllers/IndexController.php CHANGED
@@ -8,40 +8,135 @@ class Targetbay_Tracking_IndexController extends Mage_Core_Controller_Front_Acti
8
  {
9
  public function reloadAction()
10
  {
11
- if (Mage::getSingleton('customer/session')->isLoggedIn())
12
- return false;
13
 
14
  try {
15
- $quoteId = Mage::app()->getRequest()->getParam('quote_id');
16
- $store_id = Mage::app()->getStore()->getId();
17
-
18
- $checkout = Mage::getSingleton('checkout/session');
19
- $cust = Mage::getSingleton('customer/session');
20
- $chkQuote = Mage::helper('checkout/cart')->getQuote();
21
- $helper = Mage::helper('tracking');
22
-
23
- if(empty($quoteId))
24
- $this->_redirectAfterReload();
25
- $quote = Mage::getModel('sales/quote')->load($quoteId);
26
- if ($quote->getId()) {
27
- $quote->setIsActive(1)
28
- ->save();
29
- Mage::getSingleton('checkout/session')->replaceQuote($quote);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  }
31
- } catch (Exception $e) {
32
- $helper->debug("ERROR: " . $e->getMessage());
33
- }
34
 
35
  return $this->_redirectAfterReload();
36
  }
37
 
38
  private function _redirectAfterReload()
39
- {
40
  $url = 'checkout/cart/';
 
 
41
 
42
  return $this->_redirect(
43
  $url,
44
- array('_secure' => Mage::app()->getStore()->isCurrentlySecure())
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  }
47
  }
8
  {
9
  public function reloadAction()
10
  {
11
+ if (Mage::getSingleton('customer/session')->isLoggedIn())
12
+ return false;
13
 
14
  try {
15
+ $quoteId = Mage::app()->getRequest()->getParam('quote_id');
16
+ $guestUserId = Mage::app()->getRequest()->getParam('guest_user_id');
17
+ //$guestUserId = 591861368;
18
+ $store_id = Mage::app()->getStore()->getId();
19
+
20
+ if($guestUserId != '' && !Mage::getSingleton('customer/session')->isLoggedIn()) {
21
+ Mage::getModel('core/cookie')->set('targetbay_session_id', $guestUserId, null, null, null, null, false);
22
+ }
23
+
24
+ $checkout = Mage::getSingleton('checkout/session');
25
+ $cust = Mage::getSingleton('customer/session');
26
+ $coreSession = Mage::getSingleton('core/session');
27
+ $coreSession->setRestoreQuoteId($quoteId);
28
+ $coreSession->setAbandonedMail(true);
29
+ $chkQuote = Mage::helper('checkout/cart')->getQuote();
30
+ $helper = Mage::helper('tracking');
31
+
32
+ if(empty($quoteId)) {
33
+ $this->_redirectAfterReload();
34
+ }
35
+
36
+ if($checkout->getQuoteMerged()) {
37
+ $this->_redirectAfterReload();
38
+ }
39
+
40
+ $quote = Mage::getModel('sales/quote')->load($quoteId);
41
+ if($quote && $quote->getId() && $quote->getIsActive() && (($checkout->getQuoteMerged() == null) ||
42
+ $checkout->getQuoteMerged() != true)) {
43
+ if (!$chkQuote) {
44
+ $chkQuote = Mage::getModel('sales/quote');
45
+ }
46
+
47
+ $chkQuote->merge($quote)
48
+ ->collectTotals()
49
+ ->save();
50
+ $checkout->setQuoteId($chkQuote->getId());
51
+ $checkout->setQuoteMerged(true);
52
+ }
53
+ } catch (Exception $e) {
54
+ $helper->debug("ERROR: " . $e->getMessage());
55
  }
 
 
 
56
 
57
  return $this->_redirectAfterReload();
58
  }
59
 
60
  private function _redirectAfterReload()
61
+ {
62
  $url = 'checkout/cart/';
63
+ $utmSource = Mage::app()->getRequest()->getParam('utm_source');
64
+ $utmToken = Mage::app()->getRequest()->getParam('token');
65
 
66
  return $this->_redirect(
67
  $url,
68
+ array('_secure' => Mage::app()->getStore()->isCurrentlySecure(), 'utm_source' => $utmSource, 'token' => $utmToken)
69
+ );
70
+ }
71
+
72
+ public function tokenAction() {
73
+
74
+ $params = array(
75
+ 'siteUrl' => 'http://dev-goodstate.enterpriseapplicationdevelopers.com/oauth',
76
+ 'requestTokenUrl' => 'http://dev-goodstate.enterpriseapplicationdevelopers.com/oauth/initiate',
77
+ 'accessTokenUrl' => 'http://dev-goodstate.enterpriseapplicationdevelopers.com/oauth/token',
78
+ 'authorizeUrl' => 'http://dev-goodstate.enterpriseapplicationdevelopers.com/admin/oauth_authorize',//This URL is used only if we authenticate as Admin user type
79
+ 'consumerKey' => 'fe2975957a5699225d7cbad7873e6d7a',//Consumer key registered in server administration
80
+ 'consumerSecret' => '0b59f92cfd9bcfa982aa95d3dc0513c5',//Consumer secret registered in server administration
81
+ 'callbackUrl' => 'http://localhost/magento_19/index.php/tracking/index/callback',//Url of callback action below
82
+ );
83
+
84
+ // Initiate oAuth consumer with above parameters
85
+ $consumer = new Zend_Oauth_Consumer($params);
86
+
87
+ // Get request token
88
+ $requestToken = $consumer->getRequestToken();
89
+ Mage::helper('tracking')->debug('requestToken====');
90
+ Mage::helper('tracking')->debug(print_r($requestToken, true));
91
+ // Get session
92
+ $session = Mage::getSingleton('core/session');
93
+ // Save serialized request token object in session for later use
94
+ $session->setRequestToken(serialize($requestToken));
95
+ // Redirect to authorize URL
96
+ $consumer->redirect();
97
+
98
+ return;
99
+ }
100
+
101
+ public function callbackAction() {
102
+
103
+ $params = array(
104
+ 'siteUrl' => 'http://dev-goodstate.enterpriseapplicationdevelopers.com/oauth',
105
+ 'requestTokenUrl' => 'http://dev-goodstate.enterpriseapplicationdevelopers.com/oauth/initiate',
106
+ 'accessTokenUrl' => 'http://dev-goodstate.enterpriseapplicationdevelopers.com/oauth/token',
107
+ 'consumerKey' => 'fe2975957a5699225d7cbad7873e6d7a',
108
+ 'consumerSecret' => '0b59f92cfd9bcfa982aa95d3dc0513c5'
109
  );
110
+
111
+ // Get session
112
+ $session = Mage::getSingleton('core/session');
113
+ // Read and unserialize request token from session
114
+ $requestToken = unserialize($session->getRequestToken());
115
+ // Initiate oAuth consumer
116
+ $consumer = new Zend_Oauth_Consumer($params);
117
+ Mage::log('Get Array:' . print_r($_GET, true) );
118
+ // Using oAuth parameters and request Token we got, get access token
119
+ $acessToken = $consumer->getAccessToken($_GET, $requestToken);
120
+ Mage::helper('tracking')->debug('acessToken====');
121
+ Mage::helper('tracking')->debug(print_r($acessToken, true));
122
+ // Get HTTP client from access token object
123
+ $restClient = $acessToken->getHttpClient($params);
124
+ Mage::helper('tracking')->debug('restClient====');
125
+ Mage::helper('tracking')->debug(print_r($restClient, true));
126
+ // Set REST resource URL
127
+ //$restClient->setUri('http://dev.getbitoutdoor.com/api/rest/targetbay/totalproductcounts');
128
+ //$restClient->setUri('http://developer:heymagento@getbit-live.enterpriseapplicationdevelopers.com/api/rest/targetbay/totalproductcounts');
129
+ $restClient->setUri('http://developer:heymagento@dev-goodstate.enterpriseapplicationdevelopers.com/api/rest/targetbay/totalcategorycounts');
130
+ // In Magento it is neccesary to set json or xml headers in order to work
131
+ $restClient->setHeaders('Accept', 'application/json');
132
+ // Get method
133
+ $restClient->setMethod(Zend_Http_Client::GET);
134
+ //Make REST request
135
+ $response = $restClient->request();
136
+ // Here we can see that response body contains json list of products
137
+ echo '<pre>';
138
+ Zend_Debug::dump($response);
139
+
140
+ return;
141
  }
142
  }
app/code/community/Targetbay/Tracking/etc/api2.xml CHANGED
@@ -77,6 +77,7 @@
77
  <buy_now_url>Buy Now URL</buy_now_url>
78
  <has_custom_options>Has Custom Options</has_custom_options>
79
  <is_in_stock>Stock Status</is_in_stock>
 
80
  <special_price>Special price</special_price>
81
  <regular_price_with_tax>Regular Price With Tax
82
  </regular_price_with_tax>
77
  <buy_now_url>Buy Now URL</buy_now_url>
78
  <has_custom_options>Has Custom Options</has_custom_options>
79
  <is_in_stock>Stock Status</is_in_stock>
80
+ <price>Price</price>
81
  <special_price>Special price</special_price>
82
  <regular_price_with_tax>Regular Price With Tax
83
  </regular_price_with_tax>
app/code/community/Targetbay/Tracking/etc/config.xml CHANGED
@@ -9,7 +9,7 @@
9
  <config>
10
  <modules>
11
  <Targetbay_Tracking>
12
- <version>5.1.1</version>
13
  </Targetbay_Tracking>
14
  </modules>
15
  <frontend>
@@ -118,6 +118,17 @@
118
  </observers>
119
  </sales_quote_remove_item>
120
 
 
 
 
 
 
 
 
 
 
 
 
121
  <!-- cart update event -->
122
  <checkout_cart_update_items_before>
123
  <observers>
@@ -141,7 +152,7 @@
141
  </controller_action_predispatch_checkout_cart_updatePost>
142
 
143
  <!-- create order event -->
144
- <sales_order_save_after>
145
  <observers>
146
  <sales_order_place_after>
147
  <type>singleton</type>
@@ -149,9 +160,20 @@
149
  <method>pushOrderData</method>
150
  </sales_order_place_after>
151
  </observers>
 
 
 
 
 
 
 
 
 
 
 
152
  </sales_order_save_after>
153
 
154
- <!-- create shipment event >
155
  <sales_order_shipment_save_after>
156
  <observers>
157
  <sales_order_shipment_after>
@@ -160,7 +182,7 @@
160
  <method>pushOrderShipmentData</method>
161
  </sales_order_shipment_after>
162
  </observers>
163
- </sales_order_shipment_save_after-->
164
 
165
  <!-- customer login event -->
166
  <customer_login>
@@ -454,12 +476,6 @@
454
  <targetbay_tracking>
455
  <tracking_groups>
456
  <enabled>1</enabled>
457
- <hostname><![CDATA[http://dev.targetbay.com/api/v1/webhooks/]]></hostname>
458
- <message_js><![CDATA[http://dev.targetbay.com/js/tb-messages.js]]></message_js>
459
- <review_js><![CDATA[http://dev.targetbay.com/js/tb-reviews.js]]></review_js>
460
- <api_token>6e1c1435-ccc9-45e4-9eb6-a1a7bbbaf2e9</api_token>
461
- <api_index>cccc8aea-ebcd-5466-8698-3657a3aa1169</api_index>
462
- <debug>1</debug>
463
  <debug_file>tracking.log</debug_file>
464
  <page_types>all</page_types>
465
  </tracking_groups>
@@ -490,4 +506,4 @@
490
  </resources>
491
  </acl>
492
  </adminhtml>
493
- </config>
9
  <config>
10
  <modules>
11
  <Targetbay_Tracking>
12
+ <version>5.1.2</version>
13
  </Targetbay_Tracking>
14
  </modules>
15
  <frontend>
118
  </observers>
119
  </sales_quote_remove_item>
120
 
121
+ <!-- Merge quote for logged in user -->
122
+ <sales_quote_merge_before>
123
+ <observers>
124
+ <targetbay_tracking_event_quote_merge_before>
125
+ <type>singleton</type>
126
+ <class>tracking/observer</class>
127
+ <method>quoteMergeData</method>
128
+ </targetbay_tracking_event_quote_merge_before>
129
+ </observers>
130
+ </sales_quote_merge_before>
131
+
132
  <!-- cart update event -->
133
  <checkout_cart_update_items_before>
134
  <observers>
152
  </controller_action_predispatch_checkout_cart_updatePost>
153
 
154
  <!-- create order event -->
155
+ <sales_order_place_after>
156
  <observers>
157
  <sales_order_place_after>
158
  <type>singleton</type>
160
  <method>pushOrderData</method>
161
  </sales_order_place_after>
162
  </observers>
163
+ </sales_order_place_after>
164
+
165
+ <!-- create order event -->
166
+ <sales_order_save_after>
167
+ <observers>
168
+ <targetbay_order_save_after>
169
+ <type>singleton</type>
170
+ <class>tracking/observer</class>
171
+ <method>pushOrderStatusData</method>
172
+ </targetbay_order_save_after>
173
+ </observers>
174
  </sales_order_save_after>
175
 
176
+ <!-- create shipment event -->
177
  <sales_order_shipment_save_after>
178
  <observers>
179
  <sales_order_shipment_after>
182
  <method>pushOrderShipmentData</method>
183
  </sales_order_shipment_after>
184
  </observers>
185
+ </sales_order_shipment_save_after>
186
 
187
  <!-- customer login event -->
188
  <customer_login>
476
  <targetbay_tracking>
477
  <tracking_groups>
478
  <enabled>1</enabled>
 
 
 
 
 
 
479
  <debug_file>tracking.log</debug_file>
480
  <page_types>all</page_types>
481
  </tracking_groups>
506
  </resources>
507
  </acl>
508
  </adminhtml>
509
+ </config>
app/design/frontend/base/default/layout/tracking.xml CHANGED
@@ -13,14 +13,15 @@
13
  </reference>
14
  </default>
15
  <catalog_product_view>
 
 
 
 
 
16
  <reference name="product.info.tabs">
17
  <action method="unsetChild">
18
  <child>review</child>
19
  </action>
20
  </reference>
21
- <reference name="product.info.additional">
22
- <remove name="product.reviews"/>
23
- <block type="tracking/product_review" name="innpl-product-review" before="-" as="innpl-product-review" />
24
- </reference>
25
  </catalog_product_view>
26
  </layout>
13
  </reference>
14
  </default>
15
  <catalog_product_view>
16
+ <reference name="content">
17
+ <remove name="product.reviews"/>
18
+ <block type="tracking/product_review" name="innpl-product-review" as="innpl-product-review"
19
+ after="product.info" />
20
+ </reference>
21
  <reference name="product.info.tabs">
22
  <action method="unsetChild">
23
  <child>review</child>
24
  </action>
25
  </reference>
 
 
 
 
26
  </catalog_product_view>
27
  </layout>
app/design/frontend/base/default/template/tracking/product/review.phtml CHANGED
@@ -8,6 +8,7 @@
8
  <?php if(!empty($richSnippets) && $richSnippets['average_score'] > 0): ?>
9
  <div id="<?php echo $productSku; ?>" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
10
  <span itemprop="bestRating" content="5"></span>
 
11
  <span itemprop="ratingValue" content="<?php echo $richSnippets['average_score']; ?>"></span>
12
  <span itemprop="reviewCount" content="<?php echo $richSnippets['reviews_count']; ?>"></span>
13
  <div itemprop="itemReviewed" itemscope itemtype="http://schema.org/Thing">
@@ -30,11 +31,12 @@
30
  <span itemprop="name" content="<?php echo $productName; ?>"></span>
31
  </div>
32
  <div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
33
- <span itemprop="ratingValue" content="<?php echo $reviewRating; ?>"></span>
34
- <span itemprop="bestRating" content="5"></span>
 
35
  </div>
36
  <div itemprop="author" itemscope itemtype="http://schema.org/Thing">
37
- <span itemprop="name" content="<?php echo $userName; ?>"></span>
38
  </div>
39
  </div>
40
  <?php endforeach; ?>
@@ -42,3 +44,48 @@
42
  <?php else: ?>
43
  <div id="<?php echo $productSku; ?>"></div>
44
  <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  <?php if(!empty($richSnippets) && $richSnippets['average_score'] > 0): ?>
9
  <div id="<?php echo $productSku; ?>" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
10
  <span itemprop="bestRating" content="5"></span>
11
+ <span itemprop="worstRating" content="1"></span>
12
  <span itemprop="ratingValue" content="<?php echo $richSnippets['average_score']; ?>"></span>
13
  <span itemprop="reviewCount" content="<?php echo $richSnippets['reviews_count']; ?>"></span>
14
  <div itemprop="itemReviewed" itemscope itemtype="http://schema.org/Thing">
31
  <span itemprop="name" content="<?php echo $productName; ?>"></span>
32
  </div>
33
  <div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
34
+ <span itemprop="ratingValue" content="<?php echo $reviewRating; ?>"></span>
35
+ <span itemprop="worstRating" content="1"></span>
36
+ <span itemprop="bestRating" content="5"></span>
37
  </div>
38
  <div itemprop="author" itemscope itemtype="http://schema.org/Thing">
39
+ <span itemprop="name" content="<?php echo $userName; ?>"></span>
40
  </div>
41
  </div>
42
  <?php endforeach; ?>
44
  <?php else: ?>
45
  <div id="<?php echo $productSku; ?>"></div>
46
  <?php endif; ?>
47
+
48
+ <?php $questionSnippets = Mage::helper('tracking')->getQuestionSnippets(); ?>
49
+
50
+ <?php if(!empty($questionSnippets) && $questionSnippets['qa_count'] > 0): ?>
51
+ <?php $authorName = $questionSnippets['qa_author']; ?>
52
+ <?php foreach($questionSnippets['qa_details'] as $key => $qasDetails): ?>
53
+ <?php $productName = $qasDetails->_source->product_name; ?>
54
+ <?php $questionName = $qasDetails->_source->questions; ?>
55
+ <?php $qasCreatedDate = $qasDetails->_source->timestamp; ?>
56
+ <?php $qasUsername = $qasDetails->_source->user_name; ?>
57
+ <?php $answerArray = $qasDetails->_source->question_answers; ?>
58
+ <?php $qasId = $qasDetails->_id; ?>
59
+ <?php $i = 1; ?>
60
+ <div id="<?php echo 'tb-qas-'.$key; ?>" itemscope itemtype="http://schema.org/Question">
61
+
62
+ <span itemprop="name" content="<?php echo $productName; ?>"></span>
63
+ <span itemprop="text" content="<?php echo $questionName; ?>"></span>
64
+ <span itemprop="dateCreated" content="<?php echo date('m/d/Y', $qasCreatedDate); ?>"></span>
65
+ <span itemprop="author" itemscope itemtype="http://schema.org/Person">
66
+ <span itemprop="name" content="<?php echo $qasUsername; ?>"></span>
67
+ </span>
68
+ <?php if(count($answerArray) > 0): ?>
69
+ <span itemprop="answerCount" content="<?php echo count($answerArray); ?>"></span>
70
+ <span itemprop="acceptedAnswer" itemscope itemtype="http://schema.org/Answer" id="<?php echo $qasId.'-0'; ?>">
71
+ <span itemprop="upvoteCount" content="<?php echo $answerArray[0]->upvotes; ?>"></span>
72
+ <span itemprop="text" content="<?php echo $answerArray[0]->answers; ?>"></span>
73
+ <span itemprop="dateCreated" content="<?php echo date('m/d/Y', $answerArray[0]->answer_timestamp); ?>"></span>
74
+ <span itemprop="author" itemscope itemtype="http://schema.org/Person">
75
+ <span itemprop="name" content="<?php echo $authorName; ?>"></span>
76
+ </span>
77
+ </span>
78
+ <?php foreach($answerArray as $key => $answers): ?>
79
+ <span itemprop="suggestedAnswer" itemscope itemtype="http://schema.org/Answer" id="<?php echo $qasId.'-'.$i; ?>">
80
+ <span itemprop="upvoteCount" content="<?php echo $answers->upvotes; ?>"></span>
81
+ <span itemprop="text" content="<?php echo $answers->answers; ?>"></span>
82
+ <span itemprop="dateCreated" content="<?php echo date('m/d/Y', $answers->answer_timestamp); ?>"></span>
83
+ <span itemprop="author" itemscope itemtype="http://schema.org/Person">
84
+ <span itemprop="name" content="<?php echo $authorName; ?>"></span>
85
+ </span>
86
+ </span>
87
+ <?php $i++; endforeach; ?>
88
+ <?php endif; ?>
89
+ </div>
90
+ <?php endforeach; ?>
91
+ <?php endif; ?>
app/design/frontend/base/default/template/tracking/tracking.phtml CHANGED
@@ -36,7 +36,7 @@ if($trackingScript) {
36
  $trackingCode = $trackingScript;
37
  } else {
38
  $trackingCode = 'tbTrack: true,
39
- tbMessage: true,
40
  tbReview: {
41
  tbSiteReview: true,
42
  tbProductReview: true,
@@ -97,7 +97,7 @@ tbConfig = {
97
  <?php foreach($siteReviewSnippets['reviews'] as $key => $aggregateReviewDetails): ?>
98
  <?php $reviewId = $aggregateReviewDetails->_id; ?>
99
  <?php $reviewTitle = $aggregateReviewDetails->_source->title; ?>
100
- <?php $review = $aggregateReviewDetails->_source->message;; ?>
101
  <?php $timestamp = $aggregateReviewDetails->_source->timestamp; ?>
102
  <?php $reviewRating = $aggregateReviewDetails->_source->review_rating; ?>
103
  <?php $userName = $aggregateReviewDetails->_source->user_name; ?>
@@ -107,7 +107,8 @@ tbConfig = {
107
  <span itemprop="description" content="<?php echo $review; ?>"></span>
108
  <span itemprop="datePublished" content="<?php echo date('m/d/Y', $timestamp); ?>"></span>
109
  <div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
110
- <span itemprop="ratingValue" content="<?php echo $reviewRating; ?>"></span>
 
111
  <span itemprop="bestRating" content="5"></span>
112
  </div>
113
  <div itemprop="author" itemscope itemtype="http://schema.org/Thing">
@@ -117,4 +118,4 @@ tbConfig = {
117
  <?php endforeach; ?>
118
  <?php endif; ?>
119
  </div>
120
- <?php endif; ?>
36
  $trackingCode = $trackingScript;
37
  } else {
38
  $trackingCode = 'tbTrack: true,
39
+ tbMessage: false,
40
  tbReview: {
41
  tbSiteReview: true,
42
  tbProductReview: true,
97
  <?php foreach($siteReviewSnippets['reviews'] as $key => $aggregateReviewDetails): ?>
98
  <?php $reviewId = $aggregateReviewDetails->_id; ?>
99
  <?php $reviewTitle = $aggregateReviewDetails->_source->title; ?>
100
+ <?php $review = $aggregateReviewDetails->_source->message; ?>
101
  <?php $timestamp = $aggregateReviewDetails->_source->timestamp; ?>
102
  <?php $reviewRating = $aggregateReviewDetails->_source->review_rating; ?>
103
  <?php $userName = $aggregateReviewDetails->_source->user_name; ?>
107
  <span itemprop="description" content="<?php echo $review; ?>"></span>
108
  <span itemprop="datePublished" content="<?php echo date('m/d/Y', $timestamp); ?>"></span>
109
  <div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
110
+ <span itemprop="ratingValue" content="<?php echo $reviewRating; ?>"></span>
111
+ <span itemprop="worstRating" content="1"></span>
112
  <span itemprop="bestRating" content="5"></span>
113
  </div>
114
  <div itemprop="author" itemscope itemtype="http://schema.org/Thing">
118
  <?php endforeach; ?>
119
  <?php endif; ?>
120
  </div>
121
+ <?php endif; ?>
app/etc/modules/Targetbay_Tracking.xml CHANGED
@@ -11,7 +11,7 @@
11
  <Targetbay_Tracking>
12
  <active>true</active>
13
  <codePool>community</codePool>
14
- <version>5.1.1</version>
15
  </Targetbay_Tracking>
16
  </modules>
17
  </config>
11
  <Targetbay_Tracking>
12
  <active>true</active>
13
  <codePool>community</codePool>
14
+ <version>1.1.7</version>
15
  </Targetbay_Tracking>
16
  </modules>
17
  </config>
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Targetbay_Tracking</name>
4
- <version>5.1.1</version>
5
  <stability>stable</stability>
6
  <license>OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Targetbay's Personalization platform continuously profiles in real-time, opening up the scope for behavioral targeting.</summary>
10
  <description>Making every interaction count and engaging customers with relevant messages will improve the chances of conversion exponentially. You can profile and segment users based on various parameters and actions, the data from which will form the basis for your customer engagement objectives.You can create triggers based on customer engagement objectives to deliver personalized messages. Your newsletter campaigns can also be personalized to deliver better customer engagement results. And all of this can be achieved with the help of our ecommerce-based email personalization platform.</description>
11
  <notes>Making every interaction count and engaging customers with relevant messages will improve the chances of conversion exponentially. You can profile and segment users based on various parameters and actions, the data from which will form the basis for your customer engagement objectives.You can create triggers based on customer engagement objectives to deliver personalized messages. Your newsletter campaigns can also be personalized to deliver better customer engagement results. And all of this can be achieved with the help of our ecommerce-based email personalization platform.</notes>
12
- <authors><author><name>Targetbay</name><user>Targetbay</user><email>sathishkumar.m@innoppl.com</email></author></authors>
13
- <date>2017-01-16</date>
14
- <time>06:53:56</time>
15
- <contents><target name="magecommunity"><dir name="Targetbay"><dir name="Tracking"><dir name="Block"><dir name="Product"><file name="Product.php" hash="790ea5df53326319216cf7a8c4ad8c81"/><file name="Review.php" hash="14f60843424127913bc8f1d8b0b7ac88"/></dir><dir name="Session"><file name="Tracking.php" hash="bead621eadabe0428a99f12ff4f4f60a"/></dir><file name="Tracking.php" hash="d78910db0d380d8f9c88dd55e4a174ed"/></dir><dir name="Helper"><file name="Data.php" hash="e8cb3842674c1a51cf8407d58e7456e5"/></dir><dir name="Model"><dir name="Api2"><dir name="Cartitem"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="e249ac528ec557cc6736387ff85e26ec"/></dir><dir name="Guest"><file name="V1.php" hash="45876ad828c254a3a6bb808bd9174f29"/></dir></dir></dir><file name="Cartitem.php" hash="f0de9fec4777d78a8d621b92295650ae"/><dir name="Category"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="74764d41a1d32bfb0ad4825d40e8cf46"/></dir><dir name="Guest"><file name="V1.php" hash="2dfc77fcf40841a6fbcb4e92b18c5cbe"/></dir></dir></dir><file name="Category.php" hash="37c664ba07ff52d64787ba635492b862"/><dir name="Createsubscription"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="7d1b2e26e7a5a37459f31dd5b0cb6741"/></dir><dir name="Guest"><file name="V1.php" hash="6c94923e0e86c75b90268e70f91ddb38"/></dir></dir></dir><file name="Createsubscription.php" hash="45dc64e2c1c37293f13a9eab8edd94d0"/><dir name="Customer"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="296c8a85e3c4ba7a0cacf6a0c80c5d06"/></dir><dir name="Guest"><file name="V1.php" hash="1ca174a22acfe731c0e70777c098b4f3"/></dir></dir></dir><file name="Customer.php" hash="6e4adecce83bf453e977a837ed77b0a4"/><dir name="Orders"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="f5b3a992b2e9486558ff8ddd7fd597dc"/></dir><dir name="Guest"><file name="V1.php" hash="a60f6181469b7e5dec6080956674e7e5"/></dir></dir></dir><dir name="Product"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="227c45f1d669a62c85e96a23636ed9f1"/><file name="V1.php~" hash="cb0e0f6f152441bfbd489588a5299b20"/></dir><dir name="Guest"><file name="V1.php" hash="af33a4ecf52229145f59b2b9bad096bc"/></dir></dir></dir><dir name="Review"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="60f0e620b10d0c9bc336bd47236af4f0"/></dir><dir name="Guest"><file name="V1.php" hash="71009313e064b458923062c0ee5b9ad4"/></dir></dir></dir><file name="Review.php" hash="2d6fb0e0141fc73f61e2a586e2fa895d"/><dir name="Shipment"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="eab736400f2275a32603e0b3f1d4351c"/></dir><dir name="Guest"><file name="V1.php" hash="8607da53bca20022f1781ee159b2fc3c"/></dir></dir></dir><file name="Shipment.php" hash="17756fb5e6411bbb27fd0806ce156d74"/><dir name="Stores"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="27e7e2b3fd927e91456b9e529b226522"/></dir><dir name="Guest"><file name="V1.php" hash="8dd09e20ffaef75837bfc00ccbc1c282"/></dir></dir></dir><file name="Stores.php" hash="f5eb4d00382b03c2418f83eb8b7d0ad3"/><dir name="Subscriber"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="65f5f38d5521687b6a106e29a502b7c9"/></dir><dir name="Guest"><file name="V1.php" hash="1fb1e146c1398d2858f5a088a1d59d16"/></dir></dir></dir><file name="Subscriber.php" hash="43f2f4f9c8b01b07f3130cf7488342d1"/><dir name="Totalcartiteminfo"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="65dffb80d635d17d5599a9ee1a61a35e"/></dir><dir name="Guest"><file name="V1.php" hash="c4ce67530cc5ddd7e306a1f95250a00c"/></dir></dir></dir><file name="Totalcartiteminfo.php" hash="b0b10b2a6d42ddecd0e4d97834090be7"/><dir name="Totalcategoryinfo"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="be76b164dbb7cc439a1bbd8a9aa82a53"/></dir><dir name="Guest"><file name="V1.php" hash="d6ea3c89fa7e7396614d983c026c7907"/></dir></dir></dir><file name="Totalcategoryinfo.php" hash="06b6428e59e402ad92f8404e42ce5b35"/><dir name="Totalcustomerinfo"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="def08bb44fc493c15b0a98c5717f68a8"/></dir><dir name="Guest"><file name="V1.php" hash="e0efa78eff478bf0204da6b2f5c95659"/></dir></dir></dir><file name="Totalcustomerinfo.php" hash="fdf343e2d69375826c94e5ce3988cc01"/><dir name="Totalinfo"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="0bf6291950d09e4feea261b3e75ab5a4"/></dir><dir name="Guest"><file name="V1.php" hash="d853313e63bd6708c5669dd42cb51e1b"/></dir></dir></dir><file name="Totalinfo.php" hash="c5a797bd61744e897cefe6287fce5d7d"/><dir name="Totalorderinfo"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="ce01e5d386310382fbc9b06531194b45"/></dir><dir name="Guest"><file name="V1.php" hash="b24afbd009b16df4106af72c475d0ca0"/></dir></dir></dir><file name="Totalorderinfo.php" hash="69d3cb8c8d07d53b43561050ba182580"/><dir name="Totalproductinfo"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="f5519b587214660983da9c76ed472240"/></dir><dir name="Guest"><file name="V1.php" hash="e10ed910edb0cc8981e89302ed03d65f"/></dir></dir></dir><file name="Totalproductinfo.php" hash="5724d79872c49cc2950c93489dbd3b6b"/><dir name="Totalreviewinfo"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="7d753cc08978ac86022bbb5754095064"/></dir><dir name="Guest"><file name="V1.php" hash="192f46027f72e1a668a30ab7d44cadf5"/></dir></dir></dir><file name="Totalreviewinfo.php" hash="fa652146fdf0c6939cd6ef36ca5ca696"/><dir name="Totalshipmentinfo"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="041b6b543d49b78710f71791511955d6"/></dir><dir name="Guest"><file name="V1.php" hash="5ec014ecc06ea8a72c8188acb1340308"/></dir></dir></dir><file name="Totalshipmentinfo.php" hash="d1db98b2163db7453c6a32804482c074"/><dir name="Totalsubscriberinfo"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="908a9d13f2a65b0bae45e9b35e00d232"/></dir><dir name="Guest"><file name="V1.php" hash="230ad7202d191bd9e93c1b9fd41f12bd"/></dir></dir></dir><file name="Totalsubscriberinfo.php" hash="6932199b92398c7a08026fc045b34182"/><dir name="Totalwishlistinfo"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="f938b29721d1b20cdd0d4ea7a6a6aac8"/></dir><dir name="Guest"><file name="V1.php" hash="5f44c6b021e6910458ff6140358540a1"/></dir></dir></dir><file name="Totalwishlistinfo.php" hash="9d24d05506d74208a72322f91fc03c7a"/><dir name="Updatesubscription"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="f1014aaec990673e76dec42e66d52a33"/></dir><dir name="Guest"><file name="V1.php" hash="76639c8508b730322b8d5d29bbfe7ff8"/></dir></dir></dir><file name="Updatesubscription.php" hash="1dc100c9b09c83fed1f2b343107f7a2b"/><dir name="Wishlist"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="666cf3408575628734771774afeeb915"/></dir><dir name="Guest"><file name="V1.php" hash="44671ff4a131b0fc35751440b0c03790"/></dir></dir></dir><file name="Wishlist.php" hash="41015ddf11163ec6efc21ca02d48b3eb"/></dir><file name="Customer.php" hash="4d8a9b5726458a01b0cf4eedee27f84f"/><file name="Observer.php" hash="96408f95c08e597b5078bdae2f580b2f"/><file name="Subscriber.php" hash="7c9a69c0340d85fb78149b2d1e5a3f6f"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Page.php" hash="9f110c8010f7274aee995030dbcf37e4"/><file name="Status.php" hash="17aed527b9c4b30f2d4350cf64b3a50a"/><file name="Tracking.php" hash="be2a32ac4523ee58de1b82c228796731"/><file name="Version.php" hash="27118fa886e6c21aa259d399d211b82d"/><file name="Yesno.php" hash="b99b00ea683b4c7be69c2b17b3cacae8"/></dir></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="43a69e4f131f7f42b68ed36988c85526"/></dir><dir name="etc"><file name="api2.xml" hash="0df41f76a730b175db2506c97d9dbb8a"/><file name="config.xml" hash="9bb407597203357998c5ba8131b6c1ca"/><file name="system.xml" hash="7cdf4973563deb45cfea65683603ea7c"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="tracking.xml" hash="b6c90bd1d9edff73db3a1c227046b191"/></dir><dir name="template"><dir name="tracking"><dir><dir name="product"><file name="review.phtml" hash="18722f60f77ea24e1c49c1c320e8a44d"/></dir><dir name="session"><file name="tracking.phtml" hash="5e946c9e929f6b324de083e014ede6a3"/></dir></dir><file name="tracking.phtml" hash="0a2460789061c52de21f853ab80db9ad"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Targetbay_Tracking.xml" hash="b0f324d391c606c536c063e9ebe910a9"/></dir></target></contents>
16
  <compatible/>
17
- <dependencies><required><php><min>5.2.0</min><max>7.0.11</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Targetbay_Tracking</name>
4
+ <version>5.1.2</version>
5
  <stability>stable</stability>
6
  <license>OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Targetbay&amp;amp;apos;s Personalization platform continuously profiles in real-time, opening up the scope for behavioral targeting.</summary>
10
  <description>Making every interaction count and engaging customers with relevant messages will improve the chances of conversion exponentially. You can profile and segment users based on various parameters and actions, the data from which will form the basis for your customer engagement objectives.You can create triggers based on customer engagement objectives to deliver personalized messages. Your newsletter campaigns can also be personalized to deliver better customer engagement results. And all of this can be achieved with the help of our ecommerce-based email personalization platform.</description>
11
  <notes>Making every interaction count and engaging customers with relevant messages will improve the chances of conversion exponentially. You can profile and segment users based on various parameters and actions, the data from which will form the basis for your customer engagement objectives.You can create triggers based on customer engagement objectives to deliver personalized messages. Your newsletter campaigns can also be personalized to deliver better customer engagement results. And all of this can be achieved with the help of our ecommerce-based email personalization platform.</notes>
12
+ <authors><author><name>Targetbay</name><user>Targetbay</user><email>Targetbay@gmail.com</email></author></authors>
13
+ <date>2017-03-06</date>
14
+ <time>07:48:50</time>
15
+ <contents><target name="magecommunity"><dir name="Targetbay"><dir name="Tracking"><dir name="Block"><dir name="Product"><file name="Product.php" hash="25ef7a360f9c92d75dfc657f1cecefe6"/><file name="Review.php" hash="5c37ac0e6533069f34486c95983ae512"/></dir><dir name="Session"><file name="Tracking.php" hash="bead621eadabe0428a99f12ff4f4f60a"/></dir><file name="Tracking.php" hash="d78910db0d380d8f9c88dd55e4a174ed"/></dir><dir name="Helper"><file name="Data.php" hash="3d5eb594d3b372b4450ba4069968d5ea"/></dir><dir name="Model"><dir name="Api2"><dir name="Cartitem"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="e249ac528ec557cc6736387ff85e26ec"/></dir><dir name="Guest"><file name="V1.php" hash="54ed95bbdad05f906f423aac4cb208b9"/></dir></dir></dir><file name="Cartitem.php" hash="f0de9fec4777d78a8d621b92295650ae"/><dir name="Category"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="74764d41a1d32bfb0ad4825d40e8cf46"/></dir><dir name="Guest"><file name="V1.php" hash="2dfc77fcf40841a6fbcb4e92b18c5cbe"/></dir></dir></dir><file name="Category.php" hash="37c664ba07ff52d64787ba635492b862"/><dir name="Createsubscription"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="7d1b2e26e7a5a37459f31dd5b0cb6741"/></dir><dir name="Guest"><file name="V1.php" hash="6c94923e0e86c75b90268e70f91ddb38"/></dir></dir></dir><file name="Createsubscription.php" hash="45dc64e2c1c37293f13a9eab8edd94d0"/><dir name="Customer"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="296c8a85e3c4ba7a0cacf6a0c80c5d06"/></dir><dir name="Guest"><file name="V1.php" hash="1ca174a22acfe731c0e70777c098b4f3"/></dir></dir></dir><file name="Customer.php" hash="6e4adecce83bf453e977a837ed77b0a4"/><dir name="Orders"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="f5b3a992b2e9486558ff8ddd7fd597dc"/></dir><dir name="Guest"><file name="V1.php" hash="a60f6181469b7e5dec6080956674e7e5"/></dir></dir></dir><dir name="Product"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="2d86752c37e3a30660dcff77b2dedaaf"/><file name="V1.php~" hash="cb0e0f6f152441bfbd489588a5299b20"/></dir><dir name="Guest"><file name="V1.php" hash="ef4524e81bc4afbd147a59aae41ef0c8"/></dir></dir></dir><dir name="Review"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="765499958011f928e16a3f14336bd078"/></dir><dir name="Guest"><file name="V1.php" hash="6d9f13ee0c3a904fdb3f289ca09fecc0"/></dir></dir></dir><file name="Review.php" hash="2d6fb0e0141fc73f61e2a586e2fa895d"/><dir name="Shipment"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="eab736400f2275a32603e0b3f1d4351c"/></dir><dir name="Guest"><file name="V1.php" hash="8607da53bca20022f1781ee159b2fc3c"/></dir></dir></dir><file name="Shipment.php" hash="17756fb5e6411bbb27fd0806ce156d74"/><dir name="Stores"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="27e7e2b3fd927e91456b9e529b226522"/></dir><dir name="Guest"><file name="V1.php" hash="8dd09e20ffaef75837bfc00ccbc1c282"/></dir></dir></dir><file name="Stores.php" hash="f5eb4d00382b03c2418f83eb8b7d0ad3"/><dir name="Subscriber"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="65f5f38d5521687b6a106e29a502b7c9"/></dir><dir name="Guest"><file name="V1.php" hash="1fb1e146c1398d2858f5a088a1d59d16"/></dir></dir></dir><file name="Subscriber.php" hash="43f2f4f9c8b01b07f3130cf7488342d1"/><dir name="Totalcartiteminfo"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="65dffb80d635d17d5599a9ee1a61a35e"/></dir><dir name="Guest"><file name="V1.php" hash="c4ce67530cc5ddd7e306a1f95250a00c"/></dir></dir></dir><file name="Totalcartiteminfo.php" hash="b0b10b2a6d42ddecd0e4d97834090be7"/><dir name="Totalcategoryinfo"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="be76b164dbb7cc439a1bbd8a9aa82a53"/></dir><dir name="Guest"><file name="V1.php" hash="d6ea3c89fa7e7396614d983c026c7907"/></dir></dir></dir><file name="Totalcategoryinfo.php" hash="06b6428e59e402ad92f8404e42ce5b35"/><dir name="Totalcustomerinfo"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="def08bb44fc493c15b0a98c5717f68a8"/></dir><dir name="Guest"><file name="V1.php" hash="e0efa78eff478bf0204da6b2f5c95659"/></dir></dir></dir><file name="Totalcustomerinfo.php" hash="fdf343e2d69375826c94e5ce3988cc01"/><dir name="Totalinfo"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="0bf6291950d09e4feea261b3e75ab5a4"/></dir><dir name="Guest"><file name="V1.php" hash="d853313e63bd6708c5669dd42cb51e1b"/></dir></dir></dir><file name="Totalinfo.php" hash="c5a797bd61744e897cefe6287fce5d7d"/><dir name="Totalorderinfo"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="ce01e5d386310382fbc9b06531194b45"/></dir><dir name="Guest"><file name="V1.php" hash="b24afbd009b16df4106af72c475d0ca0"/></dir></dir></dir><file name="Totalorderinfo.php" hash="69d3cb8c8d07d53b43561050ba182580"/><dir name="Totalproductinfo"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="655db4b937dcb52d6c0b0e4ad48cf8fd"/></dir><dir name="Guest"><file name="V1.php" hash="c59844f2844c2a129aede9f8c5cf0364"/></dir></dir></dir><file name="Totalproductinfo.php" hash="5724d79872c49cc2950c93489dbd3b6b"/><dir name="Totalreviewinfo"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="7d753cc08978ac86022bbb5754095064"/></dir><dir name="Guest"><file name="V1.php" hash="192f46027f72e1a668a30ab7d44cadf5"/></dir></dir></dir><file name="Totalreviewinfo.php" hash="fa652146fdf0c6939cd6ef36ca5ca696"/><dir name="Totalshipmentinfo"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="041b6b543d49b78710f71791511955d6"/></dir><dir name="Guest"><file name="V1.php" hash="5ec014ecc06ea8a72c8188acb1340308"/></dir></dir></dir><file name="Totalshipmentinfo.php" hash="d1db98b2163db7453c6a32804482c074"/><dir name="Totalsubscriberinfo"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="908a9d13f2a65b0bae45e9b35e00d232"/></dir><dir name="Guest"><file name="V1.php" hash="230ad7202d191bd9e93c1b9fd41f12bd"/></dir></dir></dir><file name="Totalsubscriberinfo.php" hash="6932199b92398c7a08026fc045b34182"/><dir name="Totalwishlistinfo"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="f938b29721d1b20cdd0d4ea7a6a6aac8"/></dir><dir name="Guest"><file name="V1.php" hash="5f44c6b021e6910458ff6140358540a1"/></dir></dir></dir><file name="Totalwishlistinfo.php" hash="9d24d05506d74208a72322f91fc03c7a"/><dir name="Updatesubscription"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="f1014aaec990673e76dec42e66d52a33"/></dir><dir name="Guest"><file name="V1.php" hash="76639c8508b730322b8d5d29bbfe7ff8"/></dir></dir></dir><file name="Updatesubscription.php" hash="1dc100c9b09c83fed1f2b343107f7a2b"/><dir name="Wishlist"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="666cf3408575628734771774afeeb915"/></dir><dir name="Guest"><file name="V1.php" hash="44671ff4a131b0fc35751440b0c03790"/></dir></dir></dir><file name="Wishlist.php" hash="41015ddf11163ec6efc21ca02d48b3eb"/></dir><file name="Customer.php" hash="4d8a9b5726458a01b0cf4eedee27f84f"/><file name="Observer.php" hash="6eef5b6dab779fd9bdbac8b9e0989d66"/><file name="Subscriber.php" hash="7c9a69c0340d85fb78149b2d1e5a3f6f"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Page.php" hash="9f110c8010f7274aee995030dbcf37e4"/><file name="Status.php" hash="17aed527b9c4b30f2d4350cf64b3a50a"/><file name="Tracking.php" hash="be2a32ac4523ee58de1b82c228796731"/><file name="Version.php" hash="27118fa886e6c21aa259d399d211b82d"/><file name="Yesno.php" hash="b99b00ea683b4c7be69c2b17b3cacae8"/></dir></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="cd241666f46f8a40d664afca4ec58a04"/></dir><dir name="etc"><file name="api2.xml" hash="4068013dac12bc72c5aa58554070816c"/><file name="config.xml" hash="e465837c2e9e1e2ae5ba41bbd4314f86"/><file name="system.xml" hash="7cdf4973563deb45cfea65683603ea7c"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="tracking.xml" hash="a74b3eaf6139b0efb020da91f26d9fae"/></dir><dir name="template"><dir name="tracking"><dir name="product"><file name="review.phtml" hash="70c8d76b676f2ca2942d0b384c14762c"/></dir><dir name="session"><file name="tracking.phtml" hash="5e946c9e929f6b324de083e014ede6a3"/></dir><file name="tracking.phtml" hash="e0c9aeefab4d19557ac598b41d0480ff"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Targetbay_Tracking.xml" hash="a66e9417278e5e9efd1a530a324c79ef"/></dir></target></contents>
16
  <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>7.0.13</max></php></required></dependencies>
18
  </package>