Bewai_AttributeAssigner - Version 0.1.0

Version Notes

This is the first stable version.

Feel free to give feedback and propose any updates you would like to get.

Also, this version is given to you as is, please test it on samples or test servers before using in for production environments.

This extension has been conceived and tested in Magento 1.9.

Download this release

Release Info

Developer Benjamin Yayon
Extension Bewai_AttributeAssigner
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

Files changed (25) hide show
  1. app/code/local/Bewai/AttributeAssigner/Block/Adminhtml/Index.php +28 -0
  2. app/code/local/Bewai/AttributeAssigner/Block/Adminhtml/Index/App.php +105 -0
  3. app/code/local/Bewai/AttributeAssigner/Block/Adminhtml/Index/App/Breadcrumb.php +79 -0
  4. app/code/local/Bewai/AttributeAssigner/Block/Adminhtml/Index/App/Screen/Products.php +121 -0
  5. app/code/local/Bewai/AttributeAssigner/Block/Adminhtml/Index/App/Screen/Summary.php +38 -0
  6. app/code/local/Bewai/AttributeAssigner/Helper/Data.php +197 -0
  7. app/code/local/Bewai/AttributeAssigner/controllers/AdminController.php +184 -0
  8. app/code/local/Bewai/AttributeAssigner/etc/adminhtml.xml +60 -0
  9. app/code/local/Bewai/AttributeAssigner/etc/config.xml +75 -0
  10. app/design/adminhtml/default/default/layout/bewai_attributeassigner.xml +56 -0
  11. app/design/adminhtml/default/default/template/bewai/attributeassigner/index.phtml +33 -0
  12. app/design/adminhtml/default/default/template/bewai/attributeassigner/index/app.phtml +11 -0
  13. app/design/adminhtml/default/default/template/bewai/attributeassigner/index/app/breadcrumb.phtml +23 -0
  14. app/design/adminhtml/default/default/template/bewai/attributeassigner/index/app/breadcrumb/attribute.phtml +16 -0
  15. app/design/adminhtml/default/default/template/bewai/attributeassigner/index/app/breadcrumb/products.phtml +11 -0
  16. app/design/adminhtml/default/default/template/bewai/attributeassigner/index/app/breadcrumb/value.phtml +16 -0
  17. app/design/adminhtml/default/default/template/bewai/attributeassigner/index/app/screen.phtml +33 -0
  18. app/design/adminhtml/default/default/template/bewai/attributeassigner/index/app/screen/instructions.phtml +28 -0
  19. app/design/adminhtml/default/default/template/bewai/attributeassigner/index/app/screen/summary.phtml +81 -0
  20. app/design/adminhtml/default/default/template/bewai/attributeassigner/index/javascript.phtml +85 -0
  21. app/etc/modules/Bewai_AttributeAssigner.xml +33 -0
  22. app/locale/en_US/Bewai_AttributeAssigner.csv +33 -0
  23. app/locale/fr_FR/Bewai_AttributeAssigner.csv +33 -0
  24. package.xml +35 -0
  25. skin/adminhtml/default/default/bewai/attributeassigner/adminhtml.css +227 -0
app/code/local/Bewai/AttributeAssigner/Block/Adminhtml/Index.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * App container block
5
+ *
6
+ * @category Bewai
7
+ * @package Bewai_AttributeAssigner
8
+ * @copyright Copyright (c) 2014 Bewai (http://www.bewai.fr)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ class Bewai_AttributeAssigner_Block_Adminhtml_Index extends Mage_Adminhtml_Block_Widget_Container {
12
+
13
+ /**
14
+ * Sets basic conf for the block
15
+ * @return nothing
16
+ */
17
+ public function __construct()
18
+ {
19
+ parent::__construct();
20
+ $this->_headerText = Mage::helper('bewai_attributeassigner')->__('Assign Attributes');
21
+ $this->_addButton('reset', array(
22
+ 'label' => Mage::helper('adminhtml')->__('Reset'),
23
+ 'onclick' => 'setLocation(\''.$this->getUrl('*/*/reset').'\')',
24
+ ), -1);
25
+ }
26
+ }
27
+
28
+ ?>
app/code/local/Bewai/AttributeAssigner/Block/Adminhtml/Index/App.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Attribute Selector Grid Application
4
+ *
5
+ *
6
+ * @category Bewai
7
+ * @package Bewai_AttributeAssigner
8
+ * @copyright Copyright (c) 2014 Bewai (http://www.bewai.fr)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ class Bewai_AttributeAssigner_Block_Adminhtml_Index_App extends Bewai_AttributeAssigner_Block_Adminhtml_Index {
12
+
13
+ /**
14
+ * Constructor : no cache
15
+ */
16
+ protected function _construct() {
17
+ parent::_construct();
18
+ $this->setData('cache_lifetime', null);
19
+ }
20
+
21
+ /**
22
+ * Retreives helper
23
+ * @return Bewai_AttributeAssigner_Helper_Data
24
+ */
25
+ protected function _helper()
26
+ {
27
+ return Mage::helper('bewai_attributeassigner');
28
+ }
29
+
30
+ /**
31
+ * Retreives the list of attributes
32
+ * @return Mage_Catalog_Model_Resource_Product_Attribute_Collection
33
+ */
34
+ public function getAttributeList()
35
+ {
36
+ return Mage::getResourceModel('catalog/product_attribute_collection')
37
+ ->addVisibleFilter()
38
+ ->addFieldToFilter('frontend_input', 'select');
39
+ }
40
+
41
+
42
+ /**
43
+ * Retreives available values for selected attribute
44
+ * @return array|Varien_Data_Collection
45
+ */
46
+ public function getSelectedAttributeValuesList()
47
+ {
48
+ if (!$this->getAttribute()) return array();
49
+
50
+ return Mage::getResourceModel('eav/entity_attribute_option_collection')
51
+ ->setAttributeFilter($this->getAttribute()->getId())
52
+ ->setPositionOrder('desc', true)
53
+ ->load();
54
+ }
55
+
56
+ /**
57
+ * Given value is selected one
58
+ * @param string\boolean $val
59
+ * @return boolean
60
+ */
61
+ public function isValueSelected($val)
62
+ {
63
+ if (!$this->getValue()) return false;
64
+ return $val->getId() == $this->getValue()->getId();
65
+ }
66
+
67
+ /**
68
+ * Given attribute is selected one
69
+ * @param type $attr
70
+ * @return boolean
71
+ */
72
+ public function isAttributeSelected($attr)
73
+ {
74
+ if (!$this->getAttribute()) return false;
75
+ return $attr->getId() == $this->getAttribute()->getId();
76
+ }
77
+
78
+ /**
79
+ * Retreives selected attribute
80
+ * @return mixed
81
+ */
82
+ public function getAttribute()
83
+ {
84
+ return Mage::helper('bewai_attributeassigner')->getSelectedValue('attribute');
85
+ }
86
+
87
+ /**
88
+ * Retreives selected value
89
+ * @return mixed
90
+ */
91
+ public function getValue()
92
+ {
93
+ return Mage::helper('bewai_attributeassigner')->getSelectedValue('value');
94
+ }
95
+
96
+ /**
97
+ * Form action url
98
+ * @return string
99
+ */
100
+ public function getFormActionUrl()
101
+ {
102
+ return $this->getUrl('*/*/index');
103
+ // return $this->getUrl('*/*/indexAjax'); REMOVED AJAX CAUSE PROBLEM EVAL GRID SCRIPTS
104
+ }
105
+ }
app/code/local/Bewai/AttributeAssigner/Block/Adminhtml/Index/App/Breadcrumb.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Breadcrumb / Path
4
+ *
5
+ *
6
+ * @category Bewai
7
+ * @package Bewai_AttributeAssigner
8
+ * @copyright Copyright (c) 2014 Bewai (http://www.bewai.fr)
9
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
10
+ */
11
+ class Bewai_AttributeAssigner_Block_Adminhtml_Index_App_Breadcrumb extends Mage_Adminhtml_Block_Template {
12
+
13
+ /**
14
+ * Steps processed by the block
15
+ * @var array
16
+ */
17
+ protected $_steps;
18
+
19
+ /**
20
+ * Retreives helper
21
+ * @return Bewai_AttributeAssigner_Helper_Data
22
+ */
23
+ protected function _helper()
24
+ {
25
+ return Mage::helper('bewai_attributeassigner');
26
+ }
27
+
28
+ /**
29
+ * Prepares steps before display
30
+ */
31
+ public function _beforeToHtml()
32
+ {
33
+ parent::_beforeToHtml();
34
+
35
+ foreach ($this->_helper()->getSteps('with title') as $key => $title) {
36
+ $this->_steps[$key] = array(
37
+ 'title' => $title,
38
+ 'content' => $this->getChildHtml($key)
39
+ );
40
+ }
41
+
42
+ $this->_addStepClasses();
43
+ }
44
+
45
+ /**
46
+ * Block steps getter
47
+ * @return array
48
+ */
49
+ public function getSteps()
50
+ {
51
+ return $this->_steps;
52
+ }
53
+
54
+ /**
55
+ * Adds the classes to steps
56
+ * @return \Bewai_AttributeAssigner_Block_Adminhtml_Index_App_Breadcrumb
57
+ */
58
+ protected function _addStepClasses() {
59
+ $currentStep = $this->_helper()->getCurrentStep();
60
+
61
+ foreach (array_keys($this->_steps) as $key) {
62
+ $classes = array();
63
+ if ($key === $currentStep) {
64
+ $classes[] = 'active';
65
+ }
66
+
67
+ if ($this->_helper()->getSelectedValue($key)) {
68
+ $classes[] = 'valid';
69
+ }
70
+ elseif (!in_array('active', $classes)) {
71
+ $classes[] = 'disabled';
72
+ }
73
+
74
+ $this->_steps[$key]['class'] = implode(' ', $classes);
75
+ }
76
+
77
+ return $this;
78
+ }
79
+ }
app/code/local/Bewai/AttributeAssigner/Block/Adminhtml/Index/App/Screen/Products.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Product Selector Grid
4
+ *
5
+ *
6
+ * @category Bewai
7
+ * @package Bewai_AttributeAssigner
8
+ * @copyright Copyright (c) 2014 Bewai (http://www.bewai.fr)
9
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
10
+ */
11
+ class Bewai_AttributeAssigner_Block_Adminhtml_Index_App_Screen_Products extends Mage_Adminhtml_Block_Widget_Grid {
12
+
13
+ /**
14
+ * Main conf
15
+ */
16
+ public function __construct()
17
+ {
18
+ parent::__construct();
19
+
20
+ $this->setId('bewai_attributeassigner_adminhtml_index_app_screen_products');
21
+ $this->_controller = 'admin';
22
+ $this->setDefaultSort('sku');
23
+ $this->setDefaultDir('asc');
24
+ $this->setUseAjax(true);
25
+ $this->setCanDisplayContainer(true);
26
+
27
+ }
28
+
29
+ /**
30
+ * Retreives selected attribute
31
+ * @return mixed
32
+ */
33
+ public function getAttribute()
34
+ {
35
+ return Mage::helper('bewai_attributeassigner')->getSelectedValue('attribute');
36
+ }
37
+
38
+ /**
39
+ * Collection
40
+ *
41
+ * @return Bewai_AttributeAssigner_Block_Adminhtml_Index_Attributeselector
42
+ */
43
+ protected function _prepareCollection()
44
+ {
45
+ if ($attr = $this->getAttribute()) {
46
+ $collection = Mage::getModel('catalog/product')->getCollection()
47
+ ->addAttributeToSelect(array('sku', 'name', $attr->getAttributeCode()))
48
+ ->addAttributeToFilter('type_id', 'simple');
49
+
50
+ }
51
+ else {
52
+ $collection = new Varien_Data_Collection();
53
+ }
54
+
55
+ $this->setCollection($collection);
56
+ return parent::_prepareCollection();
57
+ }
58
+ /**
59
+ * Columns
60
+ * @return Bewai_AttributeAssigner_Block_Adminhtml_Index_Attributeselector
61
+ */
62
+ protected function _prepareColumns()
63
+ {
64
+ $this->addColumn('sku', array(
65
+ 'header'=> Mage::helper('catalog')->__('SKU'),
66
+ 'width' => '80px',
67
+ 'index' => 'sku',
68
+ ));
69
+
70
+ $this->addColumn('name', array(
71
+ 'header'=> Mage::helper('catalog')->__('Name'),
72
+ 'index' => 'name'
73
+ ));
74
+
75
+ if ($attr = $this->getAttribute()) {
76
+ $this->addColumn('value', array(
77
+ 'header'=> $attr->getFrontendLabel(),
78
+ 'width' => '100px',
79
+ 'index' => $attr->getAttributeCode(),
80
+ 'type' => 'options',
81
+ 'options' => Mage::helper('bewai_attributeassigner')->getOptionArray($attr->getId()),
82
+ ));
83
+ }
84
+ return parent::_prepareColumns();
85
+ }
86
+
87
+ /**
88
+ * Massaction configuration (save)
89
+ * @return Mage_Adminhtml_Block_Widget_Grid
90
+ */
91
+ protected function _prepareMassaction()
92
+ {
93
+ $this->setMassactionIdField('entity_id');
94
+ $this->getMassactionBlock()->setFormFieldName('products');
95
+ $this->getMassactionBlock()->addItem('change', array(
96
+ 'label' => Mage::helper('bewai_attributeassigner')->__('Validate'),
97
+ 'url' => $this->getUrl('*/*/index')
98
+ ));
99
+
100
+ return parent::_prepareMassaction();
101
+ }
102
+
103
+ /**
104
+ * Sets the previously selected values to massaction if any
105
+ * @return \Bewai_AttributeAssigner_Block_Adminhtml_Index_App_Screen_Products
106
+ */
107
+ protected function _prepareMassactionColumn() {
108
+ parent::_prepareMassactionColumn();
109
+ $values = Mage::helper('bewai_attributeassigner')->getSelectedValue('products');
110
+ $this->_columns['massaction']->setValues($values);
111
+ return $this;
112
+ }
113
+
114
+ /**
115
+ * Grid URL
116
+ * @return string
117
+ */
118
+ public function getGridUrl() {
119
+ return $this->getUrl('*/*/ajaxFilterGrid', array('_current' => true));
120
+ }
121
+ }
app/code/local/Bewai/AttributeAssigner/Block/Adminhtml/Index/App/Screen/Summary.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Summaries selections and propose submit
4
+ *
5
+ *
6
+ * @category Bewai
7
+ * @package Bewai_AttributeAssigner
8
+ * @copyright Copyright (c) 2014 Bewai (http://www.bewai.fr)
9
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
10
+ */
11
+ class Bewai_AttributeAssigner_Block_Adminhtml_Index_App_Screen_Summary extends Bewai_AttributeAssigner_Block_Adminhtml_Index_App {
12
+
13
+ /**
14
+ * Retreives selected products collection
15
+ * @return \Varien_Data_Collection
16
+ */
17
+ public function getProductsCollection()
18
+ {
19
+ $products = $this->_helper()->getSelectedValue('products');
20
+ if (!$products) return new Varien_Data_Collection();
21
+
22
+ return Mage::getModel('catalog/product')->getCollection()
23
+ ->addAttributeToFilter('entity_id', array('in' => $products));
24
+ }
25
+
26
+ /**
27
+ * Retreives products that already have the selected option value
28
+ * @return \Varien_Data_Collection
29
+ */
30
+ public function getTargetProductCollection()
31
+ {
32
+ $attribute = $this->_helper()->getSelectedValue('attribute');
33
+ if (!$attribute) return new Varien_Data_Collection();
34
+
35
+ return Mage::getModel('catalog/product')->getCollection()
36
+ ->addAttributeToFilter($attribute->getAttributeCode(), $this->getValue()->getOptionId());
37
+ }
38
+ }
app/code/local/Bewai/AttributeAssigner/Helper/Data.php ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Data Helper
5
+ *
6
+ * @category Bewai
7
+ * @package Bewai_AttributeAssigner
8
+ * @copyright Copyright (c) 2014 Bewai (http://www.bewai.fr)
9
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
10
+ */
11
+ class Bewai_AttributeAssigner_Helper_Data extends Mage_Core_Helper_Abstract
12
+ {
13
+ /**
14
+ * App steps
15
+ * @var array
16
+ */
17
+ protected $_steps = array(
18
+ 'attribute' => 'Attribute to change.',
19
+ 'products' => 'Products to alter.',
20
+ 'value' => 'Target attribute value.'
21
+ );
22
+
23
+ /**
24
+ * Session key for session variables to prevent namespace collision
25
+ * @var string
26
+ */
27
+ protected $_session_key = 'bewai_attributeassigner_selection_%s';
28
+
29
+ /**
30
+ * Getter for steps
31
+ *
32
+ * @param boolean $with_title Whether to include titles as values
33
+ * @return array
34
+ */
35
+ public function getSteps($with_title = false)
36
+ {
37
+ return $with_title ? $this->_steps : array_keys($this->_steps);
38
+ }
39
+
40
+ /**
41
+ * Processes form data from block
42
+ *
43
+ * @param integer $attribute_id
44
+ * @return boolean
45
+ */
46
+ public function setAttributeSelection($attribute_id = false)
47
+ {
48
+ if (!$attribute_id || $attribute_id === 'select') return $this->clearSelectedValue('attribute');
49
+
50
+ $attr = Mage::getModel('catalog/resource_eav_attribute')->load($attribute_id);
51
+ if (!$attr->getId()) return $this->clearSelectedValue('attribute');
52
+
53
+ $this->setSelectedValue('attribute', $attr);
54
+
55
+ return $this;
56
+ }
57
+
58
+ /**
59
+ * Processes product data from grid
60
+ *
61
+ * @param array $products
62
+ * @return boolean
63
+ */
64
+ public function setProductsSelection($products = array())
65
+ {
66
+ if (count($products) == 0) return $this->clearSelectedValue('products');
67
+
68
+ $count = Mage::getModel('catalog/product')->getCollection()
69
+ ->addAttributeToFilter('entity_id', array('in' => $products))
70
+ ->getSize();
71
+
72
+ if ($count == 0) return $this->clearSelectedValue('products');
73
+
74
+ $this->setSelectedValue('products', $products);
75
+
76
+ return $this;
77
+ }
78
+
79
+ /**
80
+ * Processes form data from block
81
+ *
82
+ * @param array $value
83
+ * @return boolean
84
+ */
85
+ public function setValueSelection($value = false)
86
+ {
87
+ if (!$value || $value === 'select') return $this->clearSelectedValue('value');
88
+
89
+ $val = Mage::getModel('eav/entity_attribute_option')->load($value);
90
+ if (!$val->getId()) return $this->clearSelectedValue('value');
91
+
92
+ $attribute_value = Mage::getResourceModel('eav/entity_attribute_option_collection')
93
+ ->setAttributeFilter($this->getSelectedValue('attribute')->getId())
94
+ ->setPositionOrder('desc', true)
95
+ ->addFieldToFilter('main_table.option_id', $val->getOptionId())
96
+ ->load()
97
+ ->getFirstItem();
98
+
99
+ $this->setSelectedValue('value', $attribute_value);
100
+
101
+ return $this;
102
+ }
103
+
104
+ /**
105
+ * Sets the given value into session under the key for given type and code
106
+ *
107
+ * @param string $type
108
+ * @param mixed $value
109
+ * @return mixed
110
+ */
111
+ public function setSelectedValue($type, $value)
112
+ {
113
+ return Mage::getSingleton('adminhtml/session')->setData(
114
+ sprintf($this->_session_key, $type), $value
115
+ );
116
+ }
117
+
118
+ /**
119
+ * Retreives the selected value for given type and code
120
+ *
121
+ * @param string $type
122
+ * @return mixed
123
+ */
124
+ public function getSelectedValue($type)
125
+ {
126
+ return Mage::getSingleton('adminhtml/session')->getData(
127
+ sprintf($this->_session_key, $type)
128
+ );
129
+ }
130
+
131
+ /**
132
+ * Removes previously selected value
133
+ *
134
+ * @param string $type
135
+ * @return type
136
+ */
137
+ public function clearSelectedValue($type)
138
+ {
139
+ Mage::getSingleton('adminhtml/session')->unsetData(
140
+ sprintf($this->_session_key, $type)
141
+ );
142
+
143
+ return $this;
144
+ }
145
+
146
+ /**
147
+ *
148
+ * @return array
149
+ */
150
+ public function getOptionArray($attribute_id) {
151
+
152
+ $arr = array();
153
+
154
+ $attr = Mage::getResourceModel('eav/entity_attribute_option_collection')
155
+ ->setAttributeFilter($attribute_id)
156
+ ->setPositionOrder('desc', true)
157
+ ->load();
158
+ foreach ($attr as $value) {
159
+ $arr[$value->getId()] = $value->getValue();
160
+ }
161
+ return $arr;
162
+ }
163
+
164
+ /**
165
+ * Retreives current step
166
+ * @return string
167
+ */
168
+ public function getCurrentStep()
169
+ {
170
+ if (Mage::registry('bewai_attributeassigner_force_current_step')) {
171
+ return Mage::registry('bewai_attributeassigner_force_current_step');
172
+ }
173
+
174
+ foreach ($this->getSteps() as $key) {
175
+ if ($this->getSelectedValue($key)) {
176
+ continue;
177
+ }
178
+ return $key;
179
+ }
180
+
181
+ return 'ready';
182
+ }
183
+
184
+ /**
185
+ * Finds out if app is ready for action
186
+ * @return boolean
187
+ */
188
+ public function isReady()
189
+ {
190
+ $ready = true;
191
+ foreach ($this->getSteps() as $step) {
192
+ $ready = $this->getSelectedValue($step);
193
+ if (!$ready) return false;
194
+ }
195
+ return $ready;
196
+ }
197
+ }
app/code/local/Bewai/AttributeAssigner/controllers/AdminController.php ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Admin controller
5
+ *
6
+ * @category Bewai
7
+ * @package Bewai_AttributeAssigner
8
+ * @copyright Copyright (c) 2014 Bewai (http://www.bewai.fr)
9
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
10
+ */
11
+ class Bewai_AttributeAssigner_AdminController extends Mage_Adminhtml_Controller_Action {
12
+
13
+ /**
14
+ * Retreives helper
15
+ * @return Bewai_AttributeAssigner_Helper_Data
16
+ */
17
+ protected function _helper()
18
+ {
19
+ return Mage::helper('bewai_attributeassigner');
20
+ }
21
+
22
+ /**
23
+ * Does common stuff (title, breadcrumb, menu)
24
+ *
25
+ * @return \Bewai_AttributeAssigner_AdminController
26
+ */
27
+ protected function _initModuleLayout()
28
+ {
29
+ if (!$this->_isLayoutLoaded) $this->loadLayout();
30
+
31
+ $this->_setActiveMenu('catalog/attributes/bewai_attributeassigner')
32
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Catalog'), Mage::helper('adminhtml')->__('Catalog'))
33
+ ->_addBreadcrumb(Mage::helper('bewai_attributeassigner')->__('Assign Attributes'), Mage::helper('bewai_attributeassigner')->__('Assign Attributes'))
34
+ ->_title($this->__('Catalog'))
35
+ ->_title(Mage::helper('bewai_attributeassigner')->__('Assign Attributes'));
36
+
37
+ return $this;
38
+ }
39
+
40
+ /**
41
+ * Front page (Grid)
42
+ */
43
+ public function indexAction()
44
+ {
45
+ $step = $this->getRequest()->getParam('step');
46
+ if ($step && in_array($step, $this->_helper()->getSteps())) {
47
+ Mage::register('bewai_attributeassigner_force_current_step', $step);
48
+ }
49
+
50
+ $this->_processSessionData();
51
+ $this->_initModuleLayout();
52
+ $this->renderLayout();
53
+ }
54
+
55
+ /**
56
+ * Processes all ajax calls
57
+ * @return boolean
58
+ * @deprecated since version 0.1.0
59
+ */
60
+ public function indexAjaxAction()
61
+ {
62
+ if (!$this->getRequest()->isPost() || !$this->getRequest()->isAjax()) {
63
+ $this->getResponse()->setBody(' ');
64
+ return false;
65
+ }
66
+
67
+ $this->_processSessionData();
68
+
69
+ $this->loadLayout('bewai_attributeassigner_admin_index');
70
+ $this->getResponse()->setBody(
71
+ $this->getLayout()
72
+ ->getBlock('bewai_attributeassigner_index_app')
73
+ ->toHtml()
74
+ );
75
+ }
76
+
77
+ /**
78
+ * Resets all submitted data
79
+ */
80
+ public function resetAction()
81
+ {
82
+ $this->_helper()->setAttributeSelection();
83
+ $this->_helper()->setProductsSelection();
84
+ $this->_helper()->setValueSelection();
85
+
86
+ $this->_redirect('*/*/index');
87
+ }
88
+
89
+ /**
90
+ * Processes any given data or parameters
91
+ */
92
+ protected function _processSessionData()
93
+ {
94
+ if ($attribute_id = $this->getRequest()->getParam('attribute')) {
95
+ $this->_helper()->setAttributeSelection($attribute_id);
96
+ // Clear steps after
97
+ $this->_helper()->setProductsSelection();
98
+ $this->_helper()->setValueSelection();
99
+ }
100
+
101
+ if ($product_ids = $this->getRequest()->getParam('products')) {
102
+ $this->_helper()->setProductsSelection($product_ids);
103
+ // Clear steps after
104
+ $this->_helper()->setValueSelection();
105
+ }
106
+
107
+ if ($value_id = $this->getRequest()->getParam('value')) {
108
+ $this->_helper()->setValueSelection($value_id);
109
+ }
110
+
111
+ if ($this->_helper()->isReady() && $this->getRequest()->isPost()) {
112
+ $this->_redirect('*/*/index');
113
+ return false;
114
+ }
115
+ }
116
+
117
+ /**
118
+ * Product grid for AJAX request
119
+ */
120
+ public function gridAction()
121
+ {
122
+ $this->loadLayout();
123
+ $this->renderLayout();
124
+ }
125
+
126
+ /**
127
+ * Filters products grid
128
+ *
129
+ * @return boolean
130
+ */
131
+ public function ajaxFilterGridAction()
132
+ {
133
+ $this->_initModuleLayout();
134
+ $this->loadLayout('bewai_attributeassigner_admin_index');
135
+ $this->getResponse()->setBody(
136
+ $this->getLayout()
137
+ ->getBlock('bewai_attributeassigner_index_app_products')
138
+ ->toHtml());
139
+ }
140
+
141
+ /**
142
+ * Processes attribute change
143
+ *
144
+ * @return boolean
145
+ */
146
+ public function confirmAction()
147
+ {
148
+ try {
149
+
150
+ $products_ids = $this->_helper()->getSelectedValue('products');
151
+ $attribute = $this->_helper()->getSelectedValue('attribute');
152
+ $value = $this->_helper()->getSelectedValue('value');
153
+
154
+ if (!$products_ids || count($products_ids) === 0) {
155
+ throw new Exception ($this->__('Please provide product ids to change.'));
156
+ }
157
+
158
+ if (empty($attribute) || empty($value)) {
159
+ throw new Exception ($this->__('Please specify the attribute to change and the target value.'));
160
+ }
161
+ if (!$this->_helper()->isReady()) {
162
+ throw new Exception ($this->__('You have to validate every step before submit.'));
163
+ }
164
+
165
+ Mage::getSingleton('catalog/product_action')
166
+ ->updateAttributes($products_ids, array($attribute->getAttributeCode() => $value->getId()), Mage::app()->getStore()->getId());
167
+
168
+ $this->_getSession()->addSuccess($this->__('The attribute value for %s has been successfully change to %s for selected products.',
169
+ $attribute->getFrontendLabel(), $value->getValue()
170
+ ));
171
+
172
+ $this->_redirect('*/*/reset');
173
+ return false;
174
+ }
175
+ catch (Exception $e) {
176
+ $this->_getSession()->addError($this->__('An error occured while updating products : %s', $e->getMessage()));
177
+ }
178
+
179
+ $this->_redirectReferer();
180
+ }
181
+
182
+ }
183
+
184
+ ?>
app/code/local/Bewai/AttributeAssigner/etc/adminhtml.xml ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <!--
3
+ /**
4
+ * Bewai
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to contact@bewai.fr so we can send you a copy immediately.
15
+ *
16
+ *
17
+ * @category Bewai
18
+ * @package Bewai_AttributeAssigner
19
+ * @copyright Copyright (c) 2014 Bewai (http://www.bewai.fr)
20
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
21
+ */
22
+ -->
23
+ <config>
24
+ <menu>
25
+ <catalog>
26
+ <children>
27
+ <attributes>
28
+ <children>
29
+ <bewai_attributeassigner translate="title" module="bewai_attributeassigner">
30
+ <title>Assign Attributes</title>
31
+ <action>bewai_attributeassigner/admin</action>
32
+ <sort_order>100</sort_order>
33
+ </bewai_attributeassigner>
34
+ </children>
35
+ <sort_order>20</sort_order>
36
+ </attributes>
37
+ </children>
38
+ </catalog>
39
+ </menu>
40
+ <acl>
41
+ <resources>
42
+ <admin>
43
+ <children>
44
+ <catalog>
45
+ <children>
46
+ <attributes>
47
+ <children>
48
+ <bewai_attributeassigner translate="title" module="bewai_attributeassigner">
49
+ <title>Assign Attributes</title>
50
+ <sort_order>100</sort_order>
51
+ </bewai_attributeassigner>
52
+ </children>
53
+ </attributes>
54
+ </children>
55
+ </catalog>
56
+ </children>
57
+ </admin>
58
+ </resources>
59
+ </acl>
60
+ </config>
app/code/local/Bewai/AttributeAssigner/etc/config.xml ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Bewai
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to contact@bewai.fr so we can send you a copy immediately.
15
+ *
16
+ *
17
+ * @category Bewai
18
+ * @package Bewai_AttributeAssigner
19
+ * @copyright Copyright (c) 2014 Bewai (http://www.bewai.fr)
20
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
21
+ */
22
+ -->
23
+ <config>
24
+
25
+ <modules>
26
+ <Bewai_AttributeAssigner>
27
+ <version>0.1.0</version>
28
+ </Bewai_AttributeAssigner>
29
+ </modules>
30
+
31
+ <global>
32
+ <blocks>
33
+ <bewai_attributeassigner>
34
+ <class>Bewai_AttributeAssigner_Block</class>
35
+ </bewai_attributeassigner>
36
+ </blocks>
37
+ <helpers>
38
+ <bewai_attributeassigner>
39
+ <class>Bewai_AttributeAssigner_Helper</class>
40
+ </bewai_attributeassigner>
41
+ </helpers>
42
+ </global>
43
+
44
+ <admin>
45
+ <routers>
46
+ <bewai_attributeassigner>
47
+ <use>admin</use>
48
+ <args>
49
+ <module>Bewai_AttributeAssigner</module>
50
+ <frontName>bewai-attributeassigner</frontName>
51
+ </args>
52
+ </bewai_attributeassigner>
53
+ </routers>
54
+ </admin>
55
+
56
+ <adminhtml>
57
+ <layout>
58
+ <updates>
59
+ <bewai_attributeassigner>
60
+ <file>bewai_attributeassigner.xml</file>
61
+ </bewai_attributeassigner>
62
+ </updates>
63
+ </layout>
64
+ <translate>
65
+ <modules>
66
+ <bewai_attributeassigner>
67
+ <files>
68
+ <default>Bewai_AttributeAssigner.csv</default>
69
+ </files>
70
+ </bewai_attributeassigner>
71
+ </modules>
72
+ </translate>
73
+ </adminhtml>
74
+
75
+ </config>
app/design/adminhtml/default/default/layout/bewai_attributeassigner.xml ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Bewai
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to contact@bewai.fr so we can send you a copy immediately.
15
+ *
16
+ *
17
+ * @category Bewai
18
+ * @package Bewai_AttributeAssigner
19
+ * @copyright Copyright (c) 2014 Bewai (http://www.bewai.fr)
20
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
21
+ */
22
+ -->
23
+ <layout>
24
+
25
+ <bewai_attributeassigner_admin_index>
26
+
27
+ <reference name="head">
28
+ <action method="addCss">
29
+ <name>bewai/attributeassigner/adminhtml.css</name>
30
+ </action>
31
+ </reference>
32
+
33
+ <reference name="content">
34
+ <block type="bewai_attributeassigner/adminhtml_index" name="bewai_attributeassigner_index" template="bewai/attributeassigner/index.phtml">
35
+ <block type="bewai_attributeassigner/adminhtml_index_app" name="bewai_attributeassigner_index_app" as="app" template="bewai/attributeassigner/index/app.phtml">
36
+
37
+ <block type="bewai_attributeassigner/adminhtml_index_app_breadcrumb" name="bewai_attributeassigner_index_app_breadcrumb" as="breadcrumb" template="bewai/attributeassigner/index/app/breadcrumb.phtml">
38
+ <block type="bewai_attributeassigner/adminhtml_index_app" name="bewai_attributeassigner_index_app_breadcrumb_attribute" as="attribute" template="bewai/attributeassigner/index/app/breadcrumb/attribute.phtml" />
39
+ <block type="bewai_attributeassigner/adminhtml_index_app" name="bewai_attributeassigner_index_app_breadcrumb_products" as="products" template="bewai/attributeassigner/index/app/breadcrumb/products.phtml" />
40
+ <block type="bewai_attributeassigner/adminhtml_index_app" name="bewai_attributeassigner_index_app_breadcrumb_value" as="value" template="bewai/attributeassigner/index/app/breadcrumb/value.phtml" />
41
+ </block>
42
+
43
+ <block type="adminhtml/template" name="bewai_attributeassigner_index_app_screen" as="screen" template="bewai/attributeassigner/index/app/screen.phtml">
44
+ <block type="adminhtml/template" name="bewai_attributeassigner_index_app_screen_instructions" as="instructions" template="bewai/attributeassigner/index/app/screen/instructions.phtml" />
45
+ <block type="bewai_attributeassigner/adminhtml_index_app_screen_products" name="bewai_attributeassigner_index_app_screen_products" as="products-grid" />
46
+ <block type="bewai_attributeassigner/adminhtml_index_app_screen_summary" name="bewai_attributeassigner_index_app_screen_summary" as="summary" template="bewai/attributeassigner/index/app/screen/summary.phtml" />
47
+ </block>
48
+
49
+ <block type="adminhtml/template" name="bewai_attributeassigner_index_javascript" as="javascript" template="bewai/attributeassigner/index/javascript.phtml" />
50
+ </block>
51
+ </block>
52
+ </reference>
53
+
54
+ </bewai_attributeassigner_admin_index>
55
+
56
+ </layout>
app/design/adminhtml/default/default/template/bewai/attributeassigner/index.phtml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Bewai
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to contact@bewai.fr so we can send you a copy immediately.
14
+ *
15
+ *
16
+ * @category Bewai
17
+ * @package Bewai_AttributeAssigner
18
+ * @copyright Copyright (c) 2014 Bewai (http://www.bewai.fr)
19
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
20
+ */
21
+ ?>
22
+ <div class="content-header">
23
+ <table cellspacing="0">
24
+ <tr>
25
+ <td style="<?php echo $this->getHeaderWidth() ?>"><?php echo $this->getHeaderHtml() ?></td>
26
+ <td class="form-buttons"><?php echo $this->getButtonsHtml() ?></td>
27
+ </tr>
28
+ </table>
29
+ </div>
30
+
31
+ <div id="app-container">
32
+ <?php echo $this->getChildHtml('app'); ?>
33
+ </div>
app/design/adminhtml/default/default/template/bewai/attributeassigner/index/app.phtml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="assigner-container">
2
+
3
+ <?php echo $this->getChildHtml('breadcrumb'); ?>
4
+
5
+ <div class="assigner-screen">
6
+ <?php echo $this->getChildHtml('screen'); ?>
7
+ </div>
8
+
9
+ </div>
10
+
11
+ <?php echo $this->getChildHtml('javascript'); ?>
app/design/adminhtml/default/default/template/bewai/attributeassigner/index/app/breadcrumb.phtml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="assigner-breadcrumb">
2
+ <table width="100%" cellspacing="0" cellpadding="0">
3
+ <tr>
4
+ <?php $i = 1; foreach ($this->getSteps() as $key => $step) : ?>
5
+ <td class="step-number <?php echo $step['class']; ?>">
6
+ <?php if (strpos($step['class'], 'valid') !== false) : ?>
7
+ <a href="<?php echo $this->getUrl('*/*/index', array('step' => $key)); ?>">
8
+ <?php endif; ?>
9
+ <span><?php echo $i; ?></span>
10
+ <?php if (strpos($step['class'], 'valid') !== false) : ?>
11
+ </a>
12
+ <?php endif; ?>
13
+ </td>
14
+ <td class="step-content <?php echo $step['class']; ?>">
15
+ <h4><?php echo $this->__($step['title']); ?></h4>
16
+ <?php if (isset($step['content'])) : ?>
17
+ <?php echo $step['content']; ?>
18
+ <?php endif; ?>
19
+ </td>
20
+ <?php $i++; endforeach; ?>
21
+ </tr>
22
+ </table>
23
+ </div>
app/design/adminhtml/default/default/template/bewai/attributeassigner/index/app/breadcrumb/attribute.phtml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="attribute-selector">
2
+ <form action="<?php echo $this->getFormActionUrl(); ?>" method="post">
3
+
4
+ <label for="attribute"><?php echo $this->__('Select an attribute:'); ?></label>
5
+ <br />
6
+
7
+ <select name="attribute" class="attribute-select">
8
+ <option value="select"><?php echo $this->__('Select...'); ?></option>
9
+ <?php foreach ($this->getAttributeList() as $attr) : ?>
10
+ <option value="<?php echo $attr->getId(); ?>"<?php if ($this->isAttributeSelected($attr)) echo ' selected="selected"'; ?>><?php echo $attr->getFrontendLabel(); ?></option>
11
+ <?php endforeach; ?>
12
+ </select>
13
+
14
+ <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" />
15
+ </form>
16
+ </div>
app/design/adminhtml/default/default/template/bewai/attributeassigner/index/app/breadcrumb/products.phtml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $helper = Mage::helper('bewai_attributeassigner');
3
+ $products = $helper->getSelectedValue('products');
4
+ ?>
5
+ <?php if ($products && is_array($products) && count($products) > 0) : ?>
6
+ <?php echo $this->__('%s products selected.', count($products)); ?>
7
+ <?php if ($helper->getCurrentStep() != 'products') : ?>
8
+ <br />
9
+ <a href="<?php echo $this->getUrl('*/*/index', array('step' => 'products')); ?>"><?php echo Mage::helper('adminhtml')->__('Edit'); ?></a>
10
+ <?php endif; ?>
11
+ <?php endif; ?>
app/design/adminhtml/default/default/template/bewai/attributeassigner/index/app/breadcrumb/value.phtml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="attribute-selector">
2
+ <form action="<?php echo $this->getFormActionUrl(); ?>" method="post">
3
+
4
+ <label for="value"><?php echo Mage::helper('adminhtml')->__('Value:'); ?></label>
5
+ <br />
6
+
7
+ <select name="value" class="value-select">
8
+ <option value=""><?php echo $this->__('Select...'); ?></option>
9
+ <?php foreach ($this->getSelectedAttributeValuesList() as $value) : ?>
10
+ <option value="<?php echo $value->getId(); ?>"<?php if ($this->isValueSelected($value)) echo ' selected="selected"'; ?>><?php echo $value->getValue(); ?></option>
11
+ <?php endforeach; ?>
12
+ </select>
13
+
14
+ <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" />
15
+ </form>
16
+ </div>
app/design/adminhtml/default/default/template/bewai/attributeassigner/index/app/screen.phtml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $helper = Mage::helper('bewai_attributeassigner');
3
+ $products = $helper->getSelectedValue('products');
4
+ ?>
5
+
6
+ <?php if ($helper->getCurrentStep() == 'attribute') : ?>
7
+ <?php echo $this->getChildHtml('instructions'); ?>
8
+ <?php endif; ?>
9
+
10
+ <?php if ($helper->getCurrentStep() == 'products') : ?>
11
+ <?php $grid = $this->getChild('products-grid'); ?>
12
+ <?php echo $grid->toHtml(); ?>
13
+ <div class="submit-products">
14
+ <button class="scalable" id="submitMassaction" title="Valider" type="button" style="">
15
+ <span><span><span><?php echo $this->__('Submit'); ?></span></span></span>
16
+ </button>
17
+ </div>
18
+ <script>
19
+ $('submitMassaction').observe('click', function(e){
20
+ Event.stop(e);
21
+ <?php echo $grid->getMassactionBlock()->getJsObjectName(); ?>.apply();
22
+ });
23
+
24
+ <?php if ($products) : ?>
25
+ <?php echo $grid->getMassactionBlock()->getJsObjectName(); ?>.checkedString = '<?php echo join(',', $products); ?>';
26
+ <?php echo $grid->getMassactionBlock()->getJsObjectName(); ?>.checkCheckboxes();
27
+ <?php endif; ?>
28
+ </script>
29
+ <?php endif; ?>
30
+
31
+ <?php if ($helper->isReady()) : ?>
32
+ <?php echo $this->getChildHtml('summary'); ?>
33
+ <?php endif; ?>
app/design/adminhtml/default/default/template/bewai/attributeassigner/index/app/screen/instructions.phtml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="assigner-instructions">
2
+ <h3><?php echo $this->__('Instructions'); ?></h3>
3
+ <p>
4
+ <?php echo $this->__('This module changes the option value of a selected attribute for multiple products at a time.'); ?>
5
+ <br />
6
+ <?php echo $this->__('It is dedicated (and limited) to "select" frontend_type attributes to fix a common mistake on case or mispellings during imports or updates.'); ?>
7
+ </p>
8
+ <h4><?php echo $this->__('Steps'); ?></h4>
9
+ <ol>
10
+ <li><?php echo $this->__('First select the attribute you wish to modify an option of.'); ?></li>
11
+ <li>
12
+ <?php echo $this->__('You will then be prompted to select (simple) products from a grid.'); ?>
13
+ <br />
14
+ <?php echo $this->__('The grid will show you the value for selected attribute for every simple product in your catalog.'); ?>
15
+ </li>
16
+ <li>
17
+ <?php echo $this->__('Lastly, select the new value you wish to assign to that attribute for selected products.'); ?>
18
+ </li>
19
+ <li>
20
+ <?php echo $this->__('A summary of your selections and the job to be done will then be displayed for you to validate.'); ?>
21
+ </li>
22
+ </ol>
23
+ <p class="cheers">
24
+ <?php echo $this->__('I hope this will be as useful for you as it has been for me and my customers.'); ?>
25
+ <br />
26
+ <?php echo $this->__('Cheers, bouni.'); ?>
27
+ </p>
28
+ </div>
app/design/adminhtml/default/default/template/bewai/attributeassigner/index/app/screen/summary.phtml ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $helper = Mage::helper('bewai_attributeassigner');
3
+ $attribute = $helper->getSelectedValue('attribute');
4
+
5
+ $products = $this->getProductsCollection()
6
+ ->addAttributeToSelect(array('sku', 'name', $attribute->getAttributeCode()));
7
+ $products_show = 20;
8
+
9
+ $join_products = $this->getTargetProductCollection()
10
+ ->addAttributeToSelect(array('sku', 'name'));
11
+
12
+ $join_products_size = $join_products->getSize();
13
+ $join_products_show = 10;
14
+ ?>
15
+ <div class="assigner-summary">
16
+ <div class="left-col">
17
+ <h4><?php echo $this->__('These products:'); ?></h4>
18
+ <table width="100%" cellspacing="0" cellpadding="0" id="summary-product-list" class="summary-product-list no-more">
19
+ <thead>
20
+ <tr>
21
+ <th><?php echo Mage::helper('catalog')->__('Sku'); ?></th>
22
+ <th><?php echo Mage::helper('catalog')->__('Name'); ?></th>
23
+ <th><?php echo $attribute->getFrontendLabel(); ?></th>
24
+ </tr>
25
+ </thead>
26
+ <tbody>
27
+ <?php $i = 1; foreach ($products as $p) : ?>
28
+ <tr>
29
+ <td class="sku"><?php echo $p->getSku(); ?></td>
30
+ <td class="name"><?php echo $p->getName(); ?></td>
31
+ <td class="attr-value"><?php echo $p->getAttributeText($attribute->getAttributeCode()); ?></td>
32
+ </tr>
33
+ <?php $i++; if ($i > $products_show) break; endforeach; ?>
34
+ </tbody>
35
+ </table>
36
+
37
+ <?php if ($products->getSize() > $products_show) : ?>
38
+ <a href="javascript:void(0)" onclick="$('summary-product-list').removeClassName('no-more');$(this).remove();" id="toggle-more-rows"><?php echo $this->__('%s others', $products->getSize() - $products_show); ?>...</a>
39
+ <br />
40
+ <?php endif; ?>
41
+
42
+ <a href="<?php echo $this->getUrl('*/*/index', array('step' => 'products')); ?>"><?php echo Mage::helper('adminhtml')->__('Edit'); ?></a>
43
+ </div>
44
+
45
+ <div class="right-col">
46
+ <h4><?php echo $this->__('will have their value for <strong>%s</strong> changed to <strong>%s</strong>.', $attribute->getFrontendLabel(), $this->getValue()->getValue()); ?></h4>
47
+ <form action="<?php echo $this->getUrl('*/*/confirm'); ?>" method="get" id="confirmForm">
48
+ <button class="scalable" title="<?php echo $this->__('Validate'); ?>" type="button" style="" onclick="if(confirm('<?php echo $this->__('Please confirm'); ?>')) $('confirmForm').submit();">
49
+ <span><span><span><?php echo $this->__('Validate'); ?></span></span></span>
50
+ </button>
51
+ </form>
52
+
53
+ <div class="target-product-collection">
54
+ <h5><?php echo $this->__('%s product(s) already have that value:', $join_products_size); ?></h5>
55
+ <?php $join_products->getSelect()->limit($join_products_show); ?>
56
+ <table width="100%" cellspacing="0" cellpadding="0" class="summary-product-list">
57
+ <thead>
58
+ <tr>
59
+ <th><?php echo Mage::helper('catalog')->__('Sku'); ?></th>
60
+ <th><?php echo Mage::helper('catalog')->__('Name'); ?></th>
61
+ </tr>
62
+ </thead>
63
+ <tbody>
64
+ <?php foreach ($join_products as $p) : ?>
65
+ <tr>
66
+ <td class="sku"><?php echo $p->getSku(); ?></td>
67
+ <td class="name"><?php echo $p->getName(); ?></td>
68
+ </tr>
69
+ <?php endforeach; ?>
70
+ <?php if ($join_products_size > $join_products_show) : ?>
71
+ <tr>
72
+ <td class="sku" colspan="2">...(<?php echo $this->__('%s others', $join_products_size - $join_products_show); ?>)</td>
73
+ </tr>
74
+ <?php endif; ?>
75
+ </tbody>
76
+ </table>
77
+ </div>
78
+ </div>
79
+
80
+ <div class="clear">&nbsp;</div>
81
+ </div>
app/design/adminhtml/default/default/template/bewai/attributeassigner/index/javascript.phtml ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script>
2
+
3
+ var Bewai = Bewai || {};
4
+
5
+ Bewai.AttributeAssigner = Class.create({
6
+
7
+ selectors: {
8
+ attributeSelect: '.attribute-select',
9
+ valueSelect: '.value-select'
10
+ },
11
+
12
+ initialize: function(appContainer) {
13
+ this.appContainer = $(appContainer);
14
+ this.reactiveSelects = {
15
+ attributeSelector: this.appContainer.down(this.selectors.attributeSelect),
16
+ valueSelector: this.appContainer.down(this.selectors.valueSelect)
17
+ };
18
+
19
+ this.addEventListeners();
20
+ this.doLayoutUpdates();
21
+ },
22
+
23
+ clearEventListeners: function() {
24
+ var k;
25
+ for (k in this.reactiveSelects) {
26
+ if (this.reactiveSelects.hasOwnProperty(k) && this.reactiveSelects[k]) {
27
+ this.reactiveSelects[k].stopObserving('change');
28
+ }
29
+ }
30
+ return this;
31
+ },
32
+
33
+ addEventListeners: function() {
34
+ var k, that = this;
35
+ for (k in this.reactiveSelects) {
36
+ if (this.reactiveSelects.hasOwnProperty(k) && this.reactiveSelects[k]) {
37
+ this.reactiveSelects[k]
38
+ .stopObserving('change')
39
+ .observe('change', function(e){
40
+ var form = $(this).up('form');
41
+ form.submit();
42
+ Event.stop(e);
43
+
44
+ // form.request({
45
+ // onComplete: function(data){
46
+ // that.clearEventListeners();
47
+ // that.appContainer.update(data.responseText);
48
+ // }
49
+ // });
50
+ });
51
+ }
52
+ }
53
+ },
54
+
55
+ doLayoutUpdates: function() {
56
+ this.appContainer.select('select').each(function(elt){
57
+ var options = elt.select('option');
58
+ if (options.length === 1 || (options.length === 2 && options[0].getAttribute('value') == '')) {
59
+ options[(options.length === 2 && options[0].getAttribute('value') == '') ? 1 : 0].setAttribute('selected', 'selected');
60
+ }
61
+ });
62
+
63
+ // Fix checkbox checked="checked" attribute defined for massaction
64
+ // so checked alone works better and we do not have to rewrite
65
+ // this.appContainer.select('input[type="checkbox"]').each(function(elt){
66
+ // if (elt.getAttribute('checked') === 'checked') {
67
+ // elt.removeAttribute('checked');
68
+ // elt.checked = true;
69
+ // }
70
+ // });
71
+ },
72
+
73
+ destroy: function() {
74
+ this.clearEventListeners();
75
+ return this;
76
+ }
77
+
78
+ });
79
+
80
+ if (bewai_attribute_assigner)
81
+ delete(bewai_attribute_assigner.destroy());
82
+
83
+ var bewai_attribute_assigner = new Bewai.AttributeAssigner('app-container');
84
+
85
+ </script>
app/etc/modules/Bewai_AttributeAssigner.xml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Bewai
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to contact@bewai.fr so we can send you a copy immediately.
15
+ *
16
+ *
17
+ * @category Bewai
18
+ * @package Bewai_MassAttributeAssigner
19
+ * @copyright Copyright (c) 2014 Bewai (http://www.bewai.fr)
20
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
21
+ */
22
+ -->
23
+ <config>
24
+ <modules>
25
+ <Bewai_AttributeAssigner>
26
+ <active>true</active>
27
+ <codePool>local</codePool>
28
+ <depends>
29
+ <Mage_Catalog />
30
+ </depends>
31
+ </Bewai_AttributeAssigner>
32
+ </modules>
33
+ </config>
app/locale/en_US/Bewai_AttributeAssigner.csv ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Assign Attributes","Assign Attributes"
2
+ "%s others","%s others"
3
+ "%s product(s) already have that value:","%s product(s) already have that value:"
4
+ "%s products selected.","%s products selected."
5
+ "A summary of your selections and the job to be done will then be displayed for you to validate.","A summary of your selections and the job to be done will then be displayed for you to validate."
6
+ "An error occured while updating products : %s","An error occured while updating products : %s"
7
+ "Attribute","Attribute"
8
+ "Attribute to change.","Attribute to change."
9
+ "Change","Change"
10
+ "Cheers, bouni.","Cheers, bouni."
11
+ "First select the attribute you wish to modify an option of.","First select the attribute you wish to modify an option of."
12
+ "I hope this will be as useful for you as it has been for me and my customers.","I hope this will be as useful for you as it has been for me and my customers."
13
+ "Instructions","Instructions"
14
+ "It is dedicated (and limited) to ""select"" frontend_type attributes to fix a common mistake on case or mispellings during imports or updates.","It is dedicated (and limited) to ""select"" frontend_type attributes to fix a common mistake on case or mispellings during imports or updates."
15
+ "Lastly, select the new value you wish to assign to that attribute for selected products.","Lastly, select the new value you wish to assign to that attribute for selected products."
16
+ "Please confirm","Please confirm"
17
+ "Please provide product ids to change.","Please provide product ids to change."
18
+ "Please specify the attribute to change and the target value.","Please specify the attribute to change and the target value."
19
+ "Products to alter.","Products to alter."
20
+ "Select an attribute:","Select an attribute:"
21
+ "Select...","Select..."
22
+ "Steps","Steps"
23
+ "Submit","Submit"
24
+ "Target attribute value.","Target attribute value."
25
+ "The attribute value for %s has been successfully change to %s for selected products.","The attribute value for %s has been successfully change to %s for selected products."
26
+ "The grid will show you the value for selected attribute for every simple product in your catalog.","The grid will show you the value for selected attribute for every simple product in your catalog."
27
+ "These products:","These products:"
28
+ "This module changes the option value of a selected attribute for multiple products at a time.","This module changes the option value of a selected attribute for multiple products at a time."
29
+ "Validate","Validate"
30
+ "Value","Value"
31
+ "will have their value for <strong>%s</strong> changed to <strong>%s</strong>.","will have their value for <strong>%s</strong> changed to <strong>%s</strong>."
32
+ "You have to validate every step before submit.","You have to validate every step before submit."
33
+ "You will then be prompted to select (simple) products from a grid.","You will then be prompted to select (simple) products from a grid."
app/locale/fr_FR/Bewai_AttributeAssigner.csv ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Assign Attributes","Associer les attributs"
2
+ "%s others","%s autres"
3
+ "%s product(s) already have that value:","%s produit(s) ont déjà cette valeur : "
4
+ "%s products selected.","%s produits sélectionnés."
5
+ "A summary of your selections and the job to be done will then be displayed for you to validate.","Un résumé de vos sélections et des opérations qui vont êtres effectuées vous sera alors présenté pour validation."
6
+ "An error occured while updating products : %s","Une erreur est survenue lors de la mise à jour : %s."
7
+ "Attribute","Attribut"
8
+ "Attribute to change.","Attribut à modifier."
9
+ "Change","Modifier"
10
+ "Cheers, bouni.","Cheers, bouni."
11
+ "First select the attribute you wish to modify an option of.","Sélectionnez dabord l'attribut dont vous voulez changer l'option."
12
+ "I hope this will be as useful for you as it has been for me and my customers.","J'espère que ce module vous sera autant utile qu'à moi et qu'à mes clients."
13
+ "Instructions","Instructions"
14
+ "It is dedicated (and limited) to ""select"" frontend_type attributes to fix a common mistake on case or mispellings during imports or updates.","Il est dédié (et limité) aux attributs de type ""select"" (frontend_type) pour réparer les erreurs courantes de casse ou d'orthographe des imports et des mises à jour."
15
+ "Lastly, select the new value you wish to assign to that attribute for selected products.","Enfin, choisissez la nouvelle valeur à attribuer à l'attribut pour les produits sélectionnés"
16
+ "Please confirm","Confirmez-vous la modification ?"
17
+ "Please provide product ids to change.","Merci de sélectionner les produits à modifer"
18
+ "Please specify the attribute to change and the target value.","Merci de choisir l'attribut à changer et sa nouvelle valeur"
19
+ "Products to alter.","Produits à modifier"
20
+ "Select an attribute:","Sélectionnez un attribut :"
21
+ "Select...","Sélectionnez..."
22
+ "Steps","Étapes"
23
+ "Submit","Valider"
24
+ "Target attribute value.","Nouvelle valeur."
25
+ "The attribute value for %s has been successfully change to %s for selected products.","La valeur de l'attribut ""%s"" a bien été modifiée par ""%s"" pour les produits sélectionnés."
26
+ "The grid will show you the value for selected attribute for every simple product in your catalog.","Le tableau vous montrera pour chaque produit la valeur actuelle de l'attribut précédemment sélectionné."
27
+ "These products:","Ces produits : "
28
+ "This module changes the option value of a selected attribute for multiple products at a time.","Ce module change la valeur d'un attribut sélectionné pour des produits choisis."
29
+ "Validate","Valider"
30
+ "Value","Valeur"
31
+ "will have their value for <strong>%s</strong> changed to <strong>%s</strong>.","auront pour valeur de l'attribut <strong>%s</strong> : <strong>%s</strong>."
32
+ "You have to validate every step before submit.","Vous devez valider toutes les étapes avant de valider."
33
+ "You will then be prompted to select (simple) products from a grid.","Vous serez ensuite invité à sélectionner les produits (simples) à modifier dans un tableau."
package.xml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Bewai_AttributeAssigner</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This extension changes the option value of a selected attribute for multiple products at a time.</summary>
10
+ <description>When importing or updating multiple products, it often happens that some attribute options gets duplicated (mosttly due to case or syntax errors).&#xD;
11
+ &#xD;
12
+ It then becomes handy to find out which attributes are wrong and which products are wrongly associated. The best solution in that cas would be checking the csv/xml import file for errors, and this is still painful and cannot be done by a non-developer user.&#xD;
13
+ &#xD;
14
+ This module makes this task easier.&#xD;
15
+ &#xD;
16
+ First select the attribute you wish to modify an option of. You will then be prompted to select (simple) products from a grid. The grid will show you the value for selected attribute for every simple product in your catalog. Lastly, select the new value you wish to assign to that attribute for selected products. A summary of your selections and the job to be done will then be displayed for you to validate.&#xD;
17
+ &#xD;
18
+ Easy.&#xD;
19
+ &#xD;
20
+ This works for simple products only. &#xD;
21
+ While updating, be aware that these value will change even if the product is part of a configurable product. </description>
22
+ <notes>This is the first stable version.&#xD;
23
+ &#xD;
24
+ Feel free to give feedback and propose any updates you would like to get.&#xD;
25
+ &#xD;
26
+ Also, this version is given to you as is, please test it on samples or test servers before using in for production environments.&#xD;
27
+ &#xD;
28
+ This extension has been conceived and tested in Magento 1.9.</notes>
29
+ <authors><author><name>Benjamin Yayon</name><user>bouniflax</user><email>benjamin.yayon@bewai.fr</email></author></authors>
30
+ <date>2014-10-01</date>
31
+ <time>10:13:33</time>
32
+ <contents><target name="magelocal"><dir name="Bewai"><dir name="AttributeAssigner"><dir name="Block"><dir name="Adminhtml"><dir name="Index"><dir name="App"><file name="Breadcrumb.php" hash="be7150192b967e9fa71ee79f2a8b46fb"/><dir name="Screen"><file name="Products.php" hash="8b5033581cc94b07431375254b1594df"/><file name="Summary.php" hash="9d3c66d9e26d3f3be1e5e14d3a29cd62"/></dir></dir><file name="App.php" hash="20a0130c7d9612676da00b466b7e6c13"/></dir><file name="Index.php" hash="07591c8786c4fd9721db5c867d48355b"/></dir></dir><dir name="Helper"><file name="Data.php" hash="868fca2c25ddacf905a102571034de88"/></dir><dir name="controllers"><file name="AdminController.php" hash="941797abcee00136f593c67f7e0afc61"/></dir><dir name="etc"><file name="adminhtml.xml" hash="2007d8b32e798a3048a6666022185dcb"/><file name="config.xml" hash="46097f5efb73f141256e519d88697ce0"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="bewai_attributeassigner.xml" hash="aecd4a211972477f1e39914c49b2f367"/></dir><dir name="template"><dir name="bewai"><dir name="attributeassigner"><dir name="index"><dir name="app"><dir name="breadcrumb"><file name="attribute.phtml" hash="208d10d4c5ed53c07305614aaa54bf37"/><file name="products.phtml" hash="84c870adc755e378aacab2a21f2612d0"/><file name="value.phtml" hash="797f78361c8360eefe6e84744c78a787"/></dir><file name="breadcrumb.phtml" hash="cca39b4155c1d66aeee4f903f74253f3"/><dir name="screen"><file name="instructions.phtml" hash="263abe2988b05914b9daf8002c7d3f53"/><file name="summary.phtml" hash="290d9b52d82252d6f3648fee4e08bb73"/></dir><file name="screen.phtml" hash="96e46cd9752f0d9effe8a1e083bacb3a"/></dir><file name="app.phtml" hash="b63468c4d613e07d6344037b0cd25154"/><file name="javascript.phtml" hash="ccc27c6a2987488f2a2d36833e915b9f"/></dir><file name="index.phtml" hash="84af54c18e83e57adc21c08b6d6b74d7"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Bewai_AttributeAssigner.xml" hash="14a172053dd4542ae577d13225c71ca5"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Bewai_AttributeAssigner.csv" hash="78a634e46e8ef248a177c2aa08bf0d63"/></dir><dir name="fr_FR"><file name="Bewai_AttributeAssigner.csv" hash="beaec95afe43086b962f7ca8e557d513"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="bewai"><dir name="attributeassigner"><file name="adminhtml.css" hash="44dc3b9b17c8b46f7cc1bde22308529e"/></dir></dir></dir></dir></dir></target></contents>
33
+ <compatible/>
34
+ <dependencies><required><php><min>5.3.0</min><max>5.5.0</max></php></required></dependencies>
35
+ </package>
skin/adminhtml/default/default/bewai/attributeassigner/adminhtml.css ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*-==-+_=-+_+-+_=-+-+_=_+-=-
2
+ Breadcrumb
3
+ +--==-+_=-+_+-+_=-+-+_=_+-*/
4
+ .bewai-attributeassigner-admin-index div.assigner-breadcrumb td {
5
+ text-align: center;
6
+ vertical-align: top;
7
+ padding: 10px;
8
+ }
9
+
10
+ .bewai-attributeassigner-admin-index div.assigner-breadcrumb td.step-number {
11
+ font-size: 40px;
12
+ font-weight: bold;
13
+ padding: 5px 10px;
14
+ color: white;
15
+ background: url("../../images/header_top_bg.gif") repeat-x scroll 0 0 #425e66;
16
+ vertical-align: middle;
17
+ }
18
+
19
+ .bewai-attributeassigner-admin-index div.assigner-breadcrumb td.step-number a {
20
+ text-decoration: none;
21
+ color: white;
22
+ }
23
+
24
+ .bewai-attributeassigner-admin-index div.assigner-breadcrumb td.step-number a:hover {
25
+ color: #ffa84c;
26
+ }
27
+
28
+ .bewai-attributeassigner-admin-index div.assigner-breadcrumb td.step-number.active,
29
+ .bewai-attributeassigner-admin-index div.assigner-breadcrumb td.step-number.valid.active {
30
+ background: #ffa84c; /* Old browsers */
31
+ background: -moz-linear-gradient(top, #ffa84c 0%, #ff7b0d 100%); /* FF3.6+ */
32
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffa84c), color-stop(100%,#ff7b0d)); /* Chrome,Safari4+ */
33
+ background: -webkit-linear-gradient(top, #ffa84c 0%,#ff7b0d 100%); /* Chrome10+,Safari5.1+ */
34
+ background: -o-linear-gradient(top, #ffa84c 0%,#ff7b0d 100%); /* Opera 11.10+ */
35
+ background: -ms-linear-gradient(top, #ffa84c 0%,#ff7b0d 100%); /* IE10+ */
36
+ background: linear-gradient(to bottom, #ffa84c 0%,#ff7b0d 100%); /* W3C */
37
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffa84c', endColorstr='#ff7b0d',GradientType=0 ); /* IE6-9 */
38
+ }
39
+
40
+ .bewai-attributeassigner-admin-index div.assigner-breadcrumb td.step-number.active a:hover {
41
+ color: white;
42
+ cursor: default;
43
+ }
44
+
45
+ .bewai-attributeassigner-admin-index div.assigner-breadcrumb td.step-number.valid {
46
+ background: #cdeb8e; /* Old browsers */
47
+ background: -moz-linear-gradient(top, #cdeb8e 0%, #a5c956 100%); /* FF3.6+ */
48
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#cdeb8e), color-stop(100%,#a5c956)); /* Chrome,Safari4+ */
49
+ background: -webkit-linear-gradient(top, #cdeb8e 0%,#a5c956 100%); /* Chrome10+,Safari5.1+ */
50
+ background: -o-linear-gradient(top, #cdeb8e 0%,#a5c956 100%); /* Opera 11.10+ */
51
+ background: -ms-linear-gradient(top, #cdeb8e 0%,#a5c956 100%); /* IE10+ */
52
+ background: linear-gradient(to bottom, #cdeb8e 0%,#a5c956 100%); /* W3C */
53
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cdeb8e', endColorstr='#a5c956',GradientType=0 ); /* IE6-9 */
54
+ }
55
+
56
+ .bewai-attributeassigner-admin-index div.assigner-breadcrumb td.step-number.disabled {
57
+ background: url("../../images/header_top_bg.gif") repeat-x scroll 0 0 #425e66;
58
+ color: white;
59
+ }
60
+
61
+ .bewai-attributeassigner-admin-index div.assigner-breadcrumb td.step-content {
62
+ background-color: #eee;
63
+ text-align: left;
64
+ }
65
+
66
+ .bewai-attributeassigner-admin-index div.assigner-breadcrumb td.step-content.valid {
67
+
68
+ }
69
+
70
+ .bewai-attributeassigner-admin-index div.assigner-breadcrumb td.step-content.valid.active {
71
+ background-color: #eee;
72
+ }
73
+ .bewai-attributeassigner-admin-index .attribute-selector {
74
+ padding: 0;
75
+ text-align: left;
76
+ line-height: 20px;
77
+ }
78
+
79
+ .bewai-attributeassigner-admin-index .attribute-selector td {
80
+ padding: 5px 0;
81
+ }
82
+
83
+ .bewai-attributeassigner-admin-index .attribute-selector label {
84
+ color:#2d444f;
85
+ font-weight: bold;
86
+ padding-right: 10px;
87
+ }
88
+
89
+ .bewai-attributeassigner-admin-index .attribute-selector select {
90
+ width: 70%;
91
+ }
92
+
93
+ .bewai-attributeassigner-admin-index .products-grid .massaction td {
94
+ width: 99%;
95
+ }
96
+
97
+ /*-==-+_=-+_+-+_=-+-+_=_+-=-
98
+ Screens
99
+ +--==-+_=-+_+-+_=-+-+_=_+-*/
100
+ .bewai-attributeassigner-admin-index div.assigner-screen {
101
+ margin: 10px auto;
102
+ padding: 30px;
103
+ max-width: 1000px;
104
+ }
105
+
106
+ .bewai-attributeassigner-admin-index div.assigner-screen .assigner-instructions {
107
+ background-color: #eee;
108
+ padding: 30px;
109
+ text-align: left;
110
+ color: #333;
111
+ font-size: 13px;
112
+ }
113
+
114
+
115
+ .bewai-attributeassigner-admin-index div.assigner-screen .assigner-instructions h4 {
116
+ margin-top: 10px;
117
+ }
118
+
119
+ .bewai-attributeassigner-admin-index div.assigner-screen .assigner-instructions ol {
120
+ list-style: hebrew outside;
121
+ padding-left: 15px;
122
+ }
123
+
124
+ .bewai-attributeassigner-admin-index div.assigner-screen .assigner-instructions ol li {
125
+ margin-bottom: 10px;
126
+ }
127
+
128
+ .bewai-attributeassigner-admin-index div.assigner-screen .assigner-instructions p.cheers {
129
+ margin-top: 20px;
130
+ color: #666;
131
+ font-style: italic;
132
+ }
133
+
134
+ .bewai-attributeassigner-admin-index div.assigner-screen .submit-products {
135
+ text-align: center;
136
+ }
137
+
138
+ .bewai-attributeassigner-admin-index div.assigner-screen .assigner-summary {
139
+ margin: 0 auto;
140
+ padding: 30px;
141
+ max-width: 1000px;
142
+ }
143
+
144
+ .bewai-attributeassigner-admin-index div.assigner-screen .assigner-summary .left-col {
145
+ float: left;
146
+ width: 62%;
147
+ }
148
+
149
+ .bewai-attributeassigner-admin-index div.assigner-screen .assigner-summary .left-col .summary-product-list {
150
+ border-left: 1px solid #666;
151
+ border-right: 1px solid #666;
152
+ margin-bottom: 10px;
153
+ }
154
+
155
+ .bewai-attributeassigner-admin-index div.assigner-screen .assigner-summary .left-col .summary-product-list thead tr {
156
+ background: #5f767f; /* Old browsers */
157
+ background: -moz-linear-gradient(top, #5f767f 0%, #425e66 100%); /* FF3.6+ */
158
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#5f767f), color-stop(100%,#425e66)); /* Chrome,Safari4+ */
159
+ background: -webkit-linear-gradient(top, #5f767f 0%,#425e66 100%); /* Chrome10+,Safari5.1+ */
160
+ background: -o-linear-gradient(top, #5f767f 0%,#425e66 100%); /* Opera 11.10+ */
161
+ background: -ms-linear-gradient(top, #5f767f 0%,#425e66 100%); /* IE10+ */
162
+ background: linear-gradient(to bottom, #5f767f 0%,#425e66 100%); /* W3C */
163
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#5f767f', endColorstr='#425e66',GradientType=0 ); /* IE6-9 */
164
+ color: white;
165
+ }
166
+
167
+ .bewai-attributeassigner-admin-index div.assigner-screen .assigner-summary .left-col .summary-product-list thead tr th {
168
+ text-align: center;
169
+ padding: 3px 0;
170
+ }
171
+
172
+ .bewai-attributeassigner-admin-index div.assigner-screen .assigner-summary .left-col #summary-product-list.no-more tr:nth-child(n+20) {
173
+ display: none;
174
+ }
175
+
176
+ .bewai-attributeassigner-admin-index div.assigner-screen .assigner-summary .left-col .summary-product-list tbody tr:nth-child(even) {background: #eee}
177
+ .bewai-attributeassigner-admin-index div.assigner-screen .assigner-summary .left-col .summary-product-list tbody tr:nth-child(odd) {background: #fff}
178
+
179
+ .bewai-attributeassigner-admin-index div.assigner-screen .assigner-summary .left-col .summary-product-list tbody tr td {
180
+ padding: 3px 5px;
181
+ border-bottom: 1px solid #666;
182
+ border-right: 1px dotted #ccc;
183
+ }
184
+
185
+ .bewai-attributeassigner-admin-index div.assigner-screen .assigner-summary .left-col .summary-product-list tbody tr td:last-child {
186
+ border-right: 0;
187
+ }
188
+
189
+ .bewai-attributeassigner-admin-index div.assigner-screen .assigner-summary .right-col {
190
+ float: right;
191
+ width: 34%;
192
+ }
193
+
194
+ .bewai-attributeassigner-admin-index div.assigner-screen .assigner-summary .right-col h4 {
195
+ font-weight: normal;
196
+ }
197
+
198
+ .bewai-attributeassigner-admin-index div.assigner-screen .assigner-summary .right-col form button {
199
+ width: 100%;
200
+ padding-top: 10px;
201
+ padding-bottom: 10px;
202
+ font-size: 16px;
203
+ }
204
+
205
+ .bewai-attributeassigner-admin-index div.assigner-screen .assigner-summary .right-col .target-product-collection {
206
+ margin-top: 10px;
207
+ padding: 10px;
208
+ border-top: 1px solid #aaa;
209
+ background-color: #efefef;
210
+ }
211
+
212
+ .bewai-attributeassigner-admin-index div.assigner-screen .assigner-summary .right-col .target-product-collection h5 {
213
+ margin-bottom: 10px;
214
+ }
215
+
216
+ .bewai-attributeassigner-admin-index div.assigner-screen .assigner-summary .right-col .target-product-collection thead tr th {
217
+ border-bottom: 1px dashed #ddd;
218
+ padding-bottom: 5px;
219
+ }
220
+
221
+ .bewai-attributeassigner-admin-index div.assigner-screen .assigner-summary .right-col .target-product-collection tbody tr:first-child td {
222
+ padding: 5px 0;
223
+ }
224
+
225
+ .bewai-attributeassigner-admin-index div.assigner-screen .assigner-summary .clear {
226
+ clear: both;
227
+ }