Version Notes
3rd Version
Download this release
Release Info
Developer | Sanjay Modasia |
Extension | Hwg_Attributemanager |
Version | 0.3.0 |
Comparing to | |
See all releases |
Code changes from version 0.2.0 to 0.3.0
- app/code/local/Hwg/Attributemanager/Block/View.php +46 -0
- app/code/local/Hwg/Attributemanager/Model/Ordertracking.php +8 -0
- app/code/local/Hwg/Attributemanager/controllers/IndexController.php +30 -0
- app/design/adminhtml/default/default/template/attributemanager/grid.phtml +179 -0
- app/design/adminhtml/default/default/template/attributemanager/index.phtml +21 -0
- app/design/adminhtml/default/default/template/attributemanager/js.phtml +274 -0
- app/design/adminhtml/default/default/template/attributemanager/new/created.phtml +54 -0
- app/design/adminhtml/default/default/template/attributemanager/options.phtml +178 -0
- package.xml +5 -5
app/code/local/Hwg/Attributemanager/Block/View.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once 'lib/simple_html_dom.php';
|
3 |
+
class Hwg_Ordertracking_Block_View extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
public function getDpdOrderTracking()
|
6 |
+
{
|
7 |
+
$consignment = $this->getRequest()->getParam('consignment', 15502405041348);
|
8 |
+
|
9 |
+
$link = 'http://www.dpd.co.uk/tracking/quicktrack.do?search.consignmentNumber='.$consignment.'&search.searchType=16&search.javascriptValidated=0&appmode=guest';
|
10 |
+
|
11 |
+
try
|
12 |
+
{
|
13 |
+
$html = file_get_html($link);
|
14 |
+
}
|
15 |
+
//catch exception
|
16 |
+
catch(Exception $e)
|
17 |
+
{
|
18 |
+
var_dump($e);
|
19 |
+
}
|
20 |
+
$Status = "Vide";
|
21 |
+
$target_script = "Vide";
|
22 |
+
|
23 |
+
foreach($html->find('script') as $html_script) {
|
24 |
+
if(strstr($html_script->outertext, "var trackCode =")) {
|
25 |
+
$target_script = $html_script->outertext;
|
26 |
+
}
|
27 |
+
}
|
28 |
+
$pattern = "/var trackCode = \'(.*?)\';*/";
|
29 |
+
preg_match($pattern, $target_script, $matches);
|
30 |
+
|
31 |
+
$data = array();
|
32 |
+
$data['Status'] = $html->find('td[class=app-light-row-one app-table-indent] div[id='.$matches[1].'_text]',0)->plaintext;
|
33 |
+
$data['Parcel_No'] = $html->find('td[class=app-light-row-one app-border-top app-data-row]',0)->plaintext;
|
34 |
+
$data['Reference'] = $html->find('td[class=app-light-row-one app-border-top app-data-row]',1)->plaintext;
|
35 |
+
$data['consignment'] = $html->find('td[class=app-light-row-one app-border-top app-data-row]',2)->plaintext;
|
36 |
+
$data['Post_Code'] = $html->find('td[class=app-light-row-one app-border-top app-data-row]',3)->plaintext;
|
37 |
+
$data['Collected_Date'] = $html->find('td[class=app-light-row-one app-border-top app-data-row]',4)->plaintext;
|
38 |
+
$data['Service'] = $html->find('td[class=app-light-row-one app-border-top app-data-row]',5)->plaintext;
|
39 |
+
$data['Delivery_Status'] = $html->find('td[class=app-light-row-one app-border-top app-data-row]',6)->plaintext;
|
40 |
+
$trackingtable = $html->find('table[id=parceldetail]',0)->outertext;
|
41 |
+
$data['trackingtable'] = str_replace("SPICERS LTD", "WAREHOUSE", $trackingtable);
|
42 |
+
|
43 |
+
return $data;
|
44 |
+
}
|
45 |
+
|
46 |
+
}
|
app/code/local/Hwg/Attributemanager/Model/Ordertracking.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Hwg_Ordertracking_Model_Ordertracking extends Mage_Core_Model_Abstract
|
3 |
+
{
|
4 |
+
public function _construct()
|
5 |
+
{
|
6 |
+
parent::_construct();
|
7 |
+
}
|
8 |
+
}
|
app/code/local/Hwg/Attributemanager/controllers/IndexController.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once 'lib/simple_html_dom.php';
|
3 |
+
|
4 |
+
class Hwg_Ordertracking_IndexController extends Mage_Core_Controller_Front_Action
|
5 |
+
{
|
6 |
+
public function preDispatch()
|
7 |
+
{
|
8 |
+
parent::preDispatch();
|
9 |
+
|
10 |
+
if (!Mage::getSingleton('customer/session')->authenticate($this)) {
|
11 |
+
$this->setFlag('', 'no-dispatch', true);
|
12 |
+
}
|
13 |
+
/*if (!Mage::getStoreConfigFlag('wishlist/general/active')) {
|
14 |
+
$this->norouteAction();
|
15 |
+
return;
|
16 |
+
}*/
|
17 |
+
}
|
18 |
+
|
19 |
+
public function dpdAction()
|
20 |
+
{
|
21 |
+
date_default_timezone_set('Europe/Berlin');
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
//Mage::getSingleton('customer/session')->setCarrierTracking('dpd');
|
26 |
+
$this->loadLayout();
|
27 |
+
$this->renderLayout();
|
28 |
+
}
|
29 |
+
|
30 |
+
}
|
app/design/adminhtml/default/default/template/attributemanager/grid.phtml
ADDED
@@ -0,0 +1,179 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="content-header">
|
2 |
+
<table cellspacing="0">
|
3 |
+
<tr>
|
4 |
+
<td style="width:50%;"><h3 class="icon-head head-products"><?php echo Mage::helper('attributemanager')->__('Manage attributes') ?></h3></td>
|
5 |
+
|
6 |
+
<td class="form-buttons"><?php echo $this->addNewButton()
|
7 |
+
?></td>
|
8 |
+
</tr>
|
9 |
+
</table>
|
10 |
+
</div>
|
11 |
+
<div>
|
12 |
+
|
13 |
+
<?php
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Template for Mage_Adminhtml_Block_Widget_Grid
|
17 |
+
*
|
18 |
+
* getId()
|
19 |
+
* getCollection()
|
20 |
+
* getColumns()
|
21 |
+
* getPagerVisibility()
|
22 |
+
* getVarNamePage()
|
23 |
+
*/
|
24 |
+
$numColumns = sizeof($this->getColumns());
|
25 |
+
?>
|
26 |
+
<?php if($this->getCollection()): ?>
|
27 |
+
<?php if($this->canDisplayContainer()): ?>
|
28 |
+
<?php if($this->getGridHeader()): ?>
|
29 |
+
<div class="content-header">
|
30 |
+
<table cellspacing="0">
|
31 |
+
<tr>
|
32 |
+
<td style="width:50%;"><h2><?php echo $this->getGridHeader(); ?></h2></td>
|
33 |
+
</tr>
|
34 |
+
</table>
|
35 |
+
</div>
|
36 |
+
<?php endif ?>
|
37 |
+
|
38 |
+
<div id="<?php echo $this->getId() ?>">
|
39 |
+
<?php else: ?>
|
40 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
41 |
+
<?php endif; ?>
|
42 |
+
<?php if($this->getPagerVisibility() || $this->getExportTypes() || $this->getFilterVisibility()): ?>
|
43 |
+
<table cellspacing="0" class="actions">
|
44 |
+
<tr>
|
45 |
+
<?php if($this->getPagerVisibility()): ?>
|
46 |
+
<td class="pager">
|
47 |
+
<?php echo $this->__('Page') ?>
|
48 |
+
|
49 |
+
<?php $_curPage = $this->getCollection()->getCurPage() ?>
|
50 |
+
<?php $_lastPage = $this->getCollection()->getLastPageNumber() ?>
|
51 |
+
<?php if($_curPage>1): ?>
|
52 |
+
<a href="#" title="<?php echo $this->__('Previous page') ?>" onclick="<?php echo $this->getId() ?>JsObject.setPage('<?php echo ($_curPage-1) ?>');return false;"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_left.gif') ?>" alt="Go to Previous page" class="arrow"/></a>
|
53 |
+
<?php else: ?>
|
54 |
+
<img src="<?php echo $this->getSkinUrl('images/pager_arrow_left_off.gif') ?>" alt="Go to Previous page" class="arrow"/>
|
55 |
+
<?php endif; ?>
|
56 |
+
|
57 |
+
<input type="text" name="<?php echo $this->getVarNamePage() ?>" value="<?php echo $_curPage ?>" class="input-text page" onkeypress="<?php echo $this->getId() ?>JsObject.inputPage(event, '<?php echo $_lastPage ?>')"/>
|
58 |
+
|
59 |
+
<?php if($_curPage < $_lastPage): ?>
|
60 |
+
<a href="#" title="<?php echo $this->__('Next page') ?>" onclick="<?php echo $this->getId() ?>JsObject.setPage('<?php echo ($_curPage+1) ?>');return false;"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_right.gif') ?>" alt="Go to Next page" class="arrow"/></a>
|
61 |
+
<?php else: ?>
|
62 |
+
<img src="<?php echo $this->getSkinUrl('images/pager_arrow_right_off.gif') ?>" alt="Go to Previous page" class="arrow"/>
|
63 |
+
<?php endif; ?>
|
64 |
+
|
65 |
+
<?php echo $this->__('of %s pages', $this->getCollection()->getLastPageNumber()) ?>
|
66 |
+
<span class="separator">|</span>
|
67 |
+
<?php echo $this->__('View') ?>
|
68 |
+
<select name="<?php echo $this->getVarNameLimit() ?>" onchange="<?php echo $this->getId() ?>JsObject.loadByElement(this)">
|
69 |
+
<option value="20"<?php if($this->getCollection()->getPageSize()==20): ?> selected="selected"<?php endif; ?>>20</option>
|
70 |
+
<option value="30"<?php if($this->getCollection()->getPageSize()==30): ?> selected="selected"<?php endif; ?>>30</option>
|
71 |
+
<option value="50"<?php if($this->getCollection()->getPageSize()==50): ?> selected="selected"<?php endif; ?>>50</option>
|
72 |
+
<option value="100"<?php if($this->getCollection()->getPageSize()==100): ?> selected="selected"<?php endif; ?>>100</option>
|
73 |
+
<option value="200"<?php if($this->getCollection()->getPageSize()==200): ?> selected="selected"<?php endif; ?>>200</option>
|
74 |
+
</select>
|
75 |
+
<?php echo $this->__('per page') ?><span class="separator">|</span>
|
76 |
+
<?php echo $this->__('Total %d records found', $this->getCollection()->getSize()) ?>
|
77 |
+
<span id="<?php echo $this->getHtmlId() ?>-total-count" class="no-display"><?php echo $this->getCollection()->getSize() ?></span>
|
78 |
+
<?php if($this->getRssLists()): ?>
|
79 |
+
<?php foreach ($this->getRssLists() as $_rss): ?>
|
80 |
+
<span class="separator">|</span><a href="<?php echo $_rss->getUrl() ?>" class="link-feed"><?php echo $_rss->getLabel() ?></a>
|
81 |
+
<?php endforeach ?>
|
82 |
+
<?php endif; ?>
|
83 |
+
</td>
|
84 |
+
<?php endif ?>
|
85 |
+
<?php if($this->getExportTypes()): ?>
|
86 |
+
<td class="export a-right">
|
87 |
+
<img src="<?php echo $this->getSkinUrl('images/icon_export.gif') ?>" alt="" class="v-middle"/> <?php echo $this->__('Export to:') ?>
|
88 |
+
<select name="<?php echo $this->getId() ?>_export" id="<?php echo $this->getId() ?>_export" style="width:8em;">
|
89 |
+
<?php foreach ($this->getExportTypes() as $_type): ?>
|
90 |
+
<option value="<?php echo $_type->getUrl() ?>"><?php echo $_type->getLabel() ?></option>
|
91 |
+
<?php endforeach; ?>
|
92 |
+
</select>
|
93 |
+
<?php echo $this->getExportButtonHtml() ?>
|
94 |
+
</td>
|
95 |
+
<?php endif; ?>
|
96 |
+
<td class="filter-actions a-right">
|
97 |
+
<?php echo $this->getMainButtonsHtml() ?>
|
98 |
+
</td>
|
99 |
+
</tr>
|
100 |
+
</table>
|
101 |
+
<?php endif; ?>
|
102 |
+
<?php if($this->getMassactionBlock()->isAvailable()): ?>
|
103 |
+
<?php echo $this->getMassactionBlockHtml() ?>
|
104 |
+
<?php endif ?>
|
105 |
+
<div class="grid">
|
106 |
+
<div class="hor-scroll">
|
107 |
+
<table cellspacing="0" class="data" id="<?php echo $this->getId() ?>_table">
|
108 |
+
<?php foreach ($this->getColumns() as $_column): ?>
|
109 |
+
<col <?php echo $_column->getHtmlProperty() ?> />
|
110 |
+
<?php endforeach; ?>
|
111 |
+
<?php if ($this->getHeadersVisibility() || $this->getFilterVisibility()): ?>
|
112 |
+
<thead>
|
113 |
+
<?php if ($this->getHeadersVisibility()): ?>
|
114 |
+
<tr class="headings">
|
115 |
+
<?php foreach ($this->getColumns() as $_column): ?>
|
116 |
+
<th<?php echo $_column->getHeaderHtmlProperty() ?>><span class="nobr"><?php echo $_column->getHeaderHtml() ?></span></th>
|
117 |
+
<?php endforeach; ?>
|
118 |
+
</tr>
|
119 |
+
<?php endif; ?>
|
120 |
+
<?php if ($this->getFilterVisibility()): ?>
|
121 |
+
<tr class="filter">
|
122 |
+
<?php $i=0;foreach ($this->getColumns() as $_column): ?>
|
123 |
+
<th<?php echo $_column->getHeaderHtmlProperty() ?>><?php echo $_column->getFilterHtml() ?></th>
|
124 |
+
<?php endforeach; ?>
|
125 |
+
</tr>
|
126 |
+
<?php endif ?>
|
127 |
+
</thead>
|
128 |
+
<?php endif; ?>
|
129 |
+
<?php if ($this->getCountTotals()): ?>
|
130 |
+
<tfoot>
|
131 |
+
<tr>
|
132 |
+
<?php foreach ($this->getColumns() as $_column): ?>
|
133 |
+
<th class="<?php echo $_column->getCssProperty() ?>"><?php echo $_column->getRowField($_column->getGrid()->getTotals()) ?> </th>
|
134 |
+
<?php endforeach; ?>
|
135 |
+
</tr>
|
136 |
+
</tfoot>
|
137 |
+
<?php endif; ?>
|
138 |
+
<tbody>
|
139 |
+
<?php if (($this->getCollection()->getSize()>0) && (!$this->getIsCollapsed())): ?>
|
140 |
+
<?php foreach ($this->getCollection() as $_index=>$_item): ?>
|
141 |
+
<tr title="<?php echo $this->getRowUrl($_item) ?>"<?php if ($_class = $this->getRowClass($_item)):?> class="<?php echo $_class; ?>"<?php endif;?> >
|
142 |
+
<?php $i=0;foreach ($this->getColumns() as $_column): ?>
|
143 |
+
<td class="<?php echo $_column->getCssProperty() ?> <?php echo ++$i==$numColumns?'last':'' ?>"><?php echo (($_html = $_column->getRowField($_item)) != '' ? $_html : ' ') ?></td>
|
144 |
+
<?php endforeach; ?>
|
145 |
+
</tr>
|
146 |
+
<?php endforeach; ?>
|
147 |
+
<?php elseif ($this->getEmptyText()): ?>
|
148 |
+
<tr>
|
149 |
+
<td class="empty-text <?php echo $this->getEmptyTextClass() ?>" colspan="100"><?php echo $this->getEmptyText() ?></td>
|
150 |
+
</tr>
|
151 |
+
<?php endif; ?>
|
152 |
+
</tbody>
|
153 |
+
</table>
|
154 |
+
</div>
|
155 |
+
</div>
|
156 |
+
<?php if($this->canDisplayContainer()): ?>
|
157 |
+
</div>
|
158 |
+
<script type="text/javascript">
|
159 |
+
//<![CDATA[
|
160 |
+
<?php echo $this->getJsObjectName() ?> = new varienGrid('<?php echo $this->getId() ?>', '<?php echo $this->getGridUrl() ?>', '<?php echo $this->getVarNamePage() ?>', '<?php echo $this->getVarNameSort() ?>', '<?php echo $this->getVarNameDir() ?>', '<?php echo $this->getVarNameFilter() ?>');
|
161 |
+
<?php echo $this->getJsObjectName() ?>.useAjax = '<?php echo $this->getUseAjax() ?>';
|
162 |
+
<?php if($this->getRowClickCallback()): ?>
|
163 |
+
<?php echo $this->getJsObjectName() ?>.rowClickCallback = <?php echo $this->getRowClickCallback() ?>;
|
164 |
+
<?php endif; ?>
|
165 |
+
<?php if($this->getCheckboxCheckCallback()): ?>
|
166 |
+
<?php echo $this->getJsObjectName() ?>.checkboxCheckCallback = <?php echo $this->getCheckboxCheckCallback() ?>;
|
167 |
+
<?php endif; ?>
|
168 |
+
<?php if($this->getRowInitCallback()): ?>
|
169 |
+
<?php echo $this->getJsObjectName() ?>.initRowCallback = <?php echo $this->getRowInitCallback() ?>;
|
170 |
+
<?php echo $this->getJsObjectName() ?>.rows.each(function(row){<?php echo $this->getRowInitCallback() ?>(<?php echo $this->getJsObjectName() ?>, row)});
|
171 |
+
<?php endif; ?>
|
172 |
+
<?php if($this->getMassactionBlock()->isAvailable()): ?>
|
173 |
+
<?php echo $this->getMassactionBlock()->getJavaScript() ?>
|
174 |
+
<?php endif ?>
|
175 |
+
//]]>
|
176 |
+
</script>
|
177 |
+
<?php endif; ?>
|
178 |
+
<?php endif ?>
|
179 |
+
</div>
|
app/design/adminhtml/default/default/template/attributemanager/index.phtml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="content-header">
|
2 |
+
<table cellspacing="0">
|
3 |
+
<tr>
|
4 |
+
<td style="width:50%;"><h3 class="icon-head head-products"><?php echo Mage::helper('attributemanager')->__('Manage attributes') ?></h3></td>
|
5 |
+
<td class="a-right">
|
6 |
+
</td>
|
7 |
+
</tr>
|
8 |
+
</table>
|
9 |
+
</div>
|
10 |
+
<div>
|
11 |
+
<div align="center">
|
12 |
+
<h3 class="icon-head"><u><?php echo Mage::helper('attributemanager')->__('Choose attributes to manage') ?></u></h3>
|
13 |
+
<br/><br/>
|
14 |
+
<h3 class="icon-head">
|
15 |
+
<a href="<?php echo $this->getUrl('attributemanager/index/category');?>filter/"><?php echo Mage::helper('attributemanager')->__('Categories attributes') ?></a>
|
16 |
+
<br/>
|
17 |
+
<a href="<?php echo $this->getUrl('attributemanager/index/customer');?>filter/"><?php echo Mage::helper('attributemanager')->__('Customers attributes') ?></a>
|
18 |
+
<br/>
|
19 |
+
<a href="<?php echo $this->getUrl('attributemanager/index/address');?>filter/"><?php echo Mage::helper('attributemanager')->__('Customer\'s address attributes') ?></a></h3>
|
20 |
+
</div>
|
21 |
+
</div>
|
app/design/adminhtml/default/default/template/attributemanager/js.phtml
ADDED
@@ -0,0 +1,274 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design_default
|
22 |
+
* @package Mage
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<script type="text/javascript">
|
28 |
+
function saveAndContinueEdit(){
|
29 |
+
editForm.submit($('edit_form').action+'back/edit/tab/' + product_attribute_tabsJsTabs.activeTab.id);
|
30 |
+
}
|
31 |
+
|
32 |
+
|
33 |
+
function toggleApplyVisibility(select) {
|
34 |
+
if ($(select).value == 1) {
|
35 |
+
$(select).next('select').removeClassName('no-display');
|
36 |
+
$(select).next('select').removeClassName('ignore-validate');
|
37 |
+
|
38 |
+
} else {
|
39 |
+
$(select).next('select').addClassName('no-display');
|
40 |
+
$(select).next('select').addClassName('ignore-validate');
|
41 |
+
var options = $(select).next('select').options;
|
42 |
+
for( var i=0; i < options.length; i++) {
|
43 |
+
options[i].selected = false;
|
44 |
+
}
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
function checkOptionsPanelVisibility(){
|
49 |
+
if($('matage-options-panel')){
|
50 |
+
var panel = $('matage-options-panel');
|
51 |
+
if($('frontend_input') && ($('frontend_input').value=='select' || $('frontend_input').value=='multiselect')){
|
52 |
+
panel.show();
|
53 |
+
}
|
54 |
+
else {
|
55 |
+
panel.hide();
|
56 |
+
}
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
function bindAttributeInputType()
|
61 |
+
{
|
62 |
+
checkOptionsPanelVisibility();
|
63 |
+
switchDefaultValueField();
|
64 |
+
checkIsConfigurableVisibility();
|
65 |
+
if($('frontend_input') && ($('frontend_input').value=='select' || $('frontend_input').value=='multiselect' || $('frontend_input').value=='price')){
|
66 |
+
if($('is_filterable')){
|
67 |
+
$('is_filterable').disabled = false;
|
68 |
+
}
|
69 |
+
if($('is_filterable_in_search')){
|
70 |
+
$('is_filterable_in_search').disabled = false;
|
71 |
+
}
|
72 |
+
if($('backend_type') && $('backend_type').options){
|
73 |
+
for(var i=0;i<$('backend_type').options.length;i++){
|
74 |
+
if($('backend_type').options[i].value=='int') $('backend_type').selectedIndex = i;
|
75 |
+
}
|
76 |
+
}
|
77 |
+
}
|
78 |
+
else {
|
79 |
+
if($('is_filterable')){
|
80 |
+
$('is_filterable').selectedIndex=0;
|
81 |
+
$('is_filterable').disabled = true;
|
82 |
+
}
|
83 |
+
if($('is_filterable_in_search')){
|
84 |
+
$('is_filterable_in_search').disabled = true;
|
85 |
+
}
|
86 |
+
}
|
87 |
+
switchIsFilterable();
|
88 |
+
}
|
89 |
+
|
90 |
+
function switchIsFilterable()
|
91 |
+
{
|
92 |
+
if ($('is_filterable')) {
|
93 |
+
if ($('is_filterable').selectedIndex == 0) {
|
94 |
+
$('position').disabled = true;
|
95 |
+
} else {
|
96 |
+
$('position').disabled = false;
|
97 |
+
}
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
function disableApplyToValue(value)
|
102 |
+
{
|
103 |
+
var applyToSelect = $('apply_to');
|
104 |
+
for (i=0;i<applyToSelect.options.length;i++) {
|
105 |
+
if (value == applyToSelect.options[i].value) {
|
106 |
+
applyToSelect.options[i].disabled = true;
|
107 |
+
applyToSelect.options[i].selected = false;
|
108 |
+
}
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
function switchDefaultValueField()
|
113 |
+
{
|
114 |
+
if (!$('frontend_input')) {
|
115 |
+
return;
|
116 |
+
}
|
117 |
+
|
118 |
+
var currentValue = $('frontend_input').value;
|
119 |
+
|
120 |
+
var defaultValueTextVisibility = false;
|
121 |
+
var defaultValueTextareaVisibility = false;
|
122 |
+
var defaultValueDateVisibility = false;
|
123 |
+
var defaultValueYesnoVisibility = false;
|
124 |
+
var scopeVisibility = true;
|
125 |
+
|
126 |
+
switch (currentValue) {
|
127 |
+
case 'select':
|
128 |
+
optionDefaultInputType = 'radio';
|
129 |
+
break;
|
130 |
+
|
131 |
+
case 'multiselect':
|
132 |
+
optionDefaultInputType = 'checkbox';
|
133 |
+
break;
|
134 |
+
|
135 |
+
case 'date':
|
136 |
+
defaultValueDateVisibility = true;
|
137 |
+
break;
|
138 |
+
|
139 |
+
case 'boolean':
|
140 |
+
defaultValueYesnoVisibility = true;
|
141 |
+
break;
|
142 |
+
|
143 |
+
case 'textarea':
|
144 |
+
defaultValueTextareaVisibility = true;
|
145 |
+
break;
|
146 |
+
|
147 |
+
case 'media_image':
|
148 |
+
defaultValueTextVisibility = false;
|
149 |
+
break;
|
150 |
+
case 'price':
|
151 |
+
scopeVisibility = false;
|
152 |
+
default:
|
153 |
+
defaultValueTextVisibility = true;
|
154 |
+
break;
|
155 |
+
}
|
156 |
+
|
157 |
+
var applyToSelect = $('apply_to');
|
158 |
+
switch (currentValue) {
|
159 |
+
<?php foreach (Mage::helper('catalog')->getAttributeDisabledTypes() as $type=>$disabled): ?>
|
160 |
+
case '<?php echo $type; ?>':
|
161 |
+
<?php foreach ($disabled as $one): ?>
|
162 |
+
disableApplyToValue('<?php echo $one; ?>');
|
163 |
+
<?php endforeach; ?>
|
164 |
+
break;
|
165 |
+
<?php endforeach; ?>
|
166 |
+
default:
|
167 |
+
for (i=0;i<applyToSelect.options.length;i++) {
|
168 |
+
applyToSelect.options[i].disabled = false;
|
169 |
+
}
|
170 |
+
break;
|
171 |
+
}
|
172 |
+
|
173 |
+
switch (currentValue) {
|
174 |
+
case 'media_image':
|
175 |
+
$('front_fieldset').previous().hide();
|
176 |
+
$('front_fieldset').hide();
|
177 |
+
|
178 |
+
setRowVisibility('is_required', false);
|
179 |
+
setRowVisibility('is_unique', false);
|
180 |
+
setRowVisibility('frontend_class', false);
|
181 |
+
break;
|
182 |
+
|
183 |
+
<?php foreach (Mage::helper('catalog')->getAttributeHiddenFields() as $type=>$fields): ?>
|
184 |
+
case '<?php echo $type; ?>':
|
185 |
+
<?php foreach ($fields as $one): ?>
|
186 |
+
<?php if ($one == '_front_fieldset'): ?>
|
187 |
+
$('front_fieldset').previous().hide();
|
188 |
+
$('front_fieldset').hide();
|
189 |
+
<?php elseif ($one == '_default_value'): ?>
|
190 |
+
defaultValueTextVisibility =
|
191 |
+
defaultValueTextareaVisibility =
|
192 |
+
defaultValueDateVisibility =
|
193 |
+
defaultValueYesnoVisibility = false;
|
194 |
+
<?php elseif ($one == '_scope'): ?>
|
195 |
+
scopeVisibility = false;
|
196 |
+
<?php else: ?>
|
197 |
+
setRowVisibility('<?php echo $one; ?>', false);
|
198 |
+
<?php endif; ?>
|
199 |
+
<?php endforeach; ?>
|
200 |
+
break;
|
201 |
+
<?php endforeach; ?>
|
202 |
+
|
203 |
+
default:
|
204 |
+
$('front_fieldset').previous().show();
|
205 |
+
$('front_fieldset').show();
|
206 |
+
setRowVisibility('is_required', true);
|
207 |
+
setRowVisibility('is_unique', true);
|
208 |
+
setRowVisibility('frontend_class', true);
|
209 |
+
setRowVisibility('is_configurable', true);
|
210 |
+
break;
|
211 |
+
}
|
212 |
+
|
213 |
+
setRowVisibility('default_value_text', defaultValueTextVisibility);
|
214 |
+
setRowVisibility('default_value_textarea', defaultValueTextareaVisibility);
|
215 |
+
setRowVisibility('default_value_date', defaultValueDateVisibility);
|
216 |
+
setRowVisibility('default_value_yesno', defaultValueYesnoVisibility);
|
217 |
+
setRowVisibility('is_global', scopeVisibility);
|
218 |
+
|
219 |
+
var elems = document.getElementsByName('default[]');
|
220 |
+
for (var i = 0; i < elems.length; i++) {
|
221 |
+
elems[i].type = optionDefaultInputType;
|
222 |
+
}
|
223 |
+
}
|
224 |
+
|
225 |
+
function setRowVisibility(id, isVisible)
|
226 |
+
{
|
227 |
+
if ($(id)) {
|
228 |
+
var td = $(id).parentNode;
|
229 |
+
var tr = $(td.parentNode);
|
230 |
+
|
231 |
+
if (isVisible) {
|
232 |
+
tr.show();
|
233 |
+
} else {
|
234 |
+
tr.blur();
|
235 |
+
tr.hide();
|
236 |
+
}
|
237 |
+
}
|
238 |
+
}
|
239 |
+
|
240 |
+
function checkIsConfigurableVisibility()
|
241 |
+
{
|
242 |
+
if (!$('is_configurable') || !$('is_global') || !$('frontend_input')) return;
|
243 |
+
if ($F('is_global')==1 && $F('frontend_input')=='select') {
|
244 |
+
setRowVisibility('is_configurable', true);
|
245 |
+
} else {
|
246 |
+
setRowVisibility('is_configurable', false);
|
247 |
+
}
|
248 |
+
}
|
249 |
+
|
250 |
+
function updateRequriedOptions()
|
251 |
+
{
|
252 |
+
if ($F('frontend_input')=='select' && $F('is_required')==1) {
|
253 |
+
$('option-count-check').addClassName('required-options-count');
|
254 |
+
} else {
|
255 |
+
$('option-count-check').removeClassName('required-options-count');
|
256 |
+
}
|
257 |
+
}
|
258 |
+
|
259 |
+
if($('frontend_input')){
|
260 |
+
Event.observe($('frontend_input'), 'change', updateRequriedOptions);
|
261 |
+
Event.observe($('frontend_input'), 'change', bindAttributeInputType);
|
262 |
+
Event.observe($('is_global'), 'change', checkIsConfigurableVisibility);
|
263 |
+
}
|
264 |
+
|
265 |
+
if ($('is_filterable')) {
|
266 |
+
Event.observe($('is_filterable'), 'change', switchIsFilterable);
|
267 |
+
}
|
268 |
+
|
269 |
+
if ($('is_required')) {
|
270 |
+
Event.observe($('is_required'), 'change', updateRequriedOptions);
|
271 |
+
}
|
272 |
+
bindAttributeInputType();
|
273 |
+
|
274 |
+
</script>
|
app/design/adminhtml/default/default/template/attributemanager/new/created.phtml
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design_default
|
22 |
+
* @package Mage
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<script type="text/javascript">
|
28 |
+
var added = false;
|
29 |
+
function addAttribute(closeAfter) {
|
30 |
+
if(window.opener!=null && !added) {
|
31 |
+
window.opener.Product.AttributesBridge.addAttributeRow(<?php echo $this->getAttributesBlockJson() ?>);
|
32 |
+
added = true;
|
33 |
+
}
|
34 |
+
|
35 |
+
if(closeAfter)
|
36 |
+
{
|
37 |
+
closeWindow();
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
function closeWindow()
|
42 |
+
{
|
43 |
+
if (window.opener) {
|
44 |
+
window.opener.focus();
|
45 |
+
}
|
46 |
+
window.close();
|
47 |
+
}
|
48 |
+
|
49 |
+
addAttribute(false);
|
50 |
+
setTimeout(closeWindow, 3000);
|
51 |
+
</script>
|
52 |
+
<div class="a-center">
|
53 |
+
<?php echo $this->getCloseButtonHtml() ?>
|
54 |
+
</div>
|
app/design/adminhtml/default/default/template/attributemanager/options.phtml
ADDED
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Attribute otions control
|
4 |
+
*
|
5 |
+
* @see Mage_Adminhtml_Block_Catalog_Product_Attribute_Edit_Tab_Options
|
6 |
+
*/
|
7 |
+
?>
|
8 |
+
<div>
|
9 |
+
<ul class="messages">
|
10 |
+
<li class="notice-msg">
|
11 |
+
<ul>
|
12 |
+
<li><?php echo Mage::helper('catalog')->__('If you do not specify an option value for a store then the default value will be used.') ?></li>
|
13 |
+
</ul>
|
14 |
+
</li>
|
15 |
+
</ul>
|
16 |
+
</div>
|
17 |
+
|
18 |
+
<div class="entity-edit">
|
19 |
+
<div class="entry-edit-head">
|
20 |
+
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('catalog')->__('Manage Titles (Size, Color, etc.)') ?></h4>
|
21 |
+
</div>
|
22 |
+
<div class="box">
|
23 |
+
<div class="hor-scroll">
|
24 |
+
<table class="dynamic-grid" cellspacing="0" id="attribute-labels-table">
|
25 |
+
<tr>
|
26 |
+
<?php foreach ($this->getStores() as $_store): ?>
|
27 |
+
<th><?php echo $_store->getName() ?></th>
|
28 |
+
<?php endforeach; ?>
|
29 |
+
</tr>
|
30 |
+
<tr>
|
31 |
+
<?php $_labels = $this->getLabelValues() ?>
|
32 |
+
<?php foreach ($this->getStores() as $_store): ?>
|
33 |
+
<td>
|
34 |
+
<input class="input-text<?php if($_store->getId()==0): ?> required-option<?php endif; ?>" type="text" name="frontend_label[<?php echo $_store->getId() ?>]" value="<?php echo $this->htmlEscape($_labels[$_store->getId()]) ?>" />
|
35 |
+
</td>
|
36 |
+
<?php endforeach; ?>
|
37 |
+
</tr>
|
38 |
+
</table>
|
39 |
+
</div>
|
40 |
+
</div>
|
41 |
+
</div>
|
42 |
+
<br/>
|
43 |
+
<div class="entity-edit" id="matage-options-panel">
|
44 |
+
<div class="entry-edit-head">
|
45 |
+
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('catalog')->__('Manage Options (values of your attribute)') ?></h4>
|
46 |
+
</div>
|
47 |
+
<div class="box">
|
48 |
+
<div class="hor-scroll">
|
49 |
+
<table class="dynamic-grid" cellspacing="0" cellpadding="0">
|
50 |
+
<tr id="attribute-options-table">
|
51 |
+
<?php foreach ($this->getStores() as $_store): ?>
|
52 |
+
<th><?php echo $_store->getName() ?></th>
|
53 |
+
<?php endforeach; ?>
|
54 |
+
<th><?php echo Mage::helper('catalog')->__('Position') ?></th>
|
55 |
+
<th class="nobr a-center"><?php echo Mage::helper('catalog')->__('Is Default') ?></th>
|
56 |
+
<th><?php echo $this->getAddNewButtonHtml() ?></th>
|
57 |
+
</tr>
|
58 |
+
<tr class="no-display template" id="row-template">
|
59 |
+
<?php foreach ($this->getStores() as $_store): ?>
|
60 |
+
<td><input name="option[value][{{id}}][<?php echo $_store->getId() ?>]" value="{{store<?php echo $_store->getId() ?>}}" class="input-text<?php if($_store->getId()==0): ?> required-option<?php endif; ?>" type="text" /></td>
|
61 |
+
<?php endforeach; ?>
|
62 |
+
<td class="a-center"><input class="input-text" type="text" name="option[order][{{id}}]" value="{{sort_order}}" /></td>
|
63 |
+
<td><input class="input-radio" type="radio" name="default[]" value="{{id}}" /></td>
|
64 |
+
<td class="a-left">
|
65 |
+
<input type="hidden" class="delete-flag" name="option[delete][{{id}}]" value="" />
|
66 |
+
<?php echo $this->getDeleteButtonHtml() ?>
|
67 |
+
</td>
|
68 |
+
</tr>
|
69 |
+
</table>
|
70 |
+
</div>
|
71 |
+
<input type="hidden" id="option-count-check" value="" />
|
72 |
+
</div>
|
73 |
+
</div>
|
74 |
+
<script type="text/javascript">
|
75 |
+
//<![CDATA[
|
76 |
+
var optionDefaultInputType = 'radio';
|
77 |
+
|
78 |
+
// IE removes quotes from element.innerHTML whenever it thinks they're not needed, which breaks html.
|
79 |
+
var templateText =
|
80 |
+
'<tr class="option-row">'+
|
81 |
+
<?php foreach ($this->getStores() as $_store): ?>
|
82 |
+
'<td><input name="option[value][{{id}}][<?php echo $_store->getId() ?>]" value="{{store<?php echo $_store->getId() ?>}}" class="input-text<?php if($_store->getId()==0): ?> required-option<?php endif; ?>" type="text" /><\/td>'+
|
83 |
+
<?php endforeach; ?>
|
84 |
+
'<td><input class="input-text" type="text" name="option[order][{{id}}]" value="{{sort_order}}"><\/td>'+
|
85 |
+
'<td class="a-center"><input class="input-radio" type="{{intype}}" name="default[]" value="{{id}}" {{checked}} /><\/td>'+
|
86 |
+
'<td class="a-left">'+
|
87 |
+
'<input type="hidden" class="delete-flag" name="option[delete][{{id}}]" value="" />'+
|
88 |
+
'<?php echo $this->getDeleteButtonHtml() ?>'+
|
89 |
+
'<\/td>'+
|
90 |
+
'<\/tr>';
|
91 |
+
|
92 |
+
var attributeOption = {
|
93 |
+
table : $('attribute-options-table'),
|
94 |
+
templateSyntax : /(^|.|\r|\n)({{(\w+)}})/,
|
95 |
+
templateText : templateText,
|
96 |
+
itemCount : 0,
|
97 |
+
totalItems : 0,
|
98 |
+
add : function(data) {
|
99 |
+
this.template = new Template(this.templateText, this.templateSyntax);
|
100 |
+
if(!data.id){
|
101 |
+
data = {};
|
102 |
+
data.id = 'option_'+this.itemCount;
|
103 |
+
}
|
104 |
+
if (!data.intype)
|
105 |
+
data.intype = optionDefaultInputType;
|
106 |
+
|
107 |
+
Element.insert(this.table, {after: this.template.evaluate(data)});
|
108 |
+
this.bindRemoveButtons();
|
109 |
+
this.itemCount++;
|
110 |
+
this.totalItems++;
|
111 |
+
this.updateItemsCountField();
|
112 |
+
},
|
113 |
+
remove : function(event){
|
114 |
+
var element = $(Event.findElement(event, 'tr')); // !!! Button already
|
115 |
+
// have table parent in safari
|
116 |
+
// Safari workaround
|
117 |
+
element.ancestors().each(function(parentItem){
|
118 |
+
if (parentItem.hasClassName('option-row')) {
|
119 |
+
element = parentItem;
|
120 |
+
throw $break;
|
121 |
+
} else if (parentItem.hasClassName('box')) {
|
122 |
+
throw $break;
|
123 |
+
}
|
124 |
+
});
|
125 |
+
|
126 |
+
|
127 |
+
if(element){
|
128 |
+
var elementFlags = element.getElementsByClassName('delete-flag');
|
129 |
+
if(elementFlags[0]){
|
130 |
+
elementFlags[0].value=1;
|
131 |
+
}
|
132 |
+
|
133 |
+
element.addClassName('no-display');
|
134 |
+
element.addClassName('template');
|
135 |
+
element.hide();
|
136 |
+
this.totalItems--;
|
137 |
+
this.updateItemsCountField();
|
138 |
+
}
|
139 |
+
},
|
140 |
+
updateItemsCountField: function() {
|
141 |
+
if (this.totalItems > 0) {
|
142 |
+
$('option-count-check').value = '1';
|
143 |
+
} else {
|
144 |
+
$('option-count-check').value = '';
|
145 |
+
}
|
146 |
+
},
|
147 |
+
bindRemoveButtons : function(){
|
148 |
+
var buttons = $$('.delete-option');
|
149 |
+
for(var i=0;i<buttons.length;i++){
|
150 |
+
if(!$(buttons[i]).binded){
|
151 |
+
$(buttons[i]).binded = true;
|
152 |
+
Event.observe(buttons[i], 'click', this.remove.bind(this));
|
153 |
+
}
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
}
|
158 |
+
if($('row-template')){
|
159 |
+
$('row-template').remove();
|
160 |
+
}
|
161 |
+
attributeOption.bindRemoveButtons();
|
162 |
+
|
163 |
+
if($('add_new_option_button')){
|
164 |
+
Event.observe('add_new_option_button', 'click', attributeOption.add.bind(attributeOption));
|
165 |
+
}
|
166 |
+
Validation.addAllThese([
|
167 |
+
['required-option', '<?php echo Mage::helper('catalog')->__('Failed') ?>', function(v) {
|
168 |
+
return !Validation.get('IsEmpty').test(v);
|
169 |
+
}]]);
|
170 |
+
Validation.addAllThese([
|
171 |
+
['required-options-count', '<?php echo Mage::helper('catalog')->__('Options is required') ?>', function(v) {
|
172 |
+
return !Validation.get('IsEmpty').test(v);
|
173 |
+
}]]);
|
174 |
+
<?php foreach ($this->getOptionValues() as $_value): ?>
|
175 |
+
attributeOption.add(<?php echo $_value->toJson() ?>);
|
176 |
+
<?php endforeach; ?>
|
177 |
+
//]]>
|
178 |
+
</script>
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Hwg_Attributemanager</name>
|
4 |
-
<version>0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">GPL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Create custom attribute for customer, category, customer address</summary>
|
10 |
<description>Using this extension you can create custom attributes for customer, category, customer address.</description>
|
11 |
-
<notes>
|
12 |
<authors><author><name>Sanjay Modasia</name><user>sanjaymodasia</user><email>sanjaymodasia@gmail.com</email></author></authors>
|
13 |
-
<date>2012-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magelocal"><dir name="Hwg"><dir name="Attributemanager"><dir name="Block"><dir name="Adminhtml"><dir name="Address"><dir name="Edit"><file name="Form.php" hash="b6cd8384a5380850d810adfebdd9f714"/><dir name="Tab"><file name="Main.php" hash="98fb53f1ac8315077891829ea76c6732"/><file name="Options.php" hash="9b802dbcf80251e45a5f77ece9895033"/></dir><file name="Tabs.php" hash="b010124cc527cc0bda16b062e0ec12d9"/></dir><file name="Edit.php" hash="ce2bd494cc16ebd29e5aa1fab4e910ba"/><file name="Grid.php" hash="3d6b4941dcfe3acdf8612ec18797d1a9"/></dir><file name="Address.php" hash="0ee9142d47a055ce80b9abba1edd2a10"/><dir name="Category"><dir name="Edit"><file name="Form.php" hash="117173cba42eb72725c2bac6717eaae4"/><dir name="Tab"><file name="Front.php" hash="1adeab8c8bbf9c45f8d81d5453a9fa63"/><file name="Main.php" hash="7065c6806abba244b42c8533b5328f45"/><file name="Options.php" hash="f54573f629266fb215ca2a2ff79690b1"/><file name="System.php" hash="a0297869e9aa6df54611e61946764606"/></dir><file name="Tabs.php" hash="175dc93f524d62fac852a3c88d5cd3fa"/></dir><file name="Edit.php" hash="2b660b032771be68fd9bb05f968161fa"/><file name="Grid.php" hash="5e5fea8d4ed79f3712708198c53d41dc"/></dir><file name="Category.php" hash="103e8d55704b9237af218c18eec51359"/><dir name="Customer"><dir name="Edit"><file name="Form.php" hash="518c24ba092cb60841db93b6a9b33658"/><dir name="Tab"><file name="Front.php" hash="29754c79c4b9fdf247fc4be78bb762f8"/><file name="Main.php" hash="20fac1539bce94c150d606f36700a474"/><file name="Options.php" hash="cc77c662c69e297eb53f6bc9abb446b9"/><file name="System.php" hash="133a65f79ced3e244347a4c0d6495854"/></dir><file name="Tabs.php" hash="2b4a7cea518b27bc46135dbc3bfce96d"/></dir><file name="Edit.php" hash="69ac4ca2976ef8cfb2d867ef05ec89ef"/><file name="Grid.php" hash="d86c4c106a8660b2481a2a9e613a8154"/></dir><file name="Customer.php" hash="fdbe66aa1b6cbbaaa92239bf5cfb92b7"/></dir
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Hwg_Attributemanager</name>
|
4 |
+
<version>0.3.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">GPL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Create custom attribute for customer, category, customer address</summary>
|
10 |
<description>Using this extension you can create custom attributes for customer, category, customer address.</description>
|
11 |
+
<notes>3rd Version</notes>
|
12 |
<authors><author><name>Sanjay Modasia</name><user>sanjaymodasia</user><email>sanjaymodasia@gmail.com</email></author></authors>
|
13 |
+
<date>2012-06-21</date>
|
14 |
+
<time>12:30:21</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Hwg"><dir name="Attributemanager"><dir name="Block"><dir name="Adminhtml"><dir name="Address"><dir name="Edit"><file name="Form.php" hash="b6cd8384a5380850d810adfebdd9f714"/><dir name="Tab"><file name="Main.php" hash="98fb53f1ac8315077891829ea76c6732"/><file name="Options.php" hash="9b802dbcf80251e45a5f77ece9895033"/></dir><file name="Tabs.php" hash="b010124cc527cc0bda16b062e0ec12d9"/></dir><file name="Edit.php" hash="ce2bd494cc16ebd29e5aa1fab4e910ba"/><file name="Grid.php" hash="3d6b4941dcfe3acdf8612ec18797d1a9"/></dir><file name="Address.php" hash="0ee9142d47a055ce80b9abba1edd2a10"/><dir name="Category"><dir name="Edit"><file name="Form.php" hash="117173cba42eb72725c2bac6717eaae4"/><dir name="Tab"><file name="Front.php" hash="1adeab8c8bbf9c45f8d81d5453a9fa63"/><file name="Main.php" hash="7065c6806abba244b42c8533b5328f45"/><file name="Options.php" hash="f54573f629266fb215ca2a2ff79690b1"/><file name="System.php" hash="a0297869e9aa6df54611e61946764606"/></dir><file name="Tabs.php" hash="175dc93f524d62fac852a3c88d5cd3fa"/></dir><file name="Edit.php" hash="2b660b032771be68fd9bb05f968161fa"/><file name="Grid.php" hash="5e5fea8d4ed79f3712708198c53d41dc"/></dir><file name="Category.php" hash="103e8d55704b9237af218c18eec51359"/><dir name="Customer"><dir name="Edit"><file name="Form.php" hash="518c24ba092cb60841db93b6a9b33658"/><dir name="Tab"><file name="Front.php" hash="29754c79c4b9fdf247fc4be78bb762f8"/><file name="Main.php" hash="20fac1539bce94c150d606f36700a474"/><file name="Options.php" hash="cc77c662c69e297eb53f6bc9abb446b9"/><file name="System.php" hash="133a65f79ced3e244347a4c0d6495854"/></dir><file name="Tabs.php" hash="2b4a7cea518b27bc46135dbc3bfce96d"/></dir><file name="Edit.php" hash="69ac4ca2976ef8cfb2d867ef05ec89ef"/><file name="Grid.php" hash="d86c4c106a8660b2481a2a9e613a8154"/></dir><file name="Customer.php" hash="fdbe66aa1b6cbbaaa92239bf5cfb92b7"/></dir><file name="View.php" hash="bce2d73402914b51a60a80aa38470ba8"/></dir><dir name="Helper"><file name="Data.php" hash="b3ac459c1fcaa696433aeafede13747e"/></dir><dir name="Model"><file name="Attributemanager.php" hash="e54514153c723943ceb0835bdf18000d"/><file name="Ordertracking.php" hash="500bac0f4701b1b164555fd6d9f102de"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="AddressController.php" hash="fd18f78f1502d14c075510ab04c9f603"/><file name="CategoryController.php" hash="180043881072ec31a75c669e20bf1872"/><file name="CustomerController.php" hash="2b65650f1d3686fd2e9194510f0ec234"/></dir><file name="IndexController.php" hash="889f3234520c77bf957449735c164a7e"/></dir><dir name="etc"><file name="config.xml" hash="fc071f2cfae029187dce63f728192b6a"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Hwg_Attributemanager.xml" hash="c88f9e812a4f29ebf61e76602792c539"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="attributemanager.xml" hash="616f27b876b35df290befde732c98638"/></dir><dir name="template"><dir name="attributemanager"><file name="grid.phtml" hash="64f9821b3a83a80f0c4df62b1dcdac2d"/><file name="index.phtml" hash="6014ce550b926b99667dff7867f334a7"/><file name="js.phtml" hash="ceaf55fd2d77b197df0e4205e0cd7b14"/><dir name="new"><file name="created.phtml" hash="6221466a0afd2af66521244391f000d1"/></dir><file name="options.phtml" hash="cfa077b54985e1f4687d2d42f0cd266a"/></dir></dir></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|