roihunter_easy - Version 1.0.0

Version Notes

Created 28th December, 2016 Compatibility: 1.9.2.4 - Main functions: feed generation, tagging your site for remarketing, creating google ads and much more.

Download this release

Release Info

Developer ROI Hunter
Extension roihunter_easy
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (39) hide show
  1. app/code/community/Businessfactory/Roihuntereasy/Block/AddedToCartAnalytics.php +52 -0
  2. app/code/community/Businessfactory/Roihuntereasy/Block/Adminhtml/Admin.php +59 -0
  3. app/code/community/Businessfactory/Roihuntereasy/Block/Adminhtml/System/Config/Cronbutton.php +63 -0
  4. app/code/community/Businessfactory/Roihuntereasy/Block/Adminhtml/System/Config/Resetbutton.php +63 -0
  5. app/code/community/Businessfactory/Roihuntereasy/Block/CategoryViewAnalytics.php +29 -0
  6. app/code/community/Businessfactory/Roihuntereasy/Block/CheckoutAnalytics.php +52 -0
  7. app/code/community/Businessfactory/Roihuntereasy/Block/Database.php +38 -0
  8. app/code/community/Businessfactory/Roihuntereasy/Block/ProductViewAnalytics.php +8 -0
  9. app/code/community/Businessfactory/Roihuntereasy/Helper/Data.php +6 -0
  10. app/code/community/Businessfactory/Roihuntereasy/Model/AddedToCartObserver.php +35 -0
  11. app/code/community/Businessfactory/Roihuntereasy/Model/CheckoutObserver.php +52 -0
  12. app/code/community/Businessfactory/Roihuntereasy/Model/Cron.php +369 -0
  13. app/code/community/Businessfactory/Roihuntereasy/Model/Main.php +10 -0
  14. app/code/community/Businessfactory/Roihuntereasy/Model/Options.php +18 -0
  15. app/code/community/Businessfactory/Roihuntereasy/Model/Resource/Main.php +14 -0
  16. app/code/community/Businessfactory/Roihuntereasy/Model/Resource/Main/Collection.php +9 -0
  17. app/code/community/Businessfactory/Roihuntereasy/controllers/Adminhtml/RoihuntereasyController.php +15 -0
  18. app/code/community/Businessfactory/Roihuntereasy/controllers/CronController.php +72 -0
  19. app/code/community/Businessfactory/Roihuntereasy/controllers/FeedController.php +41 -0
  20. app/code/community/Businessfactory/Roihuntereasy/controllers/IndexController.php +17 -0
  21. app/code/community/Businessfactory/Roihuntereasy/controllers/ResetController.php +87 -0
  22. app/code/community/Businessfactory/Roihuntereasy/controllers/RoihuntereasyController.php +11 -0
  23. app/code/community/Businessfactory/Roihuntereasy/controllers/StoredetailsController.php +309 -0
  24. app/code/community/Businessfactory/Roihuntereasy/etc/adminhtml.xml +33 -0
  25. app/code/community/Businessfactory/Roihuntereasy/etc/config.xml +127 -0
  26. app/code/community/Businessfactory/Roihuntereasy/etc/system.xml +55 -0
  27. app/code/community/Businessfactory/Roihuntereasy/sql/businessfactory_roihuntereasy_setup/install-1.0.0.php +30 -0
  28. app/design/adminhtml/default/default/layout/businessfactory_roihuntereasy.xml +11 -0
  29. app/design/adminhtml/default/default/template/businessfactory_roihuntereasy/admin.phtml +88 -0
  30. app/design/adminhtml/default/default/template/businessfactory_roihuntereasy/system/config/cronbutton.phtml +25 -0
  31. app/design/adminhtml/default/default/template/businessfactory_roihuntereasy/system/config/resetbutton.phtml +28 -0
  32. app/design/frontend/rwd/default/layout/businessfactory_roihuntereasy.xml +41 -0
  33. app/design/frontend/rwd/default/template/businessfactory_roihuntereasy/added_to_cart_view_analytics.phtml +29 -0
  34. app/design/frontend/rwd/default/template/businessfactory_roihuntereasy/category_view_analytics.phtml +26 -0
  35. app/design/frontend/rwd/default/template/businessfactory_roihuntereasy/checkout_analytics.phtml +48 -0
  36. app/design/frontend/rwd/default/template/businessfactory_roihuntereasy/index.phtml +12 -0
  37. app/design/frontend/rwd/default/template/businessfactory_roihuntereasy/product_view_analytics.phtml +42 -0
  38. app/etc/modules/Businessfactory_Roihuntereasy.xml +9 -0
  39. package.xml +50 -0
app/code/community/Businessfactory/Roihuntereasy/Block/AddedToCartAnalytics.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Businessfactory_Roihuntereasy_Block_AddedToCartAnalytics extends Businessfactory_Roihuntereasy_Block_Database {
4
+
5
+ protected $prodId;
6
+ protected $prodPrice;
7
+
8
+ public function _toHtml() {
9
+ try {
10
+ $product_remarketing_base64 = Mage::getSingleton("customer/session")->getMyValue();
11
+
12
+ $product_remarketing_json = base64_decode($product_remarketing_base64);
13
+ $product_remarketing = json_decode($product_remarketing_json, true);
14
+
15
+ if ($product_remarketing && array_key_exists('pagetype', $product_remarketing)) {
16
+ $pagetype = $product_remarketing['pagetype'];
17
+
18
+ // render template with remarketing tag
19
+ if ($pagetype === "cart" && $product_remarketing) {
20
+ $this->prodId = $product_remarketing['id'];
21
+ $this->prodPrice = $product_remarketing['price'];
22
+
23
+ // unset session value
24
+ Mage::getSingleton('customer/session')->unsMyValue();
25
+
26
+ return parent::_toHtml();
27
+ }
28
+ }
29
+ } catch (Exception $exception) {
30
+ Mage::log(__METHOD__ . " exception.", null, 'errors.log');
31
+ Mage::log($exception, null, 'errors.log');
32
+ }
33
+
34
+ return '';
35
+ }
36
+
37
+ public function getProdId()
38
+ {
39
+ if (!$this->prodId) {
40
+ Mage::log("Product ID not found during " . __METHOD__, null, 'errors.log');
41
+ }
42
+ return $this->prodId;
43
+ }
44
+
45
+ public function getProdPrice()
46
+ {
47
+ if (!$this->prodPrice) {
48
+ Mage::log("Product price not found during " . __METHOD__, null, 'errors.log');
49
+ }
50
+ return $this->prodPrice;
51
+ }
52
+ }
app/code/community/Businessfactory/Roihuntereasy/Block/Adminhtml/Admin.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Businessfactory_Roihuntereasy_Block_Adminhtml_Admin extends Mage_Adminhtml_Block_Template {
4
+
5
+ protected $store;
6
+
7
+ function _construct() {
8
+ $this->store = Mage::app()->getStore();
9
+ }
10
+
11
+ public function getStoreBaseUrl()
12
+ {
13
+ return Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB, true);
14
+ }
15
+
16
+ public function getStoreName()
17
+ {
18
+ return $this->store->getFrontendName();
19
+ }
20
+
21
+ public function getStoreLogo()
22
+ {
23
+ return $this->store->getLogoSrc();
24
+ }
25
+
26
+ public function getStoreCurrency()
27
+ {
28
+ return $this->store->getCurrentCurrencyCode();
29
+ }
30
+
31
+ public function getStoreLanguage()
32
+ {
33
+ // http://stackoverflow.com/questions/6579287/magento-get-language-code-in-template-file
34
+ $locale = explode("_", Mage::app()->getLocale()->getLocaleCode());
35
+ return $locale[0];
36
+ }
37
+
38
+ public function getStoreCountry()
39
+ {
40
+ $locale = explode("_", Mage::app()->getLocale()->getLocaleCode());
41
+ if (is_array($locale) && count($locale) > 1) {
42
+ return $locale[1];
43
+ } else {
44
+ return "US";
45
+ }
46
+
47
+ }
48
+
49
+ function getMainItemEntry()
50
+ {
51
+ $mainItemCollection = Mage::getModel('businessfactory_roihuntereasy/main')->getCollection();
52
+ if ($mainItemCollection->count() <= 0) {
53
+ return null;
54
+ } else {
55
+ return $mainItemCollection->getLastItem();
56
+ }
57
+ }
58
+
59
+ }
app/code/community/Businessfactory/Roihuntereasy/Block/Adminhtml/System/Config/Cronbutton.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Businessfactory_Roihuntereasy_Block_Adminhtml_System_Config_Cronbutton extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+ /**
6
+ * Set template
7
+ */
8
+ protected function _construct()
9
+ {
10
+ parent::_construct();
11
+ $this->setTemplate('businessfactory_roihuntereasy/system/config/cronbutton.phtml');
12
+ }
13
+ /**
14
+ * Render button. Remove scope label.
15
+ *
16
+ * @param Varien_Data_Form_Element_Abstract $element
17
+ * @return string
18
+ */
19
+ public function render(Varien_Data_Form_Element_Abstract $element)
20
+ {
21
+ // Remove scope label
22
+ $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
23
+ return parent::render($element);
24
+ }
25
+
26
+ /**
27
+ * Return button element html.
28
+ *
29
+ * @param Varien_Data_Form_Element_Abstract $element
30
+ * @return string
31
+ */
32
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
33
+ {
34
+ return $this->_toHtml();
35
+ }
36
+
37
+ /**
38
+ * Generate button html
39
+ *
40
+ * @return string
41
+ */
42
+ public function getCronButtonHtml()
43
+ {
44
+ $button = $this->getLayout()->createBlock('adminhtml/widget_button')
45
+ ->setData(array(
46
+ 'id' => 'roihuntereasy_reset_button',
47
+ 'label' => $this->helper('adminhtml')->__('Reset Cron'),
48
+ 'onclick' => 'javascript:resetCron(); return false;'
49
+ ));
50
+
51
+ return $button->toHtml();
52
+ }
53
+
54
+ /**
55
+ * Return ajax url for button
56
+ *
57
+ * @return string
58
+ */
59
+ public function getCronAjaxUrl()
60
+ {
61
+ return Mage::helper('adminhtml')->getUrl('roihuntereasy/reset/cron');
62
+ }
63
+ }
app/code/community/Businessfactory/Roihuntereasy/Block/Adminhtml/System/Config/Resetbutton.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Businessfactory_Roihuntereasy_Block_Adminhtml_System_Config_Resetbutton extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+ /**
6
+ * Set template
7
+ */
8
+ protected function _construct()
9
+ {
10
+ parent::_construct();
11
+ $this->setTemplate('businessfactory_roihuntereasy/system/config/resetbutton.phtml');
12
+ }
13
+ /**
14
+ * Render button. Remove scope label.
15
+ *
16
+ * @param Varien_Data_Form_Element_Abstract $element
17
+ * @return string
18
+ */
19
+ public function render(Varien_Data_Form_Element_Abstract $element)
20
+ {
21
+ // Remove scope label
22
+ $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
23
+ return parent::render($element);
24
+ }
25
+
26
+ /**
27
+ * Return button element html.
28
+ *
29
+ * @param Varien_Data_Form_Element_Abstract $element
30
+ * @return string
31
+ */
32
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
33
+ {
34
+ return $this->_toHtml();
35
+ }
36
+
37
+ /**
38
+ * Generate button html
39
+ *
40
+ * @return string
41
+ */
42
+ public function getResetButtonHtml()
43
+ {
44
+ $button = $this->getLayout()->createBlock('adminhtml/widget_button')
45
+ ->setData(array(
46
+ 'id' => 'roihuntereasy_reset_button',
47
+ 'label' => $this->helper('adminhtml')->__('Reset Data'),
48
+ 'onclick' => 'javascript:resetData(); return false;'
49
+ ));
50
+
51
+ return $button->toHtml();
52
+ }
53
+
54
+ /**
55
+ * Return ajax url for button
56
+ *
57
+ * @return string
58
+ */
59
+ public function getResetAjaxUrl()
60
+ {
61
+ return Mage::helper('adminhtml')->getUrl('roihuntereasy/reset/data');
62
+ }
63
+ }
app/code/community/Businessfactory/Roihuntereasy/Block/CategoryViewAnalytics.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Businessfactory_Roihuntereasy_Block_CategoryViewAnalytics extends Businessfactory_Roihuntereasy_Block_Database
4
+ {
5
+ public function getProductIds() {
6
+ try {
7
+ $products = Mage::registry('current_category')->getProductCollection();
8
+
9
+ // slice array not to list all the products
10
+ $limit = 10;
11
+ $count = 0;
12
+ $productIds = array();
13
+ foreach ($products as $product) {
14
+ array_push($productIds, $product->getSku());
15
+ if (count($productIds) >= $limit) {
16
+ break;
17
+ }
18
+ $count = $count + 1;
19
+ }
20
+ return json_encode($productIds);
21
+ } catch (Exception $exception) {
22
+ Mage::log(__METHOD__ . " exception.", null, 'errors.log');
23
+ Mage::log($exception, null, 'errors.log');
24
+ return null;
25
+ }
26
+
27
+ return ;
28
+ }
29
+ }
app/code/community/Businessfactory/Roihuntereasy/Block/CheckoutAnalytics.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Businessfactory_Roihuntereasy_Block_CheckoutAnalytics extends Businessfactory_Roihuntereasy_Block_Database {
4
+
5
+ protected $prodId;
6
+ protected $prodPrice;
7
+
8
+ public function _toHtml() {
9
+ try {
10
+ // find out if session was set
11
+ $product_remarketing_base64 = Mage::getSingleton("customer/session")->getMyValue();
12
+ $product_remarketing_json = base64_decode($product_remarketing_base64);
13
+ $product_remarketing = json_decode($product_remarketing_json, true);
14
+
15
+ if ($product_remarketing && array_key_exists('pagetype', $product_remarketing)) {
16
+ $pagetype = $product_remarketing['pagetype'];
17
+
18
+ // render template with remarketing tag
19
+ if ($pagetype === "checkout" && $product_remarketing) {
20
+ $this->prodId = $product_remarketing['id'];
21
+ $this->prodPrice = $product_remarketing['price'];
22
+
23
+ // unset session value
24
+ Mage::getSingleton('customer/session')->unsMyValue();
25
+
26
+ return parent::_toHtml();
27
+ }
28
+ }
29
+ } catch (Exception $exception) {
30
+ Mage::log(__METHOD__ . " exception.", null, 'errors.log');
31
+ Mage::log($exception, null, 'errors.log');
32
+ }
33
+
34
+ return '';
35
+ }
36
+
37
+ public function getProdId()
38
+ {
39
+ if (!$this->prodId) {
40
+ Mage::log("Product ID not found during " . __METHOD__, null, 'errors.log');
41
+ }
42
+ return json_encode($this->prodId);
43
+ }
44
+
45
+ public function getProdPrice()
46
+ {
47
+ if (!$this->prodPrice) {
48
+ Mage::log("Product price not found during " . __METHOD__, null, 'errors.log');
49
+ }
50
+ return $this->prodPrice;
51
+ }
52
+ }
app/code/community/Businessfactory/Roihuntereasy/Block/Database.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Businessfactory_Roihuntereasy_Block_Database extends Mage_Core_Block_Template {
4
+
5
+ protected $_Collection = null;
6
+
7
+ public function getCollection()
8
+ {
9
+ if(is_null($this->_Collection)){
10
+ $this->_Collection=Mage::getModel('businessfactory_roihuntereasy/main')->getCollection();
11
+ }
12
+
13
+ return $this->_Collection;
14
+ }
15
+
16
+ public function getConversionId()
17
+ {
18
+ try {
19
+ $collection=$this->getCollection();
20
+
21
+ if (($mainItem = ($collection->getLastItem())) == NULL) {
22
+ Mage::log("Table record not found during " . __METHOD__, null, 'errors.log');
23
+ return null;
24
+ }
25
+
26
+ if (($conversionId = $mainItem->getConversionId()) == NULL) {
27
+ Mage::log("Conversion ID not found during " . __METHOD__, null, 'errors.log');
28
+ return null;
29
+ }
30
+
31
+ return $conversionId;
32
+ } catch (Exception $exception) {
33
+ Mage::log(__METHOD__ . " exception.", null, 'errors.log');
34
+ Mage::log($exception, null, 'errors.log');
35
+ return null;
36
+ }
37
+ }
38
+ }
app/code/community/Businessfactory/Roihuntereasy/Block/ProductViewAnalytics.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Businessfactory_Roihuntereasy_Block_ProductViewAnalytics extends Businessfactory_Roihuntereasy_Block_Database
4
+ {
5
+ public function getProduct() {
6
+ return Mage::registry('current_product');
7
+ }
8
+ }
app/code/community/Businessfactory/Roihuntereasy/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Businessfactory_Roihuntereasy_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
app/code/community/Businessfactory/Roihuntereasy/Model/AddedToCartObserver.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Businessfactory_Roihuntereasy_Model_AddedToCartObserver extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('roihuntereasy/roihuntereasy');
8
+ }
9
+
10
+ public function setRemarketingTag(Varien_Event_Observer $observer)
11
+ {
12
+ try {
13
+ $product = $observer->getEvent()->getProduct();
14
+
15
+ $sku = $product->getSku();
16
+ $price = $product->getFinalPrice();
17
+
18
+ // set product as session data
19
+ $product_remarketing_data = array(
20
+ 'pagetype' => 'cart',
21
+ 'id' => $sku,
22
+ 'price' => $price
23
+ );
24
+ $product_remarketing_json = json_encode($product_remarketing_data);
25
+ $product_remarketing_base64 = base64_encode($product_remarketing_json);
26
+
27
+ // set session
28
+ Mage::getSingleton('customer/session')->setMyValue($product_remarketing_base64);
29
+ } catch (Exception $exception) {
30
+ Mage::log(__METHOD__ . " exception.", null, 'errors.log');
31
+ Mage::log($exception, null, 'errors.log');
32
+ }
33
+ }
34
+ }
35
+ ?>
app/code/community/Businessfactory/Roihuntereasy/Model/CheckoutObserver.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Businessfactory_Roihuntereasy_Model_CheckoutObserver extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('roihuntereasy/roihuntereasy');
8
+ }
9
+
10
+ public function setRemarketingTag(Varien_Event_Observer $observer)
11
+ {
12
+ try {
13
+ $orderIds = $observer->getEvent()->getOrderIds();
14
+
15
+ if (!$orderIds || !is_array($orderIds)) {
16
+ return $this;
17
+ }
18
+
19
+ $conversionValue = 0;
20
+ $productIds = array();
21
+
22
+ $collection = Mage::getResourceModel('sales/order_collection')
23
+ ->addFieldToFilter('entity_id', array('in' => $orderIds));
24
+
25
+ foreach ($collection as $order) {
26
+ $conversionValue += $order->getBaseGrandTotal();
27
+
28
+ $products = $order->getAllVisibleItems();
29
+ foreach ($products as $product) {
30
+ array_push($productIds, $product->getSku());
31
+ }
32
+ }
33
+
34
+ $checkout_remarketing_data = array(
35
+ 'pagetype' => 'checkout',
36
+ 'id' => $productIds,
37
+ 'price' => $conversionValue
38
+ );
39
+ $checkout_remarketing_json = json_encode($checkout_remarketing_data);
40
+ $checkout_remarketing_base64 = base64_encode($checkout_remarketing_json);
41
+
42
+ // set session
43
+ Mage::getSingleton('customer/session')->setMyValue($checkout_remarketing_base64);
44
+
45
+ return $this;
46
+ } catch (Exception $exception) {
47
+ Mage::log(__METHOD__ . " exception.", null, 'errors.log');
48
+ Mage::log($exception, null, 'errors.log');
49
+ }
50
+ }
51
+ }
52
+ ?>
app/code/community/Businessfactory/Roihuntereasy/Model/Cron.php ADDED
@@ -0,0 +1,369 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Businessfactory_Roihuntereasy_Model_Cron extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ }
9
+
10
+ public function test() {
11
+ Mage::log("Cron schedule running.", null, "cron.log");
12
+ }
13
+
14
+ /**
15
+ * Method start new feed creation process, if not another feed creation process running.
16
+ */
17
+ public function createFeed()
18
+ {
19
+ Mage::log(__METHOD__ . " cron", null, 'cron.log');
20
+ $filename = "businessFactoryRoiHunterEasyFeedSign";
21
+
22
+ try {
23
+ $io = new Varien_Io_File();
24
+ $io->setAllowCreateFolders(true);
25
+ $io->open(array('path' => Mage::getBaseDir()));
26
+
27
+ if ($io->fileExists($filename)) {
28
+ Mage::log("Feed generation already running.", null, 'cron.log');
29
+ return false;
30
+ }
31
+
32
+ $io->streamOpen($filename);
33
+ $io->streamWrite("Running");
34
+ $io->streamClose();
35
+
36
+ // Generate feed
37
+ $this->generateAndSaveFeed();
38
+
39
+ // Delete file
40
+ $io->rm($filename);
41
+
42
+ return true;
43
+ } catch (Exception $exception) {
44
+ Mage::log(__METHOD__ . " exception.", null, 'errors.log');
45
+ Mage::log($exception, null, 'errors.log');
46
+
47
+ // Try delete file also when exception occurred.
48
+ try {
49
+ $io->rm($filename);
50
+ } catch (Exception $exception) {
51
+ Mage::log(__METHOD__ . " exception.", null, 'errors.log');
52
+ Mage::log($exception, null, 'errors.log');
53
+ }
54
+ return false;
55
+ }
56
+ }
57
+
58
+ /**
59
+ * Feed generation function
60
+ */
61
+ private function generateAndSaveFeed()
62
+ {
63
+ $pathTemp = "roi_hunter_easy_feed_temp.xml";
64
+ $pathFinal = "roi_hunter_easy_feed_final.xml";
65
+
66
+ $io = new Varien_Io_File();
67
+ $io->setAllowCreateFolders(true);
68
+ $io->open(array('path' => Mage::getBaseDir() . "/feeds"));
69
+
70
+ // Clear file
71
+ if ($io->fileExists($pathTemp)) {
72
+ $io->rm($pathTemp);
73
+ }
74
+ $io->streamOpen($pathTemp);
75
+
76
+ try {
77
+ $xmlWriter = new XMLWriter();
78
+ $xmlWriter->openMemory();
79
+ $xmlWriter->startDocument('1.0', 'UTF-8');
80
+ $xmlWriter->setIndent(true);
81
+
82
+ $xmlWriter->startElement('rss');
83
+ $xmlWriter->writeAttribute('version', '2.0');
84
+ $xmlWriter->writeAttributeNs('xmlns', 'g', null, 'http://base.google.com/ns/1.0');
85
+ $xmlWriter->startElement('channel');
86
+ $xmlWriter->writeElement('title', 'ROI Hunter Easy - Magento data feed');
87
+ $xmlWriter->writeElement('description', 'Magento data feed used in Google Merchants');
88
+ $xmlWriter->writeElement('link', Mage::app()->getStore()->getBaseUrl());
89
+
90
+ $total_time_start = microtime(true);
91
+ $time_start = microtime(true);
92
+ $products = $this->getProductCollection();
93
+ $time_end = microtime(true);
94
+ $execution_time = ($time_end - $time_start);
95
+ Mage::log('getProductCollection count: ' . count($products) . '. Execution time: ' . $execution_time, null, 'cron.log');
96
+
97
+ $this->count = 0;
98
+
99
+ // debug variables
100
+ $limit_enabled = false;
101
+ $simple_products_count = 0;
102
+ $configurable_products_count = 0;
103
+ $simple_products_limit = 2;
104
+ $configurable_products_limit = 1;
105
+
106
+ foreach ($products as $_product) {
107
+
108
+ $xmlWriter->writeElement('store', $_product->getStoreId());
109
+ // $_product->setStoreId(Mage::app()->getStore());
110
+
111
+ switch ($_product->getTypeId()) {
112
+ case 'downloadable':
113
+ if ($_product->getPrice() <= 0) {
114
+ // $this->_logger->info("Skip this");
115
+ break;
116
+ }
117
+ // Else same processing as simple product
118
+ case 'simple':
119
+ if (!$limit_enabled || $simple_products_count < $simple_products_limit) {
120
+ $this->write_simple_product($_product, $xmlWriter);
121
+ $simple_products_count++;
122
+ }
123
+ break;
124
+ case 'configurable':
125
+ if (!$limit_enabled || $configurable_products_count < $configurable_products_limit) {
126
+ $this->write_configurable_product($_product, $xmlWriter);
127
+ $configurable_products_count++;
128
+ }
129
+ break;
130
+ }
131
+ if ($limit_enabled && $simple_products_count >= $simple_products_limit && $configurable_products_count >= $configurable_products_limit) {
132
+ break;
133
+ }
134
+
135
+ $this->count++;
136
+ if ($this->count >= 512) {
137
+ $this->count = 0;
138
+ // After each 512 products flush memory to file.
139
+ $io->streamWrite($xmlWriter->flush());
140
+ }
141
+ }
142
+
143
+ $xmlWriter->endElement();
144
+ $xmlWriter->endElement();
145
+ $xmlWriter->endDocument();
146
+
147
+ // Final memory flush, rename temporary file and feed is done.
148
+ $io->streamWrite($xmlWriter->flush());
149
+ $io->streamClose();
150
+
151
+ if ($io->mv($pathTemp, $pathFinal)) {
152
+ Mage::log("Created feed renamed successful", null, 'cron.log');
153
+ } else {
154
+ Mage::log("ERROR: Created feed renamed unsuccessful", null, 'cron.log');
155
+ }
156
+
157
+ $total_time_end = microtime(true);
158
+ $total_execution_time = ($total_time_end - $total_time_start);
159
+ Mage::log('total execution time: ' . $total_execution_time, null, 'cron.log');
160
+ } catch (Exception $e) {
161
+ Mage::throwException($e);
162
+ }
163
+ return true;
164
+ }
165
+
166
+ public function getProductCollection()
167
+ {
168
+ $collection = Mage::getModel('catalog/product')->getCollection();
169
+
170
+ // select necessary attributes
171
+ $collection->addAttributeToSelect('name');
172
+ $collection->addAttributeToSelect('short_description');
173
+ $collection->addAttributeToSelect('description');
174
+ $collection->addAttributeToSelect('price');
175
+ $collection->addAttributeToSelect('special_price');
176
+ $collection->addAttributeToSelect('size');
177
+ $collection->addAttributeToSelect('color');
178
+ $collection->addAttributeToSelect('pattern');
179
+ $collection->addAttributeToSelect('image');
180
+
181
+ // Allow only visible products
182
+ $visibility = array(
183
+ Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
184
+ Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG
185
+ );
186
+ $collection->addAttributeToFilter('visibility', $visibility);
187
+ $collection->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
188
+
189
+ $collection->addUrlRewrite();
190
+
191
+ $collection->load();
192
+
193
+ return $collection;
194
+ }
195
+
196
+ /**
197
+ * @param $_product
198
+ * @param XMLWriter $xmlWriter
199
+ */
200
+ private function write_simple_product($_product, $xmlWriter)
201
+ {
202
+ $xmlWriter->startElement('item');
203
+
204
+ // process common attributes
205
+ $this->write_parent_product_attributes($_product, $xmlWriter);
206
+ // process advanced attributes
207
+ $this->write_child_product_attributes($_product, $xmlWriter);
208
+ // categories
209
+ $catCollection = $this->get_product_types($_product);
210
+ $this->write_product_types($catCollection, $xmlWriter);
211
+
212
+ $xmlWriter->endElement();
213
+ }
214
+
215
+ /**
216
+ * @param Mixed $_product
217
+ * @param XMLWriter $xmlWriter
218
+ */
219
+ function write_parent_product_attributes($_product, $xmlWriter)
220
+ {
221
+ $xmlWriter->writeElement('g:title', $_product->getName());
222
+ $xmlWriter->writeElement('g:description', $this->get_description($_product));
223
+ $xmlWriter->writeElement('g:link', $_product->getProductUrl());
224
+ $xmlWriter->writeElement('g:brand', $_product->getAttributeText('manufacturer'));
225
+
226
+ $xmlWriter->writeElement('g:condition', 'new');
227
+ // TODO add more attributes if needed.
228
+ // $xmlWriter->writeElement('g:size_system', 'uk');
229
+ // $xmlWriter->writeElement('g:age_group', 'adult');
230
+
231
+ // $xmlWriter->writeElement('g:identifier_exists', 'TRUE');
232
+ // $xmlWriter->writeElement('g:adult', $this->do_is_adult($_product));
233
+ }
234
+
235
+ // /**
236
+ // * @param Mixed $_product
237
+ // * @return string
238
+ // */
239
+ // function do_is_adult($_product)
240
+ // {
241
+ // // TODO add decision if needed.
242
+ //// switch ($_product->getAttributeText('familysafe')) {
243
+ //// case 'No':
244
+ //// $isadult = "FALSE";
245
+ //// default:
246
+ //// $isadult = "TRUE";
247
+ //// }
248
+ // return ("FALSE");
249
+ // }
250
+
251
+ /**
252
+ * @param Mixed $product
253
+ * @return mixed
254
+ */
255
+ function get_description($product)
256
+ {
257
+ $description = $product->getShortDescription();
258
+ if (!$description) {
259
+ $description = $product->getDescription();
260
+ }
261
+ return ($description);
262
+ }
263
+
264
+ /**
265
+ * @param Mixed $product
266
+ * @return string
267
+ */
268
+ function get_image_url($product)
269
+ {
270
+ $productMediaConfig = Mage::getModel('catalog/product_media_config');
271
+ $baseImageUrl = $productMediaConfig->getMediaUrl($product->getImage());
272
+
273
+ return $baseImageUrl;
274
+ }
275
+
276
+ /**
277
+ * @param Mixed $_product
278
+ * @param XMLWriter $xmlWriter
279
+ */
280
+ function write_child_product_attributes($_product, $xmlWriter)
281
+ {
282
+ $xmlWriter->writeElement('g:id', $_product->getId());
283
+ $xmlWriter->writeElement('g:image_link', $this->get_image_url($_product));
284
+
285
+ // $this->_logger->debug('gtin: ' . $_product->getEan());
286
+ $xmlWriter->writeElement('g:mpn', $_product->getSku());
287
+ $xmlWriter->writeElement('display_ads_id', $_product->getSku());
288
+ if (strlen($_product->getEan()) > 7) {
289
+ $xmlWriter->writeElement('g:gtin', $_product->getEan());
290
+ }
291
+
292
+ $xmlWriter->writeElement('g:price', $_product->getPrice());
293
+ $xmlWriter->writeElement('g:sale_price', $_product->getSpecialPrice());
294
+ $xmlWriter->writeElement('g:size', $_product->getAttributeText('size'));
295
+ $xmlWriter->writeElement('g:color', $_product->getAttributeText('color'));
296
+ $xmlWriter->writeElement('g:availability', $this->do_isinstock($_product));
297
+ }
298
+
299
+ /**
300
+ * @param Mixed $_product
301
+ * @return string
302
+ */
303
+ function do_isinstock($_product)
304
+ {
305
+ $stockItem = $_product->getStockItem();
306
+ if($stockItem->getIsInStock())
307
+ {
308
+ $stockval = 'in stock';
309
+ }
310
+ else
311
+ {
312
+ $stockval = 'out of stock';
313
+ }
314
+
315
+ return $stockval;
316
+ }
317
+
318
+ /**
319
+ * @param Mixed $catCollection
320
+ * @param XMLWriter $xmlWriter
321
+ */
322
+ function write_product_types($catCollection, $xmlWriter)
323
+ {
324
+ /** @var Mixed $category */
325
+ foreach ($catCollection as $category) {
326
+ $xmlWriter->writeElement('g:product_type', $category->getName());
327
+ }
328
+ }
329
+
330
+ /**
331
+ * @param Mixed $_product
332
+ * @return mixed
333
+ */
334
+ function get_product_types($_product)
335
+ {
336
+ // SELECT name FROM category
337
+ // if I want to load more attributes, I need to select them first
338
+ // loading and selecting is processor intensive! Selecting more attributes will result in longer delay!
339
+ return $_product->getCategoryCollection()->addAttributeToSelect('name')->load();
340
+ }
341
+
342
+ /**
343
+ * @param Mixed $_product
344
+ * @param XMLWriter $xmlWriter
345
+ */
346
+ private function write_configurable_product($_product, $xmlWriter)
347
+ {
348
+ $catCollection = $this->get_product_types($_product);
349
+
350
+ $conf = Mage::getModel('catalog/product_type_configurable')->setProduct($_product);
351
+ $simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
352
+
353
+ foreach ($simple_collection as $_childproduct) {
354
+ $xmlWriter->startElement('item');
355
+
356
+ $xmlWriter->writeElement('g:item_group_id', $_product->getSku());
357
+
358
+ // process common attributes
359
+ $this->write_parent_product_attributes($_product, $xmlWriter);
360
+ // process advanced attributes
361
+ $this->write_child_product_attributes($_childproduct, $xmlWriter);
362
+ // categories
363
+ $this->write_product_types($catCollection, $xmlWriter);
364
+
365
+ $xmlWriter->endElement();
366
+ $this->count++;
367
+ }
368
+ }
369
+ }
app/code/community/Businessfactory/Roihuntereasy/Model/Main.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Businessfactory_Roihuntereasy_Model_Main extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('businessfactory_roihuntereasy/main');
9
+ }
10
+ }
app/code/community/Businessfactory/Roihuntereasy/Model/Options.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Businessfactory_Roihuntereasy_Model_Options
3
+ {
4
+ /**
5
+ * Provide available options as a value/label array
6
+ *
7
+ * @return array
8
+ */
9
+ public function toOptionArray()
10
+ {
11
+ return array(
12
+ array('value'=>1, 'label'=>'One'),
13
+ array('value'=>2, 'label'=>'Two'),
14
+ array('value'=>3, 'label'=>'Three'),
15
+ array('value'=>4, 'label'=>'Four')
16
+ );
17
+ }
18
+ }
app/code/community/Businessfactory/Roihuntereasy/Model/Resource/Main.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Businessfactory_Roihuntereasy_Model_Resource_Main extends Mage_Core_Model_Resource_Db_Abstract
4
+ {
5
+ /**
6
+ * Initialize resource model
7
+ *
8
+ * @return void
9
+ */
10
+ public function _construct()
11
+ {
12
+ $this->_init('businessfactory_roihuntereasy/main', 'id');
13
+ }
14
+ }
app/code/community/Businessfactory/Roihuntereasy/Model/Resource/Main/Collection.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Businessfactory_Roihuntereasy_Model_Resource_Main_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
4
+
5
+ protected function _constuct()
6
+ {
7
+ $this->_init('businessfactory_roihuntereasy/main');
8
+ }
9
+ }
app/code/community/Businessfactory/Roihuntereasy/controllers/Adminhtml/RoihuntereasyController.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Businessfactory_Roihuntereasy_Adminhtml_RoihuntereasyController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ /**
6
+  * Return some checking result
7
+  *
8
+  * @return void
9
+ */
10
+ public function checkAction() {
11
+ $result = 1;
12
+ Mage::app()->getResponse()->setBody($result);
13
+ }
14
+ }
15
+
app/code/community/Businessfactory/Roihuntereasy/controllers/CronController.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Businessfactory_Roihuntereasy_CronController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ protected $cron;
6
+
7
+ public function _construct()
8
+ {
9
+ parent::_construct();
10
+ $this->cron = new Businessfactory_Roihuntereasy_Model_Cron();
11
+ }
12
+
13
+ /**
14
+ * http://store.com/roihuntereasy/cron/index
15
+ */
16
+ public function indexAction()
17
+ {
18
+ $request = $this->getRequest();
19
+ $response = $this->getResponse();
20
+
21
+ $response->setHeader('Content-type', 'application/json');
22
+ $response->setHeader('Access-Control-Allow-Origin', '*', true);
23
+ $response->setHeader('Access-Control-Allow-Methods', 'OPTIONS,GET', true);
24
+ $response->setHeader('Access-Control-Max-Age', '60', true);
25
+ $response->setHeader('Access-Control-Allow-Headers', 'X-Authorization', true);
26
+
27
+ if ($request->getMethod() === 'GET') {
28
+ $this->processGET();
29
+ } else if ($request->getMethod() === 'OPTIONS') {
30
+
31
+ } else {
32
+ $response->setHttpResponseCode(400);
33
+ }
34
+ }
35
+
36
+ /**
37
+ * GET
38
+ * http://store.com/roihuntereasy/cron/index
39
+ */
40
+ function processGET()
41
+ {
42
+ $request = $this->getRequest();
43
+ $response = $this->getResponse();
44
+
45
+ try {
46
+ $authorizationHeader = $request->getHeader('X-Authorization');
47
+
48
+ $mainItemCollection = Mage::getModel('businessfactory_roihuntereasy/main')->getCollection();
49
+ $clientToken = $mainItemCollection->getLastItem()->getClientToken();
50
+ if ($clientToken == NULL || $clientToken !== $authorizationHeader) {
51
+ $response->setBody(json_encode("Not authorized"));
52
+ $response->setHttpResponseCode(403);
53
+ return;
54
+ }
55
+
56
+ Mage::log("Cron generating started manually.", null, 'cron.log');
57
+ $resultCode = $this->cron->createFeed();
58
+ if($resultCode == true){
59
+ $response->setBody(json_encode('Feed generated.'));
60
+ } else {
61
+ $response->setBody(json_encode('Feed not generated.'));
62
+ }
63
+ } catch (Exception $exception) {
64
+ Mage::log(__METHOD__ . " exception.", null, 'errors.log');
65
+ Mage::log($exception, null, 'errors.log');
66
+ Mage::log($request, null, 'errors.log');
67
+ $response->setHttpResponseCode(500);
68
+ $response->setBody(json_encode('Feed generation failed.'));
69
+ }
70
+ }
71
+ }
72
+
app/code/community/Businessfactory/Roihuntereasy/controllers/FeedController.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Businessfactory_Roihuntereasy_FeedController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ public function feedAction()
6
+ {
7
+ Mage::log("Get product feed called.", null, 'feed.log');
8
+
9
+ try {
10
+ $file = "feeds/roi_hunter_easy_feed_final.xml";
11
+
12
+ if (file_exists($file)) {
13
+ header('Content-Description: File Transfer');
14
+ header('Content-Type: application/octet-stream');
15
+ header('Content-Disposition: attachment; filename="' . basename($file) .'"');
16
+ header('Expires: 0');
17
+ header('Cache-Control: must-revalidate');
18
+ header('Pragma: public');
19
+ readfile($file);
20
+ exit;
21
+ }
22
+ else {
23
+ Mage::log("Product feed file does not exist.", null, 'feed.log');
24
+ $this->getResponse()->setHttpResponseCode(404);
25
+ $this->getResponse()->setBody(json_encode(
26
+ ['error_message' => 'Feed not found. Please look to log file for more information.']
27
+ ));
28
+ }
29
+ } catch (Exception $exception) {
30
+ Mage::log(__METHOD__ . " exception.", null, 'errors.log');
31
+ Mage::log($exception, null, 'errors.log');
32
+ Mage::log($this->getRequest(), null, 'errors.log');
33
+
34
+ $this->getResponse()->setHttpResponseCode(500);
35
+ $this->getResponse()->setBody(json_encode(
36
+ ['error_message' => 'Cannot return feed. Please look to log file for more information.']
37
+ ));
38
+ }
39
+ }
40
+ }
41
+
app/code/community/Businessfactory/Roihuntereasy/controllers/IndexController.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Businessfactory_Roihuntereasy_IndexController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ public function indexAction()
6
+ {
7
+ echo "<h1>Hello Holly.</h1>";
8
+ $this->loadLayout();
9
+ $this->renderLayout();
10
+ }
11
+
12
+ public function mamethodeAction()
13
+ {
14
+ echo "test mamethode";
15
+ }
16
+ }
17
+
app/code/community/Businessfactory/Roihuntereasy/controllers/ResetController.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Businessfactory_Roihuntereasy_ResetController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ /**
6
+ * http://store.com/roihuntereasy/reset/data
7
+ */
8
+ public function dataAction()
9
+ {
10
+ Mage::log(__METHOD__ . " invoked", null, 'debug.log');
11
+
12
+ $response = $this->getResponse();
13
+
14
+ try {
15
+ // If no items -> success
16
+ $mainItemCollection = Mage::getModel('businessfactory_roihuntereasy/main')->getCollection();
17
+ if ($mainItemCollection->count() <= 0) {
18
+ return $response->setBody(json_encode("Reset completed"));
19
+ } else {
20
+ // Delete all plugin data
21
+ $accessToken = $mainItemCollection->getLastItem()->getAccessToken();
22
+
23
+ foreach ($mainItemCollection as $mainItem) {
24
+ Mage::getModel('businessfactory_roihuntereasy/main')->load($mainItem->getId())->delete();
25
+ }
26
+
27
+ $client = new Varien_Http_Client('https://goostav.roihunter.com/customers/disconnect');
28
+ $client->setMethod(Varien_Http_Client::GET);
29
+ $client->setConfig(array(
30
+ 'adapter' => 'Zend_Http_Client_Adapter_Curl',
31
+ 'curloptions' => [CURLOPT_FOLLOWLOCATION => true],
32
+ 'maxredirects' => 5,
33
+ 'timeout' => 60
34
+ ));
35
+ $client->setHeaders([
36
+ 'X-Authorization' => $accessToken
37
+ ]);
38
+
39
+ try{
40
+ $goostav_response = $client->request();
41
+ if ($goostav_response->isSuccessful()) {
42
+ return $response->setBody(json_encode("Reset data completed"));
43
+ }
44
+ else {
45
+ return $response->setBody($goostav_response->getStatus());
46
+ }
47
+ } catch (Exception $e) {
48
+ Mage::log($e, null, 'errors.log');
49
+ return $response->setBody(json_encode("Reset failed. Please check logs and contact support at easy@roihunter.com."));
50
+ }
51
+ }
52
+ } catch (Exception $e) {
53
+ Mage::log($e, null, 'errors.log');
54
+ return $response->setBody(json_encode("Reset failed. Please check logs and contact support at easy@roihunter.com."));
55
+ }
56
+ }
57
+
58
+ /**
59
+ * http://store.com/roihuntereasy/reset/cron
60
+ */
61
+ public function cronAction()
62
+ {
63
+ Mage::log(__METHOD__ . " invoked", null, 'debug.log');
64
+
65
+ $response = $this->getResponse();
66
+
67
+ try {
68
+ $filename = "businessFactoryRoiHunterEasyFeedSign";
69
+ $io = new Varien_Io_File();
70
+ $io->open(array('path' => Mage::getBaseDir()));
71
+
72
+ if ($io->fileExists($filename)) {
73
+ $io->rm($filename);
74
+ return $response->setBody(json_encode("Reset cron completed."));
75
+ }
76
+ else {
77
+ return $response->setBody(json_encode("Reset already completed."));
78
+ }
79
+
80
+ } catch (Exception $e) {
81
+ Mage::log($e, null, 'errors.log');
82
+ return $response->setBody(json_encode("Reset cron failed. Please check logs and contact support at easy@roihunter.com."));
83
+ }
84
+ }
85
+
86
+ }
87
+
app/code/community/Businessfactory/Roihuntereasy/controllers/RoihuntereasyController.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Admin page controller
4
+ class Businessfactory_Roihuntereasy_RoihuntereasyController extends Mage_Adminhtml_Controller_Action
5
+ {
6
+ public function indexAction()
7
+ {
8
+ $this->loadLayout()->_setActiveMenu('businessfactory');
9
+ $this->renderLayout();
10
+ }
11
+ }
app/code/community/Businessfactory/Roihuntereasy/controllers/StoredetailsController.php ADDED
@@ -0,0 +1,309 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Businessfactory_Roihuntereasy_StoredetailsController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ public function indexAction()
6
+ {
7
+ echo "<h1>Hello Store Details.</h1>";
8
+
9
+ $this->loadLayout();
10
+ $this->renderLayout();
11
+ }
12
+
13
+ /**
14
+ * http://store.com/roihuntereasy/storedetails/state
15
+ */
16
+ public function stateAction()
17
+ {
18
+ $request = $this->getRequest();
19
+ $response = $this->getResponse();
20
+
21
+ $response->setHeader('Content-type', 'application/json');
22
+ $response->setHeader('Access-Control-Allow-Origin', '*', true);
23
+ $response->setHeader('Access-Control-Allow-Methods', 'OPTIONS,GET,POST', true);
24
+ $response->setHeader('Access-Control-Max-Age', '60', true);
25
+ $response->setHeader('Access-Control-Allow-Headers', 'X-Authorization', true);
26
+
27
+ if ($request->getMethod() === 'GET') {
28
+ $this->processStateGET();
29
+ } else if ($request->getMethod() === 'POST') {
30
+ $this->processStatePOST();
31
+ }
32
+ }
33
+
34
+ /**
35
+ * GET
36
+ * http://store.com/roihuntereasy/storedetails/state
37
+ *
38
+ * Returns state.
39
+ */
40
+ function processStateGET()
41
+ {
42
+ $request = $this->getRequest();
43
+ $response = $this->getResponse();
44
+
45
+ try {
46
+ $mainItemCollection = Mage::getModel('businessfactory_roihuntereasy/main')->getCollection();
47
+ // If table empty, then create new item.
48
+ if ($mainItemCollection->count() <= 0) {
49
+ $response->setBody(json_encode("Entry not exist."));
50
+ $response->setHttpResponseCode(404);
51
+ } else {
52
+ $response->setBody(json_encode($mainItemCollection->getLastItem()->getCreationState()));
53
+ }
54
+ } catch (Exception $exception) {
55
+ Mage::log(__METHOD__ . " exception.", null, 'errors.log');
56
+ Mage::log($exception, null, 'errors.log');
57
+ Mage::log($request, null, 'errors.log');
58
+ $response->setHttpResponseCode(500);
59
+ }
60
+ }
61
+
62
+ /**
63
+ * POST
64
+ * http://store.com/roihuntereasy/storedetails/state
65
+ *
66
+ * Updates state.
67
+ */
68
+ function processStatePOST()
69
+ {
70
+ $request = $this->getRequest();
71
+ $response = $this->getResponse();
72
+
73
+ try {
74
+ // Get request params
75
+ $requestData = $request->getParams();
76
+ $authorizationHeader = $request->getHeader('X-Authorization');
77
+ $newCreationState = $request->getParam('new_state');
78
+
79
+ if ($newCreationState === NULL) {
80
+ $response->setBody(json_encode("Missing parameter."));
81
+ $response->setHttpResponseCode(422);
82
+ return;
83
+ } else {
84
+ // Prepare database item. If table empty, then create new item.
85
+ $mainItemCollection = Mage::getModel('businessfactory_roihuntereasy/main')->getCollection();
86
+ if ($mainItemCollection->count() <= 0) {
87
+ $dataEntity = Mage::getModel('businessfactory_roihuntereasy/main');
88
+ $dataEntity->setDescription("New");
89
+ } else {
90
+ $dataEntity = Mage::getModel('businessfactory_roihuntereasy/main')->load($mainItemCollection->getLastItem()->getId());
91
+ $dataEntity->setDescription("Updated");
92
+
93
+ // If data already exist check for client token.
94
+ if ($dataEntity->getClientToken() !== NULL && $dataEntity->getClientToken() !== $authorizationHeader) {
95
+ $response->setBody(json_encode("Not authorized"));
96
+ $response->setHttpResponseCode(403);
97
+ return;
98
+ }
99
+ }
100
+
101
+ // Save data and send response success
102
+ $dataEntity->setCreationState($newCreationState);
103
+ $dataEntity->save();
104
+
105
+ $response->setBody(json_encode(array(
106
+ "data" => $requestData
107
+ )));
108
+ }
109
+ } catch (Exception $exception) {
110
+ Mage::log(__METHOD__ . " exception.", null, 'errors.log');
111
+ Mage::log($exception, null, 'errors.log');
112
+ Mage::log($request, null, 'errors.log');
113
+ $response->setHttpResponseCode(500);
114
+ }
115
+ }
116
+
117
+ /**
118
+ * http://store.com/roihuntereasy/storedetails/add
119
+ */
120
+ public function addAction()
121
+ {
122
+ $request = $this->getRequest();
123
+ $response = $this->getResponse();
124
+
125
+ $response->setHeader('Content-type', 'application/json');
126
+ $response->setHeader('Access-Control-Allow-Origin', '*', true);
127
+ $response->setHeader('Access-Control-Allow-Methods', 'OPTIONS,GET,POST', true);
128
+ $response->setHeader('Access-Control-Max-Age', '60', true);
129
+ $response->setHeader('Access-Control-Allow-Headers', 'X-Authorization', true);
130
+
131
+ if ($request->getMethod() === 'GET') {
132
+ $this->processAddGET();
133
+ } else if ($request->getMethod() === 'POST') {
134
+ $this->processAddPOST();
135
+ }
136
+ }
137
+
138
+ /**
139
+ * GET
140
+ * http://store.com/roihuntereasy/storedetails/add
141
+ *
142
+ * Return dynamicAds table data.
143
+ */
144
+ function processAddGET()
145
+ {
146
+ $request = $this->getRequest();
147
+ $response = $this->getResponse();
148
+
149
+ try {
150
+ $mainItemCollection = Mage::getModel('businessfactory_roihuntereasy/main')->getCollection();
151
+ $authorizationHeader = $this->getRequest()->getHeader('X-Authorization');
152
+
153
+ // If table empty, then create new item.
154
+ if ($mainItemCollection->count() <= 0) {
155
+ $response->setBody(json_encode("Entry not exist."));
156
+ $response->setHttpResponseCode(404);
157
+ } else {
158
+ $dataEntity = $mainItemCollection->getLastItem();
159
+ if ($dataEntity->getClientToken() !== NULL && $dataEntity->getClientToken() !== $authorizationHeader) {
160
+ $response->setBody(json_encode("Not authorized"));
161
+ $response->setHttpResponseCode(403);
162
+ return;
163
+ }
164
+
165
+ $response->setBody(json_encode($dataEntity->getData()));
166
+ }
167
+ } catch (Exception $exception) {
168
+ Mage::log(__METHOD__ . " exception.", null, 'errors.log');
169
+ Mage::log($exception, null, 'errors.log');
170
+ Mage::log($request, null, 'errors.log');
171
+ $response->setHttpResponseCode(500);
172
+ }
173
+ }
174
+
175
+ /**
176
+ * POST
177
+ * http://store.com/roihuntereasy/storedetails/add
178
+ *
179
+ * Method should handle call after customer successful connection on goostav.
180
+ */
181
+ function processAddPOST()
182
+ {
183
+ $request = $this->getRequest();
184
+ $response = $this->getResponse();
185
+
186
+ try {
187
+ // Get request params
188
+ $requestData = $request->getParams();
189
+ Mage::log("Process add request with data: ", null, 'api.log');
190
+ Mage::log($requestData, null, 'api.log');
191
+
192
+ $authorizationHeader = $request->getHeader('X-Authorization');
193
+
194
+ // Prepare database item. If table empty, then create new item.
195
+ $mainItemCollection = Mage::getModel('businessfactory_roihuntereasy/main')->getCollection();
196
+ if ($mainItemCollection->count() <= 0) {
197
+ $dataEntity = Mage::getModel('businessfactory_roihuntereasy/main');
198
+ $dataEntity->setDescription("New");
199
+ } else {
200
+ $dataEntity = Mage::getModel('businessfactory_roihuntereasy/main')->load($mainItemCollection->getLastItem()->getId());
201
+ $dataEntity->setDescription("Updated");
202
+
203
+ // If data already exist check for client token.
204
+ if ($dataEntity->getClientToken() != NULL && $dataEntity->getClientToken() !== $authorizationHeader) {
205
+ $response->setBody(json_encode("Not authorized"));
206
+ $response->setHttpResponseCode(403);
207
+ return;
208
+ }
209
+ }
210
+
211
+ // Save clientToken only if not exist
212
+ if ($dataEntity->getClientToken() == NULL) {
213
+ $client_token = $request->getParam('client_token');
214
+ if ($client_token == NULL) {
215
+ $response->setBody(json_encode("Missing client token"));
216
+ $response->setHttpResponseCode(422);
217
+ return;
218
+ } else {
219
+ $dataEntity->setClientToken($client_token);
220
+ }
221
+ }
222
+
223
+ // Save AccessToken only if not exist
224
+ if ($dataEntity->getAccessToken() == NULL) {
225
+ $goostav_access_token = $request->getParam('access_token');
226
+ if ($goostav_access_token == NULL) {
227
+ $response->setBody(json_encode("Missing tokens"));
228
+ $response->setHttpResponseCode(422);
229
+ return;
230
+ } else {
231
+ $dataEntity->setAccessToken($goostav_access_token);
232
+ }
233
+ }
234
+
235
+
236
+ // Save status and errors if something failed
237
+ $status = $request->getParam('status');
238
+ if ($status != NULL) $dataEntity->setStatus($status);
239
+ $errors = $request->getParam('errors');
240
+ if ($errors != NULL) $dataEntity->setErrors($errors);
241
+
242
+
243
+ // Save customer id
244
+ $customerId = $request->getParam('id');
245
+ if ($customerId != NULL) $dataEntity->setCustomerId($customerId);
246
+ // Save conversion id
247
+ $conversionId = $request->getParam('conversion_id');
248
+ if ($conversionId != NULL) $dataEntity->setConversionId($conversionId);
249
+
250
+ // Set managed merchants
251
+ $managedMerchants = $request->getParam('managed_merchants');
252
+ if ($managedMerchants !== NULL) $dataEntity->setManagedMerchants($managedMerchants === 'true');
253
+ // Set adult content
254
+ $adultOriented = $request->getParam('adult_oriented');
255
+ if ($adultOriented !== NULL) $dataEntity->setAdultOriented($adultOriented === 'true');
256
+
257
+
258
+ // Persist data
259
+ $dataEntity->save();
260
+
261
+ // Create verification file
262
+ $filename = $request->getParam('site_verification_token');
263
+ $this->createVerificationFile($filename);
264
+
265
+ // Return response
266
+ $response->setBody(json_encode(array(
267
+ "data" => $requestData
268
+ )));
269
+ } catch (Exception $exception) {
270
+ Mage::log(__METHOD__ . " exception.", null, 'errors.log');
271
+ Mage::log($exception, null, 'errors.log');
272
+ Mage::log($request, null, 'errors.log');
273
+ $response->setHttpResponseCode(500);
274
+ }
275
+ }
276
+
277
+ /**
278
+ * Create verification file.
279
+ */
280
+ function createVerificationFile($filename)
281
+ {
282
+ try {
283
+ if ($filename != NULL) {
284
+ $content = "google-site-verification: " . $filename;
285
+
286
+ // Apache
287
+ $io = new Varien_Io_File();
288
+ $io->setAllowCreateFolders(true);
289
+ $io->open(array('path' => Mage::getBaseDir()));
290
+
291
+ if ($io->fileExists($filename)) {
292
+ $io->rm($filename);
293
+ }
294
+ $io->streamOpen($filename);
295
+ $io->streamWrite($content);
296
+ $io->streamClose();
297
+
298
+ // Nginx - check if it is necessary to create file in public folder
299
+
300
+ } else {
301
+ Mage::log('ERROR: Cannot create verification file. Missing filename', null, 'errors.log');
302
+ }
303
+ } catch (Exception $exception) {
304
+ Mage::log(__METHOD__ . " exception.", null, 'errors.log');
305
+ Mage::log($exception, null, 'errors.log');
306
+ }
307
+ }
308
+ }
309
+
app/code/community/Businessfactory/Roihuntereasy/etc/adminhtml.xml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <menu>
4
+ <businessfactory translate="title" module="businessfactory_roihuntereasy">
5
+ <title>ROI Hunter Easy</title>
6
+ <sort_order>1</sort_order>
7
+ <action>adminhtml/roihuntereasy/index</action>
8
+ </businessfactory>
9
+ </menu>
10
+ <acl>
11
+ <resources>
12
+ <admin>
13
+ <children>
14
+ <system>
15
+ <children>
16
+ <config>
17
+ <children>
18
+ <roihuntereasy_options>
19
+ <title>ROI Hunter Easy Section</title>
20
+ </roihuntereasy_options>
21
+ </children>
22
+ </config>
23
+ </children>
24
+ </system>
25
+ <businessfactory translate="title" module="businessfactory_roihuntereasy">
26
+ <title>Top Level ROI Hunter Easy Menu Item</title>
27
+ <sort_order>1</sort_order>
28
+ </businessfactory>
29
+ </children>
30
+ </admin>
31
+ </resources>
32
+ </acl>
33
+ </config>
app/code/community/Businessfactory/Roihuntereasy/etc/config.xml ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Businessfactory_Roihuntereasy>
5
+ <version>1.0.0</version>
6
+ </Businessfactory_Roihuntereasy>
7
+ </modules>
8
+ <admin>
9
+ <routers>
10
+ <adminhtml>
11
+ <args>
12
+ <modules>
13
+ <Businessfactory_Roihuntereasy after="Mage_Adminhtml">Businessfactory_Roihuntereasy</Businessfactory_Roihuntereasy>
14
+ </modules>
15
+ </args>
16
+ </adminhtml>
17
+ </routers>
18
+ </admin>
19
+ <adminhtml>
20
+ <layout>
21
+ <updates>
22
+ <businessfactory_roihuntereasy>
23
+ <file>businessfactory_roihuntereasy.xml</file>
24
+ </businessfactory_roihuntereasy>
25
+ </updates>
26
+ </layout>
27
+ </adminhtml>
28
+ <frontend>
29
+ <routers>
30
+ <businessfactory_roihuntereasy>
31
+ <use>standard</use>
32
+ <args>
33
+ <module>Businessfactory_Roihuntereasy</module>
34
+ <frontName>roihuntereasy</frontName>
35
+ </args>
36
+ </businessfactory_roihuntereasy>
37
+ </routers>
38
+ <layout>
39
+ <updates>
40
+ <businessfactory_roihuntereasy>
41
+ <file>businessfactory_roihuntereasy.xml</file>
42
+ </businessfactory_roihuntereasy>
43
+ </updates>
44
+ </layout>
45
+ <events>
46
+ <checkout_cart_product_add_after>
47
+ <observers>
48
+ <businessfactory_roihuntereasy>
49
+ <class>businessfactory_roihuntereasy/addedToCartObserver</class>
50
+ <method>setRemarketingTag</method>
51
+ </businessfactory_roihuntereasy>
52
+ </observers>
53
+ </checkout_cart_product_add_after>
54
+ <checkout_onepage_controller_success_action>
55
+ <observers>
56
+ <businessfactory_roihuntereasy>
57
+ <class>businessfactory_roihuntereasy/checkoutObserver</class>
58
+ <method>setRemarketingTag</method>
59
+ </businessfactory_roihuntereasy>
60
+ </observers>
61
+ </checkout_onepage_controller_success_action>
62
+ <checkout_multishipping_controller_success_action>
63
+ <observers>
64
+ <observers>
65
+ <businessfactory_roihuntereasy>
66
+ <class>businessfactory_roihuntereasy/checkoutObserver</class>
67
+ <method>setRemarketingTag</method>
68
+ </businessfactory_roihuntereasy>
69
+ </observers> </observers>
70
+ </checkout_multishipping_controller_success_action>
71
+ </events>
72
+ </frontend>
73
+ <global>
74
+ <models>
75
+ <businessfactory_roihuntereasy>
76
+ <class>Businessfactory_Roihuntereasy_Model</class>
77
+ <resourceModel>businessfactory_roihuntereasy_resource</resourceModel>
78
+ </businessfactory_roihuntereasy>
79
+ <businessfactory_roihuntereasy_resource>
80
+ <class>Businessfactory_Roihuntereasy_Model_Resource</class>
81
+ <entities>
82
+ <main>
83
+ <table>businessfactory_roihuntereasy_main</table>
84
+ </main>
85
+ </entities>
86
+ </businessfactory_roihuntereasy_resource>
87
+ </models>
88
+ <resources>
89
+ <businessfactory_roihuntereasy_setup>
90
+ <setup>
91
+ <module>Businessfactory_Roihuntereasy</module>
92
+ </setup>
93
+ <connection>
94
+ <use>core_setup</use>
95
+ </connection>
96
+ </businessfactory_roihuntereasy_setup>
97
+ <businessfactory_roihuntereasy_read>
98
+ <connection>
99
+ <use>core_read</use>
100
+ </connection>
101
+ </businessfactory_roihuntereasy_read>
102
+ <businessfactory_roihuntereasy_write>
103
+ <connection>
104
+ <use>core_write</use>
105
+ </connection>
106
+ </businessfactory_roihuntereasy_write>
107
+ </resources>
108
+ <blocks>
109
+ <businessfactory_roihuntereasy>
110
+ <class>Businessfactory_Roihuntereasy_Block</class>
111
+ </businessfactory_roihuntereasy>
112
+ </blocks>
113
+ <helpers>
114
+ <businessfactory_roihuntereasy>
115
+ <class>Businessfactory_Roihuntereasy_Helper</class>
116
+ </businessfactory_roihuntereasy>
117
+ </helpers>
118
+ </global>
119
+ <crontab>
120
+ <jobs>
121
+ <businessfactory_roihuntereasy>
122
+ <schedule><cron_expr>*/15 * * * *</cron_expr></schedule>
123
+ <run><model>businessfactory_roihuntereasy/cron::createFeed</model></run>
124
+ </businessfactory_roihuntereasy>
125
+ </jobs>
126
+ </crontab>
127
+ </config>
app/code/community/Businessfactory/Roihuntereasy/etc/system.xml ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <roihuntereasy translate="label" module="businessfactory_roihuntereasy">
5
+ <label>ROI Hunter</label>
6
+ <sort_order>100</sort_order>
7
+ </roihuntereasy>
8
+ </tabs>
9
+ <sections>
10
+ <roihuntereasy_options translate="label" module="businessfactory_roihuntereasy">
11
+ <label>ROI Hunter Easy</label>
12
+ <tab>roihuntereasy</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>100</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <tools translate="label">
20
+ <expanded>1</expanded>
21
+ <label>General</label>
22
+ <sort_order>3</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <reset translate="label">
28
+ <frontend_type>button</frontend_type>
29
+ <frontend_model>businessfactory_roihuntereasy/adminhtml_system_config_resetbutton
30
+ </frontend_model>
31
+ <comment>(All current plugin data will be lost)</comment>
32
+ <sort_order>20</sort_order>
33
+ <show_in_default>1</show_in_default>
34
+ <show_in_website>1</show_in_website>
35
+ <show_in_store>1</show_in_store>
36
+ </reset>
37
+ <cron translate="label comment">
38
+ <frontend_type>button</frontend_type>
39
+ <frontend_model>businessfactory_roihuntereasy/adminhtml_system_config_cronbutton
40
+ </frontend_model>
41
+ <comment></comment>
42
+ <sort_order>30</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>1</show_in_store>
46
+ </cron>
47
+
48
+
49
+
50
+ </fields>
51
+ </tools>
52
+ </groups>
53
+ </roihuntereasy_options>
54
+ </sections>
55
+ </config>
app/code/community/Businessfactory/Roihuntereasy/sql/businessfactory_roihuntereasy_setup/install-1.0.0.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer=$this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+ -- DROP TABLE IF EXISTS {$this->getTable('businessfactory_roihuntereasy/main')};
9
+ CREATE TABLE {$this->getTable('businessfactory_roihuntereasy/main')} (
10
+ `id` int(11) unsigned NOT NULL auto_increment COMMENT 'ID',
11
+ `description` varchar(255) NULL COMMENT 'Description',
12
+ `google_analytics_ua` varchar(255) NULL COMMENT 'Google Analytics UA',
13
+ `customer_id` varchar(255) NULL COMMENT 'Customer Id',
14
+ `access_token` varchar(255) NULL COMMENT 'Access Token',
15
+ `client_token` varchar(255) NULL COMMENT 'Client Token',
16
+ `conversion_id` int(11) NOT NULL COMMENT 'Conversion id',
17
+ `managed_merchants` tinyint(1) NULL COMMENT 'Managed merchants by us',
18
+ `adult_oriented` tinyint(1) NULL COMMENT 'Adult oriented',
19
+ `status` varchar(255) NULL COMMENT 'Goostav status',
20
+ `errors` text NULL COMMENT 'Errors',
21
+ `creation_state` varchar(255) NULL COMMENT 'Creation State',
22
+ `creation_time` timestamp NULL COMMENT 'Creation Time',
23
+ `update_time` timestamp NULL COMMENT 'Modification Time',
24
+ `is_active` smallint(6) NULL COMMENT 'Is Active',
25
+ PRIMARY KEY (`id`)
26
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
27
+
28
+ ");
29
+
30
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/businessfactory_roihuntereasy.xml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <layout>
2
+ <!--Any page-->
3
+ <adminhtml_roihuntereasy_index>
4
+ <reference name="content">
5
+ <block type="businessfactory_roihuntereasy/adminhtml_admin"
6
+ name="admin_block"
7
+ template="businessfactory_roihuntereasy/admin.phtml">
8
+ </block>
9
+ </reference>
10
+ </adminhtml_roihuntereasy_index>
11
+ </layout>
app/design/adminhtml/default/default/template/businessfactory_roihuntereasy/admin.phtml ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--"http://localhost:3000" "http://magento.roihunter.com/" -->
2
+ <!-- TODO testing url-->
3
+ <iframe src="//magento.roihunter.com/"
4
+ scrolling="yes"
5
+ frameBorder="0"
6
+ allowfullscreen
7
+ align="center"
8
+ style="width: 100%"
9
+ id="RoihuntereasyIFrame">
10
+ <p>Your browser does not support iFrames.</p>
11
+ </iframe>
12
+
13
+ <!--
14
+ <p>MainItem data: ?php echo($this->getMainItemEntry() ? $this->getMainItemEntry()->toString() : "Empty"); ?></p>
15
+ <p>AccessToken data: ?php echo($this->getMainItemEntry() ? $this->getMainItemEntry()->getAccessToken() : "No token"); ?></p>
16
+ <p>Creation status: ?php echo($this->getMainItemEntry() ? $this->getMainItemEntry()->getCreationState() : "No status"); ?></p>
17
+ <p>Store currency: ?php echo $this->getStoreCurrency()?></p>
18
+ <p>Store language: ?php echo $this->getStoreLanguage()?></p>
19
+ <p>Store url: ?php echo $this->getStoreBaseUrl()?></p>
20
+ -->
21
+
22
+ <div id="loadingMessage">Loading...</div>
23
+
24
+ <script>
25
+ var storeUrl = "<?php echo $this->getStoreBaseUrl(); ?>";
26
+ var storeName = "<?php echo $this->getStoreName(); ?>";
27
+ var storeCurrency = "<?php echo $this->getStoreCurrency(); ?>";
28
+ var storeLanguage = "<?php echo $this->getStoreLanguage(); ?>";
29
+ var storeCountry = "<?php echo $this->getStoreCountry(); ?>";
30
+
31
+ var customerId = "<?php echo($this->getMainItemEntry() ? $this->getMainItemEntry()->getCustomerId() : null); ?>";
32
+ var accessToken = "<?php echo($this->getMainItemEntry() ? $this->getMainItemEntry()->getAccessToken() : null); ?>";
33
+ var clientToken = "<?php echo($this->getMainItemEntry() ? $this->getMainItemEntry()->getClientToken() : null); ?>";
34
+ var managedMerchants = "<?php echo($this->getMainItemEntry() ? $this->getMainItemEntry()->getManagedMerchants() : null); ?>";
35
+ var adultOriented = "<?php echo($this->getMainItemEntry() ? $this->getMainItemEntry()->getAdultOriented() : null); ?>";
36
+ var status = "<?php echo($this->getMainItemEntry() ? $this->getMainItemEntry()->getStatus() : null); ?>";
37
+ var errors = "<?php echo($this->getMainItemEntry() ? $this->getMainItemEntry()->getErrors() : null); ?>";
38
+ var creationState = "<?php echo($this->getMainItemEntry() ? $this->getMainItemEntry()->getCreationState() : null); ?>";
39
+
40
+
41
+ var iFrame = document.getElementById('RoihuntereasyIFrame');
42
+ var loadingMessageEl = document.getElementById('loadingMessage');
43
+
44
+ iFrame.addEventListener('load', function () {
45
+ console.log('hiding Loader');
46
+ loadingMessageEl.style.display = 'none';
47
+
48
+ // pass base url to React iframe fro future API calls to this site
49
+ iFrame.contentWindow.postMessage({
50
+ "type": "roihunter_magento_plugin",
51
+ "storeUrl": storeUrl,
52
+ "storeName": storeName,
53
+ "storeCurrency": storeCurrency,
54
+ "storeLanguage": storeLanguage,
55
+ "storeCountry": storeCountry,
56
+
57
+ // Database part
58
+ "customerId": customerId,
59
+ "accessToken": accessToken,
60
+ "clientToken": clientToken,
61
+ "managedMerchants": managedMerchants,
62
+ "adultOriented": adultOriented,
63
+ "status": status,
64
+ "errors": errors,
65
+ "creationState": creationState
66
+ }, '*'
67
+ );
68
+ });
69
+ </script>
70
+
71
+ <script>
72
+ // Create IE + others compatible event handler
73
+ var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
74
+ var eventer = window[eventMethod];
75
+ var messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message";
76
+
77
+ // Listen to message from child window
78
+ eventer(messageEvent, function (e) {
79
+ if (e.data.type === "roihunter_magento_plugin_height") {
80
+ // Change size of iFrame to correspond new height of content
81
+ // console.log("new height: " + e.data.height);
82
+ document.getElementById('RoihuntereasyIFrame').style.height = e.data.height + 'px';
83
+ } else {
84
+ // console.log("Unknown message event", e);
85
+ }
86
+ }, false);
87
+
88
+ </script>
app/design/adminhtml/default/default/template/businessfactory_roihuntereasy/system/config/cronbutton.phtml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ //<![CDATA[
3
+ function resetCron() {
4
+ new Ajax.Request('<?php echo $this->getCronAjaxUrl() ?>', {
5
+ method:     'get',
6
+ onCreate: function () {
7
+
8
+ },
9
+ onSuccess: function (response) {
10
+ console.log(response.responseText);
11
+ if (response.responseJSON) {
12
+ alert(response.responseJSON);
13
+ } else {
14
+ alert(response.responseText);
15
+ }
16
+ },
17
+ onFailure: function () {
18
+ resultBox.text('Request failed.');
19
+ }
20
+ });
21
+ }
22
+ //]]>
23
+ </script>
24
+  
25
+ <?php echo $this->getCronButtonHtml() ?>
app/design/adminhtml/default/default/template/businessfactory_roihuntereasy/system/config/resetbutton.phtml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ //<![CDATA[
3
+ function resetData() {
4
+ var r = confirm("Are you sure you want to reset data?");
5
+ if (r == true) {
6
+ new Ajax.Request('<?php echo $this->getResetAjaxUrl() ?>', {
7
+ method:     'get',
8
+ onCreate: function () {
9
+
10
+ },
11
+ onSuccess: function (response) {
12
+ console.log(response.responseText);
13
+ if (response.responseJSON) {
14
+ alert(response.responseJSON);
15
+ } else {
16
+ alert(response.responseText);
17
+ }
18
+ },
19
+ onFailure: function () {
20
+ resultBox.text('Request failed.');
21
+ }
22
+ });
23
+ }
24
+ }
25
+ //]]>
26
+ </script>
27
+  
28
+ <?php echo $this->getResetButtonHtml() ?>
app/design/frontend/rwd/default/layout/businessfactory_roihuntereasy.xml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <layout>
2
+ <!--Product View Analytics-->
3
+ <catalog_product_view>
4
+ <reference name="before_body_end">
5
+ <block type="businessfactory_roihuntereasy/productViewAnalytics"
6
+ name="product_view_analytics_block"
7
+ template="businessfactory_roihuntereasy/product_view_analytics.phtml">
8
+ </block>
9
+ </reference>
10
+ </catalog_product_view>
11
+ <!--Category View Analytics-->
12
+ <catalog_category_view>
13
+ <reference name="before_body_end">
14
+ <block type="businessfactory_roihuntereasy/categoryViewAnalytics"
15
+ name="category_view_analytics_block"
16
+ template="businessfactory_roihuntereasy/category_view_analytics.phtml">
17
+ </block>
18
+ </reference>
19
+ </catalog_category_view>
20
+ <!--Any page-->
21
+ <default>
22
+ <reference name="before_body_end">
23
+ <block type="businessfactory_roihuntereasy/addedToCartAnalytics"
24
+ name="added_to_cart_analytics_block"
25
+ template="businessfactory_roihuntereasy/added_to_cart_view_analytics.phtml">
26
+ </block>
27
+ <block type="businessfactory_roihuntereasy/checkoutAnalytics"
28
+ name="checkout_analytics_block"
29
+ template="businessfactory_roihuntereasy/checkout_analytics.phtml">
30
+ </block>
31
+ </reference>
32
+ </default>
33
+ <!--<roihuntereasy_index_index>-->
34
+ <!--<reference name="content">-->
35
+ <!--<block type="businessfactory_roihuntereasy/database"-->
36
+ <!--name="database_block"-->
37
+ <!--template="businessfactory_roihuntereasy/index.phtml">-->
38
+ <!--</block>-->
39
+ <!--</reference>-->
40
+ <!--</roihuntereasy_index_index>-->
41
+ </layout>
app/design/frontend/rwd/default/template/businessfactory_roihuntereasy/added_to_cart_view_analytics.phtml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <?php
3
+ $_prodSku = $this->getProdId();
4
+ $_prodPrice = $this->getProdPrice();
5
+ $_conversionId = $this->getConversionId();
6
+ ?>
7
+
8
+ <!-- Google Code for Remarketing Tag -->
9
+ <!--------------------------------------------------
10
+ Remarketing tags may not be associated with personally identifiable information or placed on pages related to sensitive categories. See more information and instructions on how to setup the tag on: http://google.com/ads/remarketingsetup
11
+ --------------------------------------------------->
12
+ <script type="text/javascript">
13
+ /* <![CDATA[ */
14
+ var google_conversion_id = <?php echo $_conversionId ?>;
15
+ var google_custom_params = {
16
+ ecomm_prodid: '<?php echo $_prodSku ?>',
17
+ ecomm_pagetype: 'cart',
18
+ ecomm_totalvalue: <?php echo $_prodPrice ?>,
19
+ };
20
+ var google_remarketing_only = true;
21
+ /* ]]> */
22
+ </script>
23
+ <script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
24
+ </script>
25
+ <noscript>
26
+ <div style="display:inline;">
27
+ <img height="1" width="1" style="border-style:none;" alt="" src="//googleads.g.doubleclick.net/pagead/viewthroughconversion/<?php echo $_conversionId ?>/?value=0&amp;guid=ON&amp;script=0"/>
28
+ </div>
29
+ </noscript>
app/design/frontend/rwd/default/template/businessfactory_roihuntereasy/category_view_analytics.phtml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $_products = $this->getProductIds();
3
+ $_conversionId = $this->getConversionId();
4
+ ?>
5
+
6
+ <!-- Google Code for Remarketing Tag -->
7
+ <!--------------------------------------------------
8
+ Remarketing tags may not be associated with personally identifiable information or placed on pages related to sensitive categories. See more information and instructions on how to setup the tag on: http://google.com/ads/remarketingsetup
9
+ --------------------------------------------------->
10
+ <script type="text/javascript">
11
+ /* <![CDATA[ */
12
+ var google_conversion_id = <?php echo $_conversionId ?>;
13
+ var google_custom_params = {
14
+ ecomm_prodid: <?php echo $_products ?>,
15
+ ecomm_pagetype: 'category'
16
+ };
17
+ var google_remarketing_only = true;
18
+ /* ]]> */
19
+ </script>
20
+ <script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
21
+ </script>
22
+ <noscript>
23
+ <div style="display:inline;">
24
+ <img height="1" width="1" style="border-style:none;" alt="" src="//googleads.g.doubleclick.net/pagead/viewthroughconversion/<?php echo $_conversionId ?>/?value=0&amp;guid=ON&amp;script=0"/>
25
+ </div>
26
+ </noscript>
app/design/frontend/rwd/default/template/businessfactory_roihuntereasy/checkout_analytics.phtml ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $_prodSku = $this->getProdId();
4
+ $_prodPrice = $this->getProdPrice();
5
+ $_conversionId = $this->getConversionId();
6
+
7
+ ?>
8
+
9
+ <!-- Google Code for Remarketing Tag -->
10
+ <!--------------------------------------------------
11
+ Remarketing tags may not be associated with personally identifiable information or placed on pages related to sensitive categories. See more information and instructions on how to setup the tag on: http://google.com/ads/remarketingsetup
12
+ --------------------------------------------------->
13
+ <script type="text/javascript">
14
+ /* <![CDATA[ */
15
+ var google_conversion_id = <?php echo $_conversionId ?>;
16
+ var google_custom_params = {
17
+ ecomm_prodid: <?php echo $_prodSku ?>,
18
+ ecomm_pagetype: 'purchase',
19
+ ecomm_totalvalue: <?php echo $_prodPrice ?>,
20
+ };
21
+ var google_remarketing_only = true;
22
+ /* ]]> */
23
+ </script>
24
+ <script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
25
+ </script>
26
+ <noscript>
27
+ <div style="display:inline;">
28
+ <img height="1" width="1" style="border-style:none;" alt="" src="//googleads.g.doubleclick.net/pagead/viewthroughconversion/<?php echo $_conversionId ?>/?value=0&amp;guid=ON&amp;script=0"/>
29
+ </div>
30
+ </noscript>
31
+
32
+ <!-- Google Code for Purchase Conversion Page -->
33
+ <script type="text/javascript">
34
+ /* <![CDATA[ */
35
+ var google_conversion_id = <?php echo $_conversionId ?>;
36
+ var google_conversion_language = "en_US";
37
+ var google_conversion_format = "1";
38
+ var google_conversion_color = "666666";
39
+ var google_remarketing_only = true;
40
+ var google_conversion_value = <?php echo $_prodPrice ?>;
41
+ /* ]]> */
42
+ </script>
43
+ <script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
44
+ </script>
45
+ <noscript>
46
+ <img height=1 width=1 border=0 src="//www.googleadservices.com/pagead/
47
+ conversion/<?php echo $_conversionId ?>/?value=<?php echo $_prodPrice ?>&amp;guid=ON&amp;script=0">
48
+ </noscript>
app/design/frontend/rwd/default/template/businessfactory_roihuntereasy/index.phtml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ echo "<h1>INDEX</h1>";
4
+
5
+ echo get_class($this);
6
+ $collection=$this->getCollection();
7
+ foreach($collection as $each){
8
+ echo "<pre>";
9
+ print_r($each->getData());
10
+ echo "</pre>";
11
+ }
12
+ ?>
app/design/frontend/rwd/default/template/businessfactory_roihuntereasy/product_view_analytics.phtml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $_conversionId = $this->getConversionId();
4
+
5
+ $_product = $this->getProduct();
6
+ $_prodName = null;
7
+ $_prodSku = null;
8
+ $_prodId = null;
9
+ $_prodPrice = null;
10
+
11
+ if ($_product) {
12
+ $_prodName = $_product->getName();
13
+ $_prodSku = $_product->getSku();
14
+ $_prodId = $_product->getId();
15
+ $_prodPrice = $_product->getFinalPrice();
16
+ // Regular price without discount
17
+ // $_prodPrice = $_product->getPriceInfo()->getPrice('regular_price')->getAmount()->getValue();
18
+ }
19
+ ?>
20
+
21
+ <!-- Google Code for Remarketing Tag -->
22
+ <!--------------------------------------------------
23
+ Remarketing tags may not be associated with personally identifiable information or placed on pages related to sensitive categories. See more information and instructions on how to setup the tag on: http://google.com/ads/remarketingsetup
24
+ --------------------------------------------------->
25
+ <script type="text/javascript">
26
+ /* <![CDATA[ */
27
+ var google_conversion_id = <?php echo $_conversionId ?>;
28
+ var google_custom_params = {
29
+ ecomm_prodid: '<?php echo $_prodSku ?>',
30
+ ecomm_pagetype: 'product',
31
+ ecomm_totalvalue: <?php echo $_prodPrice ?>,
32
+ };;
33
+ var google_remarketing_only = true;
34
+ /* ]]> */
35
+ </script>
36
+ <script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
37
+ </script>
38
+ <noscript>
39
+ <div style="display:inline;">
40
+ <img height="1" width="1" style="border-style:none;" alt="" src="//googleads.g.doubleclick.net/pagead/viewthroughconversion/<?php echo $_conversionId ?>/?value=0&amp;guid=ON&amp;script=0"/>
41
+ </div>
42
+ </noscript>
app/etc/modules/Businessfactory_Roihuntereasy.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Businessfactory_Roihuntereasy>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Businessfactory_Roihuntereasy>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>roihunter_easy</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>AFL 3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>ROI Hunter Easy boost your eshop by Google Display remarketing campaigns. Set dynamic campaigns for free in 60 seconds. You only need Adwords Account.</summary>
10
+ <description>ROI Hunter EASY helps power your eshop with Google Remarketing. We know it's a pain to get dynamic remarketing up and running on Google &amp;#x2013; developers need to produce an xml feed in a certain format, you need to register it in Google Merchant, correct wrong product formats, link Merchant Center to Adwords, ask developers to put all codes to right places, set up audiences in Adwords, connect everything together, go through dozens of settings, etc. Time to stop! We are putting an end to this hassle. ROI Hunter Easy will take care of all the annoying tech settings so you can have professional remarketing campaigns in 3 simple steps:&amp;#xD;&#xD;
11
+ &amp;#xD;&#xD;
12
+ Install the plugin for Free&amp;#xD;&#xD;
13
+ Connect Google Adwords&amp;#xD;&#xD;
14
+ Create your first Campaign&amp;#xD;&#xD;
15
+ You do not need any technical requirements. ROI Hunter EASY does all settings for you&amp;#xD;&#xD;
16
+ &amp;#xD;&#xD;
17
+ A separate Google Adwords account is required. ROI Hunter EASY is free. You only pay for your running ads directly to Google. You can set up your budget directly in ROI Hunter easy You can create your Google Adwords account here: http://www.google.cz/adwords/&amp;#xD;&#xD;
18
+ &amp;#xD;&#xD;
19
+ ROI Hunter will automatically do these things for you: &amp;#xD;&#xD;
20
+ &amp;#xD;&#xD;
21
+ create product catalogue for your website&amp;#xD;&#xD;
22
+ register your website to Google Merchant center&amp;#xD;&#xD;
23
+ upload your product catalogue to Google&amp;#xD;&#xD;
24
+ verify your website&amp;#xD;&#xD;
25
+ connect your Adwords account with Google Merchant center&amp;#xD;&#xD;
26
+ deploy all dynamic remarketing scripts to your website&amp;#xD;&#xD;
27
+ set up automatically the most effective remarketing audiences&amp;#xD;&#xD;
28
+ set up the most effective bidding strategy&amp;#xD;&#xD;
29
+ choose the most effective dynamic banner/text templates.&amp;#xD;&#xD;
30
+ Plugin reflects our best practices from 8 years of advertising experience in Google Adwords. &amp;#xD;&#xD;
31
+ &amp;#xD;&#xD;
32
+ ROI Hunter Easy marketing extension is available in EN. Support is also available in EN.&amp;#xD;&#xD;
33
+ &amp;#xD;&#xD;
34
+ It is very easy to set up your first campaign. No developers needed.&amp;#xD;&#xD;
35
+ &amp;#xD;&#xD;
36
+ Pricing of extension: &amp;#xD;&#xD;
37
+ &amp;#xD;&#xD;
38
+ Extension cost: 0.00 &amp;#x20AC;&amp;#xD;&#xD;
39
+ Extension update: 0.00 &amp;#x20AC;&amp;#xD;&#xD;
40
+ No support fee&amp;#xD;&#xD;
41
+ No contract duration&amp;#xD;&#xD;
42
+ * Extension do not cover your Google Adwords Ad Spend. </description>
43
+ <notes>Created 28th December, 2016 Compatibility: 1.9.2.4 - Main functions: feed generation, tagging your site for remarketing, creating google ads and much more.</notes>
44
+ <authors><author><name>ROI Hunter</name><user>MAG003490427</user><email>petr.skornok@b.cz</email></author></authors>
45
+ <date>2017-01-10</date>
46
+ <time>09:12:41</time>
47
+ <contents><target name="magecommunity"><dir name="Businessfactory"><dir name="Roihuntereasy"><dir name="Block"><file name="AddedToCartAnalytics.php" hash="eeb701f487b06ed82e0754aefb192fab"/><dir name="Adminhtml"><file name="Admin.php" hash="6cc0936cb52dde8cf2419f23974410a8"/><dir name="System"><dir name="Config"><file name="Cronbutton.php" hash="a07a6cfbd52a9a96fb4ec78cc8270924"/><file name="Resetbutton.php" hash="7721bb62feafe5d9d2951e70bfb0c30e"/></dir></dir></dir><file name="CategoryViewAnalytics.php" hash="739f1993bbc42c5df4b1a96956e97770"/><file name="CheckoutAnalytics.php" hash="831094424cf896e6644d66b0c70c3688"/><file name="Database.php" hash="4333ce4f66b762097cb50b4f04a7a4d2"/><file name="ProductViewAnalytics.php" hash="033e6702927d92ae5f2d388f00b46bd5"/></dir><dir name="Helper"><file name="Data.php" hash="05ee8de6f74805d4a2b4643b0b0fe33a"/></dir><dir name="Model"><file name="AddedToCartObserver.php" hash="904468a570b1d4f24862a0fe0e46ea59"/><file name="CheckoutObserver.php" hash="9088d55f2384a9dd3e4cc8b77d8b63ca"/><file name="Cron.php" hash="dec77226a3ec0c081c50fc53b7131b16"/><file name="Main.php" hash="06766b59391b52aaa701d8bf01e80d1a"/><file name="Options.php" hash="f6ecd5ab10cfcc5e0948b236bb873932"/><dir name="Resource"><dir name="Main"><file name="Collection.php" hash="9b66b73b312ac16e270c1435a789fdb9"/></dir><file name="Main.php" hash="1432c450ff554fb5057d1d6c4fd26c3c"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="RoihuntereasyController.php" hash="ecb41ae805a34ef450e849da610fc2ed"/></dir><file name="CronController.php" hash="3bebd548376a9bf7cf26689ca903f441"/><file name="FeedController.php" hash="7284f777ef57cd027fd70074195c6979"/><file name="IndexController.php" hash="6201b3c08113a1fb220dc3601dcbe43d"/><file name="ResetController.php" hash="91e83d54fd5e85e0acd7e3d001fcee98"/><file name="RoihuntereasyController.php" hash="68612c9bef815ce8b1bc2048a31a9721"/><file name="StoredetailsController.php" hash="1a2d7bd8e89fc7a7647da3140965b479"/></dir><dir name="etc"><file name="adminhtml.xml" hash="bbab6af370448895030570a657469a15"/><file name="config.xml" hash="4b044240a4b1e4081250b429400681f9"/><file name="system.xml" hash="718ea25db00b6a500b8783f9c8e1ba5c"/></dir><dir name="sql"><dir name="businessfactory_roihuntereasy_setup"><file name="install-1.0.0.php" hash="f490ddfd229eb5680e68fb7ec55a5820"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="businessfactory_roihuntereasy.xml" hash="fa2e345d2461459e15c641731d1b114a"/></dir><dir name="template"><dir name="businessfactory_roihuntereasy"><file name="admin.phtml" hash="142ab9a7c4119f0b47c228fb831737bf"/><dir name="system"><dir name="config"><file name="cronbutton.phtml" hash="758b97b5da81c92aaeb175e4b0142288"/><file name="resetbutton.phtml" hash="7aedce71c5d21bfce1a08c77e603143d"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="rwd"><dir name="default"><dir name="layout"><file name="businessfactory_roihuntereasy.xml" hash="e1379f4d0a022d6740d0a6d96fd9fbed"/></dir><dir name="template"><dir name="businessfactory_roihuntereasy"><file name="added_to_cart_view_analytics.phtml" hash="8679d7940136d046ce46d2bc9aa2b522"/><file name="category_view_analytics.phtml" hash="420fe9c183c444e655250efa0b037da4"/><file name="checkout_analytics.phtml" hash="f06507f3867d78e0e6f1791fc210797d"/><file name="index.phtml" hash="a69cff3727b7bba2be7154b94b86ff08"/><file name="product_view_analytics.phtml" hash="0c6581a84fbf2bd89a220bb1e3669928"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Businessfactory_Roihuntereasy.xml" hash="d46e92b8a1b158bfdc47b9daa3274a3d"/></dir></target></contents>
48
+ <compatible/>
49
+ <dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
50
+ </package>