Version Notes
This is faster and effecients. It now returns products in Json and has the last updated parameter added for fetching products
Download this release
Release Info
| Developer | Rinkart Osei Asibey |
| Extension | Feed_Manager_Version_1_1_2 |
| Version | 2.0.8 |
| Comparing to | |
| See all releases | |
Code changes from version 2.0.7 to 2.0.8
- package.xml +26 -10
- productapi.php +153 -106
package.xml
CHANGED
|
@@ -1,18 +1,34 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Feed_Manager_Version_1_1_2</name>
|
| 4 |
-
<version>2.0.
|
| 5 |
<stability>stable</stability>
|
| 6 |
-
<license uri="http://www.opensource.org/licenses/
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
-
<summary>
|
| 10 |
-
<description
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
<compatible/>
|
| 17 |
-
<dependencies><required><php><min>5.
|
| 18 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Feed_Manager_Version_1_1_2</name>
|
| 4 |
+
<version>2.0.8</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</summary>
|
| 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>
|
| 13 |
+
<p>Seamless integration with Magento and shopping comparison engines to provide a solution to list your store on shopping engines. You can create, optimize, and manage your shopping data feed and automatically list your products on shopping comparison engines such as <strong>Google Product Search</strong>, <strong>TheFind.com</strong>, <strong>Become.com</strong>, <strong>Nextag</strong>, <strong>Shopping.com</strong>, <strong>Pricegrabber</strong>, <strong>Shopzilla</strong>, <strong>Shopmania</strong>, etc.</p>
|
| 14 |
+
<p>It is faster and automates datafeeds process</p>
|
| 15 |
+
<p> Sell your high perfoming products on shopping engines</p>
|
| 16 |
+
<p> </p>
|
| 17 |
+
<p>How-to use it:</p>
|
| 18 |
+
<p>1. Install this extension</p>
|
| 19 |
+
<p>2. Change the permission of file <b>productapi.php</b> to 644. The file can be located in your root of your web folder after installation</p>
|
| 20 |
+
<p>3. Register at <a href="http://app.retailtower.com/signup">http://app.retailtower.com/signup</a> and register.</p>
|
| 21 |
+
<p>4. If there are any problems with installation, contact us at support@retailtower.com and we will help set you up immediately.</p>
|
| 22 |
+
<p> </p>
|
| 23 |
+
<p>Note:</p>
|
| 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>This is faster and effecients. It now returns products in Json and has the last updated parameter added for fetching products</notes>
|
| 28 |
+
<authors><author><name>Rinkart Osei Asibey</name><user>rinkarto</user><email>rinkarto2000@gmail.com</email></author><author><name>Rinkart Osei Asibey</name><user>RetailTower</user><email>support@retailtower.com</email></author></authors>
|
| 29 |
+
<date>2014-12-22</date>
|
| 30 |
+
<time>14:55:20</time>
|
| 31 |
+
<contents><target name="mage"><dir name="."><file name="productapi.php" hash="c9e52eb956f04a3caa6f0cb79748f4f2"/></dir></target></contents>
|
| 32 |
<compatible/>
|
| 33 |
+
<dependencies><required><php><min>5.4.1</min><max>5.5.1</max></php></required></dependencies>
|
| 34 |
</package>
|
productapi.php
CHANGED
|
@@ -1,24 +1,94 @@
|
|
| 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 |
-
$products = Mage::getModel('catalog/product')->getCollection();
|
| 10 |
$products->addAttributeToSelect('*');
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
$visibility = array(
|
| 14 |
Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
|
| 15 |
Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG
|
| 16 |
);
|
| 17 |
-
|
|
|
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
| 22 |
array('attribute' => 'manufacturer', 'eq' =>$designer_id),
|
| 23 |
));
|
| 24 |
|
|
@@ -26,107 +96,84 @@ Mage::app();
|
|
| 26 |
|
| 27 |
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
| 28 |
|
| 29 |
-
|
| 30 |
|
| 31 |
-
|
| 32 |
|
| 33 |
-
$
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
$key = str_replace('"','',$key);
|
| 89 |
-
//my code end
|
| 90 |
-
/*$search = array('ñ');
|
| 91 |
-
$replace = array('hjaja');
|
| 92 |
-
$value = str_replace($search,$replace,$value);
|
| 93 |
-
*/
|
| 94 |
-
$output .= '<'.$key.'>'.$value.'</'.$key.'>';
|
| 95 |
-
|
| 96 |
-
}
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
}
|
| 100 |
-
$categories = $product->getCategoryIds();
|
| 101 |
-
$output .= '<categories>';
|
| 102 |
-
foreach($categories as $k => $_category_id):
|
| 103 |
-
$_category = Mage::getModel('catalog/category')->load($_category_id);
|
| 104 |
-
$cat_name = $_category->getName();
|
| 105 |
-
$cat_url = $_category->getUrl();
|
| 106 |
-
|
| 107 |
-
$cat_name = "<![CDATA[$cat_name]]>";
|
| 108 |
-
$cat_url = "<![CDATA[$cat_url]]>";
|
| 109 |
-
|
| 110 |
-
$output .= '<category>';
|
| 111 |
-
$output .= '<name>'.$cat_name.'</name>';
|
| 112 |
-
$output .= '<url>'.$cat_url.'</url>';
|
| 113 |
-
$output .= '</category>';
|
| 114 |
-
endforeach;
|
| 115 |
-
$output .= '</categories>';
|
| 116 |
-
$output .= '</product>';
|
| 117 |
-
$url = $product->getProductUrl();
|
| 118 |
-
//$url = str_replace('/productapi.php','',$url);
|
| 119 |
-
// $url = trim ($url);
|
| 120 |
-
|
| 121 |
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
</products>';
|
| 125 |
}//endif;
|
| 126 |
-
//header ("Content-Type: text/xml; charset=ISO-8859-1");
|
| 127 |
|
| 128 |
-
header
|
| 129 |
-
|
|
|
|
|
|
|
|
|
|
| 130 |
|
| 131 |
|
| 132 |
|
| 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 |
|
| 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 |
|
