Potato_Gridautocomplete - Version 1.0.0

Version Notes

* Abitity to easy autocomplete selection in filters of some grids

Download this release

Release Info

Developer PotatoCommerce
Extension Potato_Gridautocomplete
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/local/Potato/Gridautocomplete/Block/Adminhtml/Abstract.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ abstract class Potato_Gridautocomplete_Block_Adminhtml_Abstract extends Mage_Adminhtml_Block_Template
4
+ {
5
+ protected $_items = array();
6
+
7
+ abstract public function getJsGridObjectName();
8
+
9
+ public function getItems()
10
+ {
11
+ return $this->_items;
12
+ }
13
+
14
+ public function addItem($id, $block, $column, $targetElIds)
15
+ {
16
+ $item = new Varien_Object(
17
+ array(
18
+ 'id' => Zend_Json::encode($id),
19
+ 'target_el_ids' => Zend_Json::encode($targetElIds),
20
+ 'url' => Zend_Json::encode(
21
+ $this->getUrl(
22
+ 'po_gridautocomplete_admin/adminhtml_index/index',
23
+ array(
24
+ 'block' => $block,
25
+ 'column' => $column,
26
+ )
27
+ )
28
+ )
29
+ )
30
+ );
31
+ $this->_items[] = $item;
32
+ return $this;
33
+ }
34
+
35
+ }
app/code/local/Potato/Gridautocomplete/Block/Adminhtml/Catalog/Product/Js.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Potato_Gridautocomplete_Block_Adminhtml_Catalog_Product_Js extends Potato_Gridautocomplete_Block_Adminhtml_Abstract
4
+ {
5
+ protected function _toHtml()
6
+ {
7
+ $this->addItem(
8
+ 'catalog_product_name', 'catalog_product', 'name',
9
+ array(
10
+ 'productGrid_product_filter_name',
11
+ 'product_filter_name',
12
+ )
13
+ );
14
+ $this->addItem(
15
+ 'catalog_product_sku', 'catalog_product', 'sku',
16
+ array(
17
+ 'productGrid_product_filter_sku',
18
+ 'product_filter_sku',
19
+ )
20
+ );
21
+ return parent::_toHtml();
22
+ }
23
+
24
+ public function getJsGridObjectName()
25
+ {
26
+ return "productGridJsObject";
27
+ }
28
+ }
app/code/local/Potato/Gridautocomplete/Block/Adminhtml/Customer/Index/Js.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Potato_Gridautocomplete_Block_Adminhtml_Customer_Index_Js extends Potato_Gridautocomplete_Block_Adminhtml_Abstract
4
+ {
5
+ protected function _toHtml()
6
+ {
7
+ $this->addItem(
8
+ 'customer_name', 'customer_index', 'name',
9
+ array(
10
+ 'customerGrid_filter_name',
11
+ 'filter_name',
12
+ )
13
+ );
14
+ $this->addItem(
15
+ 'customer_email', 'customer_index', 'email',
16
+ array(
17
+ 'customerGrid_filter_email',
18
+ 'filter_email',
19
+ )
20
+ );
21
+ $this->addItem(
22
+ 'customer_billing_telephone', 'customer_index', 'billing_telephone',
23
+ array(
24
+ 'customerGrid_filter_Telephone',
25
+ 'filter_Telephone',
26
+ )
27
+ );
28
+ $this->addItem(
29
+ 'customer_billing_postcode', 'customer_index', 'billing_postcode',
30
+ array(
31
+ 'customerGrid_filter_billing_postcode',
32
+ 'filter_billing_postcode',
33
+ )
34
+ );
35
+ $this->addItem(
36
+ 'customer_billing_region', 'customer_index', 'billing_region',
37
+ array(
38
+ 'customerGrid_filter_billing_region',
39
+ 'filter_billing_region',
40
+ )
41
+ );
42
+ return parent::_toHtml();
43
+ }
44
+
45
+ public function getJsGridObjectName()
46
+ {
47
+ return "customerGridJsObject";
48
+ }
49
+ }
app/code/local/Potato/Gridautocomplete/Block/Adminhtml/Sales/Creditmemo/Js.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Potato_Gridautocomplete_Block_Adminhtml_Sales_Creditmemo_Js extends Potato_Gridautocomplete_Block_Adminhtml_Abstract
4
+ {
5
+ protected function _toHtml()
6
+ {
7
+ $this->addItem(
8
+ 'sales_creditmemo_increment_id', 'sales_creditmemo', 'increment_id',
9
+ array(
10
+ 'sales_creditmemo_grid_filter_increment_id',
11
+ 'filter_increment_id',
12
+ )
13
+ );
14
+ $this->addItem(
15
+ 'sales_creditmemo_order_increment_id', 'sales_creditmemo', 'order_increment_id',
16
+ array(
17
+ 'sales_creditmemo_grid_filter_order_increment_id',
18
+ 'filter_order_increment_id',
19
+ )
20
+ );
21
+ $this->addItem(
22
+ 'sales_creditmemo_billing_name', 'sales_creditmemo', 'billing_name',
23
+ array(
24
+ 'sales_creditmemo_grid_filter_billing_name',
25
+ 'filter_billing_name',
26
+ )
27
+ );
28
+ return parent::_toHtml();
29
+ }
30
+
31
+ public function getJsGridObjectName()
32
+ {
33
+ return "sales_creditmemo_gridJsObject";
34
+ }
35
+ }
app/code/local/Potato/Gridautocomplete/Block/Adminhtml/Sales/Invoice/Js.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Potato_Gridautocomplete_Block_Adminhtml_Sales_Invoice_Js extends Potato_Gridautocomplete_Block_Adminhtml_Abstract
4
+ {
5
+ protected function _toHtml()
6
+ {
7
+ $this->addItem(
8
+ 'sales_invoice_increment_id', 'sales_invoice', 'increment_id',
9
+ array(
10
+ 'sales_invoice_grid_filter_increment_id',
11
+ 'filter_increment_id',
12
+ )
13
+ );
14
+ $this->addItem(
15
+ 'sales_invoice_order_increment_id', 'sales_invoice', 'order_increment_id',
16
+ array(
17
+ 'sales_invoice_grid_filter_order_increment_id',
18
+ 'filter_order_increment_id',
19
+ )
20
+ );
21
+ $this->addItem(
22
+ 'sales_invoice_billing_name', 'sales_invoice', 'billing_name',
23
+ array(
24
+ 'sales_invoice_grid_filter_billing_name',
25
+ 'filter_billing_name',
26
+ )
27
+ );
28
+ return parent::_toHtml();
29
+ }
30
+
31
+ public function getJsGridObjectName()
32
+ {
33
+ return "sales_invoice_gridJsObject";
34
+ }
35
+ }
app/code/local/Potato/Gridautocomplete/Block/Adminhtml/Sales/Order/Js.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Potato_Gridautocomplete_Block_Adminhtml_Sales_Order_Js extends Potato_Gridautocomplete_Block_Adminhtml_Abstract
4
+ {
5
+ protected function _toHtml()
6
+ {
7
+ $this->addItem(
8
+ 'sales_order_increment_id', 'sales_order', 'increment_id',
9
+ array(
10
+ 'sales_order_grid_filter_real_order_id',
11
+ 'filter_real_order_id',
12
+ )
13
+ );
14
+ $this->addItem(
15
+ 'sales_order_billing_name', 'sales_order', 'billing_name',
16
+ array(
17
+ 'sales_order_grid_filter_billing_name',
18
+ 'filter_billing_name',
19
+ )
20
+ );
21
+ $this->addItem(
22
+ 'sales_order_shipping_name', 'sales_order', 'shipping_name',
23
+ array(
24
+ 'sales_order_grid_filter_shipping_name',
25
+ 'filter_shipping_name',
26
+ )
27
+ );
28
+ return parent::_toHtml();
29
+ }
30
+
31
+ public function getJsGridObjectName()
32
+ {
33
+ return "sales_order_gridJsObject";
34
+ }
35
+ }
app/code/local/Potato/Gridautocomplete/Block/Adminhtml/Sales/Shipment/Js.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Potato_Gridautocomplete_Block_Adminhtml_Sales_Shipment_Js extends Potato_Gridautocomplete_Block_Adminhtml_Abstract
4
+ {
5
+ protected function _toHtml()
6
+ {
7
+ $this->addItem(
8
+ 'sales_shipment_increment_id', 'sales_shipment', 'increment_id',
9
+ array(
10
+ 'sales_shipment_grid_filter_increment_id',
11
+ 'filter_increment_id',
12
+ )
13
+ );
14
+ $this->addItem(
15
+ 'sales_shipment_order_increment_id', 'sales_shipment', 'order_increment_id',
16
+ array(
17
+ 'sales_shipment_grid_filter_order_increment_id',
18
+ 'filter_order_increment_id',
19
+ )
20
+ );
21
+ $this->addItem(
22
+ 'sales_shipment_shipping_name', 'sales_shipment', 'shipping_name',
23
+ array(
24
+ 'sales_shipment_grid_filter_shipping_name',
25
+ 'filter_shipping_name',
26
+ )
27
+ );
28
+ return parent::_toHtml();
29
+ }
30
+
31
+ public function getJsGridObjectName()
32
+ {
33
+ return "sales_shipment_gridJsObject";
34
+ }
35
+ }
app/code/local/Potato/Gridautocomplete/controllers/Adminhtml/IndexController.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Potato_Gridautocomplete_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ public function indexAction()
6
+ {
7
+ $block = $this->getRequest()->getParam('block', null);
8
+ $column = $this->getRequest()->getParam('column', null);
9
+ $search = $this->getRequest()->getParam('search', null);
10
+ if (in_array(null, array($block, $column, $search))) {
11
+ return;
12
+ }
13
+ $blockNameMap = array(
14
+ 'catalog_product' => 'adminhtml/catalog_product_grid',
15
+ 'customer_index' => 'adminhtml/customer_grid',
16
+ 'sales_order' => 'adminhtml/sales_order_grid',
17
+ 'sales_invoice' => 'adminhtml/sales_invoice_grid',
18
+ 'sales_shipment' => 'adminhtml/sales_shipment_grid',
19
+ 'sales_creditmemo' => 'adminhtml/sales_creditmemo_grid',
20
+ );
21
+ $data = array();
22
+ if (array_key_exists($block, $blockNameMap)) {
23
+ $data = $this->_getDataFromGrid($blockNameMap[$block], $column, $search);
24
+ }
25
+ $this->getResponse()->setBody(
26
+ $this->_render($data)
27
+ );
28
+ }
29
+
30
+
31
+ protected function _getDataFromGrid($blockName, $column, $search)
32
+ {
33
+ $layout = $this->getLayout();
34
+
35
+ $block = $layout->createBlock($blockName);
36
+ $block->toHtml();
37
+ $collection = $block->getCollection();
38
+ $collection->clear();
39
+ $collection->getSelect()->reset(Zend_Db_Select::WHERE);
40
+ $collection->getSelect()->reset(Zend_Db_Select::LIMIT_COUNT);
41
+ $collection->getSelect()->reset(Zend_Db_Select::LIMIT_OFFSET);
42
+ $collection->getSelect()->distinct();
43
+ $collection->addFieldToFilter($column, array('like' => '%' . $search . '%'));
44
+ $collection->setPage(null, 1000);
45
+
46
+ $data = $collection->getColumnValues($column);
47
+ $data = array_unique($data);
48
+ $data = array_slice($data, 0, 10);
49
+ return $data;
50
+ }
51
+
52
+ /**
53
+ * @param array $data
54
+ *
55
+ * @return string
56
+ */
57
+ protected function _render($data)
58
+ {
59
+ $html = "<ul>";
60
+ foreach ($data as $item) {
61
+ $html .= "<li>" . $item . "</li>";
62
+ }
63
+ $html .= "</ul>";
64
+ return $html;
65
+ }
66
+ }
app/code/local/Potato/Gridautocomplete/etc/config.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Potato_Gridautocomplete>
5
+ <version>1.0.0</version>
6
+ </Potato_Gridautocomplete>
7
+ </modules>
8
+ <admin>
9
+ <routers>
10
+ <po_gridautocomplete_admin>
11
+ <use>admin</use>
12
+ <args>
13
+ <module>Potato_Gridautocomplete</module>
14
+ <frontName>po_gridautocomplete_admin</frontName>
15
+ </args>
16
+ </po_gridautocomplete_admin>
17
+ </routers>
18
+ </admin>
19
+ </config>
app/design/adminhtml/default/default/layout/po_gridautocomplete.xml ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <adminhtml_sales_order_index>
4
+ <reference name="head">
5
+ <action method="addItem"><type>skin_js</type><name>po_gridautocomplete/js/autocomplete.js</name></action>
6
+ <action method="addItem"><type>skin_css</type><name>po_gridautocomplete/css/style.css</name></action>
7
+ </reference>
8
+ <reference name="js">
9
+ <block type="po_gridautocomplete/adminhtml_sales_order_js" template="potato_gridautocomplete/js.phtml"
10
+ name="potato_gridautocomplete.sales.order.js" as="potato_gridautocomplete_sales_order_js"/>
11
+ </reference>
12
+ </adminhtml_sales_order_index>
13
+ <adminhtml_sales_invoice_index>
14
+ <reference name="head">
15
+ <action method="addItem"><type>skin_js</type><name>po_gridautocomplete/js/autocomplete.js</name></action>
16
+ <action method="addItem"><type>skin_css</type><name>po_gridautocomplete/css/style.css</name></action>
17
+ </reference>
18
+ <reference name="js">
19
+ <block type="po_gridautocomplete/adminhtml_sales_invoice_js" template="potato_gridautocomplete/js.phtml"
20
+ name="potato_gridautocomplete.sales.invoice.js" as="potato_gridautocomplete_sales_invoice_js"/>
21
+ </reference>
22
+ </adminhtml_sales_invoice_index>
23
+ <adminhtml_sales_shipment_index>
24
+ <reference name="head">
25
+ <action method="addItem"><type>skin_js</type><name>po_gridautocomplete/js/autocomplete.js</name></action>
26
+ <action method="addItem"><type>skin_css</type><name>po_gridautocomplete/css/style.css</name></action>
27
+ </reference>
28
+ <reference name="js">
29
+ <block type="po_gridautocomplete/adminhtml_sales_shipment_js" template="potato_gridautocomplete/js.phtml"
30
+ name="potato_gridautocomplete.sales.shipment.js" as="potato_gridautocomplete_sales_shipment_js"/>
31
+ </reference>
32
+ </adminhtml_sales_shipment_index>
33
+ <adminhtml_sales_creditmemo_index>
34
+ <reference name="head">
35
+ <action method="addItem"><type>skin_js</type><name>po_gridautocomplete/js/autocomplete.js</name></action>
36
+ <action method="addItem"><type>skin_css</type><name>po_gridautocomplete/css/style.css</name></action>
37
+ </reference>
38
+ <reference name="js">
39
+ <block type="po_gridautocomplete/adminhtml_sales_creditmemo_js" template="potato_gridautocomplete/js.phtml"
40
+ name="potato_gridautocomplete.sales.creditmemo.js" as="potato_gridautocomplete_sales_creditmemo_js"/>
41
+ </reference>
42
+ </adminhtml_sales_creditmemo_index>
43
+ <adminhtml_catalog_product_index>
44
+ <reference name="head">
45
+ <action method="addItem"><type>skin_js</type><name>po_gridautocomplete/js/autocomplete.js</name></action>
46
+ <action method="addItem"><type>skin_css</type><name>po_gridautocomplete/css/style.css</name></action>
47
+ </reference>
48
+ <reference name="js">
49
+ <block type="po_gridautocomplete/adminhtml_catalog_product_js" template="potato_gridautocomplete/js.phtml"
50
+ name="potato_gridautocomplete.catalog.product.js" as="potato_gridautocomplete_catalog_product_js"/>
51
+ </reference>
52
+ </adminhtml_catalog_product_index>
53
+ <adminhtml_customer_index>
54
+ <reference name="head">
55
+ <action method="addItem"><type>skin_js</type><name>po_gridautocomplete/js/autocomplete.js</name></action>
56
+ <action method="addItem"><type>skin_css</type><name>po_gridautocomplete/css/style.css</name></action>
57
+ </reference>
58
+ <reference name="js">
59
+ <block type="po_gridautocomplete/adminhtml_customer_index_js" template="potato_gridautocomplete/js.phtml"
60
+ name="potato_gridautocomplete.customer.index.js" as="potato_gridautocomplete_customer_index_js"/>
61
+ </reference>
62
+ </adminhtml_customer_index>
63
+ </layout>
app/design/adminhtml/default/default/template/potato_gridautocomplete/js.phtml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ <?php if (count($this->getItems()) > 0): ?>
3
+ <?php echo $this->getJsGridObjectName();?>.preInitCallback = function(){
4
+ <?php foreach ($this->getItems() as $item):?>
5
+ new potatoGridAutocomplete(
6
+ <?php echo $item->getTargetElIds();?>,
7
+ "po-gridautocomplete-container-" + <?php echo $item->getId();?>,
8
+ <?php echo $item->getUrl();?>,
9
+ {}
10
+ );
11
+ <?php endforeach;?>
12
+ };
13
+ Event.observe(window, 'load', function(e){
14
+ <?php echo $this->getJsGridObjectName();?>.preInitCallback();
15
+ });
16
+ <?php endif;?>
17
+ </script>
app/etc/modules/Potato_Gridautocomplete.xml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Potato_Gridautocomplete>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Potato_Gridautocomplete>
8
+ </modules>
9
+ <admin>
10
+ <routers>
11
+ <po_gridautocomplete_admin>
12
+ <use>admin</use>
13
+ <args>
14
+ <module>Potato_Gridautocomplete</module>
15
+ <frontName>po_gridautocomplete_admin</frontName>
16
+ </args>
17
+ </po_gridautocomplete_admin>
18
+ </routers>
19
+ </admin>
20
+ <adminhtml>
21
+ <layout>
22
+ <updates>
23
+ <po_gridautocomplete module="Potato_Gridautocomplete">
24
+ <file>po_gridautocomplete.xml</file>
25
+ </po_gridautocomplete>
26
+ </updates>
27
+ </layout>
28
+ </adminhtml>
29
+ <global>
30
+ <helpers>
31
+ <po_gridautocomplete>
32
+ <class>Potato_Gridautocomplete_Helper</class>
33
+ </po_gridautocomplete>
34
+ </helpers>
35
+ <blocks>
36
+ <po_gridautocomplete>
37
+ <class>Potato_Gridautocomplete_Block</class>
38
+ </po_gridautocomplete>
39
+ </blocks>
40
+ <models>
41
+ <po_gridautocomplete>
42
+ <class>Potato_Smsnotice_Model</class>
43
+ </po_gridautocomplete>
44
+ </models>
45
+ </global>
46
+ </config>
package.xml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Potato_Gridautocomplete</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Grid Autocomplete by PotatoCommerce&#xD;
10
+ Module adds simple auto-complete in Magento grids.</summary>
11
+ <description>By default functionality works in these columns:&#xD;
12
+ &#xD;
13
+ Backend &gt; Sales &gt; Orders&#xD;
14
+ &#x201C;Order ID&#x201D;&#xD;
15
+ &#x201C;Bill To Name&#x201D;&#xD;
16
+ &#x201C;Ship To Name&#x201D;&#xD;
17
+ &#xD;
18
+ Backend &gt; Catalog &gt; Manage Products&#xD;
19
+ &#x201C;Name&#x201D;&#xD;
20
+ &#x201C;SKU&#x201D;&#xD;
21
+ &#xD;
22
+ Backend &gt; Customers &gt; Manage Customers&#xD;
23
+ &#x201C;Name&#x201D;&#xD;
24
+ &#x201C;Email column&#x201D;&#xD;
25
+ &#x201C;Telephone&#x201D;&#xD;
26
+ &#x201C;ZIP&#x201D;&#xD;
27
+ &#x201C;State/Province&#x201D;</description>
28
+ <notes>* Abitity to easy autocomplete selection in filters of some grids</notes>
29
+ <authors><author><name>PotatoCommerce</name><user>potatocommerce</user><email>potatocommerce@gmail.com</email></author></authors>
30
+ <date>2014-03-17</date>
31
+ <time>19:25:33</time>
32
+ <contents><target name="magelocal"><dir name="Potato"><dir name="Gridautocomplete"><dir name="Block"><dir name="Adminhtml"><file name="Abstract.php" hash="dd2eaafefdef6ea55a5257609ef2d01c"/><dir name="Catalog"><dir name="Product"><file name="Js.php" hash="81436718a1bac52687f422b4d9386710"/></dir></dir><dir name="Customer"><dir name="Index"><file name="Js.php" hash="de559fcf02447af1b18fe690d6e93f10"/></dir></dir><dir name="Sales"><dir name="Creditmemo"><file name="Js.php" hash="77255bbf8230b6fb63f3ca2a556d2b34"/></dir><dir name="Invoice"><file name="Js.php" hash="f66bcb56e829a86454bfe1dea134d8cf"/></dir><dir name="Order"><file name="Js.php" hash="ae2213555b7ef029ff8caeab6cfe83e6"/></dir><dir name="Shipment"><file name="Js.php" hash="7d091a24af5e95a8115dd5f718569b42"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="IndexController.php" hash="5033e9a901e523646b7e7eac78de7d8f"/></dir></dir><dir name="etc"><file name="config.xml" hash="1d9c0e4667f8127ba7a9094da52118ea"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="potato_gridautocomplete"><file name="js.phtml" hash="529fc17392d3ef96f8382d75b7baac2a"/></dir></dir><dir name="layout"><file name="po_gridautocomplete.xml" hash="0ab49de41c697c4427cb8d2890c2a2ff"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Potato_Gridautocomplete.xml" hash="2b61654e75e4116a94f74ca81110bd3d"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="po_gridautocomplete"><dir name="css"><file name="style.css" hash="9ed6a6f4d41b0720996b5472be65df8c"/></dir><dir name="js"><file name="autocomplete.js" hash="1bb1320dec6265e8fe0675085cfa831e"/></dir></dir></dir></dir></dir></target></contents>
33
+ <compatible/>
34
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
35
+ </package>
skin/adminhtml/default/default/po_gridautocomplete/css/style.css ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ div.po-autocomplete-container {
2
+ margin:0;
3
+ padding:0;
4
+ width:250px;
5
+ background:#fff;
6
+ border: 1px solid #ddd;
7
+ border-top: 0;
8
+ position:absolute;
9
+ }
10
+
11
+ div.po-autocomplete-container ul {
12
+ margin:0;
13
+ padding:0;
14
+ list-style-type:none;
15
+ }
16
+
17
+ div.po-autocomplete-container ul li{
18
+ margin: 0;
19
+ padding: 2px;
20
+ height: 20px;
21
+ display: block;
22
+ list-style-type: none;
23
+ cursor: pointer;
24
+ padding-top: 7px;
25
+ background-color: #C3D9EB;
26
+ color: #333;
27
+ font-size: 14px;
28
+ }
29
+ div.po-autocomplete-container ul li:nth-child(even){
30
+ background-color: #A9CDEB;
31
+ }
32
+ div.po-autocomplete-container ul li.selected{
33
+ background-color:#95C2E8;
34
+ font-weight: bold;
35
+ }
skin/adminhtml/default/default/po_gridautocomplete/js/autocomplete.js ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var potatoGridAutocomplete = Class.create(Ajax.Autocompleter, {
2
+ initialize: function(elementIds, update, url, options) {
3
+ var element = null;
4
+ elementIds.each(function(elId){
5
+ if ($(elId)) {
6
+ element = $(elId);
7
+ }
8
+ });
9
+ element.up().setStyle({
10
+ border: '1px solid orange'
11
+ });
12
+ this.autocompleteContainer = new Element('div', {
13
+ 'class' : 'po-autocomplete-container',
14
+ 'id' : update,
15
+ 'style': 'display:none'
16
+ });
17
+ $$('body').first().appendChild(this.autocompleteContainer);
18
+ options.onShow = options.onShow ||
19
+ function(element, update){
20
+ if(!update.style.position || update.style.position=='absolute') {
21
+ update.style.position = 'absolute';
22
+ Position.clone(element, update, {
23
+ setHeight: false,
24
+ offsetTop: element.offsetHeight
25
+ });
26
+ }
27
+ Effect.Appear(update, {
28
+ duration:0.05,
29
+ afterFinish: function(){
30
+ update.setStyle({'min-width': update.getStyle('width')});
31
+ update.setStyle({'width': 'auto'});
32
+ }
33
+ });
34
+ };
35
+ options.paramName = options.paramName || 'search';
36
+ options.frequency = options.frequency || 0.5;
37
+ options.minChars = options.minChars || 3;
38
+
39
+
40
+ this.baseInitialize(element, update, options);
41
+ this.options.asynchronous = true;
42
+ this.options.onComplete = this.onComplete.bind(this);
43
+ this.options.defaultParams = this.options.parameters || null;
44
+ this.url = url;
45
+ },
46
+
47
+ updateChoices: function(choices) {
48
+ if(!this.changed && this.hasFocus) {
49
+ this.update.innerHTML = choices;
50
+ Element.cleanWhitespace(this.update);
51
+ Element.cleanWhitespace(this.update.down());
52
+
53
+ if(this.update.firstChild && this.update.down().childNodes) {
54
+ this.entryCount =
55
+ this.update.down().childNodes.length;
56
+ for (var i = 0; i < this.entryCount; i++) {
57
+ var entry = this.getEntry(i);
58
+ entry.autocompleteIndex = i;
59
+ this.addObservers(entry);
60
+ }
61
+ } else {
62
+ this.entryCount = 0;
63
+ }
64
+
65
+ this.stopIndicator();
66
+ this.index = -1;
67
+
68
+ if(this.entryCount==1 && this.options.autoSelect) {
69
+ this.selectEntry();
70
+ this.hide();
71
+ } else {
72
+ this.render();
73
+ }
74
+ }
75
+ }
76
+ });