Version Notes
Allow to create pictograms and to link them with products
Download this release
Release Info
Developer | Auguria |
Extension | Auguria_ProductsEnhancement |
Version | 0.2.1 |
Comparing to | |
See all releases |
Version 0.2.1
- app/code/community/Auguria/ProductsEnhancement/Block/Adminhtml/Productsenhancement.php +20 -0
- app/code/community/Auguria/ProductsEnhancement/Block/Adminhtml/Productsenhancement/Edit.php +50 -0
- app/code/community/Auguria/ProductsEnhancement/Block/Adminhtml/Productsenhancement/Edit/Form.php +24 -0
- app/code/community/Auguria/ProductsEnhancement/Block/Adminhtml/Productsenhancement/Edit/Tab/Form.php +58 -0
- app/code/community/Auguria/ProductsEnhancement/Block/Adminhtml/Productsenhancement/Edit/Tabs.php +28 -0
- app/code/community/Auguria/ProductsEnhancement/Block/Adminhtml/Productsenhancement/Grid.php +89 -0
- app/code/community/Auguria/ProductsEnhancement/Helper/Data.php +11 -0
- app/code/community/Auguria/ProductsEnhancement/Model/Catalog/Product/Attribute/Source/Pictogram.php +23 -0
- app/code/community/Auguria/ProductsEnhancement/Model/Mysql4/Productsenhancement.php +15 -0
- app/code/community/Auguria/ProductsEnhancement/Model/Mysql4/Productsenhancement/Collection.php +22 -0
- app/code/community/Auguria/ProductsEnhancement/Model/Productsenhancement.php +62 -0
- app/code/community/Auguria/ProductsEnhancement/controllers/Adminhtml/ProductsenhancementController.php +223 -0
- app/code/community/Auguria/ProductsEnhancement/etc/config.xml +126 -0
- app/code/community/Auguria/ProductsEnhancement/sql/auguria_productsenhancement_setup/mysql4-install-0.1.0.php +34 -0
- app/code/community/Auguria/ProductsEnhancement/sql/auguria_productsenhancement_setup/mysql4-upgrade-0.1.0-0.1.1.php +18 -0
- app/code/community/Auguria/ProductsEnhancement/sql/auguria_productsenhancement_setup/mysql4-upgrade-0.1.1-0.2.0.php +14 -0
- app/design/adminhtml/default/default/layout/auguria/productsenhancement.xml +16 -0
- app/design/frontend/base/default/layout/auguria/productsenhancement.xml +24 -0
- app/design/frontend/base/default/template/auguria/productsenhancement/product/list/pictograms.phtml +39 -0
- app/design/frontend/base/default/template/auguria/productsenhancement/product/view/pictograms.phtml +44 -0
- app/etc/modules/Auguria_ProductsEnhancement.xml +17 -0
- app/locale/fr_FR/Auguria_ProductsEnhancement.csv +17 -0
- package.xml +19 -0
- skin/frontend/base/default/css/auguria/productsenhancement/productsenhancement.css +36 -0
app/code/community/Auguria/ProductsEnhancement/Block/Adminhtml/Productsenhancement.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_ProductsEnhancement
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
class Auguria_ProductsEnhancement_Block_Adminhtml_Productsenhancement extends Mage_Adminhtml_Block_Widget_Grid_Container
|
9 |
+
{
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
$this->setTemplate('widget/grid/container.phtml');
|
13 |
+
|
14 |
+
$this->_controller = 'adminhtml_productsenhancement';
|
15 |
+
$this->_blockGroup = 'auguria_productsenhancement';
|
16 |
+
$this->_headerText = $this->__('Pictograms list');
|
17 |
+
$this->_addButtonLabel = $this->__('Add pictogram');
|
18 |
+
parent::__construct();
|
19 |
+
}
|
20 |
+
}
|
app/code/community/Auguria/ProductsEnhancement/Block/Adminhtml/Productsenhancement/Edit.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_ProductsEnhancement
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
class Auguria_ProductsEnhancement_Block_Adminhtml_Productsenhancement_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
9 |
+
{
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
parent::__construct();
|
13 |
+
|
14 |
+
$this->_objectId = 'id';
|
15 |
+
$this->_blockGroup = 'auguria_productsenhancement';
|
16 |
+
$this->_controller = 'adminhtml_productsenhancement';
|
17 |
+
|
18 |
+
$this->_updateButton('save', 'label', Mage::helper('auguria_productsenhancement')->__('Save Item'));
|
19 |
+
$this->_updateButton('delete', 'label', Mage::helper('auguria_productsenhancement')->__('Delete Item'));
|
20 |
+
|
21 |
+
$this->_addButton('saveandcontinue', array(
|
22 |
+
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
23 |
+
'onclick' => 'saveAndContinueEdit()',
|
24 |
+
'class' => 'save',
|
25 |
+
), -100);
|
26 |
+
|
27 |
+
$this->_formScripts[] = "
|
28 |
+
function toggleEditor() {
|
29 |
+
if (tinyMCE.getInstanceById('productsenhancement_content') == null) {
|
30 |
+
tinyMCE.execCommand('mceAddControl', false, 'productsenhancement_content');
|
31 |
+
} else {
|
32 |
+
tinyMCE.execCommand('mceRemoveControl', false, 'productsenhancement_content');
|
33 |
+
}
|
34 |
+
}
|
35 |
+
|
36 |
+
function saveAndContinueEdit(){
|
37 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
38 |
+
}
|
39 |
+
";
|
40 |
+
}
|
41 |
+
|
42 |
+
public function getHeaderText()
|
43 |
+
{
|
44 |
+
if( Mage::registry('productsenhancement_data') && Mage::registry('productsenhancement_data')->getId() ) {
|
45 |
+
return Mage::helper('auguria_productsenhancement')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('productsenhancement_data')->getOptionName()));
|
46 |
+
} else {
|
47 |
+
return Mage::helper('auguria_productsenhancement')->__('Add Item');
|
48 |
+
}
|
49 |
+
}
|
50 |
+
}
|
app/code/community/Auguria/ProductsEnhancement/Block/Adminhtml/Productsenhancement/Edit/Form.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_ProductsEnhancement
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
class Auguria_ProductsEnhancement_Block_Adminhtml_Productsenhancement_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
9 |
+
{
|
10 |
+
protected function _prepareForm()
|
11 |
+
{
|
12 |
+
$form = new Varien_Data_Form(array(
|
13 |
+
'id' => 'edit_form',
|
14 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
15 |
+
'method' => 'post',
|
16 |
+
'enctype' => 'multipart/form-data'
|
17 |
+
)
|
18 |
+
);
|
19 |
+
|
20 |
+
$form->setUseContainer(true);
|
21 |
+
$this->setForm($form);
|
22 |
+
return parent::_prepareForm();
|
23 |
+
}
|
24 |
+
}
|
app/code/community/Auguria/ProductsEnhancement/Block/Adminhtml/Productsenhancement/Edit/Tab/Form.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_ProductsEnhancement
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
class Auguria_ProductsEnhancement_Block_Adminhtml_Productsenhancement_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
|
9 |
+
{
|
10 |
+
protected function _prepareForm()
|
11 |
+
{
|
12 |
+
$form = new Varien_Data_Form();
|
13 |
+
$this->setForm($form);
|
14 |
+
$fieldset = $form->addFieldset('productsenhancement_form', array('legend'=>Mage::helper('auguria_productsenhancement')->__('Item information')));
|
15 |
+
|
16 |
+
$fieldset->addField('option_name', 'text', array(
|
17 |
+
'label' => Mage::helper('auguria_productsenhancement')->__('Option Name'),
|
18 |
+
'class' => 'required-entry input-text',
|
19 |
+
'required' => true,
|
20 |
+
'name' => 'option_name',
|
21 |
+
));
|
22 |
+
|
23 |
+
$fieldset->addField('filename', 'file', array(
|
24 |
+
'label' => Mage::helper('auguria_productsenhancement')->__('Image File'),
|
25 |
+
'required' => false,
|
26 |
+
'name' => 'filename',
|
27 |
+
));
|
28 |
+
|
29 |
+
$fieldset->addField('title', 'text', array(
|
30 |
+
'label' => Mage::helper('auguria_productsenhancement')->__('Title tag'),
|
31 |
+
'class' => 'input-text',
|
32 |
+
'name' => 'title',
|
33 |
+
));
|
34 |
+
|
35 |
+
$fieldset->addField('alt', 'text', array(
|
36 |
+
'label' => Mage::helper('auguria_productsenhancement')->__('Alt tag'),
|
37 |
+
'class' => 'input-text',
|
38 |
+
'name' => 'alt',
|
39 |
+
));
|
40 |
+
|
41 |
+
$fieldset->addField('description', 'text', array(
|
42 |
+
'label' => Mage::helper('auguria_productsenhancement')->__('Description'),
|
43 |
+
'class' => 'input-text',
|
44 |
+
'name' => 'description',
|
45 |
+
));
|
46 |
+
|
47 |
+
if (Mage::getSingleton('adminhtml/session')->getBannerSliderData())
|
48 |
+
{
|
49 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getProductsenhancementData());
|
50 |
+
Mage::getSingleton('adminhtml/session')->setProductsenhancementData(null);
|
51 |
+
}
|
52 |
+
elseif (Mage::registry('productsenhancement_data'))
|
53 |
+
{
|
54 |
+
$form->setValues(Mage::registry('productsenhancement_data')->getData());
|
55 |
+
}
|
56 |
+
return parent::_prepareForm();
|
57 |
+
}
|
58 |
+
}
|
app/code/community/Auguria/ProductsEnhancement/Block/Adminhtml/Productsenhancement/Edit/Tabs.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_ProductsEnhancement
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
class Auguria_ProductsEnhancement_Block_Adminhtml_Productsenhancement_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
9 |
+
{
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
parent::__construct();
|
13 |
+
$this->setId('productsenhancement_tabs');
|
14 |
+
$this->setDestElementId('edit_form');
|
15 |
+
$this->setTitle(Mage::helper('auguria_productsenhancement')->__('Item Information'));
|
16 |
+
}
|
17 |
+
|
18 |
+
protected function _beforeToHtml()
|
19 |
+
{
|
20 |
+
$this->addTab('form_section', array(
|
21 |
+
'label' => Mage::helper('auguria_productsenhancement')->__('Item Information'),
|
22 |
+
'title' => Mage::helper('auguria_productsenhancement')->__('Item Information'),
|
23 |
+
'content' => $this->getLayout()->createBlock('auguria_productsenhancement/adminhtml_productsenhancement_edit_tab_form')->toHtml(),
|
24 |
+
));
|
25 |
+
|
26 |
+
return parent::_beforeToHtml();
|
27 |
+
}
|
28 |
+
}
|
app/code/community/Auguria/ProductsEnhancement/Block/Adminhtml/Productsenhancement/Grid.php
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_ProductsEnhancement
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
class Auguria_ProductsEnhancement_Block_Adminhtml_Productsenhancement_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
9 |
+
{
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
parent::__construct();
|
13 |
+
$this->setId('productsenhancementGrid');
|
14 |
+
$this->setDefaultSort('auguria_productsenhancement_id');
|
15 |
+
$this->setDefaultDir('ASC');
|
16 |
+
$this->setSaveParametersInSession(true);
|
17 |
+
}
|
18 |
+
|
19 |
+
protected function _prepareCollection()
|
20 |
+
{
|
21 |
+
$collection = Mage::getResourceModel('auguria_productsenhancement/productsenhancement_collection');
|
22 |
+
$this->setCollection($collection);
|
23 |
+
return parent::_prepareCollection();
|
24 |
+
}
|
25 |
+
|
26 |
+
protected function _prepareColumns()
|
27 |
+
{
|
28 |
+
$this->addColumn('auguria_productsenhancement_id', array(
|
29 |
+
'header' => Mage::helper('auguria_productsenhancement')->__('ID'),
|
30 |
+
'align' =>'right',
|
31 |
+
'width' => '40px',
|
32 |
+
'index' => 'auguria_productsenhancement_id',
|
33 |
+
));
|
34 |
+
|
35 |
+
$this->addColumn('option_name', array(
|
36 |
+
'header' => Mage::helper('auguria_productsenhancement')->__('Option name'),
|
37 |
+
'align' =>'left',
|
38 |
+
'index' => 'option_name',
|
39 |
+
));
|
40 |
+
|
41 |
+
$this->addColumn('image_path', array(
|
42 |
+
'header' => Mage::helper('auguria_productsenhancement')->__('Image'),
|
43 |
+
'align' =>'left',
|
44 |
+
'index' => 'image_path',
|
45 |
+
));
|
46 |
+
|
47 |
+
$this->addColumn('action',
|
48 |
+
array(
|
49 |
+
'header' => Mage::helper('auguria_productsenhancement')->__('Action'),
|
50 |
+
'width' => '100',
|
51 |
+
'type' => 'action',
|
52 |
+
'getter' => 'getId',
|
53 |
+
'actions' => array(
|
54 |
+
array(
|
55 |
+
'caption' => Mage::helper('auguria_productsenhancement')->__('Edit'),
|
56 |
+
'url' => array('base'=> '*/*/edit'),
|
57 |
+
'field' => 'id'
|
58 |
+
)
|
59 |
+
),
|
60 |
+
'filter' => false,
|
61 |
+
'sortable' => false,
|
62 |
+
'index' => 'stores',
|
63 |
+
'is_system' => true,
|
64 |
+
));
|
65 |
+
|
66 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('auguria_productsenhancement')->__('CSV'));
|
67 |
+
$this->addExportType('*/*/exportXml', Mage::helper('auguria_productsenhancement')->__('XML'));
|
68 |
+
|
69 |
+
return parent::_prepareColumns();
|
70 |
+
}
|
71 |
+
|
72 |
+
protected function _prepareMassaction()
|
73 |
+
{
|
74 |
+
$this->setMassactionIdField('auguria_productsenhancement_id');
|
75 |
+
$this->getMassactionBlock()->setFormFieldName('productsenhancement');
|
76 |
+
|
77 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
78 |
+
'label' => Mage::helper('auguria_productsenhancement')->__('Delete'),
|
79 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
80 |
+
'confirm' => Mage::helper('auguria_productsenhancement')->__('Are you sure?')
|
81 |
+
));
|
82 |
+
return $this;
|
83 |
+
}
|
84 |
+
|
85 |
+
public function getRowUrl($row)
|
86 |
+
{
|
87 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
88 |
+
}
|
89 |
+
}
|
app/code/community/Auguria/ProductsEnhancement/Helper/Data.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_ProductsEnhancement
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
class Auguria_ProductsEnhancement_Helper_Data extends Mage_Core_Helper_Abstract
|
9 |
+
{
|
10 |
+
|
11 |
+
}
|
app/code/community/Auguria/ProductsEnhancement/Model/Catalog/Product/Attribute/Source/Pictogram.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @category Auguria
|
5 |
+
* @package Auguria_ProductsEnhancement
|
6 |
+
* @author Auguria
|
7 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
8 |
+
*/
|
9 |
+
class Auguria_ProductsEnhancement_Model_Catalog_Product_Attribute_Source_Pictogram
|
10 |
+
extends Mage_Eav_Model_Entity_Attribute_Source_Table
|
11 |
+
{
|
12 |
+
/**
|
13 |
+
* Get list of all available pictograms
|
14 |
+
*
|
15 |
+
* @return mixed
|
16 |
+
*/
|
17 |
+
public function getAllOptions()
|
18 |
+
{
|
19 |
+
$collection = Mage::getModel('auguria_productsenhancement/productsenhancement')->getResourceCollection();
|
20 |
+
$options = $collection->toOptionArray();
|
21 |
+
return $options;
|
22 |
+
}
|
23 |
+
}
|
app/code/community/Auguria/ProductsEnhancement/Model/Mysql4/Productsenhancement.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_ProductsEnhancement
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
class Auguria_ProductsEnhancement_Model_Mysql4_Productsenhancement extends Mage_Core_Model_Mysql4_Abstract
|
9 |
+
{
|
10 |
+
public function _construct()
|
11 |
+
{
|
12 |
+
// Note that the sponsorship_id refers to the key field in your database table.
|
13 |
+
$this->_init('auguria_productsenhancement/productsenhancement', 'auguria_productsenhancement_id');
|
14 |
+
}
|
15 |
+
}
|
app/code/community/Auguria/ProductsEnhancement/Model/Mysql4/Productsenhancement/Collection.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_ProductsEnhancement
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
class Auguria_ProductsEnhancement_Model_Mysql4_Productsenhancement_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
9 |
+
{
|
10 |
+
public function _construct()
|
11 |
+
{
|
12 |
+
parent::_construct();
|
13 |
+
$this->_init('auguria_productsenhancement/productsenhancement');
|
14 |
+
}
|
15 |
+
|
16 |
+
|
17 |
+
|
18 |
+
public function toOptionArray()
|
19 |
+
{
|
20 |
+
return $this->_toOptionArray('auguria_productsenhancement_id', 'option_name');
|
21 |
+
}
|
22 |
+
}
|
app/code/community/Auguria/ProductsEnhancement/Model/Productsenhancement.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_ProductsEnhancement
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
class Auguria_ProductsEnhancement_Model_Productsenhancement extends Mage_Core_Model_Abstract
|
9 |
+
{
|
10 |
+
public function _construct()
|
11 |
+
{
|
12 |
+
parent::_construct();
|
13 |
+
$this->_init('auguria_productsenhancement/productsenhancement');
|
14 |
+
}
|
15 |
+
|
16 |
+
public function getPictogramsFromCsv($_pictogramIds)
|
17 |
+
{
|
18 |
+
$_pictogramIds = explode(",", $_pictogramIds);
|
19 |
+
$_pictograms = $this->getCollection();
|
20 |
+
if (count($_pictogramIds) > 0) {
|
21 |
+
$_pictograms->addFieldToFilter('auguria_productsenhancement_id', Array('in'=>Array($_pictogramIds)));
|
22 |
+
}
|
23 |
+
else {
|
24 |
+
$_pictograms->resetData();
|
25 |
+
}
|
26 |
+
return $_pictograms;
|
27 |
+
}
|
28 |
+
|
29 |
+
public function getPictogramImage($type)
|
30 |
+
{
|
31 |
+
$filename = $this->getImagePath();
|
32 |
+
if (isset($filename) && !empty($filename)) {
|
33 |
+
$imagePath = Mage::getBaseDir('media').'/productsenhancement/'.$type.'/'.$filename;
|
34 |
+
if (file_exists($imagePath)) {
|
35 |
+
return Mage::getBaseUrl('media').'productsenhancement/'.$type.'/'.$filename;;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
return false;
|
39 |
+
}
|
40 |
+
|
41 |
+
public function deleteImage()
|
42 |
+
{
|
43 |
+
$imagePath = $this->getImagePath();
|
44 |
+
if (isset($imagePath) && !empty($imagePath)) {
|
45 |
+
$path = Mage::getBaseDir('media') . DS . 'productsenhancement' . DS;
|
46 |
+
$imageProduct = $path. 'product' . DS . $imagePath;
|
47 |
+
$imageList = $path. 'list' . DS . $imagePath;
|
48 |
+
if (file_exists($imageProduct)) {
|
49 |
+
unlink($imageProduct);
|
50 |
+
}
|
51 |
+
if (file_exists($imageList)) {
|
52 |
+
unlink($imageList);
|
53 |
+
}
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
public function delete()
|
58 |
+
{
|
59 |
+
$this->deleteImage();
|
60 |
+
return parent::delete();
|
61 |
+
}
|
62 |
+
}
|
app/code/community/Auguria/ProductsEnhancement/controllers/Adminhtml/ProductsenhancementController.php
ADDED
@@ -0,0 +1,223 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_ProductsEnhancement
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
class Auguria_ProductsEnhancement_Adminhtml_ProductsenhancementController extends Mage_Adminhtml_Controller_action
|
9 |
+
{
|
10 |
+
|
11 |
+
protected function _initAction()
|
12 |
+
{
|
13 |
+
$this->loadLayout()
|
14 |
+
->_setActiveMenu('productsenhancement/items')
|
15 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
16 |
+
|
17 |
+
return $this;
|
18 |
+
}
|
19 |
+
|
20 |
+
public function indexAction()
|
21 |
+
{
|
22 |
+
$this->_initAction()
|
23 |
+
->renderLayout();
|
24 |
+
}
|
25 |
+
|
26 |
+
|
27 |
+
public function editAction()
|
28 |
+
{
|
29 |
+
$id = $this->getRequest()->getParam('id');
|
30 |
+
|
31 |
+
$model = Mage::getModel('auguria_productsenhancement/productsenhancement')->load($id);
|
32 |
+
if ($model->getId() || $id == 0)
|
33 |
+
{
|
34 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
35 |
+
if (!empty($data))
|
36 |
+
{
|
37 |
+
$model->setData($data);
|
38 |
+
}
|
39 |
+
|
40 |
+
Mage::register('productsenhancement_data', $model);
|
41 |
+
|
42 |
+
$this->loadLayout();
|
43 |
+
$this->_setActiveMenu('productsenhancement/items');
|
44 |
+
|
45 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
46 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
|
47 |
+
|
48 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
49 |
+
|
50 |
+
$this->_addContent($this->getLayout()->createBlock('auguria_productsenhancement/adminhtml_productsenhancement_edit'))
|
51 |
+
->_addLeft($this->getLayout()->createBlock('auguria_productsenhancement/adminhtml_productsenhancement_edit_tabs'));
|
52 |
+
|
53 |
+
$this->renderLayout();
|
54 |
+
}
|
55 |
+
else
|
56 |
+
{
|
57 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('auguria_productsenhancement')->__('Item does not exist'));
|
58 |
+
$this->_redirect('*/*/');
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
public function newAction()
|
63 |
+
{
|
64 |
+
$this->_forward('edit');
|
65 |
+
}
|
66 |
+
|
67 |
+
public function saveAction()
|
68 |
+
{
|
69 |
+
if ($data = $this->getRequest()->getPost())
|
70 |
+
{
|
71 |
+
if(isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '')
|
72 |
+
{
|
73 |
+
try
|
74 |
+
{
|
75 |
+
// Upload file
|
76 |
+
$uploader = new Varien_File_Uploader('filename');
|
77 |
+
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
|
78 |
+
$uploader->setFilesDispersion(false);
|
79 |
+
$path = Mage::getBaseDir('media') . DS . 'productsenhancement' . DS;
|
80 |
+
$fileName = $_FILES['filename']['name'];
|
81 |
+
$uploader->save($path.'product'. DS, $fileName );
|
82 |
+
|
83 |
+
// Resize uploaded file for list
|
84 |
+
$image = new Varien_Image_Adapter_Gd2();
|
85 |
+
$image->open($path.'product'. DS. $fileName);
|
86 |
+
$image->keepAspectRatio(true);
|
87 |
+
$image->keepTransparency(true);
|
88 |
+
$image->quality(100);
|
89 |
+
$image->resize(Mage::getStoreConfig('auguria_productsenhancement/images/list/width'),Mage::getStoreConfig('productsenhancement/images/list/height'));
|
90 |
+
$image->save($path.'list'. DS . $fileName);
|
91 |
+
|
92 |
+
|
93 |
+
// Resize uploaded file for product view
|
94 |
+
$image = new Varien_Image_Adapter_Gd2();
|
95 |
+
$image->open($path.'product'. DS. $fileName);
|
96 |
+
$image->keepAspectRatio(true);
|
97 |
+
$image->keepTransparency(true);
|
98 |
+
$image->quality(100);
|
99 |
+
$image->resize(Mage::getStoreConfig('auguria_productsenhancement/images/product/width'),Mage::getStoreConfig('productsenhancement/images/product/height'));
|
100 |
+
$image->save($path.'product'. DS. $fileName);
|
101 |
+
}
|
102 |
+
catch (Exception $e)
|
103 |
+
{
|
104 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
105 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
106 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
107 |
+
return;
|
108 |
+
}
|
109 |
+
|
110 |
+
// Set image name
|
111 |
+
$data['image_path'] = $_FILES['filename']['name'];
|
112 |
+
}
|
113 |
+
|
114 |
+
try
|
115 |
+
{
|
116 |
+
$enhancementId = $this->getRequest()->getParam('id');
|
117 |
+
$model = Mage::getModel('auguria_productsenhancement/productsenhancement')->load($enhancementId);
|
118 |
+
$data['auguria_productsenhancement_id'] = $enhancementId;
|
119 |
+
|
120 |
+
//save enhancement
|
121 |
+
$model->setData($data);
|
122 |
+
$model->save();
|
123 |
+
|
124 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('auguria_productsenhancement')->__('Item was successfully saved'));
|
125 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
126 |
+
|
127 |
+
if ($this->getRequest()->getParam('back'))
|
128 |
+
{
|
129 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
130 |
+
return;
|
131 |
+
}
|
132 |
+
$this->_redirect('*/*/');
|
133 |
+
return;
|
134 |
+
}
|
135 |
+
catch (Exception $e)
|
136 |
+
{
|
137 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
138 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
139 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
140 |
+
return;
|
141 |
+
}
|
142 |
+
}
|
143 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('auguria_productsenhancement')->__('Unable to find item to save'));
|
144 |
+
$this->_redirect('*/*/');
|
145 |
+
}
|
146 |
+
|
147 |
+
public function deleteAction()
|
148 |
+
{
|
149 |
+
if( $this->getRequest()->getParam('id') > 0 ) {
|
150 |
+
try {
|
151 |
+
$model = Mage::getModel('auguria_productsenhancement/productsenhancement')->load($this->getRequest()->getParam('id'));
|
152 |
+
$model->delete();
|
153 |
+
|
154 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
|
155 |
+
$this->_redirect('*/*/');
|
156 |
+
}
|
157 |
+
catch (Exception $e) {
|
158 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
159 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
160 |
+
}
|
161 |
+
}
|
162 |
+
$this->_redirect('*/*/');
|
163 |
+
}
|
164 |
+
|
165 |
+
public function massDeleteAction()
|
166 |
+
{
|
167 |
+
$productsenhancementIds = $this->getRequest()->getParam('productsenhancement');
|
168 |
+
if(!is_array($productsenhancementIds)) {
|
169 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
|
170 |
+
}
|
171 |
+
else {
|
172 |
+
try {
|
173 |
+
foreach ($productsenhancementIds as $productsenhancementId) {
|
174 |
+
$productsenhancement = Mage::getModel('auguria_productsenhancement/productsenhancement')->load($productsenhancementId);
|
175 |
+
$productsenhancement->delete();
|
176 |
+
}
|
177 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
178 |
+
Mage::helper('adminhtml')->__(
|
179 |
+
'Total of %d record(s) were successfully deleted', count($productsenhancementIds)
|
180 |
+
)
|
181 |
+
);
|
182 |
+
}
|
183 |
+
catch (Exception $e) {
|
184 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
185 |
+
}
|
186 |
+
}
|
187 |
+
$this->_redirect('*/*/index');
|
188 |
+
}
|
189 |
+
|
190 |
+
public function exportCsvAction()
|
191 |
+
{
|
192 |
+
$fileName = 'productsenhancement.csv';
|
193 |
+
$content = $this->getLayout()->createBlock('auguria_productsenhancement/adminhtml_productsenhancement_grid')
|
194 |
+
->getCsv();
|
195 |
+
|
196 |
+
$this->_sendUploadResponse($fileName, $content);
|
197 |
+
}
|
198 |
+
|
199 |
+
public function exportXmlAction()
|
200 |
+
{
|
201 |
+
$fileName = 'productsenhancement.xml';
|
202 |
+
$content = $this->getLayout()->createBlock('auguria_productsenhancement/adminhtml_productsenhancement_grid')
|
203 |
+
->getXml();
|
204 |
+
|
205 |
+
$this->_sendUploadResponse($fileName, $content);
|
206 |
+
}
|
207 |
+
|
208 |
+
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
|
209 |
+
{
|
210 |
+
$response = $this->getResponse();
|
211 |
+
$response->setHeader('HTTP/1.1 200 OK','');
|
212 |
+
$response->setHeader('Pragma', 'public', true);
|
213 |
+
$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
|
214 |
+
$response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
|
215 |
+
$response->setHeader('Last-Modified', date('r'));
|
216 |
+
$response->setHeader('Accept-Ranges', 'bytes');
|
217 |
+
$response->setHeader('Content-Length', strlen($content));
|
218 |
+
$response->setHeader('Content-type', $contentType);
|
219 |
+
$response->setBody($content);
|
220 |
+
$response->sendResponse();
|
221 |
+
die;
|
222 |
+
}
|
223 |
+
}
|
app/code/community/Auguria/ProductsEnhancement/etc/config.xml
ADDED
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Auguria
|
5 |
+
* @package Auguria_ProductsEnhancement
|
6 |
+
* @author Auguria
|
7 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<modules>
|
12 |
+
<Auguria_ProductsEnhancement>
|
13 |
+
<version>0.2.1</version>
|
14 |
+
</Auguria_ProductsEnhancement>
|
15 |
+
</modules>
|
16 |
+
<global>
|
17 |
+
<helpers>
|
18 |
+
<auguria_productsenhancement>
|
19 |
+
<class>Auguria_ProductsEnhancement_Helper</class>
|
20 |
+
</auguria_productsenhancement>
|
21 |
+
</helpers>
|
22 |
+
<blocks>
|
23 |
+
<auguria_productsenhancement>
|
24 |
+
<class>Auguria_ProductsEnhancement_Block</class>
|
25 |
+
</auguria_productsenhancement>
|
26 |
+
</blocks>
|
27 |
+
<models>
|
28 |
+
<auguria_productsenhancement>
|
29 |
+
<class>Auguria_ProductsEnhancement_Model</class>
|
30 |
+
<resourceModel>auguria_productsenhancement_mysql4</resourceModel>
|
31 |
+
</auguria_productsenhancement>
|
32 |
+
<auguria_productsenhancement_mysql4>
|
33 |
+
<class>Auguria_ProductsEnhancement_Model_Mysql4</class>
|
34 |
+
<entities>
|
35 |
+
<productsenhancement>
|
36 |
+
<table>auguria_productsenhancement</table>
|
37 |
+
</productsenhancement>
|
38 |
+
</entities>
|
39 |
+
</auguria_productsenhancement_mysql4>
|
40 |
+
</models>
|
41 |
+
<resources>
|
42 |
+
<auguria_productsenhancement_setup>
|
43 |
+
<setup>
|
44 |
+
<module>Auguria_ProductsEnhancement</module>
|
45 |
+
<class>Mage_Catalog_Model_Resource_Eav_Mysql4_Setup</class>
|
46 |
+
</setup>
|
47 |
+
<connection>
|
48 |
+
<use>core_setup</use>
|
49 |
+
</connection>
|
50 |
+
</auguria_productsenhancement_setup>
|
51 |
+
<auguria_productsenhancement_write>
|
52 |
+
<connection>
|
53 |
+
<use>core_write</use>
|
54 |
+
</connection>
|
55 |
+
</auguria_productsenhancement_write>
|
56 |
+
<auguria_productsenhancement_read>
|
57 |
+
<connection>
|
58 |
+
<use>core_read</use>
|
59 |
+
</connection>
|
60 |
+
</auguria_productsenhancement_read>
|
61 |
+
</resources>
|
62 |
+
</global>
|
63 |
+
<frontend>
|
64 |
+
<layout>
|
65 |
+
<updates>
|
66 |
+
<auguria_productsenhancement>
|
67 |
+
<file>auguria/productsenhancement.xml</file>
|
68 |
+
</auguria_productsenhancement>
|
69 |
+
</updates>
|
70 |
+
</layout>
|
71 |
+
</frontend>
|
72 |
+
<admin>
|
73 |
+
<routers>
|
74 |
+
<auguria_productsenhancement>
|
75 |
+
<use>admin</use>
|
76 |
+
<args>
|
77 |
+
<module>Auguria_ProductsEnhancement</module>
|
78 |
+
<frontName>productsenhancement</frontName>
|
79 |
+
</args>
|
80 |
+
</auguria_productsenhancement>
|
81 |
+
</routers>
|
82 |
+
</admin>
|
83 |
+
<adminhtml>
|
84 |
+
<layout>
|
85 |
+
<updates>
|
86 |
+
<auguria_productsenhancement>
|
87 |
+
<file>auguria/productsenhancement.xml</file>
|
88 |
+
</auguria_productsenhancement>
|
89 |
+
</updates>
|
90 |
+
</layout>
|
91 |
+
<menu>
|
92 |
+
<catalog>
|
93 |
+
<children>
|
94 |
+
<items module="auguria_productsenhancement">
|
95 |
+
<title>Manage Pictograms</title>
|
96 |
+
<sort_order>0</sort_order>
|
97 |
+
<action>auguria_productsenhancement/adminhtml_productsenhancement</action>
|
98 |
+
</items>
|
99 |
+
</children>
|
100 |
+
</catalog>
|
101 |
+
</menu>
|
102 |
+
<translate>
|
103 |
+
<modules>
|
104 |
+
<Auguria_ProductsEnhancement>
|
105 |
+
<files>
|
106 |
+
<auguria_productsenhancement>Auguria_ProductsEnhancement.csv</auguria_productsenhancement>
|
107 |
+
</files>
|
108 |
+
</Auguria_ProductsEnhancement>
|
109 |
+
</modules>
|
110 |
+
</translate>
|
111 |
+
</adminhtml>
|
112 |
+
<default>
|
113 |
+
<auguria_productsenhancement>
|
114 |
+
<images>
|
115 |
+
<product>
|
116 |
+
<width>26</width>
|
117 |
+
<height>26</height>
|
118 |
+
</product>
|
119 |
+
<list>
|
120 |
+
<width>26</width>
|
121 |
+
<height>26</height>
|
122 |
+
</list>
|
123 |
+
</images>
|
124 |
+
</auguria_productsenhancement>
|
125 |
+
</default>
|
126 |
+
</config>
|
app/code/community/Auguria/ProductsEnhancement/sql/auguria_productsenhancement_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_ProductsEnhancement
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
|
9 |
+
$installer = $this;
|
10 |
+
|
11 |
+
$installer->startSetup();
|
12 |
+
|
13 |
+
$installer->addAttribute('catalog_product', 'auguria_product_enhancement', array(
|
14 |
+
'type' => 'varchar',
|
15 |
+
'backend' => 'eav/entity_attribute_backend_array',
|
16 |
+
'frontend' => '',
|
17 |
+
'label' => 'Pictograms',
|
18 |
+
'input' => 'multiselect',
|
19 |
+
'type' => 'varchar',
|
20 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
|
21 |
+
'class' => '',
|
22 |
+
'source' => 'auguria_productsenhancement/catalog_product_attribute_source_pictogram',
|
23 |
+
'visible' => true,
|
24 |
+
'required' => false,
|
25 |
+
'user_defined' => false,
|
26 |
+
'searchable' => false,
|
27 |
+
'filterable' => false,
|
28 |
+
'comparable' => false,
|
29 |
+
'visible_on_front' => false,
|
30 |
+
'unique' => false,
|
31 |
+
'used_in_product_listing' => true,
|
32 |
+
));
|
33 |
+
|
34 |
+
$installer->endSetup();
|
app/code/community/Auguria/ProductsEnhancement/sql/auguria_productsenhancement_setup/mysql4-upgrade-0.1.0-0.1.1.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_ProductsEnhancement
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
$this->startSetup();
|
9 |
+
$this->run("
|
10 |
+
|
11 |
+
CREATE TABLE IF NOT EXISTS {$this->getTable('auguria_productsenhancement')} (
|
12 |
+
`auguria_productsenhancement_id` int(11) unsigned NOT NULL auto_increment,
|
13 |
+
`option_name` varchar(255) NOT NULL default '',
|
14 |
+
`image_path` varchar(255) NOT NULL default '',
|
15 |
+
PRIMARY KEY (`auguria_productsenhancement_id`)
|
16 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
17 |
+
");
|
18 |
+
$this->endSetup();
|
app/code/community/Auguria/ProductsEnhancement/sql/auguria_productsenhancement_setup/mysql4-upgrade-0.1.1-0.2.0.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_ProductsEnhancement
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
$this->startSetup();
|
9 |
+
$this->run("
|
10 |
+
ALTER TABLE `{$this->getTable('auguria_productsenhancement')}` ADD COLUMN `title` varchar(255);
|
11 |
+
ALTER TABLE `{$this->getTable('auguria_productsenhancement')}` ADD COLUMN `alt` varchar(255);
|
12 |
+
ALTER TABLE `{$this->getTable('auguria_productsenhancement')}` ADD COLUMN `description` text;
|
13 |
+
");
|
14 |
+
$this->endSetup();
|
app/design/adminhtml/default/default/layout/auguria/productsenhancement.xml
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Auguria
|
5 |
+
* @package Auguria_ProductsEnhancement
|
6 |
+
* @author Auguria
|
7 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<layout version="0.1.0">
|
11 |
+
<auguria_productsenhancement_adminhtml_productsenhancement_index>
|
12 |
+
<reference name="content">
|
13 |
+
<block type="auguria_productsenhancement/adminhtml_productsenhancement" name="productsenhancement" />
|
14 |
+
</reference>
|
15 |
+
</auguria_productsenhancement_adminhtml_productsenhancement_index>
|
16 |
+
</layout>
|
app/design/frontend/base/default/layout/auguria/productsenhancement.xml
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Auguria
|
5 |
+
* @package Auguria_ProductsEnhancement
|
6 |
+
* @author Auguria
|
7 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<layout version="0.1.0">
|
11 |
+
<catalog_product_view>
|
12 |
+
<reference name="product.info.extrahint">
|
13 |
+
<block type="catalog/product_view" name="product_view_enhancement" template="auguria/productsenhancement/product/view/pictograms.phtml"/>
|
14 |
+
</reference>
|
15 |
+
</catalog_product_view>
|
16 |
+
<default>
|
17 |
+
<reference name="head">
|
18 |
+
<action method="addCss"><stylesheet>css/auguria/productsenhancement/productsenhancement.css</stylesheet></action>
|
19 |
+
</reference>
|
20 |
+
<reference name="product_list">
|
21 |
+
<block type="core/template" name="product_view_enhancement" as="product_view_enhancement" template="auguria/productsenhancement/product/list/pictograms.phtml"/>
|
22 |
+
</reference>
|
23 |
+
</default>
|
24 |
+
</layout>
|
app/design/frontend/base/default/template/auguria/productsenhancement/product/list/pictograms.phtml
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_ProductsEnhancement
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
|
10 |
+
<?php
|
11 |
+
$_pictogramIds = $this->getProduct()->getAuguriaProductEnhancement();
|
12 |
+
if (isset($_pictogramIds) && !empty($_pictogramIds)):
|
13 |
+
$_pictograms = Mage::getModel('auguria_productsenhancement/productsenhancement')->getPictogramsFromCsv($_pictogramIds);
|
14 |
+
if ($_pictograms->count()>0):
|
15 |
+
?>
|
16 |
+
<div class="enhancement-list">
|
17 |
+
<ul class="enhancement-list">
|
18 |
+
<?php
|
19 |
+
foreach ($_pictograms as $_pictogram):
|
20 |
+
?>
|
21 |
+
<li class="enhancement-list">
|
22 |
+
<?php
|
23 |
+
$image = $_pictogram->getPictogramImage('list');
|
24 |
+
if ($image):
|
25 |
+
?>
|
26 |
+
<img class="enhancement-list" title="<?php echo $_pictogram->getTitle(); ?>" src="<?php echo $image; ?>" alt="<?php echo $_pictogram->getAlt(); ?>"/>
|
27 |
+
<?php
|
28 |
+
endif;
|
29 |
+
?>
|
30 |
+
</li>
|
31 |
+
<?php
|
32 |
+
endforeach;
|
33 |
+
?>
|
34 |
+
</ul>
|
35 |
+
</div>
|
36 |
+
<?php
|
37 |
+
endif;
|
38 |
+
endif;
|
39 |
+
?>
|
app/design/frontend/base/default/template/auguria/productsenhancement/product/view/pictograms.phtml
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_ProductsEnhancement
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
<?php
|
10 |
+
$_pictogramIds = $this->getProduct()->getAuguriaProductEnhancement();
|
11 |
+
if (isset($_pictogramIds) && !empty($_pictogramIds)):
|
12 |
+
$_pictograms = Mage::getModel('auguria_productsenhancement/productsenhancement')->getPictogramsFromCsv($_pictogramIds);
|
13 |
+
if ($_pictograms->count()>0):
|
14 |
+
?>
|
15 |
+
<div class="enhancement-product">
|
16 |
+
<ul class="enhancement-product">
|
17 |
+
<?php
|
18 |
+
foreach ($_pictograms as $_pictogram):
|
19 |
+
?>
|
20 |
+
<li class="enhancement-product">
|
21 |
+
<?php
|
22 |
+
$image = $_pictogram->getPictogramImage('product');
|
23 |
+
if ($image):
|
24 |
+
?>
|
25 |
+
<img class="enhancement-product" title="<?php echo $_pictogram->getTitle(); ?>" src="<?php echo $image; ?>" alt="<?php echo $_pictogram->getAlt(); ?>"/>
|
26 |
+
<?php
|
27 |
+
endif;
|
28 |
+
$description = $_pictogram->getDescription();
|
29 |
+
if (isset($description) && !empty($description)):
|
30 |
+
?>
|
31 |
+
<p class="enhancement-product"><?php echo $description; ?></p>
|
32 |
+
<?php
|
33 |
+
endif;
|
34 |
+
?>
|
35 |
+
</li>
|
36 |
+
<?php
|
37 |
+
endforeach;
|
38 |
+
?>
|
39 |
+
</ul>
|
40 |
+
</div>
|
41 |
+
<?php
|
42 |
+
endif;
|
43 |
+
endif;
|
44 |
+
?>
|
app/etc/modules/Auguria_ProductsEnhancement.xml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Auguria
|
5 |
+
* @package Auguria_ProductsEnhancement
|
6 |
+
* @author Auguria
|
7 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<modules>
|
12 |
+
<Auguria_ProductsEnhancement>
|
13 |
+
<active>true</active>
|
14 |
+
<codePool>community</codePool>
|
15 |
+
</Auguria_ProductsEnhancement>
|
16 |
+
</modules>
|
17 |
+
</config>
|
app/locale/fr_FR/Auguria_ProductsEnhancement.csv
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"Manage Pictograms","Gérer pictogrammes"
|
2 |
+
"Pictograms list","Liste des pictogrammes"
|
3 |
+
"Add pictogram","Ajouter un pictogramme"
|
4 |
+
"Option name","Nom du pictogramme"
|
5 |
+
"Add Item","Ajouter un pictogramme"
|
6 |
+
"Option Name","Nom du pictogramme"
|
7 |
+
"Image File","Image"
|
8 |
+
"Item information","Information sur le pictogramme"
|
9 |
+
"Item Information","Information sur le pictogramme"
|
10 |
+
"Item does not exist","Ce pictogramme n'existe pas"
|
11 |
+
"Item was successfully saved","Le pictogramme a été enregistré avec succès"
|
12 |
+
"Unable to find item to save","Impossible de trouver le pictogramme à enregistrer"
|
13 |
+
"Item was successfully deleted","Le pictogramme a été supprimé avec succès"
|
14 |
+
"Please select item(s)","Veuillez sélectionner un(des) pictogramme(s)"
|
15 |
+
"Save Item","Sauvegarder le pictogramme"
|
16 |
+
"Delete Item","Supprimer le pictogramme"
|
17 |
+
"Edit Item '%s'","Edition du pictogramme %s"
|
package.xml
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Auguria_ProductsEnhancement</name>
|
4 |
+
<version>0.2.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL 3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Allow to create pictograms and to link them with products</summary>
|
10 |
+
<description>Allow to create pictograms and to link them with products.
|
11 |
+
Thereby, you can display custom pictograms on the product view</description>
|
12 |
+
<notes>Allow to create pictograms and to link them with products</notes>
|
13 |
+
<authors><author><name>Auguria</name><user>Auguria</user><email>magento@auguria.net</email></author></authors>
|
14 |
+
<date>2012-06-22</date>
|
15 |
+
<time>14:38:26</time>
|
16 |
+
<contents><target name="magecommunity"><dir name="Auguria"><dir name="ProductsEnhancement"><dir name="Block"><dir name="Adminhtml"><dir name="Productsenhancement"><dir name="Edit"><file name="Form.php" hash="e1e5d78e05db43a02a6f1e92786ab265"/><dir name="Tab"><file name="Form.php" hash="d45d743fb7965b062864e48da7f0e6f7"/></dir><file name="Tabs.php" hash="ccdf612b4a280f8a1c1600136a61d014"/></dir><file name="Edit.php" hash="c67ad9293a188c3f173017636ff1fefa"/><file name="Grid.php" hash="e5823c58c46d9180c0212657a9e46877"/></dir><file name="Productsenhancement.php" hash="eb01905dcf7a41dc5ffdbc72d44a41d7"/></dir></dir><dir name="Helper"><file name="Data.php" hash="b6b8c39c81563c52710b372a88b743d5"/></dir><dir name="Model"><dir name="Catalog"><dir name="Product"><dir name="Attribute"><dir name="Source"><file name="Pictogram.php" hash="8954df8db2e8aed7bf40ba15b7a64585"/></dir></dir></dir></dir><dir name="Mysql4"><dir name="Productsenhancement"><file name="Collection.php" hash="f48bc320d22e4add208e5281b912df30"/></dir><file name="Productsenhancement.php" hash="63e3a2f5088a5b1beb944e8ca7bef3fa"/></dir><file name="Productsenhancement.php" hash="f4f1fa37093cb560333c16f911dabb56"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ProductsenhancementController.php" hash="425ea4dbe84525ac977bda312a8b624f"/></dir></dir><dir name="etc"><file name="config.xml" hash="fd73a9ed10b78205a51774559b6d9b58"/></dir><dir name="sql"><dir name="auguria_productsenhancement_setup"><file name="mysql4-install-0.1.0.php" hash="6ffbf3158a16740f221888c219a1d5ad"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="b2b1d01baf502c2b987764c323848f7f"/><file name="mysql4-upgrade-0.1.1-0.2.0.php" hash="b235ca99b9a2013cf9cb3707763a5b10"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Auguria_ProductsEnhancement.xml" hash="81a049a41c33102e50929575c2f3b76c"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="auguria"><file name="productsenhancement.xml" hash="35e5e93616b7323dc3b5dba0b82e7cb8"/></dir></dir><dir name="template"><dir name="auguria"><dir name="productsenhancement"><dir name="product"><dir name="list"><file name="pictograms.phtml" hash="a530c808a0486d5c78b923b33ac6eba9"/></dir><dir name="view"><file name="pictograms.phtml" hash="6b45692052f5130f44ce2007f058e96f"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="auguria"><file name="productsenhancement.xml" hash="6719e305b9a132bde11cba73ce72147a"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Auguria_ProductsEnhancement.csv" hash="02fd89cf91fa6067aff179e65eb4b7af"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="auguria"><dir name="productsenhancement"><file name="productsenhancement.css" hash="a2bb51d3790a754f8cdbc7847bd1e21e"/></dir></dir></dir></dir></dir></dir></target></contents>
|
17 |
+
<compatible/>
|
18 |
+
<dependencies><required><php><min>5.2.0</min><max>5.6.0</max></php></required></dependencies>
|
19 |
+
</package>
|
skin/frontend/base/default/css/auguria/productsenhancement/productsenhancement.css
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.enhancement-product {
|
2 |
+
margin: 5px;
|
3 |
+
padding: 0px;
|
4 |
+
}
|
5 |
+
div.enhancement-product {
|
6 |
+
width: 100%;
|
7 |
+
float: left;
|
8 |
+
}
|
9 |
+
li.enhancement-product {
|
10 |
+
float: left;
|
11 |
+
}
|
12 |
+
img.enhancement-product {
|
13 |
+
width: 26px;
|
14 |
+
height: 26px;
|
15 |
+
}
|
16 |
+
|
17 |
+
p.enhancement-product {
|
18 |
+
max-width: 48px;
|
19 |
+
}
|
20 |
+
|
21 |
+
.enhancement-list {
|
22 |
+
margin: 1px;
|
23 |
+
padding: 0px;
|
24 |
+
}
|
25 |
+
div.enhancement-list {
|
26 |
+
width: 100%;
|
27 |
+
margin: 0px;
|
28 |
+
float: left;
|
29 |
+
}
|
30 |
+
li.enhancement-list {
|
31 |
+
float: left;
|
32 |
+
}
|
33 |
+
img.enhancement-list {
|
34 |
+
width: 26px;
|
35 |
+
height: 26px;
|
36 |
+
}
|