Version Notes
MEx Pricegrabber Export helps you to export all Products to Pricegrabber
Download this release
Release Info
| Developer | Magento Core Team |
| Extension | MEx_Pricegrabber_Export |
| Version | 1.0.2 |
| Comparing to | |
| See all releases | |
Version 1.0.2
- app/code/local/MEx/Pricegrabber/Block/Catalog/Product/Grid.php +51 -0
- app/code/local/MEx/Pricegrabber/Model/Export/Csv.php +252 -0
- app/code/local/MEx/Pricegrabber/Model/Mysql4/Pricegrabber.php +28 -0
- app/code/local/MEx/Pricegrabber/Model/Mysql4/Pricegrabber/Collection.php +29 -0
- app/code/local/MEx/Pricegrabber/Model/Pricegrabber.php +35 -0
- app/code/local/MEx/Pricegrabber/controllers/Export/ProductController.php +37 -0
- app/code/local/MEx/Pricegrabber/etc/config.xml +86 -0
- app/code/local/MEx/Pricegrabber/sql/pricegrabber_setup/mysql4-install-0.1.0.php +45 -0
- package.xml +34 -0
app/code/local/MEx/Pricegrabber/Block/Catalog/Product/Grid.php
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Product export to Pricegrabber Extension
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to sales@magento-exchange.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Catalog
|
| 16 |
+
* @package MEx_Pricegrabber
|
| 17 |
+
* @author Magento Exchange
|
| 18 |
+
* @copyright Copyright (c) 2011 Magento Exchange
|
| 19 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 20 |
+
*/
|
| 21 |
+
|
| 22 |
+
/**
|
| 23 |
+
* Overrides Mage_Adminhtml_Block_Catalog_Product_Grid to append option to export to csv
|
| 24 |
+
* to mass action select box in the category grid.
|
| 25 |
+
*
|
| 26 |
+
*/
|
| 27 |
+
class MEx_Pricegrabber_Block_Catalog_Product_Grid extends Mage_Adminhtml_Block_Catalog_Product_Grid
|
| 28 |
+
{
|
| 29 |
+
/**
|
| 30 |
+
* Extends the mass action select box to append the option to export to csv.
|
| 31 |
+
*/
|
| 32 |
+
protected function _prepareMassaction()
|
| 33 |
+
{
|
| 34 |
+
parent::_prepareMassaction();
|
| 35 |
+
if(!Mage::getStoreConfig('advanced/modules_disable_output/MEx_Pricegrabber')) {
|
| 36 |
+
|
| 37 |
+
// Append option to export to csv to select box
|
| 38 |
+
$mex_feeds = Mage::getModel('pricegrabber/pricegrabber')->getAllMExFeeds();
|
| 39 |
+
|
| 40 |
+
$feed_no = 1;
|
| 41 |
+
foreach($mex_feeds as $mx_feed){
|
| 42 |
+
$mex_feed_list = $mx_feed->getData();
|
| 43 |
+
$this->getMassactionBlock()->addItem(
|
| 44 |
+
'mex_feed'.$feed_no++,
|
| 45 |
+
array('label'=>$this->__($mex_feed_list['feed_title']), 'url'=>$this->getUrl($mex_feed_list['feed_url']))
|
| 46 |
+
);
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
+
?>
|
app/code/local/MEx/Pricegrabber/Model/Export/Csv.php
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Product export to Pricegrabber Extension
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to sales@magento-exchange.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Catalog
|
| 16 |
+
* @package MEx_Pricegrabber
|
| 17 |
+
* @author Magento Exchange
|
| 18 |
+
* @copyright Copyright (c) 2011 Magento Exchange
|
| 19 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 20 |
+
*/
|
| 21 |
+
|
| 22 |
+
class MEx_Pricegrabber_Model_Export_Csv extends Mage_Core_Model_Abstract
|
| 23 |
+
{
|
| 24 |
+
const ENCLOSURE = '"';
|
| 25 |
+
const DELIMITER = ',';
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Concrete implementation of abstract method to export given orders to csv file in var/export.
|
| 29 |
+
*
|
| 30 |
+
* @param
|
| 31 |
+
* @return String The name of the written csv file in var/export
|
| 32 |
+
*/
|
| 33 |
+
public function exportProducts($productIds)
|
| 34 |
+
{
|
| 35 |
+
$fileName = 'product_export_'.date("Ymd_His").'.csv';
|
| 36 |
+
$fp = fopen(Mage::getBaseDir('export').'/'.$fileName, 'w');
|
| 37 |
+
|
| 38 |
+
$this->writeHeadRow($fp);
|
| 39 |
+
foreach ($productIds as $productId) {
|
| 40 |
+
$product = Mage::getModel('catalog/product')->load($productId);
|
| 41 |
+
$this->writeProduct($product, $fp);
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
fclose($fp);
|
| 45 |
+
|
| 46 |
+
return $fileName;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
/**
|
| 50 |
+
* Writes the head row with the column names in the csv file.
|
| 51 |
+
*
|
| 52 |
+
* @param $fp The file handle of the csv file
|
| 53 |
+
*/
|
| 54 |
+
protected function writeHeadRow($fp)
|
| 55 |
+
{
|
| 56 |
+
fputcsv($fp, $this->getHeadRowValues(), self::DELIMITER, self::ENCLOSURE);
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
/**
|
| 60 |
+
* Writes the row(s) for the given order in the csv file.
|
| 61 |
+
* A row is added to the csv file for each ordered item.
|
| 62 |
+
*
|
| 63 |
+
* @param
|
| 64 |
+
* @param $fp The file handle of the csv file
|
| 65 |
+
*/
|
| 66 |
+
protected function writeProduct($product, $fp)
|
| 67 |
+
{
|
| 68 |
+
$common = $this->getCommonProductValues($product);
|
| 69 |
+
|
| 70 |
+
fputcsv($fp, $common, self::DELIMITER, self::ENCLOSURE);
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
/**
|
| 74 |
+
* Returns the head column names.
|
| 75 |
+
*
|
| 76 |
+
* @return Array The array containing all column names
|
| 77 |
+
*/
|
| 78 |
+
protected function getHeadRowValues()
|
| 79 |
+
{
|
| 80 |
+
return array(
|
| 81 |
+
'Selling Price',
|
| 82 |
+
'Manufacturer Name',
|
| 83 |
+
'Product Title',
|
| 84 |
+
'Categorization',
|
| 85 |
+
'Detailed Description',
|
| 86 |
+
'Image Url',
|
| 87 |
+
'Condition',
|
| 88 |
+
'Unique Retailer SKU',
|
| 89 |
+
'Product Url',
|
| 90 |
+
'Weight',
|
| 91 |
+
'Availability'
|
| 92 |
+
);
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
/**
|
| 96 |
+
* Returns the product values.
|
| 97 |
+
*
|
| 98 |
+
* @return Array The array containing all column names
|
| 99 |
+
*/
|
| 100 |
+
protected function getCommonProductValues($product)
|
| 101 |
+
{
|
| 102 |
+
return array(
|
| 103 |
+
$product->getData('price'),
|
| 104 |
+
$this->getManufacturerName($product),
|
| 105 |
+
$this->getProductName($product),
|
| 106 |
+
$this->getProductCategorization($product),
|
| 107 |
+
strip_tags($product->getData('short_description')),
|
| 108 |
+
$this->getImageUrl($product),
|
| 109 |
+
'New',
|
| 110 |
+
$product->getData('sku'),
|
| 111 |
+
$this->getProductUrl($product),
|
| 112 |
+
$product->getData('weight'),
|
| 113 |
+
$product->getData('is_in_stock')=="1"?'Available':'Not Available'
|
| 114 |
+
);
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
/**
|
| 118 |
+
* Method to return the product name
|
| 119 |
+
*
|
| 120 |
+
* @param $product - Having complete product information
|
| 121 |
+
* @return String The name of the product
|
| 122 |
+
*/
|
| 123 |
+
|
| 124 |
+
protected function getProductName($product)
|
| 125 |
+
{
|
| 126 |
+
$productNm = "";
|
| 127 |
+
|
| 128 |
+
$productNm = str_replace(","," ",$product->getData('name'));
|
| 129 |
+
if(strlen($productNm)>150)
|
| 130 |
+
{
|
| 131 |
+
$productNm = substr($productNm, 0, 145)." ...";
|
| 132 |
+
}
|
| 133 |
+
return $productNm;
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
protected function getImageUrl($product)
|
| 137 |
+
{
|
| 138 |
+
//image url
|
| 139 |
+
$imageUrl = "";
|
| 140 |
+
$media = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
|
| 141 |
+
$mediaArray = explode("/index.php", $media);
|
| 142 |
+
$media = implode("", $mediaArray) . "catalog/product";
|
| 143 |
+
if($product->getData('image')!="no_selection")
|
| 144 |
+
$imageUrl = $media . $product->getData('image');
|
| 145 |
+
|
| 146 |
+
return $imageUrl;
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
/**
|
| 150 |
+
* Method to return the product url
|
| 151 |
+
*
|
| 152 |
+
* @param $product - Having complete product information
|
| 153 |
+
* @return String The url of the product
|
| 154 |
+
*/
|
| 155 |
+
|
| 156 |
+
protected function getProductUrl($product)
|
| 157 |
+
{
|
| 158 |
+
//product url
|
| 159 |
+
$productUrl = "";
|
| 160 |
+
$baseURL = Mage::getBaseUrl();
|
| 161 |
+
$baseArray = explode("/index.php", $baseURL);
|
| 162 |
+
$baseURL = implode("", $baseArray);
|
| 163 |
+
|
| 164 |
+
$_categories = $product->getCategoryIds();
|
| 165 |
+
$index = 0;
|
| 166 |
+
if(count($_categories)>0){
|
| 167 |
+
$index = count($_categories)-1;
|
| 168 |
+
}
|
| 169 |
+
if(count($_categories)>=1)
|
| 170 |
+
{
|
| 171 |
+
$_category = Mage::getModel('catalog/category')->load($_categories[$index]);
|
| 172 |
+
$productUrl = $baseURL.substr($_category->getUrlPath(), 0, strripos($_category->getUrlPath(),"."))."/".$product->getUrlPath();
|
| 173 |
+
}
|
| 174 |
+
return $productUrl;
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
/**
|
| 178 |
+
* Method to return the manufacturer name
|
| 179 |
+
*
|
| 180 |
+
* @param $product - Having complete product information
|
| 181 |
+
* @return String The name of the manfua
|
| 182 |
+
*/
|
| 183 |
+
protected function getManufacturerName($product)
|
| 184 |
+
{
|
| 185 |
+
return str_replace(","," ",$product->getAttributeText('manufacturer'));
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
/**
|
| 189 |
+
* Method to return the breadcrumb path
|
| 190 |
+
*
|
| 191 |
+
* @param $category - Takes the category.
|
| 192 |
+
* @return String categorization path
|
| 193 |
+
*/
|
| 194 |
+
protected function getProductCategorization($product)
|
| 195 |
+
{
|
| 196 |
+
$index = 0;
|
| 197 |
+
$categoryIds = $product->getCategoryIds();
|
| 198 |
+
if(count($categoryIds)>1);
|
| 199 |
+
$index = count($categoryIds)-1;
|
| 200 |
+
|
| 201 |
+
//load category by categoryId
|
| 202 |
+
$category = Mage::getModel('catalog/category');
|
| 203 |
+
$category->setStoreId(1);
|
| 204 |
+
$category->load($categoryIds[$index]);
|
| 205 |
+
|
| 206 |
+
$title = "";
|
| 207 |
+
|
| 208 |
+
$path = $this->getBreadcrumbPath($category);
|
| 209 |
+
|
| 210 |
+
foreach ($path as $name=>$breadcrumb) {
|
| 211 |
+
$title = $title.' '.$breadcrumb['label'].' > ';
|
| 212 |
+
}
|
| 213 |
+
$title = substr($title, 0, strripos($title," > ")) ;
|
| 214 |
+
|
| 215 |
+
return $title;
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
/**
|
| 219 |
+
* Method to return the breadcrumb path
|
| 220 |
+
*
|
| 221 |
+
* @param $category - Takes the category.
|
| 222 |
+
* @return Array Contains all the Url's.
|
| 223 |
+
*/
|
| 224 |
+
public function getBreadcrumbPath($category)
|
| 225 |
+
{
|
| 226 |
+
$categoryPath = "";
|
| 227 |
+
$path = array();
|
| 228 |
+
$pathInStore = $category->getPathInStore();
|
| 229 |
+
$pathIds = array_reverse(explode(',', $pathInStore));
|
| 230 |
+
|
| 231 |
+
$categories = $category->getParentCategories();
|
| 232 |
+
|
| 233 |
+
// add category path breadcrumb
|
| 234 |
+
foreach ($pathIds as $categoryId) {
|
| 235 |
+
if (isset($categories[$categoryId]) && $categories[$categoryId]->getName()) {
|
| 236 |
+
$path['category'.$categoryId] = array(
|
| 237 |
+
'label' => $categories[$categoryId]->getName(),
|
| 238 |
+
'link' => $categories[$categoryId]->getUrl()
|
| 239 |
+
);
|
| 240 |
+
}
|
| 241 |
+
}
|
| 242 |
+
|
| 243 |
+
if ($this->getProduct()) {
|
| 244 |
+
$path['product'] = array('label'=>$this->getProduct()->getName());
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
$categoryPath = $path;
|
| 248 |
+
|
| 249 |
+
return $categoryPath;
|
| 250 |
+
}
|
| 251 |
+
}
|
| 252 |
+
?>
|
app/code/local/MEx/Pricegrabber/Model/Mysql4/Pricegrabber.php
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Product export to Pricegrabber Extension
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to sales@magento-exchange.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Catalog
|
| 16 |
+
* @package MEx_Pricegrabber
|
| 17 |
+
* @author Magento Exchange
|
| 18 |
+
* @copyright Copyright (c) 2011 Magento Exchange
|
| 19 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 20 |
+
*/
|
| 21 |
+
|
| 22 |
+
class MEx_Pricegrabber_Model_Mysql4_Pricegrabber extends Mage_Core_Model_Mysql4_Abstract
|
| 23 |
+
{
|
| 24 |
+
public function _construct()
|
| 25 |
+
{
|
| 26 |
+
$this->_init('pricegrabber/pricegrabber', 'shop_feed_id');
|
| 27 |
+
}
|
| 28 |
+
}
|
app/code/local/MEx/Pricegrabber/Model/Mysql4/Pricegrabber/Collection.php
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Product export to Pricegrabber Extension
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to sales@magento-exchange.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Catalog
|
| 16 |
+
* @package MEx_Pricegrabber
|
| 17 |
+
* @author Magento Exchange
|
| 18 |
+
* @copyright Copyright (c) 2011 Magento Exchange
|
| 19 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 20 |
+
*/
|
| 21 |
+
|
| 22 |
+
class MEx_Pricegrabber_Model_Mysql4_Pricegrabber_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 23 |
+
{
|
| 24 |
+
public function _construct()
|
| 25 |
+
{
|
| 26 |
+
parent::_construct();
|
| 27 |
+
$this->_init('pricegrabber/pricegrabber');
|
| 28 |
+
}
|
| 29 |
+
}
|
app/code/local/MEx/Pricegrabber/Model/Pricegrabber.php
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Product export to Pricegrabber Extension
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 10 |
+
* It is also available through the world-wide-web at this URL:
|
| 11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 12 |
+
* If you did not receive a copy of the license and are unable to
|
| 13 |
+
* obtain it through the world-wide-web, please send an email
|
| 14 |
+
* to sales@magento-exchange.com so we can send you a copy immediately.
|
| 15 |
+
*
|
| 16 |
+
* @category Catalog
|
| 17 |
+
* @package MEx_Pricegrabber
|
| 18 |
+
* @author Magento Exchange
|
| 19 |
+
* @copyright Copyright (c) 2011 Magento Exchange
|
| 20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
class MEx_Pricegrabber_Model_Pricegrabber extends Mage_Core_Model_Abstract
|
| 24 |
+
{
|
| 25 |
+
public function _construct()
|
| 26 |
+
{
|
| 27 |
+
parent::_construct();
|
| 28 |
+
$this->_init('pricegrabber/pricegrabber');
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
public function getAllMExFeeds(){
|
| 32 |
+
$collection = Mage::getModel('pricegrabber/pricegrabber')->getCollection();
|
| 33 |
+
return $collection;
|
| 34 |
+
}
|
| 35 |
+
}
|
app/code/local/MEx/Pricegrabber/controllers/Export/ProductController.php
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Product export to Pricegrabber Extension
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to sales@magento-exchange.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Catalog
|
| 16 |
+
* @package MEx_Pricegrabber
|
| 17 |
+
* @author Magento Exchange
|
| 18 |
+
* @copyright Copyright (c) 2011 Magento Exchange
|
| 19 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 20 |
+
*/
|
| 21 |
+
|
| 22 |
+
class MEx_Pricegrabber_Export_ProductController extends Mage_Adminhtml_Controller_Action
|
| 23 |
+
{
|
| 24 |
+
/**
|
| 25 |
+
* Export products
|
| 26 |
+
*/
|
| 27 |
+
public function csvExportAction()
|
| 28 |
+
{
|
| 29 |
+
$productIds = $this->getRequest()->getParam('product');
|
| 30 |
+
|
| 31 |
+
$file = Mage::getModel('pricegrabber/export_csv')->exportProducts($productIds);
|
| 32 |
+
$this->_prepareDownloadResponse($file, file_get_contents(Mage::getBaseDir('export').'/'.$file));
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
}
|
| 37 |
+
?>
|
app/code/local/MEx/Pricegrabber/etc/config.xml
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!--
|
| 3 |
+
/**
|
| 4 |
+
* Product export to Pricegrabber Extension
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 10 |
+
* It is also available through the world-wide-web at this URL:
|
| 11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 12 |
+
* If you did not receive a copy of the license and are unable to
|
| 13 |
+
* obtain it through the world-wide-web, please send an email
|
| 14 |
+
* to sales@magento-exchange.com so we can send you a copy immediately.
|
| 15 |
+
*
|
| 16 |
+
* @category Catalog
|
| 17 |
+
* @package MEx_Pricegrabber
|
| 18 |
+
* @author Magento Exchange
|
| 19 |
+
* @copyright Copyright (c) 2011 Magento Exchange
|
| 20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 21 |
+
*/
|
| 22 |
+
-->
|
| 23 |
+
<config>
|
| 24 |
+
<modules>
|
| 25 |
+
<MEx_Pricegrabber>
|
| 26 |
+
<version>0.1.0</version>
|
| 27 |
+
</MEx_Pricegrabber>
|
| 28 |
+
</modules>
|
| 29 |
+
|
| 30 |
+
<admin>
|
| 31 |
+
<routers>
|
| 32 |
+
<MEx_Pricegrabber>
|
| 33 |
+
<use>admin</use>
|
| 34 |
+
<args>
|
| 35 |
+
<module>MEx_Pricegrabber</module>
|
| 36 |
+
<frontName>productexport</frontName>
|
| 37 |
+
</args>
|
| 38 |
+
</MEx_Pricegrabber>
|
| 39 |
+
</routers>
|
| 40 |
+
</admin>
|
| 41 |
+
|
| 42 |
+
<global>
|
| 43 |
+
<blocks>
|
| 44 |
+
<adminhtml>
|
| 45 |
+
<rewrite>
|
| 46 |
+
<catalog_product_grid>MEx_Pricegrabber_Block_Catalog_Product_Grid</catalog_product_grid>
|
| 47 |
+
</rewrite>
|
| 48 |
+
</adminhtml>
|
| 49 |
+
</blocks>
|
| 50 |
+
<models>
|
| 51 |
+
<pricegrabber>
|
| 52 |
+
<class>MEx_Pricegrabber_Model</class>
|
| 53 |
+
<resourceModel>pricegrabber_mysql4</resourceModel>
|
| 54 |
+
</pricegrabber>
|
| 55 |
+
<pricegrabber_mysql4>
|
| 56 |
+
<class>MEx_Pricegrabber_Model_Mysql4</class>
|
| 57 |
+
<entities>
|
| 58 |
+
<pricegrabber>
|
| 59 |
+
<table>mexshopping_feed</table>
|
| 60 |
+
</pricegrabber>
|
| 61 |
+
</entities>
|
| 62 |
+
</pricegrabber_mysql4>
|
| 63 |
+
</models>
|
| 64 |
+
<resources>
|
| 65 |
+
<pricegrabber_setup>
|
| 66 |
+
<setup>
|
| 67 |
+
<module>MEx_Pricegrabber</module>
|
| 68 |
+
</setup>
|
| 69 |
+
<connection>
|
| 70 |
+
<use>core_setup</use>
|
| 71 |
+
</connection>
|
| 72 |
+
</pricegrabber_setup>
|
| 73 |
+
<pricegrabber_write>
|
| 74 |
+
<connection>
|
| 75 |
+
<use>core_write</use>
|
| 76 |
+
</connection>
|
| 77 |
+
</pricegrabber_write>
|
| 78 |
+
<pricegrabber_read>
|
| 79 |
+
<connection>
|
| 80 |
+
<use>core_read</use>
|
| 81 |
+
</connection>
|
| 82 |
+
</pricegrabber_read>
|
| 83 |
+
</resources>
|
| 84 |
+
</global>
|
| 85 |
+
|
| 86 |
+
</config>
|
app/code/local/MEx/Pricegrabber/sql/pricegrabber_setup/mysql4-install-0.1.0.php
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Product export to Pricegrabber Extension
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to sales@magento-exchange.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Catalog
|
| 16 |
+
* @package MEx_Pricegrabber
|
| 17 |
+
* @author Magento Exchange
|
| 18 |
+
* @copyright Copyright (c) 2011 Magento Exchange
|
| 19 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 20 |
+
*/
|
| 21 |
+
|
| 22 |
+
$installer = $this;
|
| 23 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
| 24 |
+
|
| 25 |
+
$installer->startSetup();
|
| 26 |
+
|
| 27 |
+
$installer->run("
|
| 28 |
+
|
| 29 |
+
/*Table structure for table `mexshopping_feed` */
|
| 30 |
+
|
| 31 |
+
-- DROP TABLE IF EXISTS {$this->getTable('mexshopping_feed')};
|
| 32 |
+
CREATE TABLE IF NOT EXISTS {$this->getTable('mexshopping_feed')} (
|
| 33 |
+
`shop_feed_id` int(7) unsigned NOT NULL auto_increment,
|
| 34 |
+
`feed_name` varchar(30) default NULL,
|
| 35 |
+
`feed_title` varchar(100) default NULL,
|
| 36 |
+
`feed_url` varchar(100) default NULL,
|
| 37 |
+
PRIMARY KEY (`shop_feed_id`)
|
| 38 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='MEx Shopping Feeds';
|
| 39 |
+
|
| 40 |
+
/*Data for the table `mexshopping_feed` */
|
| 41 |
+
|
| 42 |
+
insert into {$this->getTable('mexshopping_feed')}(`feed_name`,`feed_title`, `feed_url`) values ('Price Grabber','Export to CSV(Pricegrabber)', 'productexport/export_product/csvexport');
|
| 43 |
+
");
|
| 44 |
+
|
| 45 |
+
$installer->endSetup();
|
package.xml
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>MEx_Pricegrabber_Export</name>
|
| 4 |
+
<version>1.0.2</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>MEx Pricegrabber Export helps you to export all products of Magento web-site to Pricegrabber interface.</summary>
|
| 10 |
+
<description>Some of the product features listed are
|
| 11 |
+
|
| 12 |
+
1. Easy to use and configure
|
| 13 |
+
2. Multilanguage support
|
| 14 |
+
3. Multicurrency support
|
| 15 |
+
4. Multi Store Product support
|
| 16 |
+
5. Ability to export only selected products
|
| 17 |
+
6. Capability to strip HTML from Product Names
|
| 18 |
+
7. Capability to strip HTML from Product Descriptions
|
| 19 |
+
8. Capability to include Image Url and Product Url.
|
| 20 |
+
9. Capability to auto generate Price Grabber Categorization( Bread Crumbs)
|
| 21 |
+
10. Capability to limit 100 Characters for Product titles
|
| 22 |
+
11. Capability to limit 1500 Characters for Product Description
|
| 23 |
+
12. Exports only Active Products.
|
| 24 |
+
13. Ability to export feed in CSV format
|
| 25 |
+
14. Supports Versions 1.3.2.4,1.4.1.1 and 1.4.1.2
|
| 26 |
+
15. Free Installation Support help from MEx Forum.</description>
|
| 27 |
+
<notes>MEx Pricegrabber Export helps you to export all Products to Pricegrabber</notes>
|
| 28 |
+
<authors><author><name>Magento Exchange</name><user>auto-converted</user><email>magento.exchange@gmail.com</email></author></authors>
|
| 29 |
+
<date>2011-02-14</date>
|
| 30 |
+
<time>14:39:49</time>
|
| 31 |
+
<contents><target name="magelocal"><dir name="MEx"><dir name="Pricegrabber"><dir name="Block"><dir name="Catalog"><dir name="Product"><file name="Grid.php" hash="305ad4deb4ba0716662b83560f9536a9"/></dir></dir></dir><dir name="controllers"><dir name="Export"><file name="ProductController.php" hash="b0f0387a61aa55a591cc4b030e1adef8"/></dir></dir><dir name="etc"><file name="config.xml" hash="dd210155d96ae9edc57000fb922197a1"/></dir><dir name="Model"><file name="Pricegrabber.php" hash="40d6649a5af7577d7d772754f1c4058c"/><dir name="Export"><file name="Csv.php" hash="5a16a079cdbfe642844238478c4d3774"/></dir><dir name="Mysql4"><file name="Pricegrabber.php" hash="218136de528c66446f90b6d6d307ff2b"/><dir name="Pricegrabber"><file name="Collection.php" hash="68cbdda1ac6345f31183f5d87bb05164"/></dir></dir></dir><dir name="sql"><dir name="pricegrabber_setup"><file name="mysql4-install-0.1.0.php" hash="e8d1675f747b0c1fc0603087641fc012"/></dir></dir></dir></dir></target></contents>
|
| 32 |
+
<compatible/>
|
| 33 |
+
<dependencies><required><package><name></name><channel>community</channel><min></min><max></max></package></required></dependencies>
|
| 34 |
+
</package>
|
