vian_pictograms_free - Version 2.0.0

Version Notes

Stable - First version

Download this release

Release Info

Developer Magento Core Team
Extension vian_pictograms_free
Version 2.0.0
Comparing to
See all releases


Version 2.0.0

Files changed (29) hide show
  1. app/code/local/VIAN/Pictograms/Block/Adminhtml/Pictograms.php +16 -0
  2. app/code/local/VIAN/Pictograms/Block/Adminhtml/Pictograms/Edit.php +48 -0
  3. app/code/local/VIAN/Pictograms/Block/Adminhtml/Pictograms/Edit/Form.php +22 -0
  4. app/code/local/VIAN/Pictograms/Block/Adminhtml/Pictograms/Edit/Tab/Form.php +64 -0
  5. app/code/local/VIAN/Pictograms/Block/Adminhtml/Pictograms/Edit/Tabs.php +27 -0
  6. app/code/local/VIAN/Pictograms/Block/Adminhtml/Pictograms/Grid.php +105 -0
  7. app/code/local/VIAN/Pictograms/Block/Catalog/Product/List.php +20 -0
  8. app/code/local/VIAN/Pictograms/Block/Pictograms.php +29 -0
  9. app/code/local/VIAN/Pictograms/Block/Widget/Grid/Column.php +27 -0
  10. app/code/local/VIAN/Pictograms/Block/Widget/Grid/Column/Renderer/Pictogram.php +33 -0
  11. app/code/local/VIAN/Pictograms/Helper/Data.php +131 -0
  12. app/code/local/VIAN/Pictograms/Model/Mysql4/Pictograms.php +8 -0
  13. app/code/local/VIAN/Pictograms/Model/Mysql4/Pictograms/Collection.php +35 -0
  14. app/code/local/VIAN/Pictograms/Model/Pictograms.php +54 -0
  15. app/code/local/VIAN/Pictograms/Model/Product/Attribute/Source/Unit.php +12 -0
  16. app/code/local/VIAN/Pictograms/Model/Resource/Eav/Mysql4/Setup.php +45 -0
  17. app/code/local/VIAN/Pictograms/Model/Rewrite/Action.php +36 -0
  18. app/code/local/VIAN/Pictograms/Model/Status.php +15 -0
  19. app/code/local/VIAN/Pictograms/controllers/Adminhtml/PictogramsController.php +192 -0
  20. app/code/local/VIAN/Pictograms/etc/adminhtml.xml +4 -0
  21. app/code/local/VIAN/Pictograms/etc/config.xml +156 -0
  22. app/code/local/VIAN/Pictograms/etc/system.xml +41 -0
  23. app/code/local/VIAN/Pictograms/sql/pictograms_setup/mysql4-install-2.0.0.php +22 -0
  24. app/design/frontend/default/default/layout/pictograms.xml +18 -0
  25. app/design/frontend/default/default/template/pictograms/catalog/product/view/pictograms.phtml +6 -0
  26. app/etc/modules/VIAN_Pictograms.xml +9 -0
  27. app/locale/es_ES/VIAN_Pictograms.csv +26 -0
  28. package.xml +24 -0
  29. skin/frontend/default/default/pictograms/css/skin.css +7 -0
app/code/local/VIAN/Pictograms/Block/Adminhtml/Pictograms.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class VIAN_Pictograms_Block_Adminhtml_Pictograms extends Mage_Adminhtml_Block_Widget_Grid_Container {
3
+
4
+ /**
5
+ * Grid Container
6
+ */
7
+
8
+ public function __construct() {
9
+
10
+ $this->_controller = 'adminhtml_pictograms';
11
+ $this->_blockGroup = 'pictograms';
12
+ $this->_headerText = Mage::helper('pictograms')->__('VIAN Pictograms Manager');
13
+ $this->_addButtonLabel = Mage::helper('pictograms')->__('Add Item');
14
+ parent::__construct();
15
+ }
16
+ }
app/code/local/VIAN/Pictograms/Block/Adminhtml/Pictograms/Edit.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class VIAN_Pictograms_Block_Adminhtml_Pictograms_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
3
+
4
+ /**
5
+ * Edit form Container
6
+ */
7
+
8
+ public function __construct() {
9
+
10
+ parent::__construct();
11
+
12
+ $this->_objectId = 'id';
13
+ $this->_blockGroup = 'pictograms';
14
+ $this->_controller = 'adminhtml_pictograms';
15
+
16
+ $this->_updateButton('save', 'label', Mage::helper('pictograms')->__('Save Item'));
17
+ $this->_updateButton('delete', 'label', Mage::helper('pictograms')->__('Delete Item'));
18
+
19
+ $this->_addButton('saveandcontinue', array(
20
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
21
+ 'onclick' => 'saveAndContinueEdit()',
22
+ 'class' => 'save',
23
+ ), -100);
24
+
25
+ $this->_formScripts[] = "
26
+ function toggleEditor() {
27
+ if (tinyMCE.getInstanceById('pictograms_content') == null) {
28
+ tinyMCE.execCommand('mceAddControl', false, 'pictograms_content');
29
+ } else {
30
+ tinyMCE.execCommand('mceRemoveControl', false, 'pictograms_content');
31
+ }
32
+ }
33
+
34
+ function saveAndContinueEdit(){
35
+ editForm.submit($('edit_form').action+'back/edit/');
36
+ }
37
+ ";
38
+ }
39
+
40
+ public function getHeaderText() {
41
+
42
+ if( Mage::registry('pictograms_data') && Mage::registry('pictograms_data')->getId() ) {
43
+ return Mage::helper('pictograms')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('pictograms_data')->getName()));
44
+ } else {
45
+ return Mage::helper('pictograms')->__('Add Item');
46
+ }
47
+ }
48
+ }
app/code/local/VIAN/Pictograms/Block/Adminhtml/Pictograms/Edit/Form.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class VIAN_Pictograms_Block_Adminhtml_Pictograms_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
3
+
4
+ /**
5
+ * Edit form
6
+ */
7
+
8
+ protected function _prepareForm() {
9
+
10
+ $form = new Varien_Data_Form(
11
+ array('id' => 'edit_form',
12
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
13
+ 'method' => 'post',
14
+ 'enctype' => 'multipart/form-data'
15
+ )
16
+ );
17
+ $form->setUseContainer(true);
18
+ $this->setForm($form);
19
+
20
+ return parent::_prepareForm();
21
+ }
22
+ }
app/code/local/VIAN/Pictograms/Block/Adminhtml/Pictograms/Edit/Tab/Form.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class VIAN_Pictograms_Block_Adminhtml_Pictograms_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
3
+
4
+ /**
5
+ * The Form fields
6
+ * @see Mage_Adminhtml_Block_Widget_Form::_prepareForm()
7
+ */
8
+
9
+ protected function _prepareForm() {
10
+
11
+ $form = new Varien_Data_Form();
12
+ $this->setForm($form);
13
+ $fieldset = $form->addFieldset('pictograms_form', array('legend'=> Mage::helper('pictograms')->__('Information')));
14
+
15
+ $fieldset->addField('name', 'text', array(
16
+ 'label' => Mage::helper('pictograms')->__('Name'),
17
+ 'class' => 'required-entry',
18
+ 'required' => true,
19
+ 'name' => 'name',
20
+ ));
21
+
22
+ $fieldset->addField('priority', 'text', array(
23
+ 'label' => Mage::helper('pictograms')->__('Priority'),
24
+ 'name' => 'priority',
25
+ ));
26
+
27
+ $fieldset->addField('short_description', 'textarea', array(
28
+ 'label' => Mage::helper('pictograms')->__('Short Description'),
29
+ 'name' => 'short_description',
30
+ ));
31
+
32
+ $fieldset->addField('image', 'image', array(
33
+ 'label' => Mage::helper('pictograms')->__('Image'),
34
+ 'name' => 'image',
35
+ ));
36
+
37
+ $fieldset->addField('small_image', 'image', array(
38
+ 'label' => Mage::helper('pictograms')->__('Small Image'),
39
+ 'name' => 'small_image',
40
+ ));
41
+
42
+ $fieldset->addField('hiddenData', 'hidden', array(
43
+ 'class' => Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK).'_'.Mage::registry('pictograms_data')->getId(),
44
+ ));
45
+
46
+ $statusArray = Mage::getSingleton('pictograms/status')->getOptionArray();
47
+ $fieldset->addField('status', 'select', array(
48
+ 'label' => Mage::helper('pictograms')->__('Status'),
49
+ 'name' => 'status',
50
+ 'values' => $statusArray,
51
+ ));
52
+
53
+ if ( Mage::getSingleton('adminhtml/session')->getPictogramsData()) {
54
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getPictogramsData());
55
+ Mage::getSingleton('adminhtml/session')->setPictogramsData(null);
56
+ } elseif ( Mage::registry('pictograms_data')) {
57
+ $form->setValues(Mage::registry('pictograms_data')->getData());
58
+ }
59
+
60
+ return parent::_prepareForm();
61
+ }
62
+
63
+
64
+ }
app/code/local/VIAN/Pictograms/Block/Adminhtml/Pictograms/Edit/Tabs.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class VIAN_Pictograms_Block_Adminhtml_Pictograms_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
3
+
4
+ /**
5
+ * Edit form Tabs
6
+ */
7
+
8
+ public function __construct() {
9
+
10
+ parent::__construct();
11
+ $this->setId('pictograms_tabs');
12
+ $this->setDestElementId('edit_form');
13
+ $this->setTitle(Mage::helper('pictograms')->__('VIAN Pictograms Manager'));
14
+ }
15
+
16
+
17
+ protected function _beforeToHtml() {
18
+
19
+ $this->addTab('form_section', array(
20
+ 'label' => Mage::helper('pictograms')->__('Information'),
21
+ 'title' => Mage::helper('pictograms')->__('Information'),
22
+ 'content' => $this->getLayout()->createBlock('pictograms/adminhtml_pictograms_edit_tab_form')->toHtml(),
23
+ ));
24
+
25
+ return parent::_beforeToHtml();
26
+ }
27
+ }
app/code/local/VIAN/Pictograms/Block/Adminhtml/Pictograms/Grid.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class VIAN_Pictograms_Block_Adminhtml_Pictograms_Grid extends Mage_Adminhtml_Block_Widget_Grid {
3
+
4
+ /**
5
+ * Admin main Grid
6
+ */
7
+
8
+ public function __construct() {
9
+
10
+ parent::__construct();
11
+ $this->setId('pictograms_grid');
12
+ $this->setDefaultSort('priority');
13
+ $this->setDefaultDir('ASC');
14
+ $this->setSaveParametersInSession(true);
15
+ }
16
+
17
+ protected function _prepareCollection() {
18
+
19
+ $collection = Mage::getModel('pictograms/pictograms')->getCollection();
20
+ $this->setCollection($collection);
21
+ return parent::_prepareCollection();
22
+ }
23
+
24
+ protected function _prepareColumns() {
25
+
26
+
27
+ $this->addColumn('priority', array(
28
+ 'header' => Mage::helper('pictograms')->__('Priority'),
29
+ 'align' =>'right',
30
+ 'width' => '60px',
31
+ 'index' => 'priority',
32
+ ));
33
+
34
+ $this->addColumn('image', array(
35
+ 'header'=> Mage::helper('pictograms')->__('Image'),
36
+ 'type' => 'pictogram',
37
+ 'width' => '60px',
38
+ 'index' => 'image',
39
+ ));
40
+
41
+
42
+ $this->addColumn('name', array(
43
+ 'header' => Mage::helper('pictograms')->__('Name'),
44
+ 'align' =>'left',
45
+ 'index' => 'name',
46
+ ));
47
+
48
+
49
+ $this->addColumn('short_description', array(
50
+ 'header' => Mage::helper('pictograms')->__('Short Description'),
51
+ 'align' =>'left',
52
+ 'index' => 'short_description',
53
+ ));
54
+
55
+ $statuses = Mage::getSingleton('pictograms/status')->getOptionArray();
56
+ $this->addColumn('status', array(
57
+ 'header' => Mage::helper('pictograms')->__('Status'),
58
+ 'align' => 'center',
59
+ 'width' => '100px',
60
+ 'index' => 'status',
61
+ 'type' => 'options',
62
+ 'options' => $statuses,
63
+ ));
64
+
65
+ $this->addColumn('action',
66
+ array(
67
+ 'header' => Mage::helper('pictograms')->__('Action'),
68
+ 'width' => '100',
69
+ 'type' => 'action',
70
+ 'getter' => 'getId',
71
+ 'actions' => array(
72
+ array(
73
+ 'caption' => Mage::helper('pictograms')->__('Edit'),
74
+ 'url' => array('base'=> '*/*/edit'),
75
+ 'field' => 'id'
76
+ ),
77
+ array(
78
+ 'caption' => Mage::helper('pictograms')->__('Delete'),
79
+ 'url' => array('base'=> '*/*/delete'),
80
+ 'field' => 'id'
81
+ )
82
+ ),
83
+ 'filter' => false,
84
+ 'sortable' => false,
85
+ 'index' => 'stores',
86
+ 'is_system' => true,
87
+ )
88
+ );
89
+
90
+ $this->addExportType('*/*/exportCsv', Mage::helper('pictograms')->__('CSV'));
91
+ $this->addExportType('*/*/exportXml', Mage::helper('pictograms')->__('XML'));
92
+
93
+ return parent::_prepareColumns();
94
+ }
95
+
96
+ /**
97
+ * Sets the URL when clicking an item from grid
98
+ */
99
+
100
+ public function getRowUrl($row) {
101
+
102
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
103
+ }
104
+
105
+ }
app/code/local/VIAN/Pictograms/Block/Catalog/Product/List.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class VIAN_Pictograms_Block_Catalog_Product_List extends Mage_Catalog_Block_Product_List {
3
+
4
+ /**
5
+ * Display small image block in frontend
6
+ * Over price block
7
+ */
8
+
9
+ public function getPriceHtml($product){
10
+
11
+ if (! Mage::helper('pictograms')->displayFrontEnabled()){
12
+ return parent::getPriceHtml($product);
13
+ }
14
+
15
+ $output = Mage::helper('pictograms')->getPictogramsHTML($product);
16
+ $parent = parent::getPriceHtml($product);
17
+ return $output.$parent;
18
+ }
19
+
20
+ }
app/code/local/VIAN/Pictograms/Block/Pictograms.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class VIAN_Pictograms_Block_Pictograms extends Mage_Core_Block_Template {
3
+
4
+ /**
5
+ * Get single item
6
+ * @param unknown_type $id
7
+ */
8
+
9
+ public function getPictogram($id){
10
+
11
+ return Mage::getModel('pictograms/pictograms')->load($id);
12
+ }
13
+
14
+ /**
15
+ * Gets content for HTML
16
+ */
17
+
18
+ public function getPictogramsHTML(){
19
+
20
+ $array = array();
21
+ $data = Mage::helper('pictograms')->getPictograms(Mage::registry('product')->getId());
22
+ foreach ($data as $id){
23
+ $obj = Mage::getModel('pictograms/pictograms')->load($id);
24
+ $array[] = array('url' => $obj->getImage(), 'alt' => $obj->getData('short_description'));
25
+ }
26
+ return $array;
27
+ }
28
+
29
+ }
app/code/local/VIAN/Pictograms/Block/Widget/Grid/Column.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class VIAN_Pictograms_Block_Widget_Grid_Column extends Mage_Adminhtml_Block_Widget_Grid_Column {
3
+
4
+ /**
5
+ * Specifies renderer class for custom 'pictogram' type
6
+ * @see Mage_Adminhtml_Block_Widget_Grid_Column::_getRendererByType()
7
+ */
8
+
9
+ protected function _getRendererByType() {
10
+
11
+ switch (strtolower($this->getType())) {
12
+ case 'pictogram':
13
+ $rendererClass = 'pictograms/widget_grid_column_renderer_pictogram';
14
+ break;
15
+ default:
16
+ // check if TBT_Enhancedgrid is loaded
17
+ if (Mage::helper('pictograms')->isTBTEnabled()){
18
+ $rendererClass = TBT_Enhancedgrid_Block_Widget_Grid_Column::_getRendererByType();
19
+ } else {
20
+ $rendererClass = parent::_getRendererByType();
21
+ }
22
+ break;
23
+ }
24
+ return $rendererClass;
25
+ }
26
+
27
+ }
app/code/local/VIAN/Pictograms/Block/Widget/Grid/Column/Renderer/Pictogram.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class VIAN_Pictograms_Block_Widget_Grid_Column_Renderer_Pictogram extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
3
+
4
+ protected static $width = 48;
5
+ protected static $height = 48;
6
+
7
+ /**
8
+ * Renders grid column
9
+ */
10
+
11
+ public function render(Varien_Object $row) {
12
+
13
+ return $this->_getValue($row);
14
+ }
15
+
16
+ protected function _getValue(Varien_Object $row) {
17
+
18
+ $val = $row->getData($this->getColumn()->getIndex());
19
+ $url = Mage::helper('pictograms')->getImageUrl($val);
20
+
21
+ if(empty($val) ) {
22
+ $out = "<center>" . $this->__("(no image)") . "</center>";
23
+ } else {
24
+ $out .= "<center><img src=". $url ." width='". self::$width ."' ";
25
+ if (self::$height > self::$width) {
26
+ $out .= "height='". self::$height ."' ";
27
+ }
28
+ $out .=" /></center>";
29
+ }
30
+ return $out;
31
+ }
32
+
33
+ }
app/code/local/VIAN/Pictograms/Helper/Data.php ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class VIAN_Pictograms_Helper_Data extends Mage_Core_Helper_Abstract {
3
+
4
+ /**
5
+ * Returns IDs array of Product pictograms
6
+ * @param unknown_type $productId
7
+ */
8
+
9
+ public function getPictograms($productId) {
10
+
11
+ $return = array();
12
+ $pictograms = Mage::getModel('catalog/product')->load($productId)->getData('pictograms');
13
+ $parsedPictograms = explode(',',$pictograms);
14
+
15
+ $orderedIds = Mage::getModel('pictograms/pictograms')->getCollection()->getOrdered()->getIds();
16
+
17
+ return array_values(array_intersect($orderedIds, $parsedPictograms));
18
+ }
19
+
20
+ /**
21
+ * Returns Image URL
22
+ * @param unknown_type $image_file
23
+ */
24
+
25
+ public function getImageUrl($image_file) {
26
+
27
+ $url = false;
28
+ $url = Mage::getBaseUrl('media'). $image_file;
29
+ return $url;
30
+ }
31
+
32
+ /**
33
+ * Returns unique filename
34
+ * @param string $fileName
35
+ */
36
+
37
+ public function buildFilename($fileName) {
38
+
39
+ $fileExtension = substr($fileName, strrpos($fileName, '.')+1);
40
+ return md5(time()).'.'.$fileExtension;
41
+ }
42
+
43
+ /**
44
+ * Grid list
45
+ * @param unknown_type $product
46
+ */
47
+
48
+ public function getPictogramsHTML($product) {
49
+
50
+ $hasData = FALSE;
51
+ $array = array();
52
+ if ($data = $this->getPictograms($product->getId())){
53
+ $hasData = TRUE;
54
+ }
55
+
56
+ foreach ($data as $id){
57
+ $obj = Mage::getModel('pictograms/pictograms')->load($id);
58
+ $array[] = array('url' => $obj->getSmallImage(), 'alt' => $obj->getData('short_description'));
59
+ }
60
+
61
+ // the output
62
+ $output = '';
63
+ if ($hasData){
64
+ $output = '<div class="pictograms-mini-mainDiv">';
65
+ foreach ($array as $image){
66
+ $output .= '<span class="pictograms-mini-span"><img src="'.$image['url'].'" title="'.$image['alt'].'" alt="'.$image['alt'].'" /></span>';
67
+ }
68
+ $output .= '</div>';
69
+ }
70
+ return $output;
71
+ }
72
+
73
+ /**
74
+ * @see Mage_Core_Model_Config
75
+ */
76
+
77
+ protected function _getDeclaredModuleFiles()
78
+ {
79
+ $etcDir = Mage::getConfig()->getOptions()->getEtcDir();
80
+ $moduleFiles = glob($etcDir . DS . 'modules' . DS . '*.xml');
81
+
82
+ if (!$moduleFiles) {
83
+ return false;
84
+ }
85
+
86
+ $collectModuleFiles = array(
87
+ 'base' => array(),
88
+ 'mage' => array(),
89
+ 'custom' => array()
90
+ );
91
+
92
+ foreach ($moduleFiles as $v) {
93
+ $name = explode(DIRECTORY_SEPARATOR, $v);
94
+ $name = substr($name[count($name) - 1], 0, -4);
95
+
96
+ if ($name == 'Mage_All') {
97
+ $collectModuleFiles['base'][] = $v;
98
+ }
99
+ elseif (substr($name, 0, 5) == 'Mage_') {
100
+ $collectModuleFiles['mage'][] = $v;
101
+ }
102
+ else {
103
+ $collectModuleFiles['custom'][] = $v;
104
+ }
105
+ }
106
+
107
+ return array_merge(
108
+ $collectModuleFiles['base'],
109
+ $collectModuleFiles['mage'],
110
+ $collectModuleFiles['custom']
111
+ );
112
+ }
113
+
114
+ public function isTBTEnabled() {
115
+
116
+ foreach ($this->_getDeclaredModuleFiles() as $module){
117
+ if (strpos($module,'TBT_Enhancedgrid.xml') !== FALSE){
118
+ return TRUE;
119
+ }
120
+ }
121
+ return FALSE;
122
+ }
123
+
124
+ public function displayFrontEnabled(){
125
+
126
+ if (! Mage::getStoreConfig('pictograms/frontend_configuration/display_in_list')){
127
+ return FALSE;
128
+ }
129
+ return TRUE;
130
+ }
131
+ }
app/code/local/VIAN/Pictograms/Model/Mysql4/Pictograms.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class VIAN_Pictograms_Model_Mysql4_Pictograms extends Mage_Core_Model_Mysql4_Abstract {
3
+
4
+ public function _construct() {
5
+
6
+ $this->_init('pictograms/pictograms', 'pictogram_id');
7
+ }
8
+ }
app/code/local/VIAN/Pictograms/Model/Mysql4/Pictograms/Collection.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class VIAN_Pictograms_Model_Mysql4_Pictograms_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct(){
6
+
7
+ parent::_construct();
8
+ $this->_init('pictograms/pictograms');
9
+ }
10
+
11
+ /**
12
+ * Returns collection ordered by priority & filtered by Enabled status
13
+ */
14
+
15
+ public function getOrdered(){
16
+
17
+ $this->addFieldToFilter('status',VIAN_Pictograms_Model_Status::STATUS_ENABLED);
18
+ $this->setOrder('priority','asc');
19
+ return $this;
20
+ }
21
+
22
+ /**
23
+ * Returns IDs array
24
+ */
25
+
26
+ public function getIds(){
27
+
28
+ $array = array();
29
+ foreach ($this->getItems() as $item){
30
+ $array[] = $item->getId();
31
+ }
32
+ return $array;
33
+ }
34
+
35
+ }
app/code/local/VIAN/Pictograms/Model/Pictograms.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class VIAN_Pictograms_Model_Pictograms extends Mage_Core_Model_Abstract {
3
+
4
+ public function _construct() {
5
+
6
+ parent::_construct();
7
+ $this->_init('pictograms/pictograms');
8
+ }
9
+
10
+ public function getOptionArray($active = FALSE) {
11
+
12
+ $data = array();
13
+ $collection = $this->getCollection();
14
+ if ($active){
15
+ $collection->addFieldToFilter('status',VIAN_Pictograms_Model_Status::STATUS_ENABLED);
16
+ }
17
+ $collection->setOrder('priority','asc');
18
+ foreach ($collection->getData() as $item){
19
+ $data[] = array('label' => $item['name'], 'value' => $item['pictogram_id']) ;
20
+ }
21
+ //asort($data);
22
+
23
+ return $data;
24
+ }
25
+
26
+ public function getImage(){
27
+
28
+ return Mage::helper('pictograms')->getImageUrl($this->getData('image'));
29
+ }
30
+
31
+ public function getSmallImage(){
32
+
33
+ return Mage::helper('pictograms')->getImageUrl($this->getData('small_image'));
34
+ }
35
+
36
+ public function canBeDeleted($message = FALSE){
37
+
38
+ $collection = Mage::getModel('catalog/product')->getCollection();
39
+ $collection->addAttributeToSelect('*');
40
+ $collection->addAttributeToFilter('pictograms', array('like' => '%'.$this->getId().'%'));
41
+
42
+ if ($message){
43
+ $return = Mage::helper('pictograms')->__("Pictogram cannot be deleted. It is present in %d products", $collection->getSize());
44
+ return $return;
45
+ }
46
+
47
+ if ($collection->getSize() > 0){
48
+ return FALSE;
49
+ }
50
+ return TRUE;
51
+
52
+ }
53
+
54
+ }
app/code/local/VIAN/Pictograms/Model/Product/Attribute/Source/Unit.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class VIAN_Pictograms_Model_Product_Attribute_Source_Unit extends Mage_Eav_Model_Entity_Attribute_Source_Abstract {
3
+
4
+ public function getAllOptions() {
5
+
6
+ if (!$this->_options) {
7
+ $this->_options = Mage::getSingleton('pictograms/pictograms')->getOptionArray();
8
+ }
9
+ return $this->_options;
10
+ }
11
+
12
+ }
app/code/local/VIAN/Pictograms/Model/Resource/Eav/Mysql4/Setup.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class VIAN_Pictograms_Model_Resource_Eav_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup {
3
+
4
+ /**
5
+ * @return array
6
+ */
7
+ public function getDefaultEntities() {
8
+
9
+ return array(
10
+ 'catalog_product' => array(
11
+ 'entity_model' => 'catalog/product',
12
+ 'attribute_model' => 'catalog/resource_eav_attribute',
13
+ 'table' => 'catalog/product',
14
+ 'additional_attribute_table' => 'catalog/eav_attribute',
15
+ 'entity_attribute_collection' => 'catalog/product_attribute_collection',
16
+ 'attributes' => array(
17
+ 'pictograms' => array(
18
+ 'group' => 'Pictograms',
19
+ 'label' => 'Pictograms',
20
+ 'type' => 'text',
21
+ 'input' => 'multiselect',
22
+ 'default' => '',
23
+ 'class' => '',
24
+ 'backend' => 'eav/entity_attribute_backend_array',
25
+ 'frontend' => '',
26
+ 'source' => 'pictograms/product_attribute_source_unit',
27
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
28
+ 'visible' => false,
29
+ 'required' => false,
30
+ 'user_defined' => false,
31
+ 'searchable' => false,
32
+ 'filterable' => false,
33
+ 'comparable' => false,
34
+ 'visible_on_front' => false,
35
+ 'visible_in_advanced_search' => false,
36
+ 'unique' => false
37
+ ),
38
+ )
39
+ ),
40
+ );
41
+
42
+ }
43
+ }
44
+
45
+ ?>
app/code/local/VIAN/Pictograms/Model/Rewrite/Action.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class VIAN_Pictograms_Model_Rewrite_Action extends Mage_Catalog_Model_Product_Action {
3
+
4
+ /**
5
+ * Update attribute values for entity list per store
6
+ *
7
+ * @param array $productIds
8
+ * @param array $attrData
9
+ * @param int $storeId
10
+ * @return Mage_Catalog_Model_Product_Action
11
+ */
12
+ public function updateAttributes($productIds, $attrData, $storeId)
13
+ {
14
+ $version = Mage::getVersionInfo();
15
+ /* we only need to execute this for Magento version lower than 1.5 */
16
+ if ($version['minor'] < 5){
17
+ if (isset($attrData['pictograms'])){
18
+ // convert to string
19
+ $attrData['pictograms'] = implode(',',$attrData['pictograms']);
20
+ }
21
+ }
22
+
23
+ $this->_getResource()->updateAttributes($productIds, $attrData, $storeId);
24
+ $this->setData(array(
25
+ 'product_ids' => array_unique($productIds),
26
+ 'attributes_data' => $attrData,
27
+ 'store_id' => $storeId
28
+ ));
29
+
30
+ // register mass action indexer event
31
+ Mage::getSingleton('index/indexer')->processEntityAction(
32
+ $this, Mage_Catalog_Model_Product::ENTITY, Mage_Index_Model_Event::TYPE_MASS_ACTION
33
+ );
34
+ return $this;
35
+ }
36
+ }
app/code/local/VIAN/Pictograms/Model/Status.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class VIAN_Pictograms_Model_Status extends Varien_Object
4
+ {
5
+ const STATUS_ENABLED = 1;
6
+ const STATUS_DISABLED = 2;
7
+
8
+ static public function getOptionArray()
9
+ {
10
+ return array(
11
+ self::STATUS_ENABLED => Mage::helper('pictograms')->__('Enabled'),
12
+ self::STATUS_DISABLED => Mage::helper('pictograms')->__('Disabled')
13
+ );
14
+ }
15
+ }
app/code/local/VIAN/Pictograms/controllers/Adminhtml/PictogramsController.php ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class VIAN_Pictograms_Adminhtml_PictogramsController extends Mage_Adminhtml_Controller_action
3
+ {
4
+
5
+ protected function _initAction() {
6
+
7
+ $this->loadLayout()
8
+ ->_setActiveMenu('pictograms/items')
9
+ ->_addBreadcrumb(Mage::helper('pictograms')->__('VIAN Pictograms Manager'), Mage::helper('pictograms')->__('VIAN Pictograms Manager'));
10
+ return $this;
11
+ }
12
+
13
+ public function indexAction() {
14
+
15
+ $this->_initAction()
16
+ ->renderLayout();
17
+ }
18
+
19
+ public function editAction() {
20
+
21
+ $id = $this->getRequest()->getParam('id');
22
+ $model = Mage::getModel('pictograms/pictograms')->load($id);
23
+
24
+ if ($model->getId() || $id == 0) {
25
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
26
+ if (!empty($data)) {
27
+ $model->setData($data);
28
+ }
29
+
30
+ Mage::register('pictograms_data', $model);
31
+
32
+ $this->loadLayout();
33
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
34
+
35
+ $this->_addContent($this->getLayout()->createBlock('pictograms/adminhtml_pictograms_edit'))
36
+ ->_addLeft($this->getLayout()->createBlock('pictograms/adminhtml_pictograms_edit_tabs'));
37
+
38
+ $this->renderLayout();
39
+ } else {
40
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('pictograms')->__('Item does not exist'));
41
+ $this->_redirect('*/*/');
42
+ }
43
+ }
44
+
45
+ public function newAction() {
46
+
47
+ $this->_forward('edit');
48
+ }
49
+
50
+ public function saveAction() {
51
+
52
+ /* next versions */
53
+ //@todo make folder path configurable from Backoffice
54
+ //@todo make image extensions configurable from Backoffice
55
+
56
+ $path = Mage::getBaseDir('media') . DS . 'pictograms' . DS ;
57
+ $allowedExtensions = array('jpg','jpeg','gif','png','svg');
58
+
59
+ if (substr(sprintf('%o', fileperms(Mage::getBaseDir('media'))), -3) !== '777'){
60
+ $this->_getSession()->addError(Mage::helper('pictograms')->__('This module requires /media folder to have write permissions'));
61
+ $this->_redirect('*/*/');
62
+ return;
63
+ }
64
+
65
+ mkdir($path);
66
+ mkdir($path . 'image');
67
+ mkdir($path . 'small_image');
68
+
69
+ if ($data = $this->getRequest()->getPost()) {
70
+
71
+ $mediaArray = array('image','small_image');
72
+ foreach ($mediaArray as $media){
73
+
74
+ if (isset($data[$media])){
75
+ if (isset($data[$media]['delete'])){
76
+ $data[$media] = '';
77
+ // @todo next versions: Delete from filesystem
78
+ } else {
79
+ $data[$media] = $data[$media]['value'];
80
+ }
81
+ }
82
+
83
+ if(isset($_FILES[$media]['name']) && $_FILES[$media]['name'] != '') {
84
+ try {
85
+ $uploader = new Varien_File_Uploader($media);
86
+ $uploader->setAllowedExtensions($allowedExtensions);
87
+ $uploader->setAllowRenameFiles(false);
88
+ $uploader->setFilesDispersion(false);
89
+ $pictogramsFilename = Mage::helper('pictograms')->buildFilename($_FILES[$media]['name']);
90
+
91
+ $uploader->save($path . $media . DS, $pictogramsFilename );
92
+ } catch (Exception $e) {
93
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
94
+ $this->_redirect('*/*/');
95
+ }
96
+ $data[$media] = 'pictograms' . DS. $media . DS . $pictogramsFilename;
97
+ }
98
+ }
99
+
100
+ $model = Mage::getModel('pictograms/pictograms');
101
+ $model->setData($data)
102
+ ->setId($this->getRequest()->getParam('id'));
103
+
104
+ try {
105
+ if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
106
+ $model->setCreatedTime(now())
107
+ ->setUpdateTime(now());
108
+ } else {
109
+ $model->setUpdateTime(now());
110
+ }
111
+
112
+ $model->save();
113
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('pictograms')->__('Item was successfully saved'));
114
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
115
+
116
+ if ($this->getRequest()->getParam('back')) {
117
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
118
+ return;
119
+ }
120
+ $this->_redirect('*/*/');
121
+ return;
122
+
123
+ } catch (Exception $e) {
124
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
125
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
126
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
127
+ return;
128
+ }
129
+ }
130
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('pictograms')->__('Unable to find item to save'));
131
+ $this->_redirect('*/*/');
132
+ }
133
+
134
+ public function deleteAction() {
135
+
136
+ if( $this->getRequest()->getParam('id') > 0 ) {
137
+ try {
138
+ $model = Mage::getModel('pictograms/pictograms');
139
+
140
+ $model->setId($this->getRequest()->getParam('id'));
141
+ if (! $model->canBeDeleted()){
142
+ Mage::getSingleton('adminhtml/session')->addError($model->canBeDeleted(TRUE));
143
+ $this->_redirect('*/*/');
144
+ return;
145
+ }
146
+ $model->delete();
147
+
148
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('pictograms')->__('Item was successfully deleted'));
149
+ $this->_redirect('*/*/');
150
+ } catch (Exception $e) {
151
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
152
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
153
+ }
154
+ }
155
+ $this->_redirect('*/*/');
156
+ }
157
+
158
+ public function exportCsvAction() {
159
+
160
+ $fileName = 'pictograms.csv';
161
+ $content = $this->getLayout()->createBlock('pictograms/adminhtml_pictograms_grid')
162
+ ->getCsv();
163
+
164
+ $this->_sendUploadResponse($fileName, $content);
165
+ }
166
+
167
+ public function exportXmlAction() {
168
+
169
+ $fileName = 'pictograms.xml';
170
+ $content = $this->getLayout()->createBlock('pictograms/adminhtml_pictograms_grid')
171
+ ->getXml();
172
+
173
+ $this->_sendUploadResponse($fileName, $content);
174
+ }
175
+
176
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream') {
177
+
178
+ $response = $this->getResponse();
179
+ $response->setHeader('HTTP/1.1 200 OK','');
180
+ $response->setHeader('Pragma', 'public', true);
181
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
182
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
183
+ $response->setHeader('Last-Modified', date('r'));
184
+ $response->setHeader('Accept-Ranges', 'bytes');
185
+ $response->setHeader('Content-Length', strlen($content));
186
+ $response->setHeader('Content-type', $contentType);
187
+ $response->setBody($content);
188
+ $response->sendResponse();
189
+ die;
190
+ }
191
+
192
+ }
app/code/local/VIAN/Pictograms/etc/adminhtml.xml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <!-- moved to config.xml -->
4
+ </config>
app/code/local/VIAN/Pictograms/etc/config.xml ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <VIAN_Pictograms>
5
+ <version>2.0.0</version>
6
+ </VIAN_Pictograms>
7
+ </modules>
8
+ <frontend>
9
+ <layout>
10
+ <updates>
11
+ <pictograms>
12
+ <file>pictograms.xml</file>
13
+ </pictograms>
14
+ </updates>
15
+ </layout>
16
+ </frontend>
17
+ <admin>
18
+ <routers>
19
+ <pictograms>
20
+ <use>admin</use>
21
+ <args>
22
+ <module>VIAN_Pictograms</module>
23
+ <frontName>pictograms</frontName>
24
+ </args>
25
+ </pictograms>
26
+ </routers>
27
+ </admin>
28
+ <adminhtml>
29
+ <translate>
30
+ <modules>
31
+ <VIAN_Pictograms>
32
+ <files>
33
+ <default>VIAN_Pictograms.csv</default>
34
+ </files>
35
+ </VIAN_Pictograms>
36
+ </modules>
37
+ </translate>
38
+ <menu>
39
+ <catalog module="catalog">
40
+ <children>
41
+ <features module="pictograms" translate="title">
42
+ <title>Manage Pictograms</title>
43
+ <sort_order>15</sort_order>
44
+ <action>pictograms/adminhtml_pictograms</action>
45
+ </features>
46
+ </children>
47
+ </catalog>
48
+ </menu>
49
+ <acl>
50
+ <resources>
51
+ <pictograms>
52
+ <title>Allow Everything</title>
53
+ </pictograms>
54
+ <admin>
55
+ <children>
56
+ <catalog module="catalog">
57
+ <children>
58
+ <pictograms module="pictograms" translate="title">
59
+ <title>Manage Pictograms</title>
60
+ </pictograms>
61
+ </children>
62
+ </catalog>
63
+ <system>
64
+ <children>
65
+ <config>
66
+ <children>
67
+ <pictograms translate="title" module="pictograms">
68
+ <title>Pictograms Configuration</title>
69
+ </pictograms>
70
+ </children>
71
+ </config>
72
+ </children>
73
+ </system>
74
+ </children>
75
+ </admin>
76
+ </resources>
77
+ </acl>
78
+ <layout>
79
+ <updates>
80
+ <pictograms>
81
+ <file>pictograms.xml</file>
82
+ </pictograms>
83
+ </updates>
84
+ </layout>
85
+ </adminhtml>
86
+ <default>
87
+ <pictograms>
88
+ <frontend_configuration>
89
+ <display_in_list>1</display_in_list>
90
+ </frontend_configuration>
91
+ </pictograms>
92
+ </default>
93
+ <global>
94
+ <models>
95
+ <pictograms>
96
+ <class>VIAN_Pictograms_Model</class>
97
+ <resourceModel>pictograms_mysql4</resourceModel>
98
+ </pictograms>
99
+ <pictograms_mysql4>
100
+ <class>VIAN_Pictograms_Model_Mysql4</class>
101
+ <entities>
102
+ <pictograms>
103
+ <table>pictograms</table>
104
+ </pictograms>
105
+ </entities>
106
+ </pictograms_mysql4>
107
+ <catalog>
108
+ <rewrite>
109
+ <product_action>VIAN_Pictograms_Model_Rewrite_Action</product_action>
110
+ </rewrite>
111
+ </catalog>
112
+ </models>
113
+ <resources>
114
+ <pictograms_setup>
115
+ <setup>
116
+ <module>VIAN_Pictograms</module>
117
+ <class>VIAN_Pictograms_Model_Resource_Eav_Mysql4_Setup</class>
118
+ </setup>
119
+ <connection>
120
+ <use>core_setup</use>
121
+ </connection>
122
+ </pictograms_setup>
123
+ <pictograms_write>
124
+ <connection>
125
+ <use>core_write</use>
126
+ </connection>
127
+ </pictograms_write>
128
+ <pictograms_read>
129
+ <connection>
130
+ <use>core_read</use>
131
+ </connection>
132
+ </pictograms_read>
133
+ </resources>
134
+ <blocks>
135
+ <pictograms>
136
+ <class>VIAN_Pictograms_Block</class>
137
+ </pictograms>
138
+ <catalog>
139
+ <rewrite>
140
+ <product_list>VIAN_Pictograms_Block_Catalog_Product_List</product_list>
141
+ </rewrite>
142
+ </catalog>
143
+ <adminhtml>
144
+ <rewrite>
145
+ <widget_grid_column>VIAN_Pictograms_Block_Widget_Grid_Column</widget_grid_column>
146
+ </rewrite>
147
+ </adminhtml>
148
+ </blocks>
149
+ <helpers>
150
+ <pictograms>
151
+ <class>VIAN_Pictograms_Helper</class>
152
+ </pictograms>
153
+ </helpers>
154
+
155
+ </global>
156
+ </config>
app/code/local/VIAN/Pictograms/etc/system.xml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <VIAN translate="label" module="pictograms">
5
+ <label>VIAN</label>
6
+ <sort_order>100</sort_order>
7
+ </VIAN>
8
+ </tabs>
9
+ <sections>
10
+ <pictograms translate="label" module="pictograms">
11
+ <class>separator-top</class>
12
+ <label>Pictograms</label>
13
+ <tab>VIAN</tab>
14
+ <sort_order>1</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
+ <frontend_configuration translate="label">
20
+ <label>Frontend configuration</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>1</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
+ <display_in_list translate="label">
28
+ <label>Display in Grid/List</label>
29
+ <frontend_type>select</frontend_type>
30
+ <source_model>adminhtml/system_config_source_yesno</source_model>
31
+ <sort_order>1</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
+ </display_in_list>
36
+ </fields>
37
+ </frontend_configuration>
38
+ </groups>
39
+ </pictograms>
40
+ </sections>
41
+ </config>
app/code/local/VIAN/Pictograms/sql/pictograms_setup/mysql4-install-2.0.0.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+ $installer->run("
5
+
6
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('pictograms')}` (
7
+ `pictogram_id` int(11) unsigned NOT NULL auto_increment,
8
+ `priority` int(2) NOT NULL,
9
+ `name` varchar(255) NOT NULL default '',
10
+ `short_description` varchar(255) NOT NULL default '',
11
+ `image` varchar(255) NOT NULL default '',
12
+ `small_image` varchar(255) NOT NULL default '',
13
+ `status` smallint(6) NOT NULL default '1',
14
+ `created_time` datetime NULL,
15
+ `update_time` datetime NULL,
16
+ PRIMARY KEY (`pictogram_id`)
17
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
18
+
19
+ ");
20
+
21
+ $installer->installEntities();
22
+ $installer->endSetup();
app/design/frontend/default/default/layout/pictograms.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="2.0.0">
3
+
4
+ <!-- Default layout, loads most of the pages -->
5
+ <default>
6
+ <reference name="head">
7
+ <action method="addCss"><name>pictograms/css/skin.css</name></action>
8
+ </reference>
9
+ </default>
10
+
11
+ <!-- Product View -->
12
+ <catalog_product_view>
13
+ <reference name="product.info">
14
+ <block before="product_additional_data" type="pictograms/pictograms" name="pictograms" as="other" template="pictograms/catalog/product/view/pictograms.phtml" />
15
+ </reference>
16
+ </catalog_product_view>
17
+
18
+ </layout>
app/design/frontend/default/default/template/pictograms/catalog/product/view/pictograms.phtml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <div class="pictograms-product-mainDiv">
2
+ <?php foreach ($this->getPictogramsHtml() as $data){ ?>
3
+ <span><img src="<?php echo $data['url']; ?>" title="<?php echo $data['alt']; ?>" alt="<?php echo $data['alt']; ?>" /></span>
4
+ <?php } ?>
5
+ </div>
6
+ <div class="pictograms-clear"></div>
app/etc/modules/VIAN_Pictograms.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <VIAN_Pictograms>
5
+ <codePool>local</codePool>
6
+ <active>true</active>
7
+ </VIAN_Pictograms>
8
+ </modules>
9
+ </config>
app/locale/es_ES/VIAN_Pictograms.csv ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Name","Nombre"
2
+ "Information","Información"
3
+ "Priority","Prioridad"
4
+ "Short Description","Descripción rápida"
5
+ "Image","Imagen"
6
+ "Small Image","Imagen pequeña"
7
+ "Status","Estado"
8
+ "VIAN Pictograms Manager","Gestor de VIAN Pictograms"
9
+ "Save Item","Guardar Item"
10
+ "Delete Item","Eliminar Item"
11
+ "Edit Item '%s'","Editar Item '%s'"
12
+ "Add Item","Añadir Item"
13
+ "Edit","Editar"
14
+ "Delete","Eliminar"
15
+ "Item does not exist","El item no existe"
16
+ "This module requires /media folder to have write permissions","Este módulo requiere permisos de escritura en la carpeta /media"
17
+ "Item was successfully saved","El item ha sido guardado correctamente"
18
+ "Unable to find item to save","No se ha podido encontrar el item para guardar"
19
+ "Item was successfully deleted","El item ha sido eliminado correctamente"
20
+ "Pictogram cannot be deleted. It is present in %d products","Este pictograma no se puede eliminar, está presente en %d productos"
21
+ "Enabled","Habilitado"
22
+ "Disabled","Deshabilitado"
23
+ "Manage Pictograms","Gestionar Pictogramas"
24
+ "Delete Image","Eliminar Imagen"
25
+ "Frontend configuration","Configuración de Frontend"
26
+ "Display in Grid/List","Mostrar en Grid/Listado de productos"
package.xml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>vian_pictograms_free</name>
4
+ <version>2.0.0</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>&lt;p&gt;"A picture is worth a thousand words"&lt;/p&gt; &#xD;
10
+ &lt;p&gt;This old statement explains perfectly the goal for this extension. A pictogram can be defined as a &#x201C;self explanatory enough&#x201D; icon, when you see it you should know its meaning instantly&lt;/p&gt;&#xD;
11
+ &lt;p&gt;Install this extension totally FREE to strongly beautify your catalog and improve customer experience. Well chosen icons will help customers to identify products kindly faster, increasing your sales ratings&lt;/p&gt;</summary>
12
+ <description>&lt;strong&gt;List of features&lt;/strong&gt;&#xD;
13
+ &lt;li&gt;Admin have full control over Pictograms: you can add, edit or delete items&lt;/li&gt;&#xD;
14
+ &lt;li&gt;Pictograms can be easily reordered at any time&lt;/li&gt;&#xD;
15
+ &lt;li&gt;Pictograms can have up to 2 associated images: standard images are used for product view pages, while small images are used for product listing pages (optional)&lt;/li&gt;&#xD;
16
+ &lt;li&gt;The extension&#x2019;s functionality code is 100% Open Source&lt;/li&gt;</description>
17
+ <notes>Stable - First version</notes>
18
+ <authors><author><name>viansolutions</name><user>auto-converted</user><email>joan.puche@viansolutions.com</email></author></authors>
19
+ <date>2011-11-09</date>
20
+ <time>09:55:46</time>
21
+ <contents><target name="magelocal"><dir name="VIAN"><dir name="Pictograms"><dir name="Block"><dir name="Adminhtml"><dir name="Pictograms"><dir name="Edit"><dir name="Tab"><file name="Form.php" hash="1a0bf7f170a00816bdfc9e01fbaae6a9"/></dir><file name="Form.php" hash="df28ce655944d002a9f03aad48c44037"/><file name="Tabs.php" hash="d483d18d02536d47be4894d5d80842c1"/></dir><file name="Edit.php" hash="df3bae4ece28160b469bc1c5914be853"/><file name="Grid.php" hash="732e7ddcdabe36ea975f16bd30208399"/></dir><file name="Pictograms.php" hash="1edc5fbbc32a33ee8f141eacce372bca"/></dir><dir name="Catalog"><dir name="Product"><file name="List.php" hash="ec58a7a41afd3b2ba9dcc977399a7b29"/></dir></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Pictogram.php" hash="23814b056cb4284d9c581d2f5129ba23"/></dir></dir><file name="Column.php" hash="710be7b87647b04103bd702f2f09f60e"/></dir></dir><file name="Pictograms.php" hash="3b35fd4cedba721d3cc110da6a838571"/></dir><dir name="Helper"><file name="Data.php" hash="fccef4d8cd1fd17ceeca39537496adbf"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Pictograms"><file name="Collection.php" hash="b175d464ee87c4771a3accc28181bf62"/></dir><file name="Pictograms.php" hash="1a068cf73e27409ed993be2d59f9d1e9"/></dir><dir name="Product"><dir name="Attribute"><dir name="Source"><file name="Unit.php" hash="3f51c4138a924afd28acdbc9604ba0a8"/></dir></dir></dir><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="b0a8b5265e4c1e561624c976af0ed82e"/></dir></dir></dir><dir name="Rewrite"><file name="Action.php" hash="9da05203580dda81f59c7e5afbee7aa9"/></dir><file name="Pictograms.php" hash="345ee4922df21aa54f9e5503fbb997d5"/><file name="Status.php" hash="55bb8eb5aeb77d4cc4c524699fce45ac"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="PictogramsController.php" hash="1d238c06e1be599f449fdc07dda4e1c7"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="9c528937b6de1e34b1200af70cdb2aea"/><file name="config.xml" hash="486b798f95ed2df8daee5ce4847c077b"/><file name="system.xml" hash="1dc54caa0358b98a2e52846fc08f2084"/></dir><dir name="sql"><dir name="pictograms_setup"><file name="mysql4-install-2.0.0.php" hash="f6bd4ea418567b02f8e04f7cc216abf6"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="pictograms.xml" hash="7e346f634e02fca8a0d5ded9a39d3668"/></dir><dir name="template"><dir name="pictograms"><dir name="catalog"><dir name="product"><dir name="view"><file name="pictograms.phtml" hash="c634c9f57386cee72558bf23fb5de446"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="VIAN_Pictograms.xml" hash="6b20f96c93bd0c2264d374ce5574c143"/></dir></target><target name="magelocale"><dir name="es_ES"><file name="VIAN_Pictograms.csv" hash="2d760becd8fc4dd456192f9d45409fd6"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="pictograms"><dir name="css"><file name="skin.css" hash="5353154ebd297f4dabb047b1ddab6821"/></dir></dir></dir></dir></dir></target></contents>
22
+ <compatible/>
23
+ <dependencies/>
24
+ </package>
skin/frontend/default/default/pictograms/css/skin.css ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ .pictograms-mini-mainDiv { border: 1px solid LightGrey; margin: 3px; overflow: hidden; }
2
+ .pictograms-mini-span { float: left; margin: 3px; }
3
+ .pictograms-mini-span > img { height: 16px; width: 16px; }
4
+ .pictograms-product-mainDiv { border: 1px solid LightGrey; margin: 9px; overflow: hidden; }
5
+ .pictograms-product-mainDiv > span { float: left; margin: 9px; }
6
+ .pictograms-product-mainDiv > span > img { height: 48px; width: 48px; }
7
+ .pictograms-clear { clear: both; }