Ds_Similarorder - Version 0.1.0

Version Notes

stable version

Download this release

Release Info

Developer Dotsquares
Extension Ds_Similarorder
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

app/code/community/Ds/Similarorder/Block/Adminhtml/Orderfilter.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ds_Similarorder_Block_Adminhtml_Orderfilter extends Mage_Adminhtml_Block_Widget
3
+ {
4
+ public function __construct()
5
+ {
6
+
7
+ parent::__construct();
8
+ $this->setTemplate('similarorder/orderfilter.phtml');
9
+
10
+ }
11
+ }
app/code/community/Ds/Similarorder/Block/Adminhtml/Orderform.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ds_Similarorder_Block_Adminhtml_Orderform extends Mage_Adminhtml_Block_Widget
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $this->setTemplate('similarorder/orderfilter.phtml');
8
+ }
9
+ }
app/code/community/Ds/Similarorder/Block/Adminhtml/Similarorder/Grid.php ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ds_Similarorder_Block_Adminhtml_Similarorder_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
+ {
4
+ public function __construct()
5
+ {
6
+
7
+ parent::__construct();
8
+ $this->setId('ds_order_grid');
9
+ $this->setDefaultSort('increment_id');
10
+ $this->setDefaultDir('DESC');
11
+ $this->setSaveParametersInSession(true);
12
+ $this->setUseAjax(true);
13
+ $this->setFilterVisibility(false);
14
+
15
+ }
16
+
17
+ protected function _prepareCollection()
18
+ {
19
+ $ordersearch = Mage::getResourceModel('sales/order_collection');
20
+ if ($data = $this->getRequest()->getPost())
21
+ {
22
+ if($data['order_id'] != '')
23
+ {
24
+ $ordersearch = $ordersearch->addAttributeToFilter('increment_id', array('neq' => $data['order_id']));
25
+
26
+ $order = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('increment_id',$data['order_id'])->getFirstItem();
27
+ if($order->getData())
28
+ {
29
+ if(in_array("IP", $data['filter']))
30
+ {
31
+ $remote_ip = $order->getData('remote_ip');
32
+
33
+ $ordersearch = $ordersearch->addFieldToFilter('remote_ip',$remote_ip);
34
+ /* echo "<pre>"; print_r($ordersearch->getData()); exit; */
35
+ }
36
+ /* if(in_array("cookie", $data['filter']))
37
+ {
38
+ $cookie = $order->getData('cookie');
39
+ $ordersearch = $ordersearch->addFieldToFilter('cookie',$cookie);
40
+ } */
41
+
42
+ $addData = $order->getBillingAddress()->getData();
43
+
44
+ $postcode = $addData['postcode'];
45
+ $street = $addData['street'];
46
+ $city = $addData['city'];
47
+ $telephone = $addData['telephone'];
48
+ $country_id = $addData['country_id'];
49
+ /* $cPhones[]=$telephone; */
50
+
51
+ if(in_array("Address", $data['filter']))
52
+ {
53
+ $ordersearch = $ordersearch->addFieldToFilter('a.postcode',$postcode)
54
+ ->addFieldToFilter('a.street',$street)
55
+ ->addFieldToFilter('a.city',$city)
56
+ ->addFieldToFilter('a.country_id',$country_id);
57
+
58
+ }
59
+ if(in_array("Phone", $data['filter']))
60
+ {
61
+ $ordersearch = $ordersearch->addFieldToFilter('a.telephone',$telephone);
62
+ }
63
+
64
+ }
65
+ else
66
+ {
67
+ $ordersearch = $ordersearch->addAttributeToFilter('increment_id', "0");
68
+ }
69
+ }
70
+ }
71
+
72
+
73
+ $checkArray=array("IP","Phone","Address");
74
+ if(count(array_intersect($data['filter'], $checkArray)) == 0 || $data['order_id'] == '')
75
+ {
76
+ $ordersearch = $ordersearch->addAttributeToFilter('increment_id', "0");
77
+ }
78
+
79
+ $collection = $ordersearch
80
+ ->join(array('a' => 'sales/order_address'), 'main_table.entity_id = a.parent_id AND a.address_type = \'billing\'', array(
81
+ 'city' => 'city',
82
+ 'country_id' => 'country_id'
83
+ ))
84
+ ->addExpressionFieldToSelect(
85
+ 'fullname',
86
+ 'CONCAT({{customer_firstname}}, \' \', {{customer_lastname}})',
87
+ array('customer_firstname' => 'main_table.customer_firstname', 'customer_lastname' => 'main_table.customer_lastname'))
88
+ ->addExpressionFieldToSelect(
89
+ 'products',
90
+ '(SELECT GROUP_CONCAT(\' \', x.name)
91
+ FROM sales_flat_order_item x
92
+ WHERE {{entity_id}} = x.order_id
93
+ AND x.product_type != \'configurable\')',
94
+ array('entity_id' => 'main_table.entity_id')
95
+ );
96
+
97
+ #echo $collection->getSelect()."<hr>";
98
+ /* echo "<pre>"; print_r($collection->getData()); exit; */
99
+ $this->setCollection($collection);
100
+ parent::_prepareCollection();
101
+ return $this;
102
+ }
103
+
104
+ protected function _prepareColumns()
105
+ {
106
+
107
+ $helper = Mage::helper('similarorder');
108
+ $currency = (string) Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE);
109
+ $this->addColumn('increment_id', array(
110
+ 'header' => $helper->__('Order #'),
111
+ 'filter' => false,
112
+ 'sortable' => false,
113
+ 'index' => 'increment_id'
114
+ ));
115
+ $this->addColumn('purchased_on', array(
116
+ 'header' => $helper->__('Purchased On'),
117
+ 'type' => 'datetime',
118
+ 'filter' => false,
119
+ 'sortable' => false,
120
+ 'index' => 'created_at'
121
+ ));
122
+ $this->addColumn('products', array(
123
+ 'header' => $helper->__('Products Purchased'),
124
+ 'index' => 'products',
125
+ 'filter' => false,
126
+ 'sortable' => false,
127
+ 'filter_index' => '(SELECT GROUP_CONCAT(\' \', x.name) FROM sales_flat_order_item x WHERE main_table.entity_id = x.order_id AND x.product_type != \'configurable\')'
128
+ ));
129
+ $this->addColumn('remote_ip', array(
130
+ 'header' => $helper->__('Ip Address'),
131
+ 'filter' => false,
132
+ 'sortable' => false,
133
+ 'index' => 'remote_ip'
134
+ ));
135
+ $this->addColumn('fullname', array(
136
+ 'header' => $helper->__('Name'),
137
+ 'index' => 'fullname',
138
+ 'filter' => false,
139
+ 'sortable' => false,
140
+ 'filter_index' => 'CONCAT(customer_firstname, \' \', customer_lastname)'
141
+ ));
142
+ $this->addColumn('city', array(
143
+ 'header' => $helper->__('City'),
144
+ 'filter' => false,
145
+ 'sortable' => false,
146
+ 'index' => 'city'
147
+ ));
148
+ $this->addColumn('country', array(
149
+ 'header' => $helper->__('Country'),
150
+ 'filter' => false,
151
+ 'sortable' => false,
152
+ 'index' => 'country_id',
153
+ 'renderer' => 'adminhtml/widget_grid_column_renderer_country'
154
+ ));
155
+ $this->addColumn('grand_total', array(
156
+ 'header' => $helper->__('Grand Total'),
157
+ 'index' => 'grand_total',
158
+ 'filter' => false,
159
+ 'sortable' => false,
160
+ 'type' => 'currency',
161
+ 'currency_code' => $currency
162
+ ));
163
+ $this->addColumn('order_status', array(
164
+ 'header' => $helper->__('Status'),
165
+ 'index' => 'status',
166
+ 'filter' => false,
167
+ 'sortable' => false,
168
+ 'type' => 'options',
169
+ 'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
170
+ ));
171
+
172
+ return parent::_prepareColumns();
173
+ }
174
+
175
+ public function getGridUrl()
176
+ {
177
+ return $this->getUrl('similarorder/adminhtml_ordergrid/grid', array('_current' => true));
178
+ }
179
+
180
+ public function getRowUrl($row)
181
+ {
182
+ return $this->getUrl('adminhtml/sales_order/view', array('order_id' => $row->getId()));
183
+ }
184
+
185
+ }
app/code/community/Ds/Similarorder/Block/Adminhtml/Similarorder/View/Tab/Form.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ds_Similarorder_Block_Adminhtml_Similarorder_View_Tab_Form extends Mage_Adminhtml_Block_Widget_Form implements Mage_Adminhtml_Block_Widget_Tab_Interface
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+
10
+ $fieldset = $form->addFieldset('similarorder_form', array(
11
+ 'legend' => Mage::helper('similarorder')->__('Item information')
12
+ ))->setRenderer($this->getLayout()->createBlock('adminhtml/widget_form_renderer_fieldset')->setTemplate(
13
+ 'similarorder/orderform.phtml'
14
+ ));
15
+
16
+ return parent::_prepareForm();
17
+ }
18
+
19
+ public function getTabLabel()
20
+ {
21
+ return Mage::helper('similarorder')->__('Find Similar');
22
+ }
23
+
24
+ public function getTabTitle()
25
+ {
26
+ return Mage::helper('similarorder')->__('Find Similar');
27
+ }
28
+
29
+ public function canShowTab()
30
+ {
31
+ return true;
32
+ }
33
+
34
+ public function isHidden()
35
+ {
36
+ return false;
37
+ }
38
+ }
app/code/community/Ds/Similarorder/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ds_Similarorder_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
app/code/community/Ds/Similarorder/Model/Mysql4/Similarorder.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ds_Similarorder_Model_Mysql4_Similarorder extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the similarorder_id refers to the key field in your database table.
8
+ $this->_init('similarorder/similarorder', 'similarorder_id');
9
+ }
10
+ }
app/code/community/Ds/Similarorder/Model/Mysql4/Similarorder/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ds_Similarorder_Model_Mysql4_Similarorder_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('similarorder/similarorder');
9
+ }
10
+ }
app/code/community/Ds/Similarorder/Model/Similarorder.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ds_Similarorder_Model_Similarorder extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('similarorder/similarorder');
9
+ }
10
+ }
app/code/community/Ds/Similarorder/Model/Status.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ds_Similarorder_Model_Status extends Varien_Object
4
+ {
5
+ const STATUS_ENABLED = 1;
6
+ const STATUS_DISABLED = 2;
7
+
8
+ static public function getOptionArray()
9
+ {
10
+ return array(
11
+ self::STATUS_ENABLED => Mage::helper('similarorder')->__('Enabled'),
12
+ self::STATUS_DISABLED => Mage::helper('similarorder')->__('Disabled')
13
+ );
14
+ }
15
+ }
app/code/community/Ds/Similarorder/controllers/Adminhtml/SimilarorderController.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ds_Similarorder_Adminhtml_SimilarorderController extends Mage_Adminhtml_Controller_action
4
+ {
5
+
6
+ protected function _initAction() {
7
+ $this->loadLayout()
8
+ ->_setActiveMenu('similarorder/items')
9
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
10
+
11
+ return $this;
12
+ }
13
+
14
+ public function indexAction() {
15
+ $this->_initAction()
16
+ ->renderLayout();
17
+ }
18
+
19
+ public function gridAction()
20
+ {
21
+ $this->loadLayout();
22
+ $this->renderLayout();
23
+ }
24
+
25
+ public function orderfilterAction()
26
+ {
27
+ $this->_title($this->__('Similar Order'))
28
+ ->_title($this->__('Manage Items'));
29
+
30
+ $this->_title($this->__('Order Filter'));
31
+
32
+ $this->loadLayout()
33
+ //->_setActiveMenu('ordergrid/items')
34
+ ->_addContent($this->getLayout()->createBlock('similarorder/adminhtml_orderfilter'))
35
+ ->renderLayout();
36
+ }
37
+
38
+ public function filterbyorderAction()
39
+ {
40
+
41
+ $this->_title($this->__('Similar Order'))
42
+ ->_title($this->__('Manage Items'));
43
+
44
+ $this->_title($this->__('Order Filter'));
45
+
46
+ $this->loadLayout()
47
+ //->_setActiveMenu('ordergrid/items')
48
+ ->_addContent($this->getLayout()->createBlock('similarorder/adminhtml_orderfilter'))
49
+ ->renderLayout();
50
+
51
+ }
52
+ }
app/code/community/Ds/Similarorder/etc/config.xml ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Ds_Similarorder>
5
+ <version>0.1.0</version>
6
+ </Ds_Similarorder>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <similarorder>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Ds_Similarorder</module>
14
+ <frontName>similarorder</frontName>
15
+ </args>
16
+ </similarorder>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <similarorder>
21
+ <file>similarorder.xml</file>
22
+ </similarorder>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <admin>
27
+ <routers>
28
+ <similarorder>
29
+ <use>admin</use>
30
+ <args>
31
+ <module>Ds_Similarorder</module>
32
+ <frontName>similarorder</frontName>
33
+ </args>
34
+ </similarorder>
35
+ </routers>
36
+ </admin>
37
+ <adminhtml>
38
+ <menu>
39
+ <sales>
40
+ <children>
41
+ <similarorder>
42
+ <title>Find Similar Orders</title>
43
+ <sort_order>10</sort_order>
44
+ <action>similarorder/adminhtml_similarorder</action>
45
+ </similarorder>
46
+ </children>
47
+ </sales>
48
+ </menu>
49
+ <acl>
50
+ <resources>
51
+ <all>
52
+ <title>Allow Everything</title>
53
+ </all>
54
+ <admin>
55
+ <children>
56
+ <sales>
57
+ <children>
58
+ <similarorder>
59
+ <title>Find Similar Orders</title>
60
+ <sort_order>10</sort_order>
61
+ </similarorder>
62
+ </children>
63
+ </sales>
64
+ <similarorder>
65
+ <title>Similarorder Module</title>
66
+ <sort_order>10</sort_order>
67
+ </similarorder>
68
+ </children>
69
+ </admin>
70
+ <!-- <admin>
71
+ <children>
72
+ <Ds_Similarorder>
73
+ <title>Similarorder Module</title>
74
+ <sort_order>10</sort_order>
75
+ </Ds_Similarorder>
76
+ </children>
77
+ </admin> -->
78
+ </resources>
79
+ </acl>
80
+ <layout>
81
+ <updates>
82
+ <similarorder>
83
+ <file>similarorder.xml</file>
84
+ </similarorder>
85
+ </updates>
86
+ </layout>
87
+ </adminhtml>
88
+ <global>
89
+ <models>
90
+ <similarorder>
91
+ <class>Ds_Similarorder_Model</class>
92
+ <resourceModel>similarorder_mysql4</resourceModel>
93
+ </similarorder>
94
+ <!-- <similarorder_mysql4>
95
+ <class>Ds_Similarorder_Model_Mysql4</class>
96
+ <entities>
97
+ <similarorder>
98
+ <table>similarorder</table>
99
+ </similarorder>
100
+ </entities>
101
+ </similarorder_mysql4> -->
102
+ </models>
103
+ <resources>
104
+ <similarorder_setup>
105
+ <setup>
106
+ <module>Ds_Similarorder</module>
107
+ </setup>
108
+ <connection>
109
+ <use>core_setup</use>
110
+ </connection>
111
+ </similarorder_setup>
112
+ <similarorder_write>
113
+ <connection>
114
+ <use>core_write</use>
115
+ </connection>
116
+ </similarorder_write>
117
+ <similarorder_read>
118
+ <connection>
119
+ <use>core_read</use>
120
+ </connection>
121
+ </similarorder_read>
122
+ </resources>
123
+ <blocks>
124
+ <similarorder>
125
+ <class>Ds_Similarorder_Block</class>
126
+ </similarorder>
127
+ </blocks>
128
+ <helpers>
129
+ <similarorder>
130
+ <class>Ds_Similarorder_Helper</class>
131
+ </similarorder>
132
+ </helpers>
133
+ </global>
134
+ </config>
app/design/adminhtml/default/default/layout/similarorder.xml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <!-- <similarorder_adminhtml_similarorder_index>
4
+ <reference name="content">
5
+ <block type="similarorder/adminhtml_similarorder" name="similarorder" />
6
+ </reference>
7
+ </similarorder_adminhtml_similarorder_index> -->
8
+ <adminhtml_sales_order_index>
9
+ <reference name="head">
10
+ <action method="addCss"><name>css/custom_grid.css</name></action>
11
+ <action method="addItem"><type>skin_js</type><name>js/custom_grid.js</name></action>
12
+ </reference>
13
+ </adminhtml_sales_order_index>
14
+ <similarorder_adminhtml_similarorder_index>
15
+ <reference name="content">
16
+ <block type="similarorder/adminhtml_orderform" name="orderform" />
17
+ </reference>
18
+ </similarorder_adminhtml_similarorder_index>
19
+ <adminhtml_sales_order_view>
20
+ <reference name="sales_order_tabs">
21
+ <action method="addTab">
22
+ <name>similarorder_view_tab</name>
23
+ <block>similarorder/adminhtml_similarorder_view_tab_form</block>
24
+ </action>
25
+ </reference>
26
+ </adminhtml_sales_order_view>
27
+ <similarorder_adminhtml_similarorder_grid>
28
+ <block type="core/text_list" name="root" output="toHtml">
29
+ <block type="similarorder/adminhtml_similarorder_grid" name="similarorder_grid" />
30
+ </block>
31
+ </similarorder_adminhtml_similarorder_grid>
32
+ </layout>
app/design/adminhtml/default/default/template/similarorder/orderfilter.phtml ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $orderId = $this->getRequest()->getPost();
3
+ $incId = $orderId['order_id'];
4
+
5
+ ?>
6
+
7
+ <div id="customer_info_tabs_customer_edit_tab_ordernote_content">
8
+ <form id="edit_form" name="edit_form" action="<?php echo $this->getUrl('similarorder/adminhtml_similarorder/filterbyorder'); ?>" method="post">
9
+ <?php echo $this->getBlockHtml('formkey')?>
10
+ <div class="entry-edit">
11
+ <div class="entry-edit-head">
12
+ <h4 class="icon-head head-edit-form fieldset-legend">Find Similer Orders:</h4>
13
+ </div>
14
+ <div id="ordergrid_form" class="fieldset">
15
+ <table class="form-list" cellspacing="0">
16
+ <tbody>
17
+ <tr>
18
+ <td class="label">
19
+ <label for="order_id">Odrer ID</label>
20
+ </td>
21
+ <td class="value">
22
+ <input id="order_id" class="input-text" type="text" value="<?php if(isset($incId)){ echo $incId; } ?>" name="order_id" />
23
+ </td>
24
+ </tr>
25
+ <tr>
26
+ <td class="label">
27
+ <label for="modes">Find Similer By</label>
28
+ </td>
29
+ <td class="value">
30
+ <?php /* <input type="checkbox" id="cookie" name="filter[]" value="cookie" <?php if(in_array("cookie", $orderId['filter'])) { echo 'checked="checked"'; } ?> />
31
+ <label for="cookie" style="padding-right:10px;">Cookie</label> */ ?>
32
+ <input type="checkbox" id="ip" name="filter[]" value="IP" <?php if(in_array("IP", $orderId['filter'])) { echo 'checked="checked"'; } ?> />
33
+ <label for="ip" style="padding-right:10px;">IP</label>
34
+ <input type="checkbox" id="address" name="filter[]" value="Address" <?php if(in_array("Address", $orderId['filter'])) { echo 'checked="checked"'; } ?> />
35
+ <label for="address" style="padding-right:10px;">Billing Address</label>
36
+ <input type="checkbox" id="phone" name="filter[]" value="Phone" <?php if(in_array("Phone", $orderId['filter'])) { echo 'checked="checked"'; } ?> />
37
+ <label for="phone">Phone</label>
38
+ </td>
39
+ </tr>
40
+ <tr><td colspan="2">&nbsp;</td></tr>
41
+ <tr>
42
+ <td colspan="2" align="right">
43
+ <!--input id="add_note_submit" class="button" type="button" value="Add Note" /-->
44
+ <button id="add_search" class="add_search" type="button" title="Add Search" onclick="search()"><span><span>Search</span></button>
45
+ </td>
46
+ </tr>
47
+ </tbody>
48
+ </table>
49
+ </div>
50
+ </div>
51
+ </form>
52
+ </div>
53
+ <div class="hor-scroll">
54
+ <?php echo $this->getLayout()->createBlock('similarorder/adminhtml_similarorder_grid')->toHtml() ?>
55
+ </div>
56
+ <script type="text/javascript">
57
+ function search()
58
+ {
59
+ var chec = document.getElementsByName('filter[]');
60
+
61
+ var ln = 0;
62
+ for(var i=0; i< chec.length; i++) {
63
+ if(chec[i].checked)
64
+ ln++;
65
+ }
66
+ if(ln == 0)
67
+ {
68
+ alert('please check at least one from IP/Address/Telephone.');
69
+ return false;
70
+ }
71
+ document.getElementById('edit_form').submit();
72
+ }
73
+ </script>
app/design/adminhtml/default/default/template/similarorder/orderform.phtml ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $customerId = $this->getRequest()->getParams();
3
+ /* echo "<pre>"; print_r($customerId); exit; */
4
+ $orderId = $customerId['order_id'];
5
+ $orders = Mage::getModel('sales/order')->load($orderId);
6
+ $oId = $orders->getIncrementId();
7
+
8
+ ?>
9
+
10
+ <div id="customer_info_tabs_customer_edit_tab_ordernote_content">
11
+ <form id="edit_form" name="edit_form" action="<?php echo $this->getUrl('similarorder/adminhtml_similarorder/filterbyorder'); ?>" method="post">
12
+ <?php echo $this->getBlockHtml('formkey')?>
13
+ <div class="entry-edit">
14
+ <div class="entry-edit-head">
15
+ <h4 class="icon-head head-edit-form fieldset-legend">Find Similer Orders:</h4>
16
+ </div>
17
+ <div id="ordergrid_form" class="fieldset">
18
+ <table class="form-list" cellspacing="0">
19
+ <tbody>
20
+ <tr>
21
+ <td class="label">
22
+ <label for="order_id">Odrer ID</label>
23
+ </td>
24
+ <td class="value">
25
+ <input id="order_id" class="input-text" type="text" value="<?php if(isset($oId) && $oId){ echo $oId; } ?>" name="order_id" readonly />
26
+ </td>
27
+ </tr>
28
+ <tr>
29
+ <td class="label">
30
+ <label for="modes">Find Similer By</label>
31
+ </td>
32
+ <td class="value">
33
+ <?php /* <input type="checkbox" id="cookie" name="filter[]" value="cookie" <?php if(in_array("cookie", $customerId['filter'])) { echo 'checked="checked"'; } ?> />
34
+ <label for="cookie" style="padding-right:10px;">Cookie</label> */ ?>
35
+ <input type="checkbox" id="ip" name="filter[]" class="search_check" value="IP" <?php if(in_array("IP", $customerId['filter'])) { echo 'checked="checked"'; } ?> />
36
+ <label for="ip" style="padding-right:10px;">IP</label>
37
+ <input type="checkbox" id="address" name="filter[]" class="search_check" value="Address" <?php if(in_array("Address", $customerId['filter'])) { echo 'checked="checked"'; } ?> />
38
+ <label for="address" style="padding-right:10px;">Billing Address</label>
39
+ <input type="checkbox" id="phone" name="filter[]" class="search_check" value="Phone" <?php if(in_array("Phone", $customerId['filter'])) { echo 'checked="checked"'; } ?> />
40
+ <label for="phone">Phone</label>
41
+ </td>
42
+ </tr>
43
+ <tr><td colspan="2">&nbsp;</td></tr>
44
+ <tr>
45
+ <td colspan="2" align="right">
46
+ <!--input id="add_note_submit" class="button" type="button" value="Add Note" /-->
47
+ <button id="add_search" class="add_search" type="button" title="Add Search" onclick="search(this)"><span><span>Search</span></button>
48
+ </td>
49
+ </tr>
50
+ </tbody>
51
+ </table>
52
+ </div>
53
+ </div>
54
+ </form>
55
+ </div>
56
+ <script type="text/javascript">
57
+ function search(thisform)
58
+ {
59
+ var chec = document.getElementsByName('filter[]');
60
+
61
+ var ln = 0;
62
+ for(var i=0; i< chec.length; i++) {
63
+ if(chec[i].checked)
64
+ ln++;
65
+ }
66
+ if(ln == 0)
67
+ {
68
+ alert('please check at least one from IP/Address/Telephone.');
69
+ return false;
70
+ }
71
+ document.getElementById('edit_form').submit();
72
+
73
+
74
+ }
75
+ </script>
app/etc/modules/Ds_Similarorder.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Ds_Similarorder>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Ds_Similarorder>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Ds_Similarorder</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license>OSL 3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Find all similar orders based on same IP, Address and Telephone according to order Id.</summary>
10
+ <description>&lt;h3&gt;Main Features of this extension is find all similar orders based on same IP, Same address and same telephone&lt;/h3&gt;&#xD;
11
+ &lt;p&gt;if your ecommerce site has long list of orders, Find similar order extension is for you because it displays same order according to same IP, same address and same telephone, which helps in fast search of order. &lt;/p&gt;&#xD;
12
+ &lt;p&gt;&#xD;
13
+ Using this extension, Admin can get find same address, same IP orders.&lt;/p&gt;&#xD;
14
+ &lt;ul&gt;&#xD;
15
+ &lt;li&gt;It allows automatic loading of the products with page scroll.&lt;/li&gt;&#xD;
16
+ &lt;li&gt;It offers great exposure to the website content.&lt;/li&gt;&#xD;
17
+ &lt;li&gt;It&#x2019;s perfect for touch-based devices.&lt;/li&gt;&#xD;
18
+ &lt;li&gt;It&#x2019;s responsive for all devices.&lt;/li&gt;&#xD;
19
+ &lt;li&gt;It&#x2019;s multi-store and multi-language supported.&lt;/li&gt;&#xD;
20
+ &lt;li&gt;It&#x2019;s 100% open source.&lt;/li&gt;&#xD;
21
+ &lt;li&gt;Multi browsers support : IE, FireFox, Safari, Chrome, Opera (fully tested)&lt;/li&gt;&#xD;
22
+ &lt;li&gt;User Friendly, Ultimate functionality with well designed and easy to customize.&lt;/li&gt;&#xD;
23
+ &lt;li&gt;Simply Enable/Disable module using configuration option.&lt;/li&gt;&#xD;
24
+ &lt;/ul&gt; &#xD;
25
+ &lt;h3&gt;Installation&lt;/h3&gt;&#xD;
26
+ &lt;p&gt;Go to magento connect manager and paste the extension key and click install.&lt;/p&gt;&#xD;
27
+ &lt;p&gt;After installation,active catalog ajax scroll from admin by navigate below steps:&lt;/p&gt;&#xD;
28
+ </description>
29
+ <notes>stable version </notes>
30
+ <authors><author><name>Dotsquares</name><user>dotsquaresltd</user><email>support.extensions@dotsquares.com</email></author></authors>
31
+ <date>2015-10-26</date>
32
+ <time>13:46:50</time>
33
+ <contents><target name="mageetc"><dir name="modules"><file name="Ds_Similarorder.xml" hash="1a9ae1f50115394e5f8da3f09a95d65b"/></dir></target><target name="magecommunity"><dir name="Ds"><dir name="Similarorder"><dir name="Block"><dir name="Adminhtml"><file name="Orderfilter.php" hash="4d62810674d3577ee724bdc27b0829a7"/><file name="Orderform.php" hash="9b25df4641834f68f390b17cc869d166"/><dir name="Similarorder"><file name="Grid.php" hash="0e395fcac42ae7636a4e396960afc136"/><dir name="View"><dir name="Tab"><file name="Form.php" hash="9876f2d7208b273400f56da8fef51784"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="f4ae118172bfed1fcd5b9a9f564859eb"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Similarorder"><file name="Collection.php" hash="11e7750a0b375df1b8035541b50a4b6d"/></dir><file name="Similarorder.php" hash="532c88ffaccb1bc3f6305ef6bc9844c6"/></dir><file name="Similarorder.php" hash="60827a74bab254891880c4251b837a34"/><file name="Status.php" hash="501732a43db569502dfe4d10aefb12b9"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SimilarorderController.php" hash="41b8e2376868ff73c8c2e4eaa5742511"/></dir></dir><dir name="etc"><file name="config.xml" hash="71b8028f4cbf3fc3b4187d9d2085638a"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="similarorder.xml" hash="baf303426b48115d959d8e7ce18a3766"/></dir><dir name="template"><dir name="similarorder"><file name="orderfilter.phtml" hash="9f4ae10fe6af6d597e9c52f32e4ee93c"/><file name="orderform.phtml" hash="fbebcb705b5ea8918cca05d35e60b2da"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><file name="custom_grid.css" hash="890b3609421351c1a6f12dacb15fea10"/></dir><dir name="js"><file name="custom_grid.js" hash="3b9343fce873ed71f672696facfc4e6e"/></dir></dir></dir></dir></target></contents>
34
+ <compatible/>
35
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
36
+ </package>
skin/adminhtml/default/default/css/custom_grid.css ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ div.info{
2
+ position:relative; /*this is the key*/
3
+ background-color: #FA031C;
4
+ border-radius: 50%;
5
+ height: 10px;
6
+ /* overflow: hidden; */
7
+ padding: 5px 5px 5px;
8
+ /* position: absolute; */
9
+ cursor:pointer;
10
+ top:17px;
11
+ left:25px;
12
+ text-align: center;
13
+ width: 10px;
14
+ z-index: 24;
15
+ text-indent:9999px;
16
+ }
17
+ div.api_no{
18
+ position:relative; /*this is the key*/
19
+ background-color: #03FA24;
20
+ border-radius: 50%;
21
+ height: 10px;
22
+ overflow: hidden;
23
+ padding: 5px 5px 5px;
24
+ /* position: absolute; */
25
+ top:17px;
26
+ left:25px;
27
+ text-align: center;
28
+ width: 10px;
29
+ z-index: 24;
30
+ text-indent:20px;
31
+ }
32
+ div.info:hover{z-index:25;}
33
+ div.info b{ /* color:#666666 */}
34
+ div.info:hover span{
35
+ /*the span will display just on :hover state*/
36
+ float:left;
37
+ display:block;
38
+ position:absolute;
39
+ top:0px!important;
40
+ border:1px solid #cccccc;
41
+ background-color:#FAFAFA; color:#444444;
42
+ text-align: left; left:30px; padding:5px 10px; font-size:12px; border-radius:5px;width:250px;
43
+ text-indent:0px;
44
+ }
skin/adminhtml/default/default/js/custom_grid.js ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ function showbox(x){
2
+ document.getElementById(x).style.display = 'block';
3
+ }
4
+ function hidebox(x)
5
+ {
6
+ document.getElementById(x).style.display = 'none';
7
+ }