Version Notes
It is optimized to display more products and the last updated parameter added for faster product download.
Download this release
Release Info
Developer | Rinkart Osei Asibey |
Extension | Feed_Manager_Version_1_1_2 |
Version | 2.1.1 |
Comparing to | |
See all releases |
Code changes from version 2.1.0 to 2.1.1
- package.xml +8 -7
- productapi.php +181 -0
package.xml
CHANGED
@@ -1,12 +1,13 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Feed_Manager_Version_1_1_2</name>
|
4 |
-
<version>2.1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/academic.php">Academic Free License (AFL)</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>Easily create datafeeds for your Magento store for various shopping engines and marketplaces like Google, Shopzilla, TheFind, Bing Shopping etc
|
|
|
10 |
<description><p><span><strong>Its a 2 in 1 package</strong></span></p>
|
11 |
<p>1. Submit your products to<strong> shopping comparison engines</strong> using our <strong>Feed Manager</strong> feature</p>
|
12 |
<p>2. Create <strong>Facebook fanpage stores</strong> with our new Shop Plus feature.</p>
|
@@ -24,11 +25,11 @@
|
|
24 |
<p>1. Feed Manager Version 1.1.2 works with magento 1.4x and above. </p>
|
25 |
<p>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.</p>
|
26 |
<p>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.</p></description>
|
27 |
-
<notes>
|
28 |
-
<authors><author><name>Rinkart Osei Asibey</name><user>rinkarto</user><email>rinkarto2000@gmail.com</email></author><author><name>
|
29 |
<date>2014-12-22</date>
|
30 |
-
<time>
|
31 |
-
<contents><target name="mage"><dir name="."><file name="." hash="
|
32 |
<compatible/>
|
33 |
-
<dependencies><required><php><min>
|
34 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Feed_Manager_Version_1_1_2</name>
|
4 |
+
<version>2.1.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/academic.php">Academic Free License (AFL)</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>Easily create datafeeds for your Magento store for various shopping engines and marketplaces like Google, Shopzilla, TheFind, Bing Shopping etc
|
10 |
+
</summary>
|
11 |
<description><p><span><strong>Its a 2 in 1 package</strong></span></p>
|
12 |
<p>1. Submit your products to<strong> shopping comparison engines</strong> using our <strong>Feed Manager</strong> feature</p>
|
13 |
<p>2. Create <strong>Facebook fanpage stores</strong> with our new Shop Plus feature.</p>
|
25 |
<p>1. Feed Manager Version 1.1.2 works with magento 1.4x and above. </p>
|
26 |
<p>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.</p>
|
27 |
<p>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.</p></description>
|
28 |
+
<notes>It is optimized to display more products and the last updated parameter added for faster product download.</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>2014-12-22</date>
|
31 |
+
<time>17:48:38</time>
|
32 |
+
<contents><target name="mage"><dir name="."><file name="productapi.php" hash="c9e52eb956f04a3caa6f0cb79748f4f2"/></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
ADDED
@@ -0,0 +1,181 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
|
9 |
+
if(!empty($_GET['status'])){
|
10 |
+
|
11 |
+
if($_GET['status'] == 'disabled'){
|
12 |
+
|
13 |
+
$output = array();
|
14 |
+
$data = array();
|
15 |
+
$attributes = array();
|
16 |
+
|
17 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
18 |
+
|
19 |
+
$collection = Mage::getResourceModel('catalog/product_collection')
|
20 |
+
->addAttributeToSelect('*') // select all attributes
|
21 |
+
->addAttributeToFilter('status', array('eq' => Mage_Catalog_Model_Product_Status::STATUS_DISABLED)); //select only disabled products
|
22 |
+
|
23 |
+
//loop through the list of products to get attribute values
|
24 |
+
foreach ($collection as $product) {
|
25 |
+
|
26 |
+
$attributes['name'] = $product->getName();
|
27 |
+
$attributes['id'] = $product->getId();
|
28 |
+
$attributes['status'] = $product->getStatus();
|
29 |
+
|
30 |
+
//build product data array
|
31 |
+
$data['product'] = array(
|
32 |
+
$attributes
|
33 |
+
);
|
34 |
+
|
35 |
+
//push product data array into output
|
36 |
+
array_push($output, $output["products"] = $data);
|
37 |
+
|
38 |
+
}
|
39 |
+
//header to indicate content type
|
40 |
+
header('Content-Type: application/json; charset=utf-8');
|
41 |
+
|
42 |
+
//print disabled products
|
43 |
+
print json_encode($output);
|
44 |
+
exit();
|
45 |
+
}
|
46 |
+
|
47 |
+
|
48 |
+
}
|
49 |
+
|
50 |
+
|
51 |
+
$products = Mage::getModel('catalog/product')->getCollection();
|
52 |
+
|
53 |
+
|
54 |
+
$products->addAttributeToSelect('*');
|
55 |
+
|
56 |
+
if(!empty($_GET['startDate'])){
|
57 |
+
|
58 |
+
//Start Date filter
|
59 |
+
|
60 |
+
$date = $_GET['startDate'];
|
61 |
+
//Set start date
|
62 |
+
$fromDate = $date;
|
63 |
+
//Set end date
|
64 |
+
$toDate = '2020-12-06 11:06:00';
|
65 |
+
|
66 |
+
// Format our dates
|
67 |
+
$fromDate = date('Y-m-d H:i:s', strtotime($fromDate));
|
68 |
+
$toDate = date('Y-m-d H:i:s', strtotime($toDate));
|
69 |
+
|
70 |
+
//Filter products using date ranges
|
71 |
+
$products->addAttributeToFilter('updated_at', array('from'=>$fromDate, 'to'=>$toDate, 'datetime'=>true));
|
72 |
+
|
73 |
+
//End Date filter
|
74 |
+
}
|
75 |
+
|
76 |
+
|
77 |
+
$products->addAttributeToFilter('status', array('eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED));
|
78 |
+
|
79 |
+
|
80 |
+
$visibility = array(
|
81 |
+
Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
|
82 |
+
Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG
|
83 |
+
);
|
84 |
+
|
85 |
+
$products->addAttributeToFilter('visibility', $visibility);
|
86 |
+
|
87 |
+
$collection = Mage::getModel('catalog/product')->getCollection();
|
88 |
+
|
89 |
+
$collection->addAttributeToSelect('manufacturer');
|
90 |
+
|
91 |
+
$collection->addFieldToFilter(array(
|
92 |
+
array('attribute' => 'manufacturer', 'eq' =>$designer_id),
|
93 |
+
));
|
94 |
+
|
95 |
+
$products->load();
|
96 |
+
|
97 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
98 |
+
|
99 |
+
$collection = Mage::getResourceModel('catalog/product_collection');
|
100 |
+
|
101 |
+
|
102 |
+
if (count($collection)){
|
103 |
+
|
104 |
+
$output = array();
|
105 |
+
|
106 |
+
foreach ($products as $product){
|
107 |
+
|
108 |
+
$attributes = array();
|
109 |
+
|
110 |
+
foreach ($product->getdata() as $key => $value) {
|
111 |
+
|
112 |
+
if ($key!=='stock_item') {
|
113 |
+
|
114 |
+
//my code start
|
115 |
+
|
116 |
+
$url = $product->getProductUrl();
|
117 |
+
if (($key == 'url_path') || ($key =='url_key')){
|
118 |
+
$value = $url;
|
119 |
+
$value = str_replace('/productapi.php','',$value);
|
120 |
+
$value = trim ($value);
|
121 |
+
}
|
122 |
+
|
123 |
+
if ($key == 'image'){
|
124 |
+
$value = $baseUrl."media/catalog/product".$value;
|
125 |
+
}
|
126 |
+
|
127 |
+
if ($key == 'thumbnail'){
|
128 |
+
$value = $baseUrl."media/catalog/product".$value;
|
129 |
+
}
|
130 |
+
|
131 |
+
if ($key == 'manufacturer'){
|
132 |
+
$value = $product->getResource()->getAttribute('manufacturer')->getFrontend()->getValue($product);
|
133 |
+
}
|
134 |
+
if ($key == 'brand'){
|
135 |
+
$value = $product->getResource()->getAttribute('brand')->getFrontend()->getValue($product);
|
136 |
+
}
|
137 |
+
|
138 |
+
$attributes[$key] = $value;
|
139 |
+
|
140 |
+
}
|
141 |
+
|
142 |
+
|
143 |
+
}
|
144 |
+
|
145 |
+
|
146 |
+
$categories = $product->getCategoryIds();
|
147 |
+
$product = array();
|
148 |
+
|
149 |
+
foreach($categories as $k => $_category_id):
|
150 |
+
|
151 |
+
$_category = Mage::getModel('catalog/category')->load($_category_id);
|
152 |
+
$cat_name = $_category->getName();
|
153 |
+
$cat_url = $_category->getUrl();
|
154 |
+
|
155 |
+
//build product data array
|
156 |
+
$product['product'] = array(
|
157 |
+
$attributes,
|
158 |
+
array("category" => array('name' => $cat_name, 'url' => $cat_url))
|
159 |
+
);
|
160 |
+
|
161 |
+
//push product data array into output
|
162 |
+
array_push($output, $output["products"] = $product);
|
163 |
+
|
164 |
+
|
165 |
+
endforeach;
|
166 |
+
|
167 |
+
|
168 |
+
}//endforeach;
|
169 |
+
|
170 |
+
}//endif;
|
171 |
+
|
172 |
+
//header to indicate content type
|
173 |
+
header('Content-Type: application/json; charset=utf-8');
|
174 |
+
|
175 |
+
//print products
|
176 |
+
print json_encode($output);
|
177 |
+
|
178 |
+
|
179 |
+
|
180 |
+
|
181 |
+
?>
|