shoppingfeeder - Version 1.3.0

Version Notes

This version is the first to support multi-store installations

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.0
Comparing to
See all releases


Code changes from version 1.2.2 to 1.3.0

app/code/community/ShoppingFeeder/Service/Model/Offers.php CHANGED
@@ -111,6 +111,9 @@ class ShoppingFeeder_Service_Model_Offers extends Mage_Core_Model_Abstract
111
  $maxDepth = 0;
112
  $categoryPathToUse = '';
113
 
 
 
 
114
  if (!empty($categories))
115
  {
116
  //we will get all the category paths and then use the most refined, deepest one
@@ -132,7 +135,7 @@ class ShoppingFeeder_Service_Model_Offers extends Mage_Core_Model_Abstract
132
  $depth++;
133
  $category = Mage::getModel('catalog/category')->load($categoryId);
134
  $category_name = $category->getName();
135
- if ($category_name != 'Root Catalog' && $category_name != 'Default Category')
136
  {
137
  if (!empty($categoryPath))
138
  {
@@ -182,7 +185,8 @@ class ShoppingFeeder_Service_Model_Offers extends Mage_Core_Model_Abstract
182
  $sku = $variant->getData('sku');
183
  $price = $variantPrice;
184
  $variantImage = $variant->getImage();
185
- if (!is_null($variantImage) && !empty($variantImage))
 
186
  {
187
  $imageFile = $variant->getImage();
188
  $imageUrl = $p['image_url'] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).
@@ -197,10 +201,6 @@ class ShoppingFeeder_Service_Model_Offers extends Mage_Core_Model_Abstract
197
  $imageLocalPath = $product->getMediaConfig()->getMediaPath($imageFile);
198
  }
199
  $productUrl = $product->getProductUrl().'#'.implode('&', $urlHashParts);
200
-
201
- // var_dump($variantOptionsTitle);
202
- // var_dump($variantPrice);
203
- // exit();
204
  }
205
  else
206
  {
@@ -283,7 +283,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)
287
  {
288
  /* @var Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection */
289
  $collection = Mage::getModel('catalog/product')->getCollection()
@@ -294,10 +294,10 @@ class ShoppingFeeder_Service_Model_Offers extends Mage_Core_Model_Abstract
294
  /**
295
  * For per-store system
296
  */
297
- /*
298
- $store='default';
299
- $collection->addStoreFilter(Mage::app()->getStore($store)->getId());
300
- */
301
 
302
  if (!is_null($page))
303
  {
@@ -388,7 +388,7 @@ class ShoppingFeeder_Service_Model_Offers extends Mage_Core_Model_Abstract
388
  return $products;
389
  }
390
 
391
- public function getItem($itemId)
392
  {
393
  $products = array();
394
 
111
  $maxDepth = 0;
112
  $categoryPathToUse = '';
113
 
114
+ $storeRootCategoryId = Mage::app()->getStore()->getRootCategoryId();
115
+ $storeRootCategoryName = Mage::getModel('catalog/category')->load($storeRootCategoryId)->getName();
116
+
117
  if (!empty($categories))
118
  {
119
  //we will get all the category paths and then use the most refined, deepest one
135
  $depth++;
136
  $category = Mage::getModel('catalog/category')->load($categoryId);
137
  $category_name = $category->getName();
138
+ if ($category_name != $storeRootCategoryName)
139
  {
140
  if (!empty($categoryPath))
141
  {
185
  $sku = $variant->getData('sku');
186
  $price = $variantPrice;
187
  $variantImage = $variant->getImage();
188
+
189
+ if (!is_null($variantImage) && !empty($variantImage) && $variantImage!='no_selection')
190
  {
191
  $imageFile = $variant->getImage();
192
  $imageUrl = $p['image_url'] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).
201
  $imageLocalPath = $product->getMediaConfig()->getMediaPath($imageFile);
202
  }
203
  $productUrl = $product->getProductUrl().'#'.implode('&', $urlHashParts);
 
 
 
 
204
  }
205
  else
206
  {
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()
294
  /**
295
  * For per-store system
296
  */
297
+ if (!is_null($store))
298
+ {
299
+ $collection->addStoreFilter(Mage::app()->getStore($store)->getId());
300
+ }
301
 
302
  if (!is_null($page))
303
  {
388
  return $products;
389
  }
390
 
391
+ public function getItem($itemId, $store = null)
392
  {
393
  $products = array();
394
 
app/code/community/ShoppingFeeder/Service/Model/Orders.php CHANGED
@@ -35,13 +35,21 @@ class ShoppingFeeder_Service_Model_Orders extends Mage_Core_Model_Abstract
35
  return $data;
36
  }
37
 
38
- public function getItems($page = null, $numPerPage = 1000)
39
  {
40
  /* @var Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection */
41
  $collection = Mage::getModel('sales/order')->getCollection()
42
  ->addAttributeToSelect('*')
43
  ->addAttributeToFilter('status', Mage_Sales_Model_Order::STATE_COMPLETE);
44
 
 
 
 
 
 
 
 
 
45
  if (!is_null($page))
46
  {
47
  $offset = ($page * $numPerPage) - $numPerPage;
@@ -63,7 +71,7 @@ class ShoppingFeeder_Service_Model_Orders extends Mage_Core_Model_Abstract
63
  return $orders;
64
  }
65
 
66
- public function getItem($itemId)
67
  {
68
  $orders = array();
69
 
35
  return $data;
36
  }
37
 
38
+ public function getItems($page = null, $numPerPage = 1000, $store = null)
39
  {
40
  /* @var Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection */
41
  $collection = Mage::getModel('sales/order')->getCollection()
42
  ->addAttributeToSelect('*')
43
  ->addAttributeToFilter('status', Mage_Sales_Model_Order::STATE_COMPLETE);
44
 
45
+ /**
46
+ * For per-store system
47
+ */
48
+ if (!is_null($store))
49
+ {
50
+ $collection->addAttributeToFilter('store_id', Mage::app()->getStore($store)->getId());
51
+ }
52
+
53
  if (!is_null($page))
54
  {
55
  $offset = ($page * $numPerPage) - $numPerPage;
71
  return $orders;
72
  }
73
 
74
+ public function getItem($itemId, $store = null)
75
  {
76
  $orders = array();
77
 
app/code/community/ShoppingFeeder/Service/controllers/AttributesController.php CHANGED
@@ -9,6 +9,21 @@ class ShoppingFeeder_Service_AttributesController extends ShoppingFeeder_Service
9
  {
10
  set_time_limit(0);
11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  $internalAttributes = Mage::getResourceModel('catalog/product_attribute_collection')
13
  ->getItems();
14
 
@@ -20,7 +35,8 @@ class ShoppingFeeder_Service_AttributesController extends ShoppingFeeder_Service
20
  $responseData = array(
21
  'status' => 'success',
22
  'data' => array(
23
- 'attributes' => $attributes
 
24
  )
25
  );
26
 
9
  {
10
  set_time_limit(0);
11
 
12
+ $store = $this->getRequest()->getParam('store', null);
13
+
14
+ /**
15
+ * For per-store system
16
+ */
17
+ if (!is_null($store))
18
+ {
19
+ Mage::app()->setCurrentStore($store);
20
+ }
21
+ else
22
+ {
23
+ $mageApp = Mage::app();
24
+ $mageApp->setCurrentStore($mageApp::DISTRO_STORE_CODE);
25
+ }
26
+
27
  $internalAttributes = Mage::getResourceModel('catalog/product_attribute_collection')
28
  ->getItems();
29
 
35
  $responseData = array(
36
  'status' => 'success',
37
  'data' => array(
38
+ 'attributes' => $attributes,
39
+ 'store' => $store
40
  )
41
  );
42
 
app/code/community/ShoppingFeeder/Service/controllers/FeedController.php CHANGED
@@ -16,14 +16,28 @@ class ShoppingFeeder_Service_FeedController extends ShoppingFeeder_Service_Contr
16
  $numPerPage = $this->getRequest()->getParam('num_per_page', 1000);
17
  $offerId = $this->getRequest()->getParam('offer_id', null);
18
  $lastUpdate = $this->getRequest()->getParam('last_update', null);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
  if (is_null($offerId))
21
  {
22
- $offers = $offersModel->getItems($page, $numPerPage, $lastUpdate);
23
  }
24
  else
25
  {
26
- $offers = $offersModel->getItem($offerId);
27
  }
28
 
29
  $responseData = array(
@@ -31,7 +45,8 @@ class ShoppingFeeder_Service_FeedController extends ShoppingFeeder_Service_Contr
31
  'data' => array(
32
  'page' => $page,
33
  'num_per_page' => $numPerPage,
34
- 'offers' => $offers
 
35
  )
36
  );
37
 
16
  $numPerPage = $this->getRequest()->getParam('num_per_page', 1000);
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
23
+ */
24
+ if (!is_null($store))
25
+ {
26
+ Mage::app()->setCurrentStore($store);
27
+ }
28
+ else
29
+ {
30
+ $mageApp = Mage::app();
31
+ $mageApp->setCurrentStore($mageApp::DISTRO_STORE_CODE);
32
+ }
33
 
34
  if (is_null($offerId))
35
  {
36
+ $offers = $offersModel->getItems($page, $numPerPage, $lastUpdate, $store);
37
  }
38
  else
39
  {
40
+ $offers = $offersModel->getItem($offerId, $store);
41
  }
42
 
43
  $responseData = array(
45
  'data' => array(
46
  'page' => $page,
47
  'num_per_page' => $numPerPage,
48
+ 'offers' => $offers,
49
+ 'store' => $store
50
  )
51
  );
52
 
app/code/community/ShoppingFeeder/Service/controllers/OrdersController.php CHANGED
@@ -15,14 +15,28 @@ class ShoppingFeeder_Service_OrdersController extends ShoppingFeeder_Service_Con
15
  $page = $this->getRequest()->getParam('page', null);
16
  $numPerPage = $this->getRequest()->getParam('num_per_page', 1000);
17
  $orderId = $this->getRequest()->getParam('order_id', null);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
  if (is_null($orderId))
20
  {
21
- $orders = $ordersModel->getItems($page, $numPerPage);
22
  }
23
  else
24
  {
25
- $orders = $ordersModel->getItem($orderId);
26
  }
27
 
28
  $responseData = array(
@@ -30,7 +44,8 @@ class ShoppingFeeder_Service_OrdersController extends ShoppingFeeder_Service_Con
30
  'data' => array(
31
  'page' => $page,
32
  'num_per_page' => $numPerPage,
33
- 'orders' => $orders
 
34
  )
35
  );
36
 
15
  $page = $this->getRequest()->getParam('page', null);
16
  $numPerPage = $this->getRequest()->getParam('num_per_page', 1000);
17
  $orderId = $this->getRequest()->getParam('order_id', null);
18
+ $store = $this->getRequest()->getParam('store', null);
19
+
20
+ /**
21
+ * For per-store system
22
+ */
23
+ if (!is_null($store))
24
+ {
25
+ Mage::app()->setCurrentStore($store);
26
+ }
27
+ else
28
+ {
29
+ $mageApp = Mage::app();
30
+ $mageApp->setCurrentStore($mageApp::DISTRO_STORE_CODE);
31
+ }
32
 
33
  if (is_null($orderId))
34
  {
35
+ $orders = $ordersModel->getItems($page, $numPerPage, $store);
36
  }
37
  else
38
  {
39
+ $orders = $ordersModel->getItem($orderId, $store);
40
  }
41
 
42
  $responseData = array(
44
  'data' => array(
45
  'page' => $page,
46
  'num_per_page' => $numPerPage,
47
+ 'orders' => $orders,
48
+ 'store' => $store
49
  )
50
  );
51
 
app/code/community/ShoppingFeeder/Service/controllers/StoresController.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ //IMPORTANT - "Controller" directory is not autoloaded
4
+ require_once(Mage::getModuleDir('Controller','ShoppingFeeder_Service').DS.'Controller'.DS.'FrontAuth.php');
5
+
6
+ class ShoppingFeeder_Service_StoresController extends ShoppingFeeder_Service_Controller_FrontAuth
7
+ {
8
+ public function indexAction()
9
+ {
10
+ /** @var $websiteCollection Mage_Core_Model_Store */
11
+ $storeCollection = Mage::getModel('core/store')->getCollection();
12
+
13
+ $stores = array();
14
+ foreach ($storeCollection as $store) {
15
+ /** @var $store Mage_Core_Model_Store */
16
+ $store->initConfigCache();
17
+
18
+ $stores[$store->getCode()] = $store->getName();
19
+ }
20
+
21
+ $responseData = array(
22
+ 'status' => 'success',
23
+ 'data' => array(
24
+ 'stores' => $stores
25
+ )
26
+ );
27
+
28
+ header('Content-type: application/json; charset=UTF-8');
29
+ echo json_encode($responseData);
30
+ exit();
31
+ }
32
+ }
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>shoppingfeeder</name>
4
- <version>1.2.2</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
@@ -16,13 +16,7 @@ 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 has a number of major updates, including:&#xD;
20
- - Reducing payload on unchanged products&#xD;
21
- - Enhanced support for configurable products, providing child products as variants&#xD;
22
- - Updated attribute support to enable attribute mapping in ShoppingFeeder&#xD;
23
- &#xD;
24
- Bug fixes:&#xD;
25
- - Store code bug fix&#xD;
26
  &#xD;
27
  Features include:&#xD;
28
  - One-click feed export to numerous channels&#xD;
@@ -30,9 +24,9 @@ Features include:&#xD;
30
  - Click &amp; referral tracking&#xD;
31
  - Historical order importing for reporting and ROI analysis</notes>
32
  <authors><author><name>ShoppingFeeder</name><user>shoppingfeeder</user><email>support@shoppingfeeder.com</email></author></authors>
33
- <date>2015-05-05</date>
34
- <time>19:53:27</time>
35
- <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="2dc20fec996f1c02ad8b9374af432ec0"/></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="1594b6e56528ef022a2de69813aacaa6"/><file name="Orders.php" hash="682845c908726831937d648ec966db9f"/></dir><dir name="controllers"><file name="AttributesController.php" hash="163472c6ed07a2d9fea4c933a5b6f446"/><file name="FeedController.php" hash="6d469ec267e6e03c6d3a66821bd24848"/><file name="OrdersController.php" hash="07d47f30b9740c9dbb3cebbc54ca915f"/><file name="TestController.php" hash="77604f9f9660c4bcd8ad166160945c85"/><file name="VersionController.php" hash="c143e0986c6056561e1c803953b2d5c5"/></dir><dir name="etc"><file name="config.xml" hash="a9d5f81455a1c23ce37bf51eaab87efa"/><file name="system.xml" hash="9681c74fa8886143197932690616e2dd"/></dir></dir></dir></target></contents>
36
  <compatible/>
37
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
38
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>shoppingfeeder</name>
4
+ <version>1.3.0</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&#xD;
 
 
 
 
 
 
20
  &#xD;
21
  Features include:&#xD;
22
  - One-click feed export to numerous channels&#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-07</date>
28
+ <time>14:39:36</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="2dc20fec996f1c02ad8b9374af432ec0"/></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="5e36f1ea2e246a45886b3f664f783302"/><file name="FeedController.php" hash="437a5af0b178a0e2b1994d770360b66a"/><file name="OrdersController.php" hash="361c2b77948a32e466d5c7ed10fde04b"/><file name="StoresController.php" hash="a29fa0e97299ce764fd66360cbf6632a"/><file name="TestController.php" hash="77604f9f9660c4bcd8ad166160945c85"/><file name="VersionController.php" hash="c143e0986c6056561e1c803953b2d5c5"/></dir><dir name="etc"><file name="config.xml" hash="a9d5f81455a1c23ce37bf51eaab87efa"/><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>