roihunter_easy - Version 1.1.2

Version Notes

Created 23th May, 2017 Compatibility: 1.9.2.4 - Product feed improvements - sale price & images

Download this release

Release Info

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


Code changes from version 1.1.0 to 1.1.2

app/code/community/Businessfactory/Roihuntereasy/Block/Adminhtml/Admin.php CHANGED
@@ -73,13 +73,13 @@ class Businessfactory_Roihuntereasy_Block_Adminhtml_Admin extends Mage_Adminhtml
73
  public function getStoreLanguage()
74
  {
75
  // http://stackoverflow.com/questions/6579287/magento-get-language-code-in-template-file
76
- $locale = explode("_", Mage::app()->getLocale()->getLocaleCode());
77
  return $locale[0];
78
  }
79
 
80
  public function getStoreCountry()
81
  {
82
- $locale = explode("_", Mage::app()->getLocale()->getLocaleCode());
83
  if (is_array($locale) && count($locale) > 1) {
84
  return $locale[1];
85
  } else {
73
  public function getStoreLanguage()
74
  {
75
  // http://stackoverflow.com/questions/6579287/magento-get-language-code-in-template-file
76
+ $locale = explode("_", Mage::getStoreConfig('general/locale/code', $this->getDefaultStoreId()));
77
  return $locale[0];
78
  }
79
 
80
  public function getStoreCountry()
81
  {
82
+ $locale = explode("_", Mage::getStoreConfig('general/locale/code', $this->getDefaultStoreId()));
83
  if (is_array($locale) && count($locale) > 1) {
84
  return $locale[1];
85
  } else {
app/code/community/Businessfactory/Roihuntereasy/Model/Cron.php CHANGED
@@ -148,7 +148,7 @@ class Businessfactory_Roihuntereasy_Model_Cron extends Mage_Core_Model_Abstract
148
  foreach ($products as $_product) {
149
  switch ($_product->getTypeId()) {
150
  case "downloadable":
151
- if ($_product->getPrice() <= 0) {
152
  break;
153
  }
154
  // Else same processing as simple product
@@ -183,10 +183,10 @@ class Businessfactory_Roihuntereasy_Model_Cron extends Mage_Core_Model_Abstract
183
  "ID" => $this->getId($_product, $_childproduct),
184
  "Item title" => $this->getTitle($_product),
185
  "Final URL" => $this->getProductUrl($_product),
186
- "Image URL" => $this->getImageUrl($_childproduct),
187
  "Item description" => $this->getDescription($_product),
188
- "Price" => $this->getPrice($_childproduct, true),
189
- "Sale price" => $this->getSalePrice($_childproduct, true),
190
  );
191
  array_push($productArray, $productDict);
192
  }
@@ -234,6 +234,7 @@ class Businessfactory_Roihuntereasy_Model_Cron extends Mage_Core_Model_Abstract
234
  $xmlWriter->writeElement("title", "ROI Hunter Easy - Magento data feed");
235
  $xmlWriter->writeElement("description", "Magento data feed used in Google Merchants");
236
  $xmlWriter->writeElement("link", Mage::app()->getStore()->getBaseUrl());
 
237
 
238
  $this->count = 0;
239
  foreach ($products as $_product) {
@@ -286,6 +287,8 @@ class Businessfactory_Roihuntereasy_Model_Cron extends Mage_Core_Model_Abstract
286
  $collection->addAttributeToSelect("short_description");
287
  $collection->addAttributeToSelect("description");
288
  $collection->addAttributeToSelect("price");
 
 
289
  $collection->addAttributeToSelect("special_price");
290
  $collection->addAttributeToSelect("size");
291
  $collection->addAttributeToSelect("color");
@@ -389,6 +392,15 @@ class Businessfactory_Roihuntereasy_Model_Cron extends Mage_Core_Model_Abstract
389
  }
390
 
391
  $xmlWriter->writeElement("g:condition", "new");
 
 
 
 
 
 
 
 
 
392
  }
393
 
394
  /**
@@ -397,16 +409,12 @@ class Businessfactory_Roihuntereasy_Model_Cron extends Mage_Core_Model_Abstract
397
  */
398
  function writeChildProductAttributesXML($_product, $xmlWriter)
399
  {
400
- $xmlWriter->writeElement("g:image_link", $this->getImageUrl($_product));
401
-
402
  // $this->_logger->debug("gtin: " . $_product->getEan());
403
  $xmlWriter->writeElement("g:mpn", $_product->getSku());
404
  if (strlen($_product->getEan()) > 7) {
405
  $xmlWriter->writeElement("g:gtin", $_product->getEan());
406
  }
407
 
408
- $xmlWriter->writeElement("g:price", $this->getPrice($_product));
409
- $xmlWriter->writeElement("g:sale_price", $this->getSalePrice($_product));
410
  // replaced getAttributeText with safer option
411
  $attributeCode = "color";
412
  if ($_product->getData($attributeCode) !== null){
@@ -584,10 +592,6 @@ class Businessfactory_Roihuntereasy_Model_Cron extends Mage_Core_Model_Abstract
584
  $productMediaConfig = Mage::getModel("catalog/product_media_config");
585
  $imageUrl = $productMediaConfig->getMediaUrl($product->getImage());
586
  }
587
- // retrieve cached image URL
588
- else {
589
- $imageUrl = Mage::helper("catalog/image")->init($product, "image");
590
- }
591
 
592
  return $imageUrl;
593
  }
148
  foreach ($products as $_product) {
149
  switch ($_product->getTypeId()) {
150
  case "downloadable":
151
+ if ($this->getPrice($_product) <= 0) {
152
  break;
153
  }
154
  // Else same processing as simple product
183
  "ID" => $this->getId($_product, $_childproduct),
184
  "Item title" => $this->getTitle($_product),
185
  "Final URL" => $this->getProductUrl($_product),
186
+ "Image URL" => $this->getImageUrl($_product),
187
  "Item description" => $this->getDescription($_product),
188
+ "Price" => $this->getPrice($_product, true),
189
+ "Sale price" => $this->getSalePrice($_product, true),
190
  );
191
  array_push($productArray, $productDict);
192
  }
234
  $xmlWriter->writeElement("title", "ROI Hunter Easy - Magento data feed");
235
  $xmlWriter->writeElement("description", "Magento data feed used in Google Merchants");
236
  $xmlWriter->writeElement("link", Mage::app()->getStore()->getBaseUrl());
237
+ $xmlWriter->writeElement('date', Mage::getModel('core/date')->gmtDate('Y-m-d H:i:s'));
238
 
239
  $this->count = 0;
240
  foreach ($products as $_product) {
287
  $collection->addAttributeToSelect("short_description");
288
  $collection->addAttributeToSelect("description");
289
  $collection->addAttributeToSelect("price");
290
+ $collection->addAttributeToSelect("final_price");
291
+ $collection->addAttributeToSelect("minimal_price");
292
  $collection->addAttributeToSelect("special_price");
293
  $collection->addAttributeToSelect("size");
294
  $collection->addAttributeToSelect("color");
392
  }
393
 
394
  $xmlWriter->writeElement("g:condition", "new");
395
+ // get sale price from the parent product in case that the special price is set on the configurable product
396
+ // but not on the children
397
+ // TODO: possible improvement: check children simple product first
398
+ $xmlWriter->writeElement("g:price", $this->getPrice($_product));
399
+ $xmlWriter->writeElement("g:sale_price", $this->getSalePrice($_product));
400
+ // get image URL from the parent product in case that the image is set on the configurable product
401
+ // but not on the children simple product
402
+ // TODO: possible improvement: check children simple product first
403
+ $xmlWriter->writeElement("g:image_link", $this->getImageUrl($_product));
404
  }
405
 
406
  /**
409
  */
410
  function writeChildProductAttributesXML($_product, $xmlWriter)
411
  {
 
 
412
  // $this->_logger->debug("gtin: " . $_product->getEan());
413
  $xmlWriter->writeElement("g:mpn", $_product->getSku());
414
  if (strlen($_product->getEan()) > 7) {
415
  $xmlWriter->writeElement("g:gtin", $_product->getEan());
416
  }
417
 
 
 
418
  // replaced getAttributeText with safer option
419
  $attributeCode = "color";
420
  if ($_product->getData($attributeCode) !== null){
592
  $productMediaConfig = Mage::getModel("catalog/product_media_config");
593
  $imageUrl = $productMediaConfig->getMediaUrl($product->getImage());
594
  }
 
 
 
 
595
 
596
  return $imageUrl;
597
  }
app/code/community/Businessfactory/Roihuntereasy/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Businessfactory_Roihuntereasy>
5
- <version>1.1.0</version>
6
  </Businessfactory_Roihuntereasy>
7
  </modules>
8
  <admin>
2
  <config>
3
  <modules>
4
  <Businessfactory_Roihuntereasy>
5
+ <version>1.1.2</version>
6
  </Businessfactory_Roihuntereasy>
7
  </modules>
8
  <admin>
app/design/adminhtml/default/default/template/businessfactory_roihuntereasy/admin.phtml CHANGED
@@ -20,6 +20,7 @@
20
 
21
  console.log("mode: " + magentoMode);
22
  console.log("baseUrl: " + storeUrl);
 
23
 
24
  // pass base url to React iframe fro future API calls to this site
25
  var iFrame = document.getElementById('RoiHunterEasyIFrame');
20
 
21
  console.log("mode: " + magentoMode);
22
  console.log("baseUrl: " + storeUrl);
23
+ console.log("storeLanguage_storeCountry: " + storeLanguage + "_" + storeCountry);
24
 
25
  // pass base url to React iframe fro future API calls to this site
26
  var iFrame = document.getElementById('RoiHunterEasyIFrame');
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>roihunter_easy</name>
4
- <version>1.1.0</version>
5
  <stability>stable</stability>
6
  <license>AFL 3.0</license>
7
  <channel>community</channel>
@@ -40,11 +40,11 @@ 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 16th April, 2017 Compatibility: 1.9.2.4 - CSV Product feed for Adwords compatibility, Conversion tracking, Product feed images and sale price improvements</notes>
44
  <authors><author><name>ROI Hunter</name><user>MAG003490427</user><email>petr.skornok@b.cz</email></author></authors>
45
- <date>2017-04-19</date>
46
- <time>16:17:32</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="696ce1b1e1c03cb4d69bd547bb95396c"/><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="8a47d9b4b0ad88c2e3fc1aa38258c465"/><file name="CheckoutAnalytics.php" hash="774200dbb45c1a3f832950b9c89d8557"/><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="4e6d394f8f0902904e357f441aca6289"/><file name="CheckoutObserver.php" hash="8849a591a83dbd4e9aa7900c13176bb0"/><file name="Cron.php" hash="4ba20cd18f139d89a2ed30cdaf5ffb46"/><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="687380dafaffd792a281e2bfd653d027"/></dir><file name="CronController.php" hash="7fae1e9140232183349a25e1267192a0"/><file name="FeedController.php" hash="4d3bca0c750174772ec91b0da4cc4182"/><file name="IndexController.php" hash="33c2a22770591cbeb7fb394d3654d904"/><file name="ResetController.php" hash="1a6c578829957c0a2ec2a4085ed5a089"/><file name="RoihuntereasyController.php" hash="b2b37f613badb75be2198e6643ef8d85"/><file name="StoredetailsController.php" hash="5440a2526b90a4bea9b0bf20486ac2b0"/></dir><dir name="etc"><file name="adminhtml.xml" hash="bbab6af370448895030570a657469a15"/><file name="config.xml" hash="ccb69bc13d9921bc514b4d213aaf0575"/><file name="system.xml" hash="718ea25db00b6a500b8783f9c8e1ba5c"/></dir><dir name="sql"><dir name="businessfactory_roihuntereasy_setup"><file name="install-1.0.9.php" hash="f490ddfd229eb5680e68fb7ec55a5820"/><file name="upgrade-1.0.9-1.1.0.php" hash="9a3aa2942881aad0e386c6284c012b4c"/></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="5688c1f85088716c6f3e9ef8cbed49f2"/><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="base"><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="65de844a372d10f6f215382c988dbe2a"/><file name="index.phtml" hash="a69cff3727b7bba2be7154b94b86ff08"/><file name="product_view_analytics.phtml" hash="a9ce50a31d64edcc70b2bbabd2ebf227"/></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.5.0</min><max>7.0.0</max></php></required></dependencies>
50
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>roihunter_easy</name>
4
+ <version>1.1.2</version>
5
  <stability>stable</stability>
6
  <license>AFL 3.0</license>
7
  <channel>community</channel>
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 23th May, 2017 Compatibility: 1.9.2.4 - Product feed improvements - sale price &amp; images</notes>
44
  <authors><author><name>ROI Hunter</name><user>MAG003490427</user><email>petr.skornok@b.cz</email></author></authors>
45
+ <date>2017-05-23</date>
46
+ <time>08:33:54</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="5053d9d475004afdf3ad6e7de7feed98"/><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="8a47d9b4b0ad88c2e3fc1aa38258c465"/><file name="CheckoutAnalytics.php" hash="774200dbb45c1a3f832950b9c89d8557"/><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="4e6d394f8f0902904e357f441aca6289"/><file name="CheckoutObserver.php" hash="8849a591a83dbd4e9aa7900c13176bb0"/><file name="Cron.php" hash="06f81ddac7042547879d9d11fb3fcb6d"/><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="687380dafaffd792a281e2bfd653d027"/></dir><file name="CronController.php" hash="7fae1e9140232183349a25e1267192a0"/><file name="FeedController.php" hash="4d3bca0c750174772ec91b0da4cc4182"/><file name="IndexController.php" hash="33c2a22770591cbeb7fb394d3654d904"/><file name="ResetController.php" hash="1a6c578829957c0a2ec2a4085ed5a089"/><file name="RoihuntereasyController.php" hash="b2b37f613badb75be2198e6643ef8d85"/><file name="StoredetailsController.php" hash="5440a2526b90a4bea9b0bf20486ac2b0"/></dir><dir name="etc"><file name="adminhtml.xml" hash="bbab6af370448895030570a657469a15"/><file name="config.xml" hash="09b0cc7789ce42ee34c8c9747fba0343"/><file name="system.xml" hash="718ea25db00b6a500b8783f9c8e1ba5c"/></dir><dir name="sql"><dir name="businessfactory_roihuntereasy_setup"><file name="install-1.0.9.php" hash="f490ddfd229eb5680e68fb7ec55a5820"/><file name="upgrade-1.0.9-1.1.0.php" hash="9a3aa2942881aad0e386c6284c012b4c"/></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="c9baa51b1c10f9fc272d5d1c3030d0e8"/><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="base"><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="65de844a372d10f6f215382c988dbe2a"/><file name="index.phtml" hash="a69cff3727b7bba2be7154b94b86ff08"/><file name="product_view_analytics.phtml" hash="a9ce50a31d64edcc70b2bbabd2ebf227"/></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.5.0</min><max>7.0.0</max></php></required></dependencies>
50
  </package>