Version Notes
Using this extension, user can upload .svg images for products. User can upload via product editor and via import as well.
Download this release
Release Info
Developer | Emizen Tech Private Limited |
Extension | Emizen_Svgproductimage |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/local/Emizen/Svgproductimage/Helper/Catalog/Image.php +62 -0
- app/code/local/Emizen/Svgproductimage/Helper/Data.php +5 -0
- app/code/local/Emizen/Svgproductimage/Model/Catalog/Product/Attribute/Backend/Media.php +88 -0
- app/code/local/Emizen/Svgproductimage/Model/Catalog/Product/Image.php +20 -0
- app/code/local/Emizen/Svgproductimage/Model/ImportExport/Import/Entity/Product.php +26 -0
- app/code/local/Emizen/Svgproductimage/Model/ImportExport/Import/Uploader.php +13 -0
- app/code/local/Emizen/Svgproductimage/Model/Observer.php +23 -0
- app/code/local/Emizen/Svgproductimage/controllers/Adminhtml/Catalog/Product/GalleryController.php +80 -0
- app/code/local/Emizen/Svgproductimage/etc/adminhtml.xml +23 -0
- app/code/local/Emizen/Svgproductimage/etc/config.xml +87 -0
- app/code/local/Emizen/Svgproductimage/etc/system.xml +42 -0
- app/etc/modules/Emizen_Svgproductimage.xml +10 -0
- catalog_product_20150205_070514.csv +2 -0
- export_all_products.csv +2 -0
- package.xml +21 -0
app/code/local/Emizen/Svgproductimage/Helper/Catalog/Image.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Emizen_Svgproductimage_Helper_Catalog_Image extends Mage_Catalog_Helper_Image
|
3 |
+
{
|
4 |
+
public function __toString()
|
5 |
+
{
|
6 |
+
try {
|
7 |
+
$model = $this->_getModel();
|
8 |
+
|
9 |
+
if ($this->getImageFile()) {
|
10 |
+
$model->setBaseFile($this->getImageFile());
|
11 |
+
} else {
|
12 |
+
$model->setBaseFile($this->getProduct()->getData($model->getDestinationSubdir()));
|
13 |
+
}
|
14 |
+
|
15 |
+
$ext = pathinfo($this->getProduct()->getData($model->getDestinationSubdir()), PATHINFO_EXTENSION);
|
16 |
+
$enable = Mage::getStoreConfig('svgproductimage/svgimage/enable',Mage::app()->getStore());
|
17 |
+
if($ext == "svg" && $enable)
|
18 |
+
{
|
19 |
+
return $model->getUrl();
|
20 |
+
}
|
21 |
+
|
22 |
+
|
23 |
+
if ($model->isCached()) {
|
24 |
+
return $model->getUrl();
|
25 |
+
} else {
|
26 |
+
if ($this->_scheduleRotate) {
|
27 |
+
$model->rotate($this->getAngle());
|
28 |
+
}
|
29 |
+
|
30 |
+
if ($this->_scheduleResize) {
|
31 |
+
$model->resize();
|
32 |
+
}
|
33 |
+
|
34 |
+
if ($this->getWatermark()) {
|
35 |
+
$model->setWatermark($this->getWatermark());
|
36 |
+
}
|
37 |
+
|
38 |
+
$url = $model->saveFile()->getUrl();
|
39 |
+
}
|
40 |
+
} catch (Exception $e) {
|
41 |
+
$url = Mage::getDesign()->getSkinUrl($this->getPlaceholder());
|
42 |
+
}
|
43 |
+
return $url;
|
44 |
+
}
|
45 |
+
|
46 |
+
public function validateUploadFile($filePath) {
|
47 |
+
$ext = pathinfo($filePath, PATHINFO_EXTENSION);
|
48 |
+
$enable = Mage::getStoreConfig('svgproductimage/svgimage/enable',Mage::app()->getStore());
|
49 |
+
if($ext == "svg" && $enable)
|
50 |
+
{
|
51 |
+
return ;
|
52 |
+
}else{
|
53 |
+
if (!getimagesize($filePath)) {
|
54 |
+
Mage::throwException($this->__('Disallowed file type.'));
|
55 |
+
}
|
56 |
+
|
57 |
+
$_processor = new Varien_Image($filePath);
|
58 |
+
return $_processor->getMimeType() !== null;
|
59 |
+
}
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
app/code/local/Emizen/Svgproductimage/Helper/Data.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Emizen_Svgproductimage_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
}
|
5 |
+
|
app/code/local/Emizen/Svgproductimage/Model/Catalog/Product/Attribute/Backend/Media.php
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Emizen_Svgproductimage_Model_Catalog_Product_Attribute_Backend_Media extends Mage_Catalog_Model_Product_Attribute_Backend_Media
|
3 |
+
{
|
4 |
+
public function addImage(Mage_Catalog_Model_Product $product, $file,
|
5 |
+
$mediaAttribute = null, $move = false, $exclude = true)
|
6 |
+
{
|
7 |
+
$file = realpath($file);
|
8 |
+
|
9 |
+
if (!$file || !file_exists($file)) {
|
10 |
+
Mage::throwException(Mage::helper('catalog')->__('Image does not exist.'));
|
11 |
+
}
|
12 |
+
|
13 |
+
Mage::dispatchEvent('catalog_product_media_add_image', array('product' => $product, 'image' => $file));
|
14 |
+
|
15 |
+
$pathinfo = pathinfo($file);
|
16 |
+
$imgExtensions = array('jpg','jpeg','gif','png','svg');
|
17 |
+
if (!isset($pathinfo['extension']) || !in_array(strtolower($pathinfo['extension']), $imgExtensions)) {
|
18 |
+
Mage::throwException(Mage::helper('catalog')->__('Invalid image file type.'));
|
19 |
+
}
|
20 |
+
|
21 |
+
$fileName = Mage_Core_Model_File_Uploader::getCorrectFileName($pathinfo['basename']);
|
22 |
+
$dispretionPath = Mage_Core_Model_File_Uploader::getDispretionPath($fileName);
|
23 |
+
$fileName = $dispretionPath . DS . $fileName;
|
24 |
+
|
25 |
+
$fileName = $this->_getNotDuplicatedFilename($fileName, $dispretionPath);
|
26 |
+
|
27 |
+
$ioAdapter = new Varien_Io_File();
|
28 |
+
$ioAdapter->setAllowCreateFolders(true);
|
29 |
+
$distanationDirectory = dirname($this->_getConfig()->getTmpMediaPath($fileName));
|
30 |
+
|
31 |
+
try {
|
32 |
+
$ioAdapter->open(array(
|
33 |
+
'path'=>$distanationDirectory
|
34 |
+
));
|
35 |
+
|
36 |
+
/** @var $storageHelper Mage_Core_Helper_File_Storage_Database */
|
37 |
+
$storageHelper = Mage::helper('core/file_storage_database');
|
38 |
+
if ($move) {
|
39 |
+
$ioAdapter->mv($file, $this->_getConfig()->getTmpMediaPath($fileName));
|
40 |
+
|
41 |
+
//If this is used, filesystem should be configured properly
|
42 |
+
$storageHelper->saveFile($this->_getConfig()->getTmpMediaShortUrl($fileName));
|
43 |
+
} else {
|
44 |
+
$ioAdapter->cp($file, $this->_getConfig()->getTmpMediaPath($fileName));
|
45 |
+
|
46 |
+
$storageHelper->saveFile($this->_getConfig()->getTmpMediaShortUrl($fileName));
|
47 |
+
$ioAdapter->chmod($this->_getConfig()->getTmpMediaPath($fileName), 0777);
|
48 |
+
}
|
49 |
+
}
|
50 |
+
catch (Exception $e) {
|
51 |
+
Mage::throwException(Mage::helper('catalog')->__('Failed to move file: %s', $e->getMessage()));
|
52 |
+
}
|
53 |
+
|
54 |
+
$fileName = str_replace(DS, '/', $fileName);
|
55 |
+
|
56 |
+
$attrCode = $this->getAttribute()->getAttributeCode();
|
57 |
+
$mediaGalleryData = $product->getData($attrCode);
|
58 |
+
$position = 0;
|
59 |
+
if (!is_array($mediaGalleryData)) {
|
60 |
+
$mediaGalleryData = array(
|
61 |
+
'images' => array()
|
62 |
+
);
|
63 |
+
}
|
64 |
+
|
65 |
+
foreach ($mediaGalleryData['images'] as &$image) {
|
66 |
+
if (isset($image['position']) && $image['position'] > $position) {
|
67 |
+
$position = $image['position'];
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
71 |
+
$position++;
|
72 |
+
$mediaGalleryData['images'][] = array(
|
73 |
+
'file' => $fileName,
|
74 |
+
'position' => $position,
|
75 |
+
'label' => '',
|
76 |
+
'disabled' => (int) $exclude
|
77 |
+
);
|
78 |
+
|
79 |
+
$product->setData($attrCode, $mediaGalleryData);
|
80 |
+
|
81 |
+
if (!is_null($mediaAttribute)) {
|
82 |
+
$this->setMediaAttribute($product, $mediaAttribute, $fileName);
|
83 |
+
}
|
84 |
+
|
85 |
+
return $fileName;
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
app/code/local/Emizen/Svgproductimage/Model/Catalog/Product/Image.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Emizen_Svgproductimage_Model_Catalog_Product_Image extends Mage_Catalog_Model_Product_Image
|
3 |
+
{
|
4 |
+
public function getUrl()
|
5 |
+
{
|
6 |
+
|
7 |
+
$baseDir = Mage::getBaseDir('media');
|
8 |
+
$enable = Mage::getStoreConfig('svgproductimage/svgimage/enable',Mage::app()->getStore());
|
9 |
+
$ext = pathinfo($this->_newFile, PATHINFO_EXTENSION);
|
10 |
+
if($ext == "svg" && $enable)
|
11 |
+
{
|
12 |
+
$path = str_replace($baseDir . DS, "", $this->_baseFile);
|
13 |
+
}else{
|
14 |
+
$path = str_replace($baseDir . DS, "", $this->_newFile);
|
15 |
+
}
|
16 |
+
|
17 |
+
return Mage::getBaseUrl('media') . str_replace(DS, '/', $path);
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
app/code/local/Emizen/Svgproductimage/Model/ImportExport/Import/Entity/Product.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Emizen_Svgproductimage_Model_ImportExport_Import_Entity_Product extends Mage_ImportExport_Model_Import_Entity_Product
|
3 |
+
{
|
4 |
+
protected function _getUploader()
|
5 |
+
{
|
6 |
+
if (is_null($this->_fileUploader)) {
|
7 |
+
$this->_fileUploader = new Emizen_Svgproductimage_Model_ImportExport_Import_Uploader();
|
8 |
+
|
9 |
+
$this->_fileUploader->init();
|
10 |
+
|
11 |
+
$tmpDir = Mage::getConfig()->getOptions()->getMediaDir() . '/import';
|
12 |
+
$destDir = Mage::getConfig()->getOptions()->getMediaDir() . '/catalog/product';
|
13 |
+
if (!is_writable($destDir)) {
|
14 |
+
@mkdir($destDir, 0777, true);
|
15 |
+
}
|
16 |
+
if (!$this->_fileUploader->setTmpDir($tmpDir)) {
|
17 |
+
Mage::throwException("File directory '{$tmpDir}' is not readable.");
|
18 |
+
}
|
19 |
+
if (!$this->_fileUploader->setDestDir($destDir)) {
|
20 |
+
Mage::throwException("File directory '{$destDir}' is not writable.");
|
21 |
+
}
|
22 |
+
}
|
23 |
+
return $this->_fileUploader;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
app/code/local/Emizen/Svgproductimage/Model/ImportExport/Import/Uploader.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Emizen_Svgproductimage_Model_ImportExport_Import_Uploader extends Mage_ImportExport_Model_Import_Uploader
|
3 |
+
{
|
4 |
+
protected $_allowedMimeTypes = array(
|
5 |
+
'jpg' => 'image/jpeg',
|
6 |
+
'jpeg' => 'image/jpeg',
|
7 |
+
'gif' => 'image/gif',
|
8 |
+
'png' => 'image/png',
|
9 |
+
'svg' => 'image/svg'
|
10 |
+
);
|
11 |
+
|
12 |
+
}
|
13 |
+
|
app/code/local/Emizen/Svgproductimage/Model/Observer.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Emizen_Svgproductimage_Model_Observer
|
3 |
+
{
|
4 |
+
|
5 |
+
public function setFlexUploaderConfig(Varien_Event_Observer $observer)
|
6 |
+
{
|
7 |
+
$enable = Mage::getStoreConfig('svgproductimage/svgimage/enable',Mage::app()->getStore());
|
8 |
+
if($enable)
|
9 |
+
{
|
10 |
+
$uploaderConfig = $observer->getBlock()->getUploader()->getConfig();
|
11 |
+
$additionalExtensions = array('*.svg');
|
12 |
+
$uploaderFileFilters = $uploaderConfig->getFilters();
|
13 |
+
$uploaderFileFilters['vector_images'] = array(
|
14 |
+
'label' => 'Vector Images(' . join(', ', $additionalExtensions) . ')',
|
15 |
+
'files' => $additionalExtensions
|
16 |
+
);
|
17 |
+
$uploaderConfig->setFilters($uploaderFileFilters);
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
|
22 |
+
|
23 |
+
}
|
app/code/local/Emizen/Svgproductimage/controllers/Adminhtml/Catalog/Product/GalleryController.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once "Mage/Adminhtml/controllers/Catalog/Product/GalleryController.php";
|
3 |
+
class Emizen_Svgproductimage_Adminhtml_Catalog_Product_GalleryController extends Mage_Adminhtml_Catalog_Product_GalleryController{
|
4 |
+
public static $allowedImageExtensions = array('jpg', 'jpeg', 'gif', 'png');
|
5 |
+
public static $allowedVectorExtensions = array('svg');
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Overridden to reconfigure the Uploader
|
9 |
+
*
|
10 |
+
* (non-PHPdoc)
|
11 |
+
* @see Mage_Adminhtml_Catalog_Product_GalleryController::uploadAction()
|
12 |
+
*/
|
13 |
+
public function uploadAction()
|
14 |
+
{
|
15 |
+
try {
|
16 |
+
$uploader = new Mage_Core_Model_File_Uploader('image');
|
17 |
+
|
18 |
+
|
19 |
+
// BEGIN change
|
20 |
+
$uploader->setAllowedExtensions($this->_getAllowedExtensions());
|
21 |
+
$uploader->addValidateCallback('catalog_product_image', $this, 'validateUploadImage');
|
22 |
+
$uploader->addValidateCallback('svg_image', $this, 'validateUploadVector');
|
23 |
+
// END change
|
24 |
+
|
25 |
+
|
26 |
+
$uploader->setAllowRenameFiles(true);
|
27 |
+
$uploader->setFilesDispersion(true);
|
28 |
+
$result = $uploader->save(
|
29 |
+
Mage::getSingleton('catalog/product_media_config')->getBaseTmpMediaPath()
|
30 |
+
);
|
31 |
+
|
32 |
+
Mage::dispatchEvent('catalog_product_gallery_upload_image_after', array(
|
33 |
+
'result' => $result,
|
34 |
+
'action' => $this
|
35 |
+
));
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Workaround for prototype 1.7 methods "isJSON", "evalJSON" on Windows OS
|
39 |
+
*/
|
40 |
+
$result['tmp_name'] = str_replace(DS, "/", $result['tmp_name']);
|
41 |
+
$result['path'] = str_replace(DS, "/", $result['path']);
|
42 |
+
|
43 |
+
$result['url'] = Mage::getSingleton('catalog/product_media_config')->getTmpMediaUrl($result['file']);
|
44 |
+
$result['file'] = $result['file'] . '.tmp';
|
45 |
+
$result['cookie'] = array(
|
46 |
+
'name' => session_name(),
|
47 |
+
'value' => $this->_getSession()->getSessionId(),
|
48 |
+
'lifetime' => $this->_getSession()->getCookieLifetime(),
|
49 |
+
'path' => $this->_getSession()->getCookiePath(),
|
50 |
+
'domain' => $this->_getSession()->getCookieDomain()
|
51 |
+
);
|
52 |
+
|
53 |
+
} catch (Exception $e) {
|
54 |
+
$result = array(
|
55 |
+
'error' => $e->getMessage(),
|
56 |
+
'errorcode' => $e->getCode());
|
57 |
+
}
|
58 |
+
|
59 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
60 |
+
}
|
61 |
+
|
62 |
+
protected function _getAllowedExtensions()
|
63 |
+
{
|
64 |
+
return array_merge(self::$allowedImageExtensions, self::$allowedVectorExtensions);
|
65 |
+
}
|
66 |
+
public function validateUploadImage($file)
|
67 |
+
{
|
68 |
+
if (in_array(pathinfo($file, PATHINFO_EXTENSION), self::$allowedImageExtensions)) {
|
69 |
+
return Mage::helper('catalog/image')->validateUploadFile($file);
|
70 |
+
}
|
71 |
+
}
|
72 |
+
public function validateUploadVector($file)
|
73 |
+
{
|
74 |
+
if (in_array(pathinfo($file, PATHINFO_EXTENSION), self::$allowedVectorExtensions)) {
|
75 |
+
//TODO throw exception if invalid file
|
76 |
+
return;
|
77 |
+
}
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
app/code/local/Emizen/Svgproductimage/etc/adminhtml.xml
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<admin>
|
6 |
+
<children>
|
7 |
+
<system>
|
8 |
+
<children>
|
9 |
+
<config>
|
10 |
+
<children>
|
11 |
+
<svgproductimage translate="title" module="svgproductimage">
|
12 |
+
<title>SVG Product Image Section</title>
|
13 |
+
<sort_order>0</sort_order>
|
14 |
+
</svgproductimage>
|
15 |
+
</children>
|
16 |
+
</config>
|
17 |
+
</children>
|
18 |
+
</system>
|
19 |
+
</children>
|
20 |
+
</admin>
|
21 |
+
</resources>
|
22 |
+
</acl>
|
23 |
+
</config>
|
app/code/local/Emizen/Svgproductimage/etc/config.xml
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Emizen_Svgproductimage>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Emizen_Svgproductimage>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<svgproductimage>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Emizen_Svgproductimage</module>
|
14 |
+
<frontName>svgproductimage</frontName>
|
15 |
+
</args>
|
16 |
+
</svgproductimage>
|
17 |
+
</routers>
|
18 |
+
</frontend>
|
19 |
+
<global>
|
20 |
+
<rewrite>
|
21 |
+
<emizen_svgproductimage_adminhtml_catalog_product_gallerycontroller>
|
22 |
+
<from><![CDATA[#^/admin/catalog_product_gallery/#]]></from> <!-- Mage_Adminhtml_Catalog_Product_GalleryController -->
|
23 |
+
<to>/svgproductimage/adminhtml_catalog_product_gallery/</to> <!-- Emizen_Svgproductimage_Adminhtml_Catalog_Product_GalleryController -->
|
24 |
+
</emizen_svgproductimage_adminhtml_catalog_product_gallerycontroller>
|
25 |
+
</rewrite>
|
26 |
+
<helpers>
|
27 |
+
<svgproductimage>
|
28 |
+
<class>Emizen_Svgproductimage_Helper</class>
|
29 |
+
</svgproductimage>
|
30 |
+
<catalog>
|
31 |
+
<rewrite>
|
32 |
+
<image>Emizen_Svgproductimage_Helper_Catalog_Image</image>
|
33 |
+
</rewrite>
|
34 |
+
</catalog>
|
35 |
+
</helpers>
|
36 |
+
<models>
|
37 |
+
<svgproductimage>
|
38 |
+
<class>Emizen_Svgproductimage_Model</class>
|
39 |
+
<resourceModel>svgproductimage_mysql4</resourceModel>
|
40 |
+
</svgproductimage>
|
41 |
+
<catalog>
|
42 |
+
<rewrite>
|
43 |
+
<product_image>Emizen_Svgproductimage_Model_Catalog_Product_Image</product_image>
|
44 |
+
</rewrite>
|
45 |
+
</catalog>
|
46 |
+
<catalog>
|
47 |
+
<rewrite>
|
48 |
+
<product_attribute_backend_media>Emizen_Svgproductimage_Model_Catalog_Product_Attribute_Backend_Media</product_attribute_backend_media>
|
49 |
+
</rewrite>
|
50 |
+
</catalog>
|
51 |
+
<importexport>
|
52 |
+
<rewrite>
|
53 |
+
<import_uploader>Emizen_Svgproductimage_Model_ImportExport_Import_Uploader</import_uploader>
|
54 |
+
</rewrite>
|
55 |
+
</importexport>
|
56 |
+
<importexport>
|
57 |
+
<rewrite>
|
58 |
+
<import_entity_product>Emizen_Svgproductimage_Model_ImportExport_Import_Entity_Product</import_entity_product>
|
59 |
+
</rewrite>
|
60 |
+
</importexport>
|
61 |
+
</models>
|
62 |
+
<events>
|
63 |
+
<catalog_product_gallery_prepare_layout> <!-- identifier of the event we want to catch -->
|
64 |
+
<observers>
|
65 |
+
<catalog_product_gallery_prepare_layout_handler> <!-- identifier of the event handler -->
|
66 |
+
<type>model</type> <!-- class method call type; valid are model, object and singleton -->
|
67 |
+
<class>svgproductimage/observer</class> <!-- observers class alias -->
|
68 |
+
<method>setFlexUploaderConfig</method> <!-- observer's method to be called -->
|
69 |
+
<args></args> <!-- additional arguments passed to observer -->
|
70 |
+
</catalog_product_gallery_prepare_layout_handler>
|
71 |
+
</observers>
|
72 |
+
</catalog_product_gallery_prepare_layout>
|
73 |
+
|
74 |
+
</events>
|
75 |
+
</global>
|
76 |
+
<admin>
|
77 |
+
<routers>
|
78 |
+
<svgproductimage>
|
79 |
+
<use>admin</use>
|
80 |
+
<args>
|
81 |
+
<module>Emizen_Svgproductimage</module>
|
82 |
+
<frontName>admin_svgproductimage</frontName>
|
83 |
+
</args>
|
84 |
+
</svgproductimage>
|
85 |
+
</routers>
|
86 |
+
</admin>
|
87 |
+
</config>
|
app/code/local/Emizen/Svgproductimage/etc/system.xml
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<emizen translate="label" module="svgproductimage">
|
5 |
+
<label>Emizen</label>
|
6 |
+
<sort_order>0</sort_order>
|
7 |
+
</emizen>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<svgproductimage translate="label" module="svgproductimage">
|
11 |
+
<label>SVG Product Image</label>
|
12 |
+
<tab>emizen</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>0</sort_order>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>1</show_in_store>
|
18 |
+
<groups>
|
19 |
+
<svgimage translate="label">
|
20 |
+
<label>SVG Image Section</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>0</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>1</show_in_website>
|
25 |
+
<show_in_store>1</show_in_store>
|
26 |
+
<fields>
|
27 |
+
<enable translate="label">
|
28 |
+
<label>Enable</label>
|
29 |
+
<frontend_type>select</frontend_type>
|
30 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
31 |
+
<sort_order>0</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>1</show_in_website>
|
34 |
+
<show_in_store>1</show_in_store>
|
35 |
+
<comment>enable/disable the module</comment>
|
36 |
+
</enable>
|
37 |
+
</fields>
|
38 |
+
</svgimage>
|
39 |
+
</groups>
|
40 |
+
</svgproductimage>
|
41 |
+
</sections>
|
42 |
+
</config>
|
app/etc/modules/Emizen_Svgproductimage.xml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Emizen_Svgproductimage>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
<version>0.1.0</version>
|
8 |
+
</Emizen_Svgproductimage>
|
9 |
+
</modules>
|
10 |
+
</config>
|
catalog_product_20150205_070514.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
sku,_store,_attribute_set,_type,_category,_root_category,_product_websites,accessories_size,accessories_type,apparel_type,author_artist,bag_luggage_type,bedding_pattern,bed_bath_type,books_music_type,camera_megapixels,camera_type,color,cost,country_of_manufacture,created_at,custom_design,custom_design_from,custom_design_to,custom_layout_update,decor_type,description,electronic_type,fit,format,frame_style,gallery,gender,gendered,genre,gift_message_available,gift_wrapping_available,gift_wrapping_price,has_options,homeware_style,home_decor_type,image,image_label,jewelry_type,length,lens_type,luggage_size,luggage_style,luggage_travel_style,manufacturer,material,media_gallery,meta_description,meta_keyword,meta_title,minimal_price,msrp,msrp_display_actual_price_type,msrp_enabled,name,necklace_length,news_from_date,news_to_date,occasion,options_container,page_layout,price,required_options,shoe_size,shoe_type,short_description,size,sleeve_length,small_image,small_image_label,special_from_date,special_price,special_to_date,status,style,tax_class_id,thumbnail,thumbnail_label,updated_at,visibility,weight,width,qty,min_qty,use_config_min_qty,is_qty_decimal,backorders,use_config_backorders,min_sale_qty,use_config_min_sale_qty,max_sale_qty,use_config_max_sale_qty,is_in_stock,notify_stock_qty,use_config_notify_stock_qty,manage_stock,use_config_manage_stock,stock_status_changed_auto,use_config_qty_increments,qty_increments,use_config_enable_qty_inc,enable_qty_increments,is_decimal_divided,_links_related_sku,_links_related_position,_links_crosssell_sku,_links_crosssell_position,_links_upsell_sku,_links_upsell_position,_associated_sku,_associated_default_qty,_associated_position,_tier_price_website,_tier_price_customer_group,_tier_price_qty,_tier_price_price,_group_price_website,_group_price_customer_group,_group_price_price,_media_attribute_id,_media_image,_media_lable,_media_position,_media_is_disabled,_custom_option_store,_custom_option_type,_custom_option_title,_custom_option_is_required,_custom_option_price,_custom_option_sku,_custom_option_max_characters,_custom_option_sort_order,_custom_option_row_title,_custom_option_row_price,_custom_option_row_sku,_custom_option_row_sort,_super_products_sku,_super_attribute_code,_super_attribute_option,_super_attribute_price_corr
|
2 |
+
Svg-import,,Default,simple,VIP,Default Category,base,,,,,,,,,,,,,,2015-02-05 06:50:51,,,,,,svg image test,,,,,,,,,,No,,0,,,/checked.svg,,,,,,,,,,,,,,,,Use config,Use config,svg image test,,,,,Block after Info Column,,100,0,,,svg image test,,,/checked.svg,,,,,1,,0,/checked.svg,,2015-02-05 06:50:51,4,10,,100,0,1,0,0,1,1,1,0,1,1,,1,0,1,0,1,0,1,0,0,,,,,,,,,,,,,,,,,88,/checked.svg,,1,0,,,,,,,,,,,,,,,,
|
export_all_products.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
store,websites,attribute_set,type,category_ids,sku,has_options,price,special_price,weight,msrp,gift_wrapping_price,name,meta_title,meta_description,image,small_image,thumbnail,url_key,url_path,custom_design,page_layout,options_container,image_label,small_image_label,thumbnail_label,country_of_manufacture,msrp_enabled,msrp_display_actual_price_type,gift_message_available,gift_wrapping_available,status,is_recurring,visibility,tax_class_id,description,short_description,meta_keyword,custom_layout_update,special_from_date,special_to_date,news_from_date,news_to_date,custom_design_from,custom_design_to,qty,min_qty,use_config_min_qty,is_qty_decimal,backorders,use_config_backorders,min_sale_qty,use_config_min_sale_qty,max_sale_qty,use_config_max_sale_qty,is_in_stock,low_stock_date,notify_stock_qty,use_config_notify_stock_qty,manage_stock,use_config_manage_stock,stock_status_changed_auto,use_config_qty_increments,qty_increments,use_config_enable_qty_inc,enable_qty_increments,is_decimal_divided,stock_status_changed_automatically,use_config_enable_qty_increments,product_name,store_id,product_type_id,product_status_changed,product_changed_websites
|
2 |
+
admin,base,Default,simple,9,Svg-dataflow,0,100,,10,,,svg image test,,,/checked.svg,/checked.svg,/checked.svg,svg-image-test,svg-image-test.html,,No layout updates,Block after Info Column,,,, ,Use config,Use config,No,No,Enabled,No,"Catalog, Search",None,svg image test,svg image test,,,,,,,,,100,0,1,0,0,1,1,1,0,1,1,,,1,0,1,0,1,0,1,0,0,0,1,svg image test,0,simple,,
|
package.xml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Emizen_Svgproductimage</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>It will enable to upload .sgv images for products.</summary>
|
10 |
+
<description>Using this extension, user can upload .svg images for products. User can upload via product editor and via import as well.
|
11 |
+

|
12 |
+
</description>
|
13 |
+
<notes>Using this extension, user can upload .svg images for products. User can upload via product editor and via import as well.
|
14 |
+
</notes>
|
15 |
+
<authors><author><name>Emizen Tech Private Limited</name><user>emizen</user><email>info@emizentech.com</email></author></authors>
|
16 |
+
<date>2015-02-05</date>
|
17 |
+
<time>07:33:25</time>
|
18 |
+
<contents><target name="magelocal"><dir name="Emizen"><dir name="Svgproductimage"><dir><dir name="Helper"><dir name="Catalog"><file name="Image.php" hash="9958619a1df7237321df52d52f5b3188"/></dir><file name="Data.php" hash="96828f9341002109cf120fbcd8b8bc1a"/></dir><dir name="Model"><dir name="Catalog"><dir name="Product"><dir name="Attribute"><dir name="Backend"><file name="Media.php" hash="2e6928d402b91f48809bc4b1ab272b69"/></dir></dir><file name="Image.php" hash="742cf43e0bd301a24f4b8691ae96c0e5"/></dir></dir><dir name="ImportExport"><dir name="Import"><dir name="Entity"><file name="Product.php" hash="05ec4db2caccd484dfe61e0a29a134d7"/></dir><file name="Uploader.php" hash="d810c91e4c3af7cff3e31fd4fa956349"/></dir></dir><file name="Observer.php" hash="913bf3605b47ca87044fa611a42164c9"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><file name="GalleryController.php" hash="b80b02a619918e0145b9b28f8e75ffa2"/></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="b0ac5d5d3c42d0a866e7cb8b70029286"/><file name="config.xml" hash="3042f69620b10878717be2b7c5f1a02d"/><file name="system.xml" hash="2486475b4ddf97c443a0575690518eb0"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Emizen_Svgproductimage.xml" hash="f9715c3e5bd1a48a6a3ac2fd51504cc7"/></dir></target><target name="mage"><dir name="."><file name="catalog_product_20150205_070514.csv" hash="84bebe8de24ac76ce2a8c6f9a67d57f1"/><file name="export_all_products.csv" hash="769b9dd6aca04c6d0917f7c1f201b53c"/></dir></target></contents>
|
19 |
+
<compatible/>
|
20 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
21 |
+
</package>
|