Feed_Manager_Version_1_1_2 - Version 2.1.3

Version Notes

It is optimized to display more products and the last updated parameter added for faster product download. It will pull dynamic product attributes and supports product options.

Download this release

Release Info

Developer Rinkart Osei Asibey
Extension Feed_Manager_Version_1_1_2
Version 2.1.3
Comparing to
See all releases


Code changes from version 2.1.2 to 2.1.3

Files changed (2) hide show
  1. package.xml +5 -5
  2. productapi.php +109 -23
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Feed_Manager_Version_1_1_2</name>
4
- <version>2.1.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/academic.php">Academic Free License (AFL)</license>
7
  <channel>community</channel>
@@ -25,11 +25,11 @@
25
  &lt;p&gt;1. Feed Manager Version 1.1.2 works with magento 1.4x and above. &lt;/p&gt;&#xD;
26
  &lt;p&gt;2. Please back-up your store and database before installing this extension as we will not be responsible for any errors or problems that may occur with this open source extension.&lt;/p&gt;&#xD;
27
  &lt;p&gt;3. RetailTower does not provide extensive Magento support or other related Magento installation services for this open source extension. Please read our documentation and help file for assistance.&lt;/p&gt;</description>
28
- <notes>It is optimized to display more products and the last updated parameter added for faster product download. Displays dynamic product attributes</notes>
29
  <authors><author><name>Rinkart Osei Asibey</name><user>rinkarto</user><email>rinkarto2000@gmail.com</email></author><author><name>Retailtower</name><user>RetailTower</user><email>support@retailtower.com</email></author></authors>
30
- <date>2015-01-05</date>
31
- <time>15:10:20</time>
32
- <contents><target name="mage"><dir name="."><file name="productapi.php" hash="00244dd759c4f1d89850da1b2b635218"/></dir></target></contents>
33
  <compatible/>
34
  <dependencies><required><php><min>5.1.0</min><max>5.5.1</max></php></required></dependencies>
35
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Feed_Manager_Version_1_1_2</name>
4
+ <version>2.1.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/academic.php">Academic Free License (AFL)</license>
7
  <channel>community</channel>
25
  &lt;p&gt;1. Feed Manager Version 1.1.2 works with magento 1.4x and above. &lt;/p&gt;&#xD;
26
  &lt;p&gt;2. Please back-up your store and database before installing this extension as we will not be responsible for any errors or problems that may occur with this open source extension.&lt;/p&gt;&#xD;
27
  &lt;p&gt;3. RetailTower does not provide extensive Magento support or other related Magento installation services for this open source extension. Please read our documentation and help file for assistance.&lt;/p&gt;</description>
28
+ <notes>It is optimized to display more products and the last updated parameter added for faster product download. It will pull dynamic product attributes and supports product options.</notes>
29
  <authors><author><name>Rinkart Osei Asibey</name><user>rinkarto</user><email>rinkarto2000@gmail.com</email></author><author><name>Retailtower</name><user>RetailTower</user><email>support@retailtower.com</email></author></authors>
30
+ <date>2015-02-02</date>
31
+ <time>15:33:58</time>
32
+ <contents><target name="mage"><dir name="."><file name="productapi.php" hash="1ca239c9cee1925c33a489acae0cfdd7"/></dir></target></contents>
33
  <compatible/>
34
  <dependencies><required><php><min>5.1.0</min><max>5.5.1</max></php></required></dependencies>
35
  </package>
productapi.php CHANGED
@@ -1,14 +1,14 @@
1
  <?php
2
- set_time_limit(1600);
 
3
  ini_set('memory_limit', '-1');
4
  include_once 'app/Mage.php';
5
  umask(0);
6
  Mage::app();
7
 
8
- //get store disabled products
9
- if(!empty($_GET['status'])){
10
 
11
- if($_GET['status'] == 'disabled'){
 
12
 
13
  $output = array();
14
  $data = array();
@@ -42,22 +42,81 @@
42
  //print disabled products
43
  print json_encode($output);
44
  exit();
45
- }
46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
  }
49
 
50
 
51
- //get store attributes
52
- $attribute = Mage::getModel('catalog/product')->getAttributes();
53
- $attributeArray = array();
54
 
55
- foreach($attribute as $a){
 
 
 
56
 
57
- foreach ($a->getEntityType()->getAttributeCodes() as $attributeName) {
 
 
 
 
 
 
 
 
 
 
58
 
59
- $attributeArray[$attributeName] = $attributeName;
60
- }
61
  }
62
 
63
 
@@ -71,18 +130,20 @@
71
 
72
  //Start Date filter
73
 
74
- $date = $_GET['lastupdated'];
75
  //Set start date
76
- $fromDate = $date;
 
77
  //Set end date
78
- $toDate = '2040-12-06 11:06:00';
79
 
80
  // Format our dates
81
  $fromDate = date('Y-m-d H:i:s', strtotime($fromDate));
82
- $toDate = date('Y-m-d H:i:s', strtotime($toDate));
83
 
84
  //Filter products using date ranges
85
- $products->addAttributeToFilter('updated_at', array('from'=>$fromDate, 'to'=>$toDate, 'datetime'=>true));
 
86
 
87
  //End Date filter
88
  }
@@ -124,8 +185,6 @@
124
  foreach ($product->getdata() as $key => $value) {
125
 
126
  if ($key!=='stock_item') {
127
-
128
- //my code start
129
 
130
  $url = $product->getProductUrl();
131
  if (($key == 'url_path') || ($key =='url_key')){
@@ -148,12 +207,41 @@
148
  if ($key == 'brand'){
149
  $value = $product->getResource()->getAttribute('brand')->getFrontend()->getValue($product);
150
  }
 
151
 
152
- $attributes[$key] = $value;
153
 
154
  }
155
 
156
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  }
158
 
159
 
@@ -169,6 +257,7 @@
169
  //build product data array
170
  $product['product'] = array(
171
  $attributes,
 
172
  array("category" => array('name' => $cat_name, 'url' => $cat_url))
173
  );
174
 
@@ -180,9 +269,6 @@
180
 
181
 
182
  }//endforeach;
183
-
184
- //push product attributes into output
185
- array_push($output, $output["attributes"] = $attributeArray);
186
 
187
  }//endif;
188
 
1
  <?php
2
+ //set_time_limit(1600);
3
+ ini_set('max_execution_time', -1);
4
  ini_set('memory_limit', '-1');
5
  include_once 'app/Mage.php';
6
  umask(0);
7
  Mage::app();
8
 
 
 
9
 
10
+ //get store disabled products
11
+ if($_GET['status'] == 'disabled'){
12
 
13
  $output = array();
14
  $data = array();
42
  //print disabled products
43
  print json_encode($output);
44
  exit();
 
45
 
46
+ }
47
+
48
+ if($_GET['attributes'] == 'true'){
49
+ //get store attributes
50
+ $attribute = Mage::getModel('catalog/product')->getAttributes();
51
+ $attributes = array();
52
+ $data = array();
53
+ $output = array();
54
+
55
+ foreach($attribute as $a){
56
+
57
+ foreach ($a->getEntityType()->getAttributeCodes() as $attributeName) {
58
+
59
+ $attributes[$attributeName] = $attributeName;
60
+ }
61
+ }
62
+
63
+ $data['attributes'] = array(
64
+ $attributes
65
+ );
66
+
67
+ //push product data array into output
68
+ array_push($output, $data);
69
+
70
+ //header to indicate content type
71
+ header('Content-Type: application/json; charset=utf-8');
72
+
73
+ //print store attributes
74
+ print json_encode($output);
75
+ exit();
76
+
77
+ }
78
+
79
+ if($_GET['grouped'] == 'true'){
80
+
81
+ $product = Mage::getModel('catalog/product')
82
+ ->getCollection()
83
+ ->addAttributeToFilter('type_id', array('eq' => 'grouped'))
84
+ ->load();
85
+
86
+ $parentProductId = array();
87
+
88
+ foreach($product as $simpleProducts) {
89
+ //$simpleProducts->loadParentProductIds();
90
+ //array_push($parentProductId,$simpleProducts->getParentProductIds());
91
+ //var_dump($simpleProducts->getParentProductIds());
92
+ $values = $simpleProducts->getValues();
93
+ var_dump($values);
94
+ }
95
+ //var_dump($parentProductId);
96
+ exit();
97
 
98
  }
99
 
100
 
101
+ if($_GET['bundled'] == 'true'){
 
 
102
 
103
+ $product = Mage::getModel('catalog/product')
104
+ ->getCollection()
105
+ ->addAttributeToFilter('type_id', array('eq' => 'bundle'))
106
+ ->load();
107
 
108
+ $parentProductId = array();
109
+
110
+ foreach($product as $bundleProduct) {
111
+ //$bundleProduct->loadParentProductIds();
112
+ //array_push($parentProductId,$bundleProduct->getParentProductIds());
113
+ $values = $bundleProduct->getValues();
114
+ var_dump($values);
115
+
116
+ }
117
+ //var_dump($parentProductId);
118
+ exit();
119
 
 
 
120
  }
121
 
122
 
130
 
131
  //Start Date filter
132
 
133
+
134
  //Set start date
135
+ $fromDate = $_GET['lastupdated'];
136
+
137
  //Set end date
138
+ //$toDate = '2040-12-06 11:06:00';
139
 
140
  // Format our dates
141
  $fromDate = date('Y-m-d H:i:s', strtotime($fromDate));
142
+ //$toDate = date('Y-m-d H:i:s', strtotime($toDate));
143
 
144
  //Filter products using date ranges
145
+ //$products->addAttributeToFilter('updated_at', array('from'=>$fromDate, 'to'=>$toDate, 'datetime'=>true));
146
+ $products->addAttributeToFilter('updated_at', array('from'=>$fromDate, 'datetime'=>true));
147
 
148
  //End Date filter
149
  }
185
  foreach ($product->getdata() as $key => $value) {
186
 
187
  if ($key!=='stock_item') {
 
 
188
 
189
  $url = $product->getProductUrl();
190
  if (($key == 'url_path') || ($key =='url_key')){
207
  if ($key == 'brand'){
208
  $value = $product->getResource()->getAttribute('brand')->getFrontend()->getValue($product);
209
  }
210
+
211
 
212
+ $attributes[$key] = $value;
213
 
214
  }
215
 
216
 
217
+ }
218
+
219
+
220
+ $product_options = array();
221
+ $opts = array();
222
+ //get product options
223
+ $options = Mage::getModel('catalog/product_option')->getProductOptionCollection($product);
224
+
225
+ if($options){
226
+
227
+ foreach ($options as $option) {
228
+
229
+ //get product option values
230
+ $values = $option->getValues();
231
+
232
+ if($values){
233
+ foreach ($values as $v) {
234
+ foreach ($v->getData() as $key => $value) {
235
+ $product_options[$key] = $value;
236
+ $product_options['name'] = $option->getDefaultTitle();
237
+ $product_options['optiontype'] = $option->getType();
238
+ }
239
+ array_push($opts, $product_options);
240
+ }
241
+ }
242
+
243
+ }
244
+
245
  }
246
 
247
 
257
  //build product data array
258
  $product['product'] = array(
259
  $attributes,
260
+ array("options" => $opts),
261
  array("category" => array('name' => $cat_name, 'url' => $cat_url))
262
  );
263
 
269
 
270
 
271
  }//endforeach;
 
 
 
272
 
273
  }//endif;
274