shoppingfeeder - Version 1.3.5

Version Notes

This version is the first to support multi-store installations, including:
- Store-specific currency pricing at Magento's internal exchange rate
- Base currency override

Features include:
- One-click feed export to numerous channels
- Built-in order tracking
- Click & referral tracking
- Historical order importing for reporting and ROI analysis

Download this release

Release Info

Developer ShoppingFeeder
Extension shoppingfeeder
Version 1.3.5
Comparing to
See all releases


Code changes from version 1.3.4 to 1.3.5

app/code/community/ShoppingFeeder/Service/Model/Offers.php CHANGED
@@ -13,7 +13,7 @@ class ShoppingFeeder_Service_Model_Offers extends Mage_Core_Model_Abstract
13
  return !empty($parents);
14
  }
15
 
16
- private function getProductInfo(Mage_Catalog_Model_Product $product, Mage_Catalog_Model_Product $parent = null, $variantOptions = null, $lastUpdate = null)
17
  {
18
  /** @var Mage_Catalog_Model_Product_Type_Configurable $configModel */
19
  $configModel = Mage::getModel('catalog/product_type_configurable');
@@ -238,8 +238,12 @@ class ShoppingFeeder_Service_Model_Offers extends Mage_Core_Model_Abstract
238
 
239
  //$priceModel = $product->getPriceModel();
240
 
 
 
 
 
 
241
  $p['price'] = $price;// Mage::helper('checkout')->convertPrice($priceModel->getPrice($product), false);
242
- $salePrice = $product->getSpecialPrice();// Mage::helper('checkout')->convertPrice($priceModel->getFinalPrice(null, $product), false);
243
  $p['sale_price'] = '';
244
  $p['sale_price_effective_date'] = '';
245
  if ($salePrice != $p['price'])
@@ -283,7 +287,7 @@ class ShoppingFeeder_Service_Model_Offers extends Mage_Core_Model_Abstract
283
  return $p;
284
  }
285
 
286
- public function getItems($page = null, $numPerPage = 1000, $lastUpdate = null, $store = null)
287
  {
288
  /* @var Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection */
289
  $collection = Mage::getModel('catalog/product')->getCollection()
@@ -367,7 +371,7 @@ class ShoppingFeeder_Service_Model_Offers extends Mage_Core_Model_Abstract
367
  /** @var Mage_Catalog_Model_Product $variant */
368
  //$variant = Mage::getModel('catalog/product')->load($variantId);
369
 
370
- $productData = $this->getProductInfo($variant, $parent, $variantOptions, $lastUpdate);
371
  if (!empty($productData))
372
  {
373
  $products[] = $productData;
@@ -377,7 +381,7 @@ class ShoppingFeeder_Service_Model_Offers extends Mage_Core_Model_Abstract
377
  }
378
  else
379
  {
380
- $productData = $this->getProductInfo($product, null, null, $lastUpdate);
381
  if (!empty($productData))
382
  {
383
  $products[] = $productData;
@@ -388,13 +392,13 @@ class ShoppingFeeder_Service_Model_Offers extends Mage_Core_Model_Abstract
388
  return $products;
389
  }
390
 
391
- public function getItem($itemId, $store = null)
392
  {
393
  $products = array();
394
 
395
  $product = Mage::getModel('catalog/product')->load($itemId);
396
 
397
- $products[] = $this->getProductInfo($product);
398
 
399
  return $products;
400
  }
13
  return !empty($parents);
14
  }
15
 
16
+ private function getProductInfo(Mage_Catalog_Model_Product $product, Mage_Catalog_Model_Product $parent = null, $variantOptions = null, $lastUpdate = null, $priceCurrency, $priceCurrencyRate)
17
  {
18
  /** @var Mage_Catalog_Model_Product_Type_Configurable $configModel */
19
  $configModel = Mage::getModel('catalog/product_type_configurable');
238
 
239
  //$priceModel = $product->getPriceModel();
240
 
241
+ //do a currency conversion. if the currency is in base currency, it will be 1.0
242
+ $price = $price * $priceCurrencyRate;
243
+ $salePrice = $product->getSpecialPrice() * $priceCurrencyRate;
244
+
245
+ $p['currency'] = $priceCurrency;
246
  $p['price'] = $price;// Mage::helper('checkout')->convertPrice($priceModel->getPrice($product), false);
 
247
  $p['sale_price'] = '';
248
  $p['sale_price_effective_date'] = '';
249
  if ($salePrice != $p['price'])
287
  return $p;
288
  }
289
 
290
+ public function getItems($page = null, $numPerPage = 1000, $lastUpdate = null, $store = null, $priceCurrency = null, $priceCurrencyRate = null)
291
  {
292
  /* @var Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection */
293
  $collection = Mage::getModel('catalog/product')->getCollection()
371
  /** @var Mage_Catalog_Model_Product $variant */
372
  //$variant = Mage::getModel('catalog/product')->load($variantId);
373
 
374
+ $productData = $this->getProductInfo($variant, $parent, $variantOptions, $lastUpdate, $priceCurrency, $priceCurrencyRate);
375
  if (!empty($productData))
376
  {
377
  $products[] = $productData;
381
  }
382
  else
383
  {
384
+ $productData = $this->getProductInfo($product, null, null, $lastUpdate, $priceCurrency, $priceCurrencyRate);
385
  if (!empty($productData))
386
  {
387
  $products[] = $productData;
392
  return $products;
393
  }
394
 
395
+ public function getItem($itemId, $store = null, $priceCurrency = null, $priceCurrencyRate = null)
396
  {
397
  $products = array();
398
 
399
  $product = Mage::getModel('catalog/product')->load($itemId);
400
 
401
+ $products[] = $this->getProductInfo($product, null, null, null, $priceCurrency, $priceCurrencyRate);
402
 
403
  return $products;
404
  }
app/code/community/ShoppingFeeder/Service/controllers/FeedController.php CHANGED
@@ -17,6 +17,7 @@ class ShoppingFeeder_Service_FeedController extends ShoppingFeeder_Service_Contr
17
  $offerId = $this->getRequest()->getParam('offer_id', null);
18
  $lastUpdate = $this->getRequest()->getParam('last_update', null);
19
  $store = $this->getRequest()->getParam('store', null);
 
20
 
21
  /**
22
  * For per-store system
@@ -36,13 +37,17 @@ class ShoppingFeeder_Service_FeedController extends ShoppingFeeder_Service_Contr
36
  Mage::app()->setCurrentStore($defaultStoreCode);
37
  }
38
 
 
 
 
 
39
  if (is_null($offerId))
40
  {
41
- $offers = $offersModel->getItems($page, $numPerPage, $lastUpdate, $store);
42
  }
43
  else
44
  {
45
- $offers = $offersModel->getItem($offerId, $store);
46
  }
47
 
48
  $responseData = array(
17
  $offerId = $this->getRequest()->getParam('offer_id', null);
18
  $lastUpdate = $this->getRequest()->getParam('last_update', null);
19
  $store = $this->getRequest()->getParam('store', null);
20
+ $currency = $this->getRequest()->getParam('currency', null);
21
 
22
  /**
23
  * For per-store system
37
  Mage::app()->setCurrentStore($defaultStoreCode);
38
  }
39
 
40
+ $baseCurrency = Mage::app()->getStore()->getBaseCurrencyCode();
41
+ $priceCurrency = (is_null($currency)) ? Mage::app()->getStore()->getDefaultCurrencyCode() : $currency;
42
+ $priceCurrencyRate = Mage::helper('directory')->currencyConvert(1, $baseCurrency, $priceCurrency);
43
+
44
  if (is_null($offerId))
45
  {
46
+ $offers = $offersModel->getItems($page, $numPerPage, $lastUpdate, $store, $priceCurrency, $priceCurrencyRate);
47
  }
48
  else
49
  {
50
+ $offers = $offersModel->getItem($offerId, $store, $priceCurrency, $priceCurrencyRate);
51
  }
52
 
53
  $responseData = array(
app/code/community/ShoppingFeeder/Service/controllers/TestController.php CHANGED
@@ -262,6 +262,22 @@ class ShoppingFeeder_Service_TestController extends Mage_Core_Controller_Front_A
262
  }
263
  }
264
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
265
  $offersModel = false;
266
  try {
267
  $offersModel = Mage::getSingleton('shoppingfeeder_service/offers');
262
  }
263
  }
264
 
265
+ try {
266
+ $currency = $this->getRequest()->getParam('currency', null);
267
+
268
+ $baseCurrency = Mage::app()->getStore()->getBaseCurrencyCode();
269
+ $priceCurrency = (is_null($currency)) ? Mage::app()->getStore()->getDefaultCurrencyCode() : $currency;
270
+ $priceCurrencyRate = Mage::helper('directory')->currencyConvert(1, $baseCurrency, $priceCurrency);
271
+
272
+ echo 'Base currency <span style="color:green;">'.$baseCurrency.'</span>'."<br>\n";
273
+ echo 'Price currency <span style="color:green;">'.$priceCurrency.'</span>'."<br>\n";
274
+ echo 'Exchange rate '.$baseCurrency.'/'.$priceCurrency.' <span style="color:green;">'.$priceCurrencyRate.'</span>'."<br>\n";
275
+ }
276
+ catch (Exception $e)
277
+ {
278
+ echo '<span style="color:red;">could not</span> fetch currencies: ['.$e->getMessage().']'."<br>\n";
279
+ }
280
+
281
  $offersModel = false;
282
  try {
283
  $offersModel = Mage::getSingleton('shoppingfeeder_service/offers');
app/code/community/ShoppingFeeder/Service/controllers/VersionController.php CHANGED
@@ -5,7 +5,7 @@ require_once(Mage::getModuleDir('Controller','ShoppingFeeder_Service').DS.'Contr
5
 
6
  class ShoppingFeeder_Service_VersionController extends Mage_Core_Controller_Front_Action
7
  {
8
- protected static $_version = '1.3.4';
9
 
10
  public function indexAction()
11
  {
5
 
6
  class ShoppingFeeder_Service_VersionController extends Mage_Core_Controller_Front_Action
7
  {
8
+ protected static $_version = '1.3.5';
9
 
10
  public function indexAction()
11
  {
app/code/community/ShoppingFeeder/Service/etc/config.xml CHANGED
@@ -9,7 +9,7 @@
9
  <config>
10
  <modules>
11
  <ShoppingFeeder_Service>
12
- <version>1.3.4</version>
13
  </ShoppingFeeder_Service>
14
  </modules>
15
  <global>
9
  <config>
10
  <modules>
11
  <ShoppingFeeder_Service>
12
+ <version>1.3.5</version>
13
  </ShoppingFeeder_Service>
14
  </modules>
15
  <global>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>shoppingfeeder</name>
4
- <version>1.3.4</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
@@ -16,7 +16,9 @@ Use ShoppingFeeder to import your Shopify product catalogue, export it to numero
16
  Export to Google, Shopping.com, Nextag, kelkoo, PriceCheck, Shopmania, Fruugo and more!&#xD;
17
  &#xD;
18
  To set up your ShoppingFeeder account and install this extension seamlessly, create an account at: &lt;a href="http://www.shoppingfeeder.com/register"&gt;http://www.shoppingfeeder.com/register&lt;/a&gt;</description>
19
- <notes>This version is the first to support multi-store installations&#xD;
 
 
20
  &#xD;
21
  Features include:&#xD;
22
  - One-click feed export to numerous channels&#xD;
@@ -24,9 +26,9 @@ Features include:&#xD;
24
  - Click &amp; referral tracking&#xD;
25
  - Historical order importing for reporting and ROI analysis</notes>
26
  <authors><author><name>ShoppingFeeder</name><user>shoppingfeeder</user><email>support@shoppingfeeder.com</email></author></authors>
27
- <date>2015-05-08</date>
28
- <time>14:07:31</time>
29
- <contents><target name="mageetc"><dir name="modules"><file name="ShoppingFeeder_Service.xml" hash="90b374109c2d1281ddf527f24fa7d914"/></dir></target><target name="magecommunity"><dir name="ShoppingFeeder"><dir name="Service"><dir name="Block"><dir name="Adminhtml"><file name="Service.php" hash="e94d54bc342dc2941753ad635c0454a3"/></dir><file name="Service.php" hash="48874f0e80ce70686b81eb5380e9f498"/></dir><dir name="Controller"><file name="FrontAuth.php" hash="28ed32e1bf3250362911a26869f0e6d7"/></dir><dir name="Helper"><file name="Data.php" hash="17589bd08352e497806bef9884972300"/></dir><dir name="Model"><file name="Auth.php" hash="2cff17b0750ff70695b32524627b2aaf"/><file name="Observer.php" hash="79c5aa286d8bfacbe5b4c759b8b0c5f1"/><file name="Offers.php" hash="e1a89050b723a0663f24c475041e22d8"/><file name="Orders.php" hash="cc3c9f38ae41c11ab7dda0bcb8dd001f"/></dir><dir name="controllers"><file name="AttributesController.php" hash="e937c492f770bc8381a003a080cf878b"/><file name="FeedController.php" hash="ac47a34029f0444287c885efb0cb7f0d"/><file name="OrdersController.php" hash="e0dcf407e15ca212b43ee0015c918675"/><file name="StoresController.php" hash="a29fa0e97299ce764fd66360cbf6632a"/><file name="TestController.php" hash="68f935acc0643e0ee9a5f1445fe57bb4"/><file name="VersionController.php" hash="f917750bb62dd85fa6bc417e466686ae"/></dir><dir name="etc"><file name="config.xml" hash="49a11b5d179a9a8ddcba45c3dc097bfa"/><file name="system.xml" hash="9681c74fa8886143197932690616e2dd"/></dir></dir></dir></target></contents>
30
  <compatible/>
31
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
32
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>shoppingfeeder</name>
4
+ <version>1.3.5</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
16
  Export to Google, Shopping.com, Nextag, kelkoo, PriceCheck, Shopmania, Fruugo and more!&#xD;
17
  &#xD;
18
  To set up your ShoppingFeeder account and install this extension seamlessly, create an account at: &lt;a href="http://www.shoppingfeeder.com/register"&gt;http://www.shoppingfeeder.com/register&lt;/a&gt;</description>
19
+ <notes>This version is the first to support multi-store installations, including:&#xD;
20
+ - Store-specific currency pricing at Magento's internal exchange rate&#xD;
21
+ - Base currency override&#xD;
22
  &#xD;
23
  Features include:&#xD;
24
  - One-click feed export to numerous channels&#xD;
26
  - Click &amp; referral tracking&#xD;
27
  - Historical order importing for reporting and ROI analysis</notes>
28
  <authors><author><name>ShoppingFeeder</name><user>shoppingfeeder</user><email>support@shoppingfeeder.com</email></author></authors>
29
+ <date>2015-05-09</date>
30
+ <time>10:29:40</time>
31
+ <contents><target name="mageetc"><dir name="modules"><file name="ShoppingFeeder_Service.xml" hash="90b374109c2d1281ddf527f24fa7d914"/></dir></target><target name="magecommunity"><dir name="ShoppingFeeder"><dir name="Service"><dir name="Block"><dir name="Adminhtml"><file name="Service.php" hash="e94d54bc342dc2941753ad635c0454a3"/></dir><file name="Service.php" hash="48874f0e80ce70686b81eb5380e9f498"/></dir><dir name="Controller"><file name="FrontAuth.php" hash="28ed32e1bf3250362911a26869f0e6d7"/></dir><dir name="Helper"><file name="Data.php" hash="17589bd08352e497806bef9884972300"/></dir><dir name="Model"><file name="Auth.php" hash="2cff17b0750ff70695b32524627b2aaf"/><file name="Observer.php" hash="79c5aa286d8bfacbe5b4c759b8b0c5f1"/><file name="Offers.php" hash="ba5e7dd9669ca11fcf51067934a33f00"/><file name="Orders.php" hash="cc3c9f38ae41c11ab7dda0bcb8dd001f"/></dir><dir name="controllers"><file name="AttributesController.php" hash="e937c492f770bc8381a003a080cf878b"/><file name="FeedController.php" hash="a5bf65f2a3b6bf7a061b892b5e07e6c0"/><file name="OrdersController.php" hash="e0dcf407e15ca212b43ee0015c918675"/><file name="StoresController.php" hash="a29fa0e97299ce764fd66360cbf6632a"/><file name="TestController.php" hash="5138a844cb7cbc8e792df664057bdf9b"/><file name="VersionController.php" hash="9df0e83269599781d3f4178b3688a5f6"/></dir><dir name="etc"><file name="config.xml" hash="317ca0d9d47f184d35f4e56e847a7147"/><file name="system.xml" hash="9681c74fa8886143197932690616e2dd"/></dir></dir></dir></target></contents>
32
  <compatible/>
33
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
34
  </package>