Igex_Storelocator - Version 1.0.0

Version Notes

First release of the extension.. But we look forward to make new improvements and advancements in a short while

Download this release

Release Info

Developer iGex Solutions
Extension Igex_Storelocator
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (46) hide show
  1. app/code/local/Igex/StoreLocator/Block/Adminhtml/Import.php +19 -0
  2. app/code/local/Igex/StoreLocator/Block/Adminhtml/Import/Form.php +31 -0
  3. app/code/local/Igex/StoreLocator/Block/Adminhtml/Store.php +12 -0
  4. app/code/local/Igex/StoreLocator/Block/Adminhtml/Store/Edit.php +67 -0
  5. app/code/local/Igex/StoreLocator/Block/Adminhtml/Store/Edit/Form.php +231 -0
  6. app/code/local/Igex/StoreLocator/Block/Adminhtml/Store/Grid.php +212 -0
  7. app/code/local/Igex/StoreLocator/Block/Adminhtml/Store/Renderer/Image.php +15 -0
  8. app/code/local/Igex/StoreLocator/Block/Store.php +249 -0
  9. app/code/local/Igex/StoreLocator/Block/Store.php~ +249 -0
  10. app/code/local/Igex/StoreLocator/Block/System/Config/General.php +21 -0
  11. app/code/local/Igex/StoreLocator/Helper/Data.php +83 -0
  12. app/code/local/Igex/StoreLocator/Model/Distanceunits.php +21 -0
  13. app/code/local/Igex/StoreLocator/Model/Pagedisplay.php +20 -0
  14. app/code/local/Igex/StoreLocator/Model/Resource/Store.php +145 -0
  15. app/code/local/Igex/StoreLocator/Model/Resource/Store/Collection.php +155 -0
  16. app/code/local/Igex/StoreLocator/Model/Store.php +10 -0
  17. app/code/local/Igex/StoreLocator/Model/System/Config/Backend/Image.php +95 -0
  18. app/code/local/Igex/StoreLocator/Model/System/Config/Backend/Marker.php +95 -0
  19. app/code/local/Igex/StoreLocator/controllers/Adminhtml/ImportController.php +59 -0
  20. app/code/local/Igex/StoreLocator/controllers/Adminhtml/StoreController.php +498 -0
  21. app/code/local/Igex/StoreLocator/controllers/IndexController.php +35 -0
  22. app/code/local/Igex/StoreLocator/etc/adminhtml.xml +52 -0
  23. app/code/local/Igex/StoreLocator/etc/config.xml +134 -0
  24. app/code/local/Igex/StoreLocator/etc/system.xml +241 -0
  25. app/code/local/Igex/StoreLocator/sql/igex_storelocator_setup/mysql4-install-1.0.0.php +110 -0
  26. app/design/adminhtml/default/default/layout/igex/storelocator.xml +24 -0
  27. app/design/frontend/base/default/layout/igex/storelocator.xml +147 -0
  28. app/design/frontend/base/default/template/igex/storelocator/2columns.phtml +227 -0
  29. app/design/frontend/base/default/template/igex/storelocator/2columns.phtml~ +227 -0
  30. app/design/frontend/base/default/template/igex/storelocator/storelocator.phtml +200 -0
  31. app/design/frontend/base/default/template/igex/storelocator/storelocator.phtml~ +200 -0
  32. app/etc/modules/Igex_StoreLocator.xml +10 -0
  33. media/storelocator/images/Crosses.png +0 -0
  34. media/storelocator/images/IMG_06182013_150241.jpg +0 -0
  35. media/storelocator/images/add2.png +0 -0
  36. media/storelocator/images/button.jpg +0 -0
  37. media/storelocator/images/default/Jellyfish.jpg +0 -0
  38. media/storelocator/images/default/add1.png +0 -0
  39. media/storelocator/images/download.jpg +0 -0
  40. media/storelocator/images/download_1_.jpg +0 -0
  41. media/storelocator/images/download_2_.jpg +0 -0
  42. media/storelocator/images/images.jpg +0 -0
  43. media/storelocator/images/images_1_.jpg +0 -0
  44. media/storelocator/markers/default/dealer_icon_1.png +0 -0
  45. package.xml +18 -0
  46. skin/frontend/base/default/css/igex/storelocator.css +262 -0
app/code/local/Igex/StoreLocator/Block/Adminhtml/Import.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Igex_StoreLocator_Block_Adminhtml_Import extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct() {
6
+ parent::__construct();
7
+ $this->_updateButton('save', 'label', Mage::helper('igex_storelocator')->__('Import'));
8
+ $this->_removeButton('delete');
9
+ $this->_removeButton('back');
10
+
11
+ $this->_blockGroup = 'igex_storelocator';
12
+ $this->_controller = 'adminhtml';
13
+ $this->_mode = 'import';
14
+ }
15
+
16
+ public function getHeaderText() {
17
+ return Mage::helper('igex_storelocator')->__('Import Stores');
18
+ }
19
+ }
app/code/local/Igex/StoreLocator/Block/Adminhtml/Import/Form.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Igex_StoreLocator_Block_Adminhtml_Import_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $sampleCSVpath = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'import_stores/sample.csv';
8
+ $form = new Varien_Data_Form(array(
9
+ 'id' => 'edit_form',
10
+ 'action' => $this->getUrl('*/adminhtml_import/save'),
11
+ 'method' => 'post',
12
+ 'enctype' => 'multipart/form-data'
13
+ )
14
+ );
15
+ $fieldset = $form->addFieldset('edit_form', array('legend'=>Mage::helper('igex_storelocator')->__('Add dealers via CSV file')));
16
+ $fieldset->addField('csv_file', 'file', array(
17
+ 'name' => 'csv_file',
18
+ 'label' => Mage::helper('igex_storelocator')->__('Choose CSV file to import'),
19
+ 'after_element_html' => Mage::helper('igex_storelocator')->__('<br/> Download : <a href="%s">Sample CSV file</a>', $sampleCSVpath)
20
+ )
21
+ );
22
+
23
+ $fieldset->addField('note', 'label', array(
24
+ 'value' => Mage::helper('igex_storelocator')->__('Note : A CSV file may contain many stores. Please donot edit the first row of the CSV file, as this will not import the data properly.'),
25
+ ));
26
+
27
+ $form->setUseContainer(true);
28
+ $this->setForm($form);
29
+ return parent::_prepareForm();
30
+ }
31
+ }
app/code/local/Igex/StoreLocator/Block/Adminhtml/Store.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Igex_StoreLocator_Block_Adminhtml_Store extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_blockGroup = 'igex_storelocator';
7
+ $this->_controller = 'adminhtml_store';
8
+ $this->_headerText = $this->__('Store');
9
+
10
+ parent::__construct();
11
+ }
12
+ }
app/code/local/Igex/StoreLocator/Block/Adminhtml/Store/Edit.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Igex_StoreLocator_Block_Adminhtml_Store_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
3
+ {
4
+ /**
5
+ * Init class
6
+ */
7
+ public function __construct()
8
+ {
9
+ $this->_blockGroup = 'igex_storelocator';
10
+
11
+ $this->_objectId = 'id';
12
+ $this->_controller = 'adminhtml_store';
13
+
14
+ parent::__construct();
15
+
16
+ $this->_updateButton('save', 'label', Mage::helper('igex_storelocator')->__('Save Store'));
17
+ $this->_updateButton('delete', 'label', Mage::helper('igex_storelocator')->__('Delete Store'));
18
+
19
+ $this->_addButton('saveandcontinue', array(
20
+ 'label' => Mage::helper('igex_storelocator')->__('Save and Continue Edit'),
21
+ 'onclick' => 'saveAndContinueEdit()',
22
+ 'class' => 'save',
23
+ ), -100);
24
+
25
+ $apiUrl = Mage::getStoreConfig('igex/storelocator_options/apiurl');
26
+ $apiKey = Mage::getStoreConfig('igex/storelocator_options/apikey');
27
+ $apiSensor = Mage::getStoreConfig('igex/storelocator_options/apisensor');
28
+ $sensor = ($apiSensor == 0) ? 'false' : 'true';
29
+ $img="";
30
+ $marker = "var marker = new google.maps.Marker({position: latLng, map: map });";
31
+ if(!is_null(Mage::getStoreConfig('igex/storelocator_options/mapicon')) && Mage::getStoreConfig('igex/storelocator_options/mapicon') != '') {
32
+ $img = "var imgMarker = new google.maps.MarkerImage('".Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'storelocator/markers/'.Mage::getStoreConfig('igex/storelocator_options/mapicon')."');";
33
+ $marker = "var marker = new google.maps.Marker({position: latLng, icon: imgMarker,map: map });";
34
+ }
35
+
36
+ $this->_formScripts[] = "
37
+ function saveAndContinueEdit(){
38
+ editForm.submit($('edit_form').action+'back/edit/');
39
+ }
40
+
41
+ function capitalize(str) {
42
+ var pieces = str.split(' ');
43
+ for ( var i = 0; i < pieces.length; i++ )
44
+ {
45
+ var j = pieces[i].charAt(0).toUpperCase();
46
+ pieces[i] = j + pieces[i].substr(1);
47
+ }
48
+ return pieces.join(' ');
49
+ }
50
+ ";
51
+ }
52
+
53
+ /**
54
+ * Get Header text
55
+ *
56
+ * @return string
57
+ */
58
+ public function getHeaderText()
59
+ {
60
+ if (Mage::registry('igex_storelocator')->getId()) {
61
+ return $this->__('Edit Store');
62
+ }
63
+ else {
64
+ return $this->__('New Store');
65
+ }
66
+ }
67
+ }
app/code/local/Igex/StoreLocator/Block/Adminhtml/Store/Edit/Form.php ADDED
@@ -0,0 +1,231 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Igex_StoreLocator_Block_Adminhtml_Store_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+ /**
5
+ * Init class
6
+ */
7
+ public function __construct()
8
+ {
9
+ parent::__construct();
10
+
11
+ $this->setId('store_form');
12
+ $this->setTitle($this->__('Store Information'));
13
+ }
14
+
15
+ /**
16
+ * Setup form fields for inserts/updates
17
+ *
18
+ * return Mage_Adminhtml_Block_Widget_Form
19
+ */
20
+ protected function _prepareForm()
21
+ {
22
+ $model = Mage::registry('igex_storelocator');
23
+
24
+ $form = new Varien_Data_Form(array(
25
+ 'id' => 'edit_form',
26
+ 'action' => $this->getData('action'),
27
+ 'method' => 'post',
28
+ 'enctype' => 'multipart/form-data')
29
+ );
30
+
31
+ $fieldset = $form->addFieldset('igex_storelocator_form', array(
32
+ 'legend' => Mage::helper('checkout')->__('Store Information')
33
+ ));
34
+
35
+
36
+ if ($model->getId()) {
37
+ $fieldset->addField('entity_id', 'hidden', array(
38
+ 'name' => 'entity_id',
39
+ ));
40
+ }
41
+
42
+ $fieldset->addField('created_time', 'hidden', array(
43
+ 'name' => 'created_time',
44
+ ));
45
+
46
+ $fieldset->addField('update_time', 'hidden', array(
47
+ 'name' => 'update_time',
48
+ ));
49
+
50
+
51
+ $fieldset->addField('status', 'select', array(
52
+ 'label' => Mage::helper('igex_storelocator')->__('Status'),
53
+ 'name' => 'status',
54
+ 'values' => array(
55
+ array(
56
+ 'value' => 1,
57
+ 'label' => Mage::helper('igex_storelocator')->__('Enabled'),
58
+ ),
59
+
60
+ array(
61
+ 'value' => 0,
62
+ 'label' => Mage::helper('igex_storelocator')->__('Disabled'),
63
+ ),
64
+ ),
65
+ ));
66
+
67
+ /**
68
+ * Check is single store mode
69
+ */
70
+ if (!Mage::app()->isSingleStoreMode()) {
71
+ $field = $fieldset->addField('store_id', 'multiselect', array(
72
+ 'name' => 'stores[]',
73
+ 'label' => Mage::helper('igex_storelocator')->__('Store View'),
74
+ 'title' => Mage::helper('igex_storelocator')->__('Store View'),
75
+ 'required' => true,
76
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
77
+ ));
78
+ $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
79
+ $field->setRenderer($renderer);
80
+ }
81
+ else {
82
+
83
+ $fieldset->addField('store_id', 'hidden', array(
84
+ 'name' => 'stores[]',
85
+ 'value' => Mage::app()->getStore(true)->getId()
86
+ ));
87
+ $model->setStoreId(Mage::app()->getStore(true)->getId());
88
+ }
89
+
90
+ $fieldset->addField('name', 'text', array(
91
+ 'label' => Mage::helper('igex_storelocator')->__('Store Name'),
92
+ 'class' => 'required-entry',
93
+ 'required' => true,
94
+ 'name' => 'name',
95
+ ));
96
+
97
+
98
+ $fieldset->addField('topvisible', 'select', array(
99
+ 'label' => 'Top Store Visible',
100
+ 'name' => 'topvisible',
101
+ 'values' => array(
102
+ array(
103
+ 'value' => 1,
104
+ 'label' => Mage::helper('igex_storelocator')->__('Enabled'),
105
+ ),
106
+
107
+ array(
108
+ 'value' => 0,
109
+ 'label' => Mage::helper('igex_storelocator')->__('Disabled'),
110
+ ),
111
+ ),
112
+ ));
113
+
114
+
115
+ $fieldset->addField('store_url', 'text', array(
116
+ 'label' => Mage::helper('igex_storelocator')->__('Website'),
117
+ 'required' => false,
118
+ 'name' => 'store_url',
119
+ ));
120
+
121
+ $fieldset->addField('email', 'text', array(
122
+ 'label' => Mage::helper('igex_storelocator')->__('Email'),
123
+ 'class' => 'validate-email',
124
+ 'required' => false,
125
+ 'name' => 'email',
126
+ ));
127
+
128
+ $fieldset->addField('phone', 'text', array(
129
+ 'label' => Mage::helper('igex_storelocator')->__('Telephone'),
130
+ 'name' => 'phone',
131
+ ));
132
+
133
+
134
+ $fieldset->addField('address', 'textarea', array(
135
+ 'label' => Mage::helper('igex_storelocator')->__('Address'),
136
+ 'class' => 'required-entry',
137
+ 'required' => true,
138
+ 'name' => 'address',
139
+ ));
140
+
141
+ $fieldset->addField('zipcode', 'text', array(
142
+ 'label' => Mage::helper('igex_storelocator')->__('Postal Code'),
143
+ 'class' => 'required-entry',
144
+ 'required' => true,
145
+ 'name' => 'zipcode',
146
+ ));
147
+
148
+ $fieldset->addField('state', 'text', array(
149
+ 'label' => 'State',
150
+ 'class' => 'required-entry',
151
+ 'required' => true,
152
+ 'name' => 'state',
153
+ ));
154
+
155
+ $fieldset->addField('city', 'text', array(
156
+ 'label' => Mage::helper('igex_storelocator')->__('City'),
157
+ 'class' => 'required-entry',
158
+ 'required' => true,
159
+ 'name' => 'city',
160
+ ));
161
+
162
+
163
+ $countryList = Mage::getModel('directory/country')->getCollection()->toOptionArray();
164
+
165
+
166
+
167
+ $fieldset->addField('country_id', 'select', array(
168
+ 'label' => Mage::helper('igex_storelocator')->__('Country'),
169
+ 'name' => 'country_id',
170
+ 'title' => 'country',
171
+ 'values' => $countryList
172
+ ));
173
+
174
+ $fieldset->addField('lat', 'text', array(
175
+ 'label' => Mage::helper('igex_storelocator')->__('Latitude'),
176
+ 'class' => 'required-entry',
177
+ 'required' => false,
178
+ 'name' => 'lat',
179
+ ));
180
+
181
+ $fieldset->addField('long', 'text', array(
182
+ 'label' => Mage::helper('igex_storelocator')->__('Longitude'),
183
+ 'class' => 'required-entry',
184
+ 'required' => false,
185
+ 'name' => 'long',
186
+ ));
187
+
188
+
189
+
190
+ /*$fieldset->addField('fax', 'text', array(
191
+ 'label' => Mage::helper('igex_storelocator')->__('Fax'),
192
+ 'name' => 'fax',
193
+ ));*/
194
+
195
+ /*$fieldset->addField('description', 'textarea', array(
196
+ 'label' => Mage::helper('igex_storelocator')->__('Description'),
197
+ 'name' => 'description',
198
+ ));
199
+
200
+ $fieldset->addField('lat', 'text', array(
201
+ 'label' => Mage::helper('igex_storelocator')->__('Latitude'),
202
+ 'required' => true,
203
+ 'name' => 'lat',
204
+ ));
205
+
206
+ $fieldset->addField('long', 'text', array(
207
+ 'label' => Mage::helper('igex_storelocator')->__('Longitude'),
208
+ 'required' => true,
209
+ 'name' => 'long',
210
+ ));*/
211
+
212
+ $fieldset->addField('image', 'image', array(
213
+ 'label' => Mage::helper('igex_storelocator')->__('Dealer Icon'),
214
+ 'required' => false,
215
+ 'name' => 'image',
216
+ ));
217
+
218
+ /*$fieldset->addField('marker', 'image', array(
219
+ 'label' => Mage::helper('igex_storelocator')->__('Marker'),
220
+ 'required' => false,
221
+ 'name' => 'marker',
222
+ ));*/
223
+
224
+
225
+ $form->setValues($model->getData());
226
+ $form->setUseContainer(true);
227
+ $this->setForm($form);
228
+
229
+ return parent::_prepareForm();
230
+ }
231
+ }
app/code/local/Igex/StoreLocator/Block/Adminhtml/Store/Grid.php ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Igex_StoreLocator_Block_Adminhtml_Store_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+
8
+ // Set some defaults for our grid
9
+
10
+ $this->setDefaultSort('entity_id');
11
+ $this->setId('StoreLocatorGrid');
12
+ $this->setDefaultDir('asc');
13
+ $this->setSaveParametersInSession(true);
14
+
15
+ }
16
+
17
+ protected function _getCollectionClass()
18
+ {
19
+ return 'igex_storelocator/store_collection';
20
+ }
21
+
22
+ protected function _prepareCollection()
23
+ {
24
+ // Get and set our collection for the grid
25
+ $collection = Mage::getResourceModel($this->_getCollectionClass());
26
+ $collection->setFirstStoreFlag(true);
27
+ //$collection = Mage::getModel('igex_storelocator/store')->getCollection();
28
+ $this->setCollection($collection);
29
+ return parent::_prepareCollection();
30
+ }
31
+
32
+ protected function _prepareColumns()
33
+ {
34
+ // Add the columns that should appear in the grid
35
+ $this->addColumn('entity_id',
36
+ array(
37
+ 'header'=> Mage::helper('igex_storelocator')->__('ID'),
38
+ 'align' =>'right',
39
+ 'width' => '50px',
40
+ 'align' =>'right',
41
+ 'index' => 'entity_id'
42
+ )
43
+ );
44
+
45
+
46
+ $this->addColumn('image', array(
47
+ 'header' => Mage::helper('igex_storelocator')->__('Dealer Icon'),
48
+ 'width' => '100',
49
+ 'renderer' => 'igex_storelocator/adminhtml_store_renderer_image',
50
+ 'index' => 'image',
51
+ ));
52
+
53
+ $this->addColumn('name',
54
+ array(
55
+ 'header'=> Mage::helper('igex_storelocator')->__('Store Name'),
56
+ 'index' => 'name',
57
+ )
58
+ );
59
+
60
+ $this->addColumn('topvisible',
61
+ array(
62
+ 'header'=> Mage::helper('igex_storelocator')->__('Top Store Visible'),
63
+ 'index' => 'topvisible',
64
+ 'type' => 'options',
65
+ 'options' => array(
66
+ 0 => Mage::helper('igex_storelocator')->__('Disabled'),
67
+ 1 => Mage::helper('igex_storelocator')->__('Enabled'),
68
+ ),
69
+ )
70
+ );
71
+
72
+ $this->addColumn('phone',
73
+ array(
74
+ 'header'=> Mage::helper('igex_storelocator')->__('Telephone'),
75
+ 'index' => 'phone',
76
+ )
77
+ );
78
+
79
+
80
+ $this->addColumn('email',
81
+ array(
82
+ 'header'=> Mage::helper('igex_storelocator')->__('Email'),
83
+ 'index' => 'email',
84
+ )
85
+ );
86
+
87
+ $this->addColumn('address',
88
+ array(
89
+ 'header'=> Mage::helper('igex_storelocator')->__('Address'),
90
+ 'index' => 'address',
91
+ )
92
+ );
93
+
94
+
95
+ $this->addColumn('state',
96
+ array(
97
+ 'header'=> 'State',
98
+ 'index' => 'state',
99
+ )
100
+ );
101
+
102
+ $this->addColumn('city',
103
+ array(
104
+ 'header'=> Mage::helper('igex_storelocator')->__('City'),
105
+ 'index' => 'city',
106
+ )
107
+ );
108
+
109
+ $this->addColumn('zipcode',
110
+ array(
111
+ 'header'=> Mage::helper('igex_storelocator')->__('Postal Code'),
112
+ 'index' => 'zipcode',
113
+ )
114
+ );
115
+
116
+
117
+
118
+ /*$this->addColumn('country_id', array(
119
+ 'header' => Mage::helper('customer')->__('Country'),
120
+ 'width' => '100',
121
+ 'type' => 'country',
122
+ 'index' => 'country_id',
123
+ ));
124
+
125
+
126
+
127
+ $this->addColumn('fax',
128
+ array(
129
+ 'header'=> Mage::helper('igex_storelocator')->__('Fax'),
130
+ 'index' => 'fax',
131
+ )
132
+ );
133
+
134
+ if (!Mage::app()->isSingleStoreMode()) {
135
+ $this->addColumn('store_id', array(
136
+ 'header' => Mage::helper('igex_storelocator')->__('Store View'),
137
+ 'index' => 'store_id',
138
+ 'type' => 'store',
139
+ 'store_all' => false,
140
+ 'store_view' => false,
141
+ 'sortable' => true,
142
+ 'filter_condition_callback'
143
+ => array($this, '_filterStoreCondition'),
144
+ ));
145
+ }*/
146
+
147
+ $this->addColumn('status',
148
+ array(
149
+ 'header'=> Mage::helper('igex_storelocator')->__('Status'),
150
+ 'index' => Mage::helper('igex_storelocator')->__('status'),
151
+ 'type' => 'options',
152
+ 'options' => array(
153
+ 0 => Mage::helper('igex_storelocator')->__('Disabled'),
154
+ 1 => Mage::helper('igex_storelocator')->__('Enabled'),
155
+ ),
156
+ )
157
+ );
158
+
159
+ $this->addExportType('*/*/exportCsv', Mage::helper('igex_storelocator')->__('CSV'));
160
+ return parent::_prepareColumns();
161
+ }
162
+
163
+ protected function _prepareMassaction()
164
+ {
165
+ $this->setMassactionIdField('entity_id');
166
+ $this->getMassactionBlock()->setFormFieldName('igex_storelocator');
167
+
168
+ $this->getMassactionBlock()->addItem('delete', array(
169
+ 'label' => Mage::helper('igex_storelocator')->__('Delete'),
170
+ 'url' => $this->getUrl('*/*/massDelete'),
171
+ 'confirm' => Mage::helper('igex_storelocator')->__('Are you sure?')
172
+ ));
173
+
174
+ $statuses = array(1 => Mage::helper('igex_storelocator')->__('Enabled'), 0 => Mage::helper('igex_storelocator')->__('Disabled'));
175
+ $this->getMassactionBlock()->addItem('status', array(
176
+ 'label'=> Mage::helper('igex_storelocator')->__('Change status'),
177
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
178
+ 'additional' => array(
179
+ 'visibility' => array(
180
+ 'name' => 'status',
181
+ 'type' => 'select',
182
+ 'class' => 'required-entry',
183
+ 'label' => Mage::helper('igex_storelocator')->__('Status'),
184
+ 'values' => $statuses
185
+ )
186
+ )
187
+ ));
188
+ return $this;
189
+ }
190
+
191
+ public function getRowUrl($row)
192
+ {
193
+ // This is where our row data will link to
194
+ return $this->getUrl('*/*/edit', array('entity_id' => $row->getId()));
195
+ }
196
+
197
+ protected function _afterLoadCollection()
198
+ {
199
+ $this->getCollection()->walk('afterLoad');
200
+ parent::_afterLoadCollection();
201
+ }
202
+
203
+ protected function _filterStoreCondition($collection, $column)
204
+ {
205
+ if (!$value = $column->getFilter()->getValue()) {
206
+ return;
207
+ }
208
+
209
+ $this->getCollection()->addStoreFilter($value);
210
+ }
211
+
212
+ }
app/code/local/Igex/StoreLocator/Block/Adminhtml/Store/Renderer/Image.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Igex_StoreLocator_Block_Adminhtml_Store_Renderer_Image extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract{
3
+
4
+ public function render(Varien_Object $row)
5
+ {
6
+ if(!is_null($row->getData($this->getColumn()->getIndex()))){
7
+ $html = '<img ';
8
+ $html .= 'id="' . $this->getColumn()->getId() . '" ';
9
+ $html .= 'src="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).$row->getData($this->getColumn()->getIndex()) . '"';
10
+ $html .= 'width="100"';
11
+ $html .= 'class="grid-image ' . $this->getColumn()->getInlineCss() . '"/>';
12
+ return $html;
13
+ }
14
+ }
15
+ }
app/code/local/Igex/StoreLocator/Block/Store.php ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Igex_StoreLocator_Block_Store extends Mage_Core_Block_Template
4
+ {
5
+
6
+ protected function _construct()
7
+ {
8
+ parent::_construct();
9
+ $pageType = Mage::helper('igex_storelocator')->getPageType();
10
+ if ($pageType == 2)
11
+ {
12
+ $this->setTemplate('igex/storelocator/2columns.phtml');
13
+ }
14
+ else
15
+ {
16
+ $this->setTemplate('igex/storelocator/storelocator.phtml');
17
+ }
18
+
19
+ $collection = $this->getStores();
20
+ $this->setCollection($collection);
21
+ }
22
+
23
+ public function _prepareLayout()
24
+ {
25
+ parent::_prepareLayout();
26
+ $pager = $this->getLayout()->createBlock('page/html_pager', 'dealer.pager');
27
+ // $pager->setAvailableLimit(array(10 => 10, 20 => 20, 30 => 30));
28
+ $pager->setCollection($this->getCollection());
29
+ $this->setChild('pager', $pager);
30
+ return $this;
31
+
32
+ }
33
+
34
+ public function getDefaultMarker()
35
+ {
36
+ $defaultMarker = '';
37
+
38
+ if(!is_null(Mage::getStoreConfig('igex/storelocator_options/mapicon')) && Mage::getStoreConfig('igex/storelocator_options/mapicon') != '')
39
+ {
40
+ $defaultMarker = 'storelocator/markers/'.Mage::getStoreConfig('igex/storelocator_options/mapicon');
41
+ }
42
+
43
+ return $defaultMarker;
44
+ }
45
+
46
+ public function getStores()
47
+ {
48
+ $search_add = Mage::getStoreConfig('igex/search_options/search_by_address');
49
+ $search_state = Mage::getStoreConfig('igex/search_options/search_by_state');
50
+ $search_zip = Mage::getStoreConfig('igex/search_options/search_by_zipcode');
51
+ $search_rad = Mage::getStoreConfig('igex/search_options/search_by_radius');
52
+ $show_state = Mage::getStoreConfig('igex/search_options/state_search');
53
+
54
+ //If state search is enabled, return stores
55
+ $state_req = Mage::app()->getRequest()->getParam('state');
56
+ if($state_req!='' && $show_state==1)
57
+ {
58
+ $stores = Mage::getModel('igex_storelocator/store')->getCollection()->addFieldToFilter('status',1)
59
+ ->addFieldToFilter('state',$state_req);
60
+
61
+ return $stores;
62
+ }
63
+
64
+ $postData = Mage::app()->getRequest()->getPost();
65
+
66
+ //Getting full collection of active stores
67
+ $stores = Mage::getModel('igex_storelocator/store')->getCollection()->addFieldToFilter('status',1);
68
+
69
+ //Filtering by address
70
+ if($postData['address']!='' && $search_add==1)
71
+ {
72
+ $stores = Mage::getModel('igex_storelocator/store')->getCollection()->addFieldToFilter('status',1)
73
+ ->addFieldToFilter('address',array('like'=>'%'.$postData['address'].'%'));
74
+
75
+ }
76
+
77
+ //Filtering by state
78
+ if($postData['state_or_stub']!='' && $search_zip==1)
79
+ {
80
+
81
+ $stores = Mage::getModel('igex_storelocator/store')->getCollection()->addFieldToFilter('status',1)
82
+ ->addFieldToFilter(array('city','state'),array(array('like'=>'%'.$postData['state_or_stub'].'%'),array('like'=>'%'.$postData['state_or_stub'].'%')));
83
+
84
+ }
85
+
86
+ //Filtering by zipcode
87
+ if($postData['zipcode']!='' && $search_zip==1)
88
+ {
89
+ $stores = Mage::getModel('igex_storelocator/store')->getCollection()->addFieldToFilter('status',1)
90
+ ->addFieldToFilter('zipcode',$postData['zipcode']);
91
+ }
92
+
93
+ //Filtering by radius
94
+ if($postData['zipcode']!='' && $postData['radius']!='' && $search_rad==1)
95
+ {
96
+
97
+ $stores = Mage::getModel('igex_storelocator/store')->getCollection()->addFieldToFilter('status',1);
98
+ $kilometer = $postData['radius'];
99
+
100
+ $units = Mage::helper('igex_storelocator')->getRadiusUnit();
101
+
102
+ // Finding lat-long from user-entered zipcode
103
+ if(strlen($postData['zipcode'])<=4)
104
+ {
105
+ $zipcode=$postData['zipcode'].",australia";
106
+ }
107
+ else
108
+ {
109
+ $zipcode=trim(str_replace(' ','',$postData['zipcode']));
110
+ }
111
+ $url = "http://maps.googleapis.com/maps/api/geocode/json?address=".$zipcode."&sensor=false";
112
+ $details = file_get_contents($url);
113
+ $result = json_decode($details,true);
114
+ $lat=$result['results'][0]['geometry']['location']['lat']; //from user
115
+ $lng=$result['results'][0]['geometry']['location']['lng'];
116
+
117
+ //Fetching values from db
118
+ $resource = Mage::getSingleton('core/resource');
119
+
120
+ // Retrieve the read connection
121
+ $readConnection = $resource->getConnection('core_read');
122
+
123
+ $query ="SELECT `entity_id`, `lat`, `long` FROM `igex_storelocator`";
124
+
125
+ // Execute the query and store the results in $results
126
+ $results = $readConnection->fetchAll($query);
127
+ $data = array();
128
+ $lati = array();
129
+ $longi = array();
130
+ $final= array();
131
+
132
+ for($j=0;$j<count($results);$j++)
133
+ {
134
+ $lati[] = $results[$j]['lat'];
135
+ $longi[] = $results[$j]['long'];
136
+ }
137
+
138
+ if(!function_exists('distance'))
139
+ {
140
+ function distance($lat1, $lng1, $lat2, $lng2,$unit)
141
+ {
142
+ $pi80 = M_PI / 180;
143
+ $lat1 *= $pi80;
144
+ $lng1 *= $pi80;
145
+ $lat2 *= $pi80;
146
+ $lng2 *= $pi80;
147
+
148
+ $r = 6372.797; // mean radius of Earth in km
149
+ $dlat = $lat2 - $lat1;
150
+ $dlng = $lng2 - $lng1;
151
+ $a = sin($dlat / 2) * sin($dlat / 2) + cos($lat1) * cos($lat2) * sin($dlng / 2) * sin($dlng / 2);
152
+ $c = 2 * atan2(sqrt($a), sqrt(1 - $a));
153
+ $km = $r * $c;
154
+ if($unit==1)
155
+ {
156
+ return $km;
157
+ }
158
+
159
+ return ($km/1.609344);
160
+ }
161
+ }
162
+
163
+ $dist = array();
164
+
165
+ //Finding distance
166
+ for($i=0;$i<count($lati);$i++)
167
+ {
168
+ $dist[]=distance($lati[$i],$longi[$i],$lat,$lng,$units);
169
+ }
170
+
171
+ //Getting nearby stores
172
+ for($k=0;$k<count($dist);$k++)
173
+ {
174
+ if($dist[$k]<$kilometer)
175
+ {
176
+ $final[]=$results[$k]['entity_id'];
177
+ }
178
+ }
179
+
180
+ $stores = $stores->addFieldToFilter('entity_id',array('in'=> $final));
181
+ $stores->getSelect();
182
+ }
183
+
184
+ $storesCollection = new Varien_Data_Collection();
185
+
186
+ foreach($stores as $store)
187
+ {
188
+ if(!is_null($store->getCountryId()))
189
+ {
190
+ $store->setCountryId($this->getCountryByCode($store->getCountryId()));
191
+ }
192
+ else
193
+ {
194
+ $store->setCountryId($this->__('AU'));
195
+ }
196
+
197
+ if(!is_null($store->getImage()) || $store->getImage() != '' && $show_img==1)
198
+ {
199
+ $imgUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).$store->getImage();
200
+ }
201
+ elseif (!is_null(Mage::getStoreConfig('igex/storelocator_options/defaultimage')) && Mage::getStoreConfig('igex/storelocator_options/defaultimage') != '')
202
+ {
203
+ $imgUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'storelocator/images/'.Mage::getStoreConfig('igex/storelocator_options/defaultimage');
204
+ }
205
+ else
206
+ {
207
+ $imgUrl = $this->getLogoSrc();
208
+ }
209
+ $store->setImage($imgUrl);
210
+
211
+ $storesCollection->addItem($store);
212
+
213
+ }
214
+ return $storesCollection;
215
+ }
216
+
217
+ public function getPagerHtml()
218
+ {
219
+ return $this->getChildHtml('pager');
220
+ }
221
+
222
+ public function getGoogleApiUrl()
223
+ {
224
+ $apiUrl = Mage::getStoreConfig('igex/storelocator_options/apiurl');
225
+ if(is_null($apiUrl))
226
+ $apiUrl = "http://maps.googleapis.com/maps/api/js?v=3";
227
+ $apiKey = "&key=".Mage::getStoreConfig('igex/storelocator_options/apikey');
228
+ $apiSensor = Mage::getStoreConfig('igex/storelocator_options/apisensor');
229
+ $sensor = ($apiSensor == 0) ? 'false' : 'true';
230
+ $urlGoogleApi = $apiUrl."&sensor=".$sensor.$apiKey."&callback=initialize&libraries=places";
231
+
232
+ return $urlGoogleApi;
233
+ }
234
+
235
+ public function getCountryByCode($code)
236
+ {
237
+ return Mage::getModel('directory/country')->loadByCode($code)->getName();
238
+ }
239
+
240
+ public function getLogoSrc()
241
+ {
242
+ if (empty($this->_data['logo_src']))
243
+ {
244
+ $this->_data['logo_src'] = Mage::getStoreConfig('design/header/logo_src');
245
+ }
246
+ return $this->getSkinUrl($this->_data['logo_src']);
247
+ }
248
+
249
+ }
app/code/local/Igex/StoreLocator/Block/Store.php~ ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Igex_StoreLocator_Block_Store extends Mage_Core_Block_Template
4
+ {
5
+
6
+ protected function _construct()
7
+ {
8
+ parent::_construct();
9
+ $pageType = Mage::helper('igex_storelocator')->getPageType();
10
+ if ($pageType == 2)
11
+ {
12
+ $this->setTemplate('igex/storelocator/2columns.phtml');
13
+ }
14
+ else
15
+ {
16
+ $this->setTemplate('igex/storelocator/storelocator.phtml');
17
+ }
18
+
19
+ $collection = $this->getStores();
20
+ $this->setCollection($collection);
21
+ }
22
+
23
+ public function _prepareLayout()
24
+ {
25
+ parent::_prepareLayout();
26
+ $pager = $this->getLayout()->createBlock('page/html_pager', 'dealer.pager');
27
+ // $pager->setAvailableLimit(array(10 => 10, 20 => 20, 30 => 30));
28
+ $pager->setCollection($this->getCollection());
29
+ $this->setChild('pager', $pager);
30
+ return $this;
31
+
32
+ }
33
+
34
+ public function getDefaultMarker()
35
+ {
36
+ $defaultMarker = '';
37
+
38
+ if(!is_null(Mage::getStoreConfig('igex/storelocator_options/mapicon')) && Mage::getStoreConfig('igex/storelocator_options/mapicon') != '')
39
+ {
40
+ $defaultMarker = 'storelocator/markers/'.Mage::getStoreConfig('igex/storelocator_options/mapicon');
41
+ }
42
+
43
+ return $defaultMarker;
44
+ }
45
+
46
+ public function getStores()
47
+ {
48
+ $search_add = Mage::getStoreConfig('igex/search_options/search_by_address');
49
+ $search_state = Mage::getStoreConfig('igex/search_options/search_by_state');
50
+ $search_zip = Mage::getStoreConfig('igex/search_options/search_by_zipcode');
51
+ $search_rad = Mage::getStoreConfig('igex/search_options/search_by_radius');
52
+ $show_state = Mage::getStoreConfig('igex/search_options/state_search');
53
+
54
+ //If state search is enabled, return stores
55
+ $state_req = Mage::app()->getRequest()->getParam('state');
56
+ if($state_req!='' && $show_state==1)
57
+ {
58
+ $stores = Mage::getModel('igex_storelocator/store')->getCollection()->addFieldToFilter('status',1)
59
+ ->addFieldToFilter('state',$state_req);
60
+
61
+ return $stores;
62
+ }
63
+
64
+ $postData = Mage::app()->getRequest()->getPost();
65
+
66
+ //Getting full collection of active stores
67
+ $stores = Mage::getModel('igex_storelocator/store')->getCollection()->addFieldToFilter('status',1);
68
+
69
+ //Filtering by address
70
+ if($postData['address']!='' && $search_add==1)
71
+ {
72
+ $stores = Mage::getModel('igex_storelocator/store')->getCollection()->addFieldToFilter('status',1)
73
+ ->addFieldToFilter('address',array('like'=>'%'.$postData['address'].'%'));
74
+
75
+ }
76
+
77
+ //Filtering by state
78
+ if($postData['state_or_stub']!='' && $search_zip==1)
79
+ {
80
+
81
+ $stores = Mage::getModel('igex_storelocator/store')->getCollection()->addFieldToFilter('status',1)
82
+ ->addFieldToFilter(array('city','state'),array(array('like'=>'%'.$postData['state_or_stub'].'%'),array('like'=>'%'.$postData['state_or_stub'].'%')));
83
+
84
+ }
85
+
86
+ //Filtering by zipcode
87
+ if($postData['zipcode']!='' && $search_zip==1)
88
+ {
89
+ $stores = Mage::getModel('igex_storelocator/store')->getCollection()->addFieldToFilter('status',1)
90
+ ->addFieldToFilter('zipcode',$postData['zipcode']);
91
+ }
92
+
93
+ //Filtering by radius
94
+ if($postData['zipcode']!='' && $postData['radius']!='' && $search_rad==1)
95
+ {
96
+
97
+ $stores = Mage::getModel('igex_storelocator/store')->getCollection()->addFieldToFilter('status',1);
98
+ $kilometer = $postData['radius'];
99
+
100
+ $units = Mage::helper('igex_storelocator')->getRadiusUnit();
101
+
102
+ // Finding lat-long from user-entered zipcode
103
+ if(strlen($postData['zipcode'])<=4)
104
+ {
105
+ $zipcode=$postData['zipcode'].",australia";
106
+ }
107
+ else
108
+ {
109
+ $zipcode=trim(str_replace(' ','',$postData['zipcode']));
110
+ }
111
+ $url = "http://maps.googleapis.com/maps/api/geocode/json?address=".$zipcode."&sensor=false";
112
+ $details = file_get_contents($url);
113
+ $result = json_decode($details,true);
114
+ $lat=$result['results'][0]['geometry']['location']['lat']; //from user
115
+ $lng=$result['results'][0]['geometry']['location']['lng'];
116
+
117
+ //Fetching values from db
118
+ $resource = Mage::getSingleton('core/resource');
119
+
120
+ // Retrieve the read connection
121
+ $readConnection = $resource->getConnection('core_read');
122
+
123
+ $query ="SELECT `entity_id`, `lat`, `long` FROM `igex_storelocator`";
124
+
125
+ // Execute the query and store the results in $results
126
+ $results = $readConnection->fetchAll($query);
127
+ $data = array();
128
+ $lati = array();
129
+ $longi = array();
130
+ $final= array();
131
+
132
+ for($j=0;$j<count($results);$j++)
133
+ {
134
+ $lati[] = $results[$j]['lat'];
135
+ $longi[] = $results[$j]['long'];
136
+ }
137
+
138
+ if(!function_exists('distance'))
139
+ {
140
+ function distance($lat1, $lng1, $lat2, $lng2,$unit)
141
+ {
142
+ $pi80 = M_PI / 180;
143
+ $lat1 *= $pi80;
144
+ $lng1 *= $pi80;
145
+ $lat2 *= $pi80;
146
+ $lng2 *= $pi80;
147
+
148
+ $r = 6372.797; // mean radius of Earth in km
149
+ $dlat = $lat2 - $lat1;
150
+ $dlng = $lng2 - $lng1;
151
+ $a = sin($dlat / 2) * sin($dlat / 2) + cos($lat1) * cos($lat2) * sin($dlng / 2) * sin($dlng / 2);
152
+ $c = 2 * atan2(sqrt($a), sqrt(1 - $a));
153
+ $km = $r * $c;
154
+ if($unit==1)
155
+ {
156
+ return $km;
157
+ }
158
+
159
+ return ($km/1.609344);
160
+ }
161
+ }
162
+
163
+ $dist = array();
164
+
165
+ //Finding distance
166
+ for($i=0;$i<count($lati);$i++)
167
+ {
168
+ $dist[]=distance($lati[$i],$longi[$i],$lat,$lng,$units);
169
+ }
170
+
171
+ //Getting nearby stores
172
+ for($k=0;$k<count($dist);$k++)
173
+ {
174
+ if($dist[$k]<$kilometer)
175
+ {
176
+ $final[]=$results[$k]['entity_id'];
177
+ }
178
+ }
179
+
180
+ $stores = $stores->addFieldToFilter('entity_id',array('in'=> $final));
181
+ $stores->getSelect();
182
+ }
183
+
184
+ $storesCollection = new Varien_Data_Collection();
185
+
186
+ foreach($stores as $store)
187
+ {
188
+ if(!is_null($store->getCountryId()))
189
+ {
190
+ $store->setCountryId($this->getCountryByCode($store->getCountryId()));
191
+ }
192
+ else
193
+ {
194
+ $store->setCountryId($this->__('AU'));
195
+ }
196
+
197
+ if(!is_null($store->getImage()) || $store->getImage() != '' && $show_img==1)
198
+ {
199
+ $imgUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).$store->getImage();
200
+ }
201
+ elseif (!is_null(Mage::getStoreConfig('igex/storelocator_options/defaultimage')) && Mage::getStoreConfig('igex/storelocator_options/defaultimage') != '')
202
+ {
203
+ $imgUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'storelocator/images/'.Mage::getStoreConfig('igex/storelocator_options/defaultimage');
204
+ }
205
+ else
206
+ {
207
+ $imgUrl = $this->getLogoSrc();
208
+ }
209
+ $store->setImage($imgUrl);
210
+
211
+ $storesCollection->addItem($store);
212
+
213
+ }
214
+ return $storesCollection;
215
+ }
216
+
217
+ public function getPagerHtml()
218
+ {
219
+ return $this->getChildHtml('pager');
220
+ }
221
+
222
+ public function getGoogleApiUrl()
223
+ {
224
+ $apiUrl = Mage::getStoreConfig('igex/storelocator_options/apiurl');
225
+ if(is_null($apiUrl))
226
+ $apiUrl = "http://maps.googleapis.com/maps/api/js?v=3";
227
+ $apiKey = "&key=".Mage::getStoreConfig('igex/storelocator_options/apikey');
228
+ $apiSensor = Mage::getStoreConfig('igex/storelocator_options/apisensor');
229
+ $sensor = ($apiSensor == 0) ? 'false' : 'true';
230
+ $urlGoogleApi = $apiUrl."&sensor=".$sensor.$apiKey."&callback=initialize&libraries=places";
231
+
232
+ return $urlGoogleApi;
233
+ }
234
+
235
+ public function getCountryByCode($code)
236
+ {
237
+ return Mage::getModel('directory/country')->loadByCode($code)->getName();
238
+ }
239
+
240
+ public function getLogoSrc()
241
+ {
242
+ if (empty($this->_data['logo_src']))
243
+ {
244
+ $this->_data['logo_src'] = Mage::getStoreConfig('design/header/logo_src');
245
+ }
246
+ return $this->getSkinUrl($this->_data['logo_src']);
247
+ }
248
+
249
+ }
app/code/local/Igex/StoreLocator/Block/System/Config/General.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Igex_StoreLocator_Block_System_Config_General extends Mage_Adminhtml_Block_System_Config_Form_Fieldset {
3
+ public function render(Varien_Data_Form_Element_Abstract $element) {
4
+ $html = $this->_getHeaderHtml($element);
5
+
6
+ $html .= $this->_getInfo();
7
+
8
+ $html .= $this->_getFooterHtml($element);
9
+ return $html;
10
+ }
11
+
12
+ protected function _getInfo() {
13
+ $html = '<div class="support-info">';
14
+ $html .= '<h3>Support Policy</h3>';
15
+ $html .= '<p>We provide 6 months free support for all of our extensions and templates. We are not responsible for any bug or issue caused of your changes to our products. To report a bug, you can easily go to <a href="http://www.magebuzz.com/support/" title="Magebuzz Support" target="_blank">our Support Page</a>, email, call or submit a ticket.</p>';
16
+ $html .= '<h3>Read the blog</h3><p>The <a href="http://www.magebuzz.com/blog/" target="_blank">Magebuzz Blog</a> is updated regularly with Magento tutorials, Magebuzz new products, updates, promotions... Visit <a href="http://www.magebuzz.com/blog/" target="_blank">Magebuzz Blog</a> recently to be kept updated.</p>';
17
+ $html .= '<h3>Follow Us</h3><div class="magebuzz-follow"><ul><li style="float:left" class="facebook"><a href="http://www.facebook.com/MageBuzz" title="Facebook" target="_blank"><img src="' . $this->getSkinUrl('images/magebuzz/facebook.png') . '" alt="Facebook"/></a></li><li style="float:left" class="twitter"><a href="https://twitter.com/MageBuzz" title="Twitter" target="_blank"><img src="' . $this->getSkinUrl('images/magebuzz/twitter.png') . '" alt="Twitter"/></a></li></ul></div>';
18
+ $html .= '</div>';
19
+ return $html;
20
+ }
21
+ }
app/code/local/Igex/StoreLocator/Helper/Data.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Igex_StoreLocator_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ public function getJsonData($address)
7
+ {
8
+ $storeId = Mage::app()->getStore()->getId();
9
+ $configUrl = Mage::getStoreConfig('igex/storelocator_options/apiurl', $storeId);
10
+ if ($configUrl != '')
11
+ {
12
+ $url = Mage::getStoreConfig('igex/storelocator_options/apiurl')."?address=$address&sensor=false";
13
+ }
14
+ else
15
+ {
16
+ $url = 'http://maps.googleapis.com/maps/api/geocode/json?address=' . $address . '&sensor=false';
17
+ }
18
+
19
+ $rCURL = curl_init();
20
+ curl_setopt($rCURL, CURLOPT_URL, $url);
21
+ curl_setopt($rCURL, CURLOPT_HEADER, 0);
22
+ curl_setopt($rCURL, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]);
23
+ curl_setopt($rCURL, CURLOPT_RETURNTRANSFER, 1);
24
+ $aData = curl_exec($rCURL);
25
+ curl_close($rCURL);
26
+ $json = json_decode($aData);
27
+ return $json;
28
+ }
29
+
30
+ public function getSearchLabel($radius)
31
+ {
32
+ $unit = $this->getRadiusUnit();
33
+ $searchLabel = '';
34
+ if ($unit == 1)
35
+ {
36
+ $searchLabel = $radius . ' Kilometers';
37
+ }
38
+ else
39
+ {
40
+ $searchLabel = $radius . ' Miles';
41
+ }
42
+ return $searchLabel;
43
+ }
44
+
45
+ public function getSearchRadius()
46
+ {
47
+ $storeId = Mage::app()->getStore()->getId();
48
+ return Mage::getStoreConfig('igex/search_options/default_search_radius', $storeId);
49
+ }
50
+
51
+ public function getSearchRadiusOptions()
52
+ {
53
+ $storeId = Mage::app()->getStore()->getId();
54
+ $radius = Mage::getStoreConfig('igex/search_options/search_radius', $storeId);
55
+ $options = array();
56
+ if ($radius != '')
57
+ {
58
+ $radius_array = explode(',', $radius);;
59
+ if (count($radius_array))
60
+ {
61
+ foreach ($radius_array as $item)
62
+ {
63
+ $options[] = array(
64
+ 'value' => trim($item),
65
+ 'label' => $this->getSearchLabel(trim($item)));
66
+ }
67
+ }
68
+ }
69
+ return $options;
70
+ }
71
+
72
+ public function getRadiusUnit()
73
+ {
74
+ $storeId = Mage::app()->getStore()->getId();
75
+ return Mage::getStoreConfig('igex/search_options/distance_units', $storeId);
76
+ }
77
+
78
+ public function getPageType()
79
+ {
80
+ $storeId = Mage::app()->getStore()->getId();
81
+ return (int) Mage::getStoreConfig('igex/storelocator_options/page_type', $storeId);
82
+ }
83
+ }
app/code/local/Igex/StoreLocator/Model/Distanceunits.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Igex_StoreLocator_Model_DistanceUnits
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ array('value' => 0, 'label'=>Mage::helper('adminhtml')->__('Mile')),
9
+ array('value' => 1, 'label'=>Mage::helper('adminhtml')->__('Kilometer')),
10
+ );
11
+ }
12
+
13
+ public function toArray()
14
+ {
15
+ return array(
16
+ 0 => Mage::helper('adminhtml')->__('Mile'),
17
+ 1 => Mage::helper('adminhtml')->__('Kilometer'),
18
+ );
19
+ }
20
+
21
+ }
app/code/local/Igex/StoreLocator/Model/Pagedisplay.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Igex_StoreLocator_Model_Pagedisplay
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ array('value' => 1, 'label'=>Mage::helper('adminhtml')->__('1 column')),
9
+ array('value' => 2, 'label'=>Mage::helper('adminhtml')->__('2 column')),
10
+ );
11
+ }
12
+
13
+ public function toArray()
14
+ {
15
+ return array(
16
+ 1 => Mage::helper('adminhtml')->__('1 column'),
17
+ 2 => Mage::helper('adminhtml')->__('2 column'),
18
+ );
19
+ }
20
+ }
app/code/local/Igex/StoreLocator/Model/Resource/Store.php ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Igex_StoreLocator_Model_Resource_Store extends Mage_Core_Model_Resource_Db_Abstract
4
+ {
5
+ protected $_store = null;
6
+
7
+ protected function _construct()
8
+ {
9
+ $this->_init('igex_storelocator/store', 'entity_id');
10
+ }
11
+
12
+ /**
13
+ * Assign page to store views
14
+ *
15
+ * @param Mage_Core_Model_Abstract $object
16
+ */
17
+ protected function _afterSave(Mage_Core_Model_Abstract $object)
18
+ {
19
+ $oldStores = $this->lookupStoreIds($object->getId());
20
+ $newStores = (array)$object->getStores();
21
+ if (empty($newStores)) {
22
+ $newStores = (array)$object->getStoreId();
23
+ }
24
+ $table = $this->getTable('igex_storelocator/stores');
25
+ $insert = array_diff($newStores, $oldStores);
26
+ $delete = array_diff($oldStores, $newStores);
27
+
28
+ if ($delete) {
29
+ $where = array(
30
+ 'storelocator_id = ?' => (int) $object->getId(),
31
+ 'store_id IN (?)' => $delete
32
+ );
33
+
34
+ $this->_getWriteAdapter()->delete($table, $where);
35
+ }
36
+
37
+ if ($insert) {
38
+ $data = array();
39
+
40
+ foreach ($insert as $storeId) {
41
+ $data[] = array(
42
+ 'storelocator_id' => (int) $object->getId(),
43
+ 'store_id' => (int) $storeId
44
+ );
45
+ }
46
+
47
+ $this->_getWriteAdapter()->insertMultiple($table, $data);
48
+ }
49
+
50
+ return parent::_afterSave($object);
51
+ }
52
+
53
+
54
+ /**
55
+ * Retrieve select object for load object data
56
+ *
57
+ * @param string $field
58
+ * @param mixed $value
59
+ * @return Zend_Db_Select
60
+ */
61
+ protected function _getLoadSelect($field, $value, $object)
62
+ {
63
+ $select = parent::_getLoadSelect($field, $value, $object);
64
+
65
+ if ($object->getStoreId()) {
66
+ $storeIds = array(Mage_Core_Model_App::ADMIN_STORE_ID, (int)$object->getStoreId());
67
+ $select->join(
68
+ array('igex_storelocator_store' => $this->getTable('igex_storelocator/stores')),
69
+ $this->getMainTable() . '.page_id = igex_storelocator_store.storelocator_id',
70
+ array())
71
+ ->where('igex_storelocator_store.store_id IN (?)', $storeIds)
72
+ ->order('igex_storelocator_store.store_id DESC')
73
+ ->limit(1);
74
+ }
75
+
76
+ return $select;
77
+ }
78
+
79
+ /**
80
+ * Get store ids to which specified item is assigned
81
+ *
82
+ * @param int $id
83
+ * @return array
84
+ */
85
+ public function lookupStoreIds($storeLocatorId)
86
+ {
87
+ $adapter = $this->_getReadAdapter();
88
+ $select = $adapter->select()
89
+ ->from($this->getTable('igex_storelocator/stores'), 'store_id')
90
+ ->where('storelocator_id = ?',(int)$storeLocatorId);
91
+
92
+ return $adapter->fetchCol($select);
93
+ }
94
+
95
+ protected function _afterLoad(Mage_Core_Model_Abstract $object)
96
+ {
97
+ if ($object->getId()) {
98
+ $stores = $this->lookupStoreIds($object->getId());
99
+
100
+ $object->setData('store_id', $stores);
101
+
102
+ }
103
+
104
+ return parent::_afterLoad($object);
105
+ }
106
+
107
+ /**
108
+ * Add filter by store
109
+ *
110
+ * @param int|Mage_Core_Model_Store $store
111
+ * @param bool $withAdmin
112
+ */
113
+ public function addStoreFilter($store, $withAdmin = true)
114
+ {
115
+ if ($store instanceof Mage_Core_Model_Store) {
116
+ $store = array($store->getId());
117
+ }
118
+
119
+ if (!is_array($store)) {
120
+ $store = array($store);
121
+ }
122
+
123
+ if ($withAdmin) {
124
+ $store[] = Mage_Core_Model_App::ADMIN_STORE_ID;
125
+ }
126
+ $this->addFilter('store_id', array('in' => $store), 'public');
127
+
128
+ return $this;
129
+ }
130
+ public function setStore($store)
131
+ {
132
+ $this->_store = $store;
133
+ return $this;
134
+ }
135
+
136
+ /**
137
+ * Retrieve store model
138
+ *
139
+ * @return Mage_Core_Model_Store
140
+ */
141
+ public function getStore()
142
+ {
143
+ return Mage::app()->getStore($this->_store);
144
+ }
145
+ }
app/code/local/Igex/StoreLocator/Model/Resource/Store/Collection.php ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Igex_StoreLocator_Model_Resource_Store_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
4
+ {
5
+
6
+ protected $_previewFlag;
7
+
8
+
9
+ protected function _construct()
10
+ {
11
+ $this->_init('igex_storelocator/store');
12
+ $this->_map['fields']['entity_id'] = 'main_table.entity_id';
13
+ $this->_map['fields']['storelocator_id'] = 'igex_storelocator_stores.storelocator_id';
14
+ }
15
+
16
+
17
+ /**
18
+ * Set first store flag
19
+ *
20
+ * @param bool $flag
21
+ */
22
+ public function setFirstStoreFlag($flag = false)
23
+ {
24
+ $this->_previewFlag = $flag;
25
+ return $this;
26
+ }
27
+
28
+ /**
29
+ * deprecated after 1.4.0.1, use toOptionIdArray()
30
+ *
31
+ * @return array
32
+ */
33
+ public function toOptionArray()
34
+ {
35
+ return $this->_toOptionArray('identifier', 'title');
36
+ }
37
+
38
+ /**
39
+ * Returns pairs identifier - title for unique identifiers
40
+ * and pairs identifier|page_id - title for non-unique after first
41
+ *
42
+ * @return array
43
+ */
44
+ public function toOptionIdArray()
45
+ {
46
+ $res = array();
47
+ $existingIdentifiers = array();
48
+ foreach ($this as $item) {
49
+ $identifier = $item->getData('identifier');
50
+
51
+ $data['value'] = $identifier;
52
+ $data['label'] = $item->getData('title');
53
+
54
+ if (in_array($identifier, $existingIdentifiers)) {
55
+ $data['value'] .= '|' . $item->getData('storelocator_id');
56
+ } else {
57
+ $existingIdentifiers[] = $identifier;
58
+ }
59
+
60
+ $res[] = $data;
61
+ }
62
+
63
+ return $res;
64
+ }
65
+
66
+
67
+ /**
68
+ * Perform operations after collection load
69
+ *
70
+ */
71
+ protected function _afterLoad()
72
+ {
73
+ if ($this->_previewFlag) {
74
+ $items = $this->getColumnValues('entity_id');
75
+ $connection = $this->getConnection();
76
+ if (count($items)) {
77
+ $select = $connection->select()
78
+ ->from(array('igex_storelocator_stores'=>$this->getTable('igex_storelocator/stores')))
79
+ ->where('igex_storelocator_stores.storelocator_id IN (?)', $items);
80
+
81
+ if ($result = $connection->fetchPairs($select)) {
82
+ foreach ($this as $item) {
83
+ if (!isset($result[$item->getData('entity_id')])) {
84
+ continue;
85
+ }
86
+ if ($result[$item->getData('entity_id')] == 0) {
87
+ $stores = Mage::app()->getStores(false, true);
88
+ $storeId = current($stores)->getId();
89
+ $storeCode = key($stores);
90
+ } else {
91
+ $storeId = $result[$item->getData('entity_id')];
92
+ $storeCode = Mage::app()->getStore($storeId)->getCode();
93
+ }
94
+
95
+ $item->setData('_first_store_id', $storeId);
96
+ $item->setData('store_code', $storeCode);
97
+ }
98
+ }
99
+ }
100
+ }
101
+
102
+ return parent::_afterLoad();
103
+ }
104
+
105
+ /**
106
+ * Join store relation table if there is store filter
107
+ */
108
+ protected function _renderFiltersBefore()
109
+ {
110
+ if ($this->getFilter('store_id')) {
111
+ $this->getSelect()->join(
112
+ array('igex_storelocator_stores' => $this->getTable('igex_storelocator/stores')),
113
+ 'main_table.entity_id = igex_storelocator_stores.storelocator_id',
114
+ array()
115
+ )->group('main_table.entity_id');
116
+
117
+ /*
118
+ * Allow analytic functions usage because of one field grouping
119
+ */
120
+ $this->_useAnalyticFunction = true;
121
+ }
122
+ return parent::_renderFiltersBefore();
123
+ }
124
+
125
+ /**
126
+ * Add filter by store
127
+ *
128
+ * @param int|Mage_Core_Model_Store $store
129
+ * @param bool $withAdmin
130
+ */
131
+
132
+ public function addStoreFilter($store, $withAdmin = true)
133
+ {
134
+ if (!$this->getFlag('store_filter_added')) {
135
+ if ($store instanceof Mage_Core_Model_Store) {
136
+ $store = array($store->getId());
137
+ }
138
+
139
+ if (!is_array($store)) {
140
+ $store = array($store);
141
+ }
142
+
143
+ if ($withAdmin) {
144
+ $store[] = Mage_Core_Model_App::ADMIN_STORE_ID;
145
+ }
146
+
147
+ $this->addFilter('store_id', array('in' => $store), 'public');
148
+
149
+ }
150
+
151
+ return $this;
152
+ }
153
+
154
+
155
+ }
app/code/local/Igex/StoreLocator/Model/Store.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Igex_StoreLocator_Model_Store extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('igex_storelocator/store');
9
+ }
10
+ }
app/code/local/Igex/StoreLocator/Model/System/Config/Backend/Image.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-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 Mage
22
+ * @package Mage_Adminhtml
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Backend model for uploading transactional emails custom logo image
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Adminhtml
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Igex_StoreLocator_Model_System_Config_Backend_Image extends Mage_Adminhtml_Model_System_Config_Backend_Image
35
+ {
36
+ /**
37
+ * The tail part of directory path for uploading
38
+ */
39
+ const UPLOAD_DIR = 'storelocator/images';
40
+
41
+ /**
42
+ * Token for the root part of directory path for uploading
43
+ */
44
+ const UPLOAD_ROOT_TOKEN = 'system/filesystem/media';
45
+
46
+ /**
47
+ * Upload max file size in kilobytes
48
+ *
49
+ * @var int
50
+ */
51
+ protected $_maxFileSize = 2048;
52
+
53
+ /**
54
+ * Return path to directory for upload file
55
+ *
56
+ * @return string
57
+ */
58
+ protected function _getUploadDir()
59
+ {
60
+ $uploadDir = $this->_appendScopeInfo(self::UPLOAD_DIR);
61
+ $uploadRoot = $this->_getUploadRoot(self::UPLOAD_ROOT_TOKEN);
62
+ $uploadDir = $uploadRoot . DS . $uploadDir;
63
+ return $uploadDir;
64
+ }
65
+
66
+ /**
67
+ * Makes a decision about whether to add info about the scope
68
+ *
69
+ * @return boolean
70
+ */
71
+ protected function _addWhetherScopeInfo()
72
+ {
73
+ return true;
74
+ }
75
+
76
+ /**
77
+ * Save uploaded file before saving config value
78
+ *
79
+ * Save changes and delete file if "delete" option passed
80
+ *
81
+ * @return Mage_Adminhtml_Model_System_Config_Backend_Email_Logo
82
+ */
83
+ protected function _beforeSave()
84
+ {
85
+ $value = $this->getValue();
86
+ $deleteFlag = (is_array($value) && !empty($value['delete']));
87
+ $fileTmpName = $_FILES['groups']['tmp_name'][$this->getGroupId()]['fields'][$this->getField()]['value'];
88
+
89
+ if ($this->getOldValue() && ($fileTmpName || $deleteFlag)) {
90
+ $io = new Varien_Io_File();
91
+ $io->rm($this->_getUploadRoot(self::UPLOAD_ROOT_TOKEN) . DS . self::UPLOAD_DIR . DS . $this->getOldValue());
92
+ }
93
+ return parent::_beforeSave();
94
+ }
95
+ }
app/code/local/Igex/StoreLocator/Model/System/Config/Backend/Marker.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-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 Mage
22
+ * @package Mage_Adminhtml
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Backend model for uploading transactional emails custom logo image
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Adminhtml
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Igex_StoreLocator_Model_System_Config_Backend_Marker extends Mage_Adminhtml_Model_System_Config_Backend_Image
35
+ {
36
+ /**
37
+ * The tail part of directory path for uploading
38
+ */
39
+ const UPLOAD_DIR = 'storelocator/markers';
40
+
41
+ /**
42
+ * Token for the root part of directory path for uploading
43
+ */
44
+ const UPLOAD_ROOT_TOKEN = 'system/filesystem/media';
45
+
46
+ /**
47
+ * Upload max file size in kilobytes
48
+ *
49
+ * @var int
50
+ */
51
+ protected $_maxFileSize = 2048;
52
+
53
+ /**
54
+ * Return path to directory for upload file
55
+ *
56
+ * @return string
57
+ */
58
+ protected function _getUploadDir()
59
+ {
60
+ $uploadDir = $this->_appendScopeInfo(self::UPLOAD_DIR);
61
+ $uploadRoot = $this->_getUploadRoot(self::UPLOAD_ROOT_TOKEN);
62
+ $uploadDir = $uploadRoot . DS . $uploadDir;
63
+ return $uploadDir;
64
+ }
65
+
66
+ /**
67
+ * Makes a decision about whether to add info about the scope
68
+ *
69
+ * @return boolean
70
+ */
71
+ protected function _addWhetherScopeInfo()
72
+ {
73
+ return true;
74
+ }
75
+
76
+ /**
77
+ * Save uploaded file before saving config value
78
+ *
79
+ * Save changes and delete file if "delete" option passed
80
+ *
81
+ * @return Mage_Adminhtml_Model_System_Config_Backend_Email_Logo
82
+ */
83
+ protected function _beforeSave()
84
+ {
85
+ $value = $this->getValue();
86
+ $deleteFlag = (is_array($value) && !empty($value['delete']));
87
+ $fileTmpName = $_FILES['groups']['tmp_name'][$this->getGroupId()]['fields'][$this->getField()]['value'];
88
+
89
+ if ($this->getOldValue() && ($fileTmpName || $deleteFlag)) {
90
+ $io = new Varien_Io_File();
91
+ $io->rm($this->_getUploadRoot(self::UPLOAD_ROOT_TOKEN) . DS . self::UPLOAD_DIR . DS . $this->getOldValue());
92
+ }
93
+ return parent::_beforeSave();
94
+ }
95
+ }
app/code/local/Igex/StoreLocator/controllers/Adminhtml/ImportController.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Igex_StoreLocator_Adminhtml_ImportController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ public function indexAction()
6
+ {
7
+ $this->loadLayout()->renderLayout();
8
+ }
9
+
10
+ public function saveAction()
11
+ {
12
+ if ($data = $this->getRequest()->getPost()) {
13
+ if(isset($_FILES['csv_file']['name']) && $_FILES['csv_file']['name'] != '') {
14
+ try {
15
+ $uploader = new Varien_File_Uploader('csv_file');
16
+ $uploader->setAllowedExtensions(array('csv'));
17
+ $uploader->setAllowRenameFiles(false);
18
+ $uploader->setFilesDispersion(false);
19
+ $path = Mage::getBaseDir('media').DS.'dealers'. DS ;
20
+ $uploader->save($path, $_FILES['csv_file']['name'] );
21
+ $filepath = $path.$_FILES['csv_file']['name'];
22
+ $handler = new Varien_File_Csv();
23
+ $importData = $handler->getData($filepath);
24
+ $keys = $importData[0];
25
+ foreach($keys as $key=>$value)
26
+ {
27
+ $keys[$key] = str_replace(' ', '_', strtolower($value));
28
+ }
29
+ $count = count($importData);
30
+ $model = Mage::getModel('igex_storelocator/store');
31
+ while(--$count>0) {
32
+ $currentData = $importData[$count];
33
+ $data = array_combine($keys, $currentData);
34
+ array_shift($data);
35
+ if((!$data['long'] || !$data['lat']) && ($data['address'] || $data['zipcode'])) {
36
+ if($data['address']) {
37
+ $address = urlencode($data['address']);
38
+ } else {
39
+ $address = urlencode($data['zipcode']);
40
+ }
41
+ $json = Mage::helper('igex_storelocator')->getJsonData($address);
42
+ $data['lat'] = strval($json->{'results'}[0]->{'geometry'}->{'location'}->{'lat'});
43
+ $data['long'] = strval($json->{'results'}[0]->{'geometry'}->{'location'}->{'lng'});
44
+ }
45
+ // set default store & status
46
+ $data['stores'] = 0;
47
+ $data['status'] = 1;
48
+ $model->setData($data)->save();
49
+ }
50
+
51
+ } catch (Exception $e) {
52
+ //do nothing here
53
+ }
54
+ }
55
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('igex_storelocator')->__('Data imported Successfully.'));
56
+ $this->_redirect('*/adminhtml_store/index');
57
+ }
58
+ }
59
+ }
app/code/local/Igex/StoreLocator/controllers/Adminhtml/StoreController.php ADDED
@@ -0,0 +1,498 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Igex_StoreLocator_Adminhtml_StoreController extends Mage_Adminhtml_Controller_Action
4
+
5
+ {
6
+
7
+ public function indexAction()
8
+
9
+ {
10
+
11
+ $this->_initAction()->renderLayout();
12
+
13
+ }
14
+
15
+
16
+
17
+ public function newAction()
18
+
19
+ {
20
+
21
+ $this->_forward('edit');
22
+
23
+ }
24
+
25
+
26
+
27
+ public function editAction()
28
+
29
+ {
30
+
31
+ $this->_initAction();
32
+
33
+ $id = $this->getRequest()->getParam('entity_id');
34
+
35
+ $model = Mage::getModel('igex_storelocator/store');
36
+
37
+
38
+
39
+ if ($id) {
40
+
41
+ $model->load($id);
42
+
43
+ if (!$model->getId()) {
44
+
45
+ Mage::getSingleton('adminhtml/session')->addError($this->__('This store no longer exists.'));
46
+
47
+ $this->_redirect('*/*/');
48
+
49
+ return;
50
+
51
+ }
52
+
53
+ }
54
+
55
+
56
+
57
+ $this->_title($model->getId() ? $model->getName() : $this->__('New Store'));
58
+
59
+ $data = Mage::getSingleton('adminhtml/session')->getStoreData(true);
60
+
61
+ if (!empty($data)) {
62
+
63
+ $model->setData($data);
64
+
65
+ }
66
+
67
+ Mage::register('igex_storelocator', $model);
68
+
69
+ $this->_initAction()
70
+
71
+ ->_addBreadcrumb($id ? Mage::helper('igex_storelocator')->__('Edit Store') : Mage::helper('igex_storelocator')->__('New Store'), $id ? Mage::helper('igex_storelocator')->__('Edit Store') : Mage::helper('igex_storelocator')->__('New Store'))
72
+
73
+ ->renderLayout();
74
+
75
+
76
+
77
+
78
+
79
+ }
80
+
81
+
82
+
83
+ public function saveAction()
84
+
85
+ {
86
+
87
+ if ($postData = $this->getRequest()->getPost()) {
88
+
89
+ if(isset($_FILES['image']['name']) and (file_exists($_FILES['image']['tmp_name']))) {
90
+
91
+ try {
92
+
93
+ $uploader = new Varien_File_Uploader('image');
94
+
95
+ $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
96
+
97
+ $uploader->setAllowRenameFiles(false);
98
+
99
+ $uploader->setFilesDispersion(false);
100
+
101
+ $locImg = 'storelocator/images/';
102
+
103
+ $path = Mage::getBaseDir('media') . DS . $locImg ;
104
+
105
+ $uploader->save($path, $_FILES['image']['name']);
106
+
107
+ $postData['image'] = $_FILES['image']['name'];
108
+
109
+ }catch(Exception $e) {
110
+
111
+
112
+
113
+ }
114
+
115
+ }else{
116
+
117
+ if(isset($postData['image']['delete']) && $postData['image']['delete'] == 1){
118
+
119
+ $postData['image'] = '';
120
+
121
+ }else{
122
+
123
+ unset($postData['image']);
124
+
125
+ }
126
+
127
+ }
128
+
129
+
130
+
131
+ if(isset($_FILES['marker']['name']) and (file_exists($_FILES['marker']['tmp_name']))) {
132
+
133
+ try {
134
+
135
+ $uploader = new Varien_File_Uploader('marker');
136
+
137
+ $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
138
+
139
+ $uploader->setAllowRenameFiles(false);
140
+
141
+ $uploader->setFilesDispersion(false);
142
+
143
+ $locMarker = 'storelocator/markers/';
144
+
145
+ $path = Mage::getBaseDir('media') . DS . $locMarker ;
146
+
147
+ $uploader->save($path, $_FILES['marker']['name']);
148
+
149
+ $postData['marker'] = $_FILES['marker']['name'];
150
+
151
+ }catch(Exception $e) {
152
+
153
+
154
+
155
+ }
156
+
157
+ }else{
158
+
159
+ if(isset($postData['marker']['delete']) && $postData['marker']['delete'] == 1){
160
+
161
+ $postData['marker'] = '';
162
+
163
+ }else{
164
+
165
+ unset($postData['marker']);
166
+
167
+ }
168
+
169
+ }
170
+
171
+
172
+
173
+ $model = Mage::getSingleton('igex_storelocator/store');
174
+
175
+
176
+
177
+
178
+
179
+ if ($id = $this->getRequest()->getParam('entity_id')) {
180
+
181
+ $model->load($id);
182
+
183
+ }
184
+
185
+
186
+
187
+ $model->setData($postData);
188
+
189
+
190
+
191
+ try {
192
+
193
+ if(is_null($model->getCreatedTime()) || $model->getCreatedTime() == ''){
194
+
195
+ $model->setCreatedTime(time());
196
+
197
+ }
198
+
199
+ $model->setUpdateTime(time());
200
+
201
+ //die(var_dump(substr_compare($model->getStoreUrl(), "http://", 0, 7)));
202
+
203
+ if(substr_compare($model->getStoreUrl(), "http://", 0, 7) > 0 && substr_compare($model->getStoreUrl(), "https://", 0, 8) > 0){
204
+
205
+ $model->setStoreUrl("http://".$model->getStoreUrl());
206
+
207
+ }
208
+
209
+
210
+
211
+ if(!is_null($model->getImage()) && $model->getImage() != ''){
212
+
213
+ $filename = str_replace(" ", "_", $model->getImage());
214
+
215
+ $filename = str_replace(":", "_", $filename);
216
+
217
+ $model->setImage($locImg.$filename);
218
+
219
+ }
220
+
221
+
222
+
223
+ if(!is_null($model->getMarker()) && $model->getMarker() != ''){
224
+
225
+ $filename = str_replace(" ", "_", $model->getMarker());
226
+
227
+ $filename = str_replace(":", "_", $filename);
228
+
229
+ $model->setMarker($locMarker.$filename);
230
+
231
+ }
232
+
233
+
234
+
235
+ $model->save();
236
+
237
+
238
+
239
+ Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The store has been saved.'));
240
+
241
+ if ($this->getRequest()->getParam('back')) {
242
+
243
+ $this->_redirect('*/*/edit', array('entity_id' => $model->getId()));
244
+
245
+ return;
246
+
247
+ }
248
+
249
+ $this->_redirect('*/*/');
250
+
251
+ return;
252
+
253
+ }
254
+
255
+ catch (Mage_Core_Exception $e) {
256
+
257
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
258
+
259
+ }
260
+
261
+ catch (Exception $e) {
262
+
263
+ Mage::getSingleton('adminhtml/session')->addError($this->__('An error occurred while saving this store.'));
264
+
265
+ }
266
+
267
+
268
+
269
+ Mage::getSingleton('adminhtml/session')->setStoreData($postData);
270
+
271
+ $this->_redirectReferer();
272
+
273
+ }
274
+
275
+ }
276
+
277
+
278
+
279
+ public function deleteAction() {
280
+
281
+ if( $this->getRequest()->getParam('entity_id') > 0 ) {
282
+
283
+ try {
284
+
285
+ $model = Mage::getModel('igex_storelocator/store');
286
+
287
+
288
+
289
+ $model->setId($this->getRequest()->getParam('entity_id'))
290
+
291
+ ->delete();
292
+
293
+
294
+
295
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('igex_storelocator')->__('Store was successfully deleted'));
296
+
297
+ $this->_redirect('*/*/');
298
+
299
+ } catch (Exception $e) {
300
+
301
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
302
+
303
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
304
+
305
+ }
306
+
307
+ }
308
+
309
+ $this->_redirect('*/*/');
310
+
311
+ }
312
+
313
+
314
+
315
+ public function massDeleteAction() {
316
+
317
+ $storelocatorIds = $this->getRequest()->getParam('igex_storelocator');
318
+
319
+ if(!is_array($storelocatorIds)) {
320
+
321
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('igex_storelocator')->__('Please select store(s)'));
322
+
323
+ } else {
324
+
325
+ try {
326
+
327
+ foreach ($storelocatorIds as $storelocatorId) {
328
+
329
+ $storelocator = Mage::getModel('igex_storelocator/store')->load($storelocatorId);
330
+
331
+ $storelocator->delete();
332
+
333
+ }
334
+
335
+ Mage::getSingleton('adminhtml/session')->addSuccess(
336
+
337
+ Mage::helper('igex_storelocator')->__(
338
+
339
+ 'Total of %d record(s) were successfully deleted', count($storelocatorIds)
340
+
341
+ )
342
+
343
+ );
344
+
345
+ } catch (Exception $e) {
346
+
347
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
348
+
349
+ }
350
+
351
+ }
352
+
353
+ $this->_redirect('*/*/index');
354
+
355
+ }
356
+
357
+
358
+
359
+ public function massStatusAction()
360
+
361
+ {
362
+
363
+ $storelocatorIds = $this->getRequest()->getParam('igex_storelocator');
364
+
365
+ if(!is_array($storelocatorIds)) {
366
+
367
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select store(s)'));
368
+
369
+ } else {
370
+
371
+ try {
372
+
373
+ foreach ($storelocatorIds as $storelocatorId) {
374
+
375
+ $storelocator = Mage::getSingleton('igex_storelocator/store')
376
+
377
+ ->load($storelocatorId)
378
+
379
+ ->setStatus($this->getRequest()->getParam('status'))
380
+
381
+ ->setUpdateTime(time())
382
+
383
+ ->setIsMassupdate(true)
384
+
385
+ ->save();
386
+
387
+ }
388
+
389
+ $this->_getSession()->addSuccess(
390
+
391
+ $this->__('Total of %d record(s) were successfully updated', count($storelocatorIds))
392
+
393
+ );
394
+
395
+ } catch (Exception $e) {
396
+
397
+ $this->_getSession()->addError($e->getMessage());
398
+
399
+ }
400
+
401
+ }
402
+
403
+ $this->_redirect('*/*/index');
404
+
405
+ }
406
+
407
+
408
+
409
+ public function messageAction()
410
+
411
+ {
412
+
413
+ $data = Mage::getModel('igex_storelocator/store')->load($this->getRequest()->getParam('entity_id'));
414
+
415
+ echo $data->getContent();
416
+
417
+ }
418
+
419
+
420
+
421
+ /**
422
+
423
+ * Initialize action
424
+
425
+ *
426
+
427
+ * Here, we set the breadcrumbs and the active menu
428
+
429
+ *
430
+
431
+ * @return Mage_Adminhtml_Controller_Action
432
+
433
+ */
434
+
435
+ protected function _initAction()
436
+
437
+ {
438
+
439
+
440
+
441
+ $this->loadLayout()
442
+
443
+ // Make the active menu match the menu config nodes (without 'children' inbetween)
444
+
445
+ ->_setActiveMenu('igex/igex_storelocator')
446
+
447
+ ->_title($this->__('igex'))->_title($this->__('Store'))
448
+
449
+ ->_addBreadcrumb($this->__('igex'), $this->__('igex'))
450
+
451
+ ->_addBreadcrumb($this->__('Store'), $this->__('Store'));
452
+
453
+ return $this;
454
+
455
+ }
456
+
457
+
458
+
459
+ /**
460
+
461
+ * Check currently called action by permissions for current user
462
+
463
+ *
464
+
465
+ * @return bool
466
+
467
+ */
468
+
469
+ protected function _isAllowed()
470
+
471
+ {
472
+
473
+ return Mage::getSingleton('admin/session')->isAllowed('igex/igex_storelocator');
474
+
475
+ }
476
+
477
+
478
+
479
+ /**
480
+
481
+ * Export order grid to CSV format
482
+
483
+ */
484
+
485
+ public function exportCsvAction()
486
+
487
+ {
488
+
489
+ $fileName = 'stores.csv';
490
+
491
+ $grid = $this->getLayout()->createBlock('igex_storelocator/adminhtml_store_grid');
492
+
493
+ $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
494
+
495
+ }
496
+
497
+
498
+ }
app/code/local/Igex/StoreLocator/controllers/IndexController.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Igex_StoreLocator_IndexController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+ $this->loadLayout();
7
+ $this->getLayout()->getBlock('head')->setTitle('Store Finder');
8
+ $this->renderLayout();
9
+ }
10
+
11
+ public function searchAction()
12
+ {
13
+ $this->loadLayout();
14
+ $this->getLayout()->getBlock('head')->setTitle('Store Finder');
15
+ $this->renderLayout();
16
+ }
17
+
18
+ public function detailAction()
19
+ {
20
+ //echo 'call';exit;
21
+ $getData = $this->getRequest()->getParam('id');
22
+ if($getData=='' || empty($getData)){ $this->_redirect('*/'); }
23
+ $store = Mage::getModel('igex_storelocator/store')->load($getData);
24
+ $this->loadLayout();
25
+
26
+ $this->getLayout()->getBlock("head")->setTitle($store->getName());
27
+ $breadcrumbs = $this->getLayout()->getBlock("breadcrumbs");
28
+
29
+ $breadcrumbs->addCrumb($store->getName(), array(
30
+ "label" => $this->__($store->getName()),
31
+ "title" => $this->__($store->getName())
32
+ ));
33
+ $this->renderLayout();
34
+ }
35
+ }
app/code/local/Igex/StoreLocator/etc/adminhtml.xml ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <config>
3
+ <menu>
4
+ <igex translate="title" module="igex_storelocator">
5
+ <title>Igex Extensions</title>
6
+ <sort_order>90</sort_order>
7
+ <depends>
8
+ <module>Igex_All</module>
9
+ </depends>
10
+ <children>
11
+ <item1 module="igex_storelocator">
12
+ <title>Store Locator</title>
13
+ <sort_order>0</sort_order>
14
+ <action>igex_storelocator/adminhtml_store</action>
15
+ </item1>
16
+ <item2 module="igex_storelocator">
17
+ <title>Import Stores</title>
18
+ <sort_order>2</sort_order>
19
+ <action>igex_storelocator/adminhtml_import/index</action>
20
+ </item2>
21
+ <settings module="igex_storelocator" translate="title">
22
+ <title>Settings</title>
23
+ <sort_order>1000</sort_order>
24
+ <action>adminhtml/system_config/edit/section/igex</action>
25
+ </settings>
26
+ </children>
27
+ </igex>
28
+ </menu>
29
+ <acl>
30
+ <resources>
31
+ <all>
32
+ <title>Allow Everything</title>
33
+ </all>
34
+ <admin>
35
+ <children>
36
+ <system>
37
+ <children>
38
+ <config>
39
+ <children>
40
+ <igex>
41
+ <title>Store Permission Setting</title>
42
+ </igex>
43
+ </children>
44
+ </config>
45
+ </children>
46
+ </system>
47
+
48
+ </children>
49
+ </admin>
50
+ </resources>
51
+ </acl>
52
+ </config>
app/code/local/Igex/StoreLocator/etc/config.xml ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Igex_StoreLocator>
5
+ <version>1.1.2</version>
6
+ <platform>ce</platform>
7
+ </Igex_StoreLocator>
8
+ </modules>
9
+ <global>
10
+ <blocks>
11
+ <igex_storelocator>
12
+ <class>Igex_StoreLocator_Block</class>
13
+ </igex_storelocator>
14
+ </blocks>
15
+ <helpers>
16
+ <igex_storelocator>
17
+ <class>Igex_StoreLocator_Helper</class>
18
+ </igex_storelocator>
19
+ </helpers>
20
+ <models>
21
+ <igex_storelocator>
22
+ <class>Igex_StoreLocator_Model</class>
23
+ <resourceModel>igex_storelocator_resource</resourceModel>
24
+ </igex_storelocator>
25
+
26
+ <igex_storelocator_resource>
27
+ <class>Igex_StoreLocator_Model_Resource</class>
28
+ <entities>
29
+ <store>
30
+ <table>igex_storelocator</table>
31
+ </store>
32
+ <stores>
33
+ <table>igex_storelocator_stores</table>
34
+ </stores>
35
+ </entities>
36
+ </igex_storelocator_resource>
37
+ </models>
38
+ <resources>
39
+ <igex_storelocator_setup>
40
+ <setup>
41
+ <module>Igex_StoreLocator</module>
42
+ <!-- <class>Mage_Customer_Model_Entity_Setup</class>-->
43
+ </setup>
44
+ <connection>
45
+ <use>core_setup</use>
46
+ </connection>
47
+ </igex_storelocator_setup>
48
+ <igex_storelocator_write>
49
+ <connection>
50
+ <use>core_write</use>
51
+ </connection>
52
+ </igex_storelocator_write>
53
+ <igex_storelocator_read>
54
+ <connection>
55
+ <use>core_read</use>
56
+ </connection>
57
+ </igex_storelocator_read>
58
+ </resources>
59
+ </global>
60
+ <frontend>
61
+ <translate>
62
+ <modules>
63
+ <igex_storelocator>
64
+ <files>
65
+ <default>Igex/Igex_StoreLocator.csv</default>
66
+ </files>
67
+ </igex_storelocator>
68
+ </modules>
69
+ </translate>
70
+ <routers>
71
+ <igex_storelocator>
72
+ <use>standard</use>
73
+ <args>
74
+ <module>Igex_StoreLocator</module>
75
+ <frontName>storelocator</frontName>
76
+ </args>
77
+ </igex_storelocator>
78
+ </routers>
79
+ <layout>
80
+ <updates>
81
+ <storelocator>
82
+ <file>igex/storelocator.xml</file>
83
+ </storelocator>
84
+ </updates>
85
+ </layout>
86
+ </frontend>
87
+ <admin>
88
+ <routers>
89
+ <igex_storelocator>
90
+ <use>admin</use>
91
+ <args>
92
+ <module>Igex_StoreLocator</module>
93
+ <frontName>igex_storelocator</frontName>
94
+ </args>
95
+ </igex_storelocator>
96
+ </routers>
97
+ </admin>
98
+ <adminhtml>
99
+ <translate>
100
+ <modules>
101
+ <Igex_StoreLocator>
102
+ <files>
103
+ <default>Igex/Igex_StoreLocator.csv</default>
104
+ </files>
105
+ </Igex_StoreLocator>
106
+ </modules>
107
+ </translate>
108
+ <layout>
109
+ <updates>
110
+ <storelocator>
111
+ <file>igex/storelocator.xml</file>
112
+ </storelocator>
113
+ </updates>
114
+ </layout>
115
+ </adminhtml>
116
+ <default>
117
+ <igex>
118
+ <storelocator_options>
119
+ <apiurl>http://maps.googleapis.com/maps/api/geocode/json</apiurl>
120
+ </storelocator_options>
121
+ <search_options>
122
+ <search_radius>25,50,100</search_radius>
123
+ <default_search_radius>25</default_search_radius>
124
+ <distance_units>0</distance_units>
125
+ </search_options>
126
+ <display_options>
127
+ <show_top_link>1</show_top_link>
128
+ <page_type>0</page_type>
129
+ <show_email_and_website>1</show_email_and_website>
130
+ <show_phone>1</show_phone>
131
+ </display_options>
132
+ </igex>
133
+ </default>
134
+ </config>
app/code/local/Igex/StoreLocator/etc/system.xml ADDED
@@ -0,0 +1,241 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <igex translate="label" module="igex_storelocator">
5
+ <label>Store Locator</label>
6
+ <tab>igex</tab>
7
+ <frontend_type>text</frontend_type>
8
+ <sort_order>100</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>1</show_in_store>
12
+ <groups>
13
+ <storelocator_options translate="label">
14
+ <label>General Options</label>
15
+ <frontend_type>text</frontend_type>
16
+ <sort_order>10</sort_order>
17
+ <show_in_default>1</show_in_default>
18
+ <show_in_website>1</show_in_website>
19
+ <show_in_store>1</show_in_store>
20
+ <fields>
21
+ <serial translate="label">
22
+ <label>Serial</label>
23
+ <frontend_type>text</frontend_type>
24
+ <sort_order>1</sort_order>
25
+ <show_in_default>1</show_in_default>
26
+ <show_in_website>1</show_in_website>
27
+ <show_in_store>1</show_in_store>
28
+ </serial>
29
+ <apiurl translate="label">
30
+ <label>API Url</label>
31
+ <frontend_type>text</frontend_type>
32
+ <sort_order>10</sort_order>
33
+ <show_in_default>1</show_in_default>
34
+ <show_in_website>1</show_in_website>
35
+ <show_in_store>1</show_in_store>
36
+ <comment>Enter here the Google API Url. Use the default value : http://maps.googleapis.com/maps/api/js?v=3</comment>
37
+ </apiurl>
38
+ <apikey translate="label">
39
+ <label>API Key</label>
40
+ <frontend_type>text</frontend_type>
41
+ <sort_order>11</sort_order>
42
+ <show_in_default>1</show_in_default>
43
+ <show_in_website>1</show_in_website>
44
+ <show_in_store>1</show_in_store>
45
+ <comment>Enter here the Google API key</comment>
46
+ </apikey>
47
+ <apisensor translate="label">
48
+ <label>Api Sensor</label>
49
+ <frontend_type>select</frontend_type>
50
+ <source_model>adminhtml/system_config_source_yesno</source_model>
51
+ <sort_order>12</sort_order>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>1</show_in_website>
54
+ <show_in_store>1</show_in_store>
55
+ <comment>You can enable the sensor to use the geolocation</comment>
56
+ </apisensor>
57
+ <direction translate="label">
58
+ <label>Enable Direction</label>
59
+ <frontend_type>select</frontend_type>
60
+ <source_model>adminhtml/system_config_source_yesno</source_model>
61
+ <sort_order>13</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <show_in_store>1</show_in_store>
65
+ <comment>You can enable the direction</comment>
66
+ </direction>
67
+ <defaultimage translate="label comment">
68
+ <label>Default Store Image</label>
69
+ <comment>Allowed file types: PNG, JPG, JPEG.</comment>
70
+ <frontend_type>image</frontend_type>
71
+ <backend_model>igex_storelocator/system_config_backend_image</backend_model>
72
+ <base_url type="media" scope_info="1">storelocator/images</base_url>
73
+ <sort_order>14</sort_order>
74
+ <show_in_default>1</show_in_default>
75
+ <show_in_website>1</show_in_website>
76
+ <show_in_store>1</show_in_store>
77
+ </defaultimage>
78
+ <mapicon translate="label comment">
79
+ <label>Marker Icon</label>
80
+ <comment>Allowed file types: PNG, JPG, JPEG.</comment>
81
+ <frontend_type>image</frontend_type>
82
+ <backend_model>igex_storelocator/system_config_backend_marker</backend_model>
83
+ <base_url type="media" scope_info="1">storelocator/markers</base_url>
84
+ <sort_order>15</sort_order>
85
+ <show_in_default>1</show_in_default>
86
+ <show_in_website>1</show_in_website>
87
+ <show_in_store>1</show_in_store>
88
+ </mapicon>
89
+ <page_type translate="label">
90
+ <label>Page Type</label>
91
+ <frontend_type>select</frontend_type>
92
+ <source_model>igex_storelocator/pagedisplay</source_model>
93
+ <sort_order>25</sort_order>
94
+ <show_in_default>1</show_in_default>
95
+ <show_in_website>1</show_in_website>
96
+ <show_in_store>1</show_in_store>
97
+ </page_type>
98
+ </fields>
99
+ </storelocator_options>
100
+
101
+ <search_options translate="label">
102
+ <label>Search Options</label>
103
+ <frontend_type>text</frontend_type>
104
+ <sort_order>20</sort_order>
105
+ <show_in_default>1</show_in_default>
106
+ <show_in_website>1</show_in_website>
107
+ <show_in_store>1</show_in_store>
108
+ <fields>
109
+ <search_by_address translate="label">
110
+ <label>Enable Address Search</label>
111
+ <frontend_type>select</frontend_type>
112
+ <source_model>adminhtml/system_config_source_yesno</source_model>
113
+ <sort_order>20</sort_order>
114
+ <show_in_default>1</show_in_default>
115
+ <show_in_website>1</show_in_website>
116
+ <show_in_store>1</show_in_store>
117
+ </search_by_address>
118
+ <search_by_state translate="label">
119
+ <label>Enable State Search</label>
120
+ <frontend_type>select</frontend_type>
121
+ <source_model>adminhtml/system_config_source_yesno</source_model>
122
+ <sort_order>25</sort_order>
123
+ <show_in_default>1</show_in_default>
124
+ <show_in_website>1</show_in_website>
125
+ <show_in_store>1</show_in_store>
126
+ </search_by_state>
127
+ <search_by_zipcode translate="label">
128
+ <label>Enable Zipcode Search</label>
129
+ <frontend_type>select</frontend_type>
130
+ <source_model>adminhtml/system_config_source_yesno</source_model>
131
+ <sort_order>30</sort_order>
132
+ <show_in_default>1</show_in_default>
133
+ <show_in_website>1</show_in_website>
134
+ <show_in_store>1</show_in_store>
135
+ </search_by_zipcode>
136
+ <search_by_radius translate="label">
137
+ <label>Enable Radius Search</label>
138
+ <frontend_type>select</frontend_type>
139
+ <source_model>adminhtml/system_config_source_yesno</source_model>
140
+ <sort_order>30</sort_order>
141
+ <show_in_default>1</show_in_default>
142
+ <show_in_website>1</show_in_website>
143
+ <show_in_store>1</show_in_store>
144
+ </search_by_radius>
145
+ <search_radius translate="label comment">
146
+ <label>Search Radius</label>
147
+ <comment><![CDATA[Separated by comma.]]></comment>
148
+ <frontend_type>text</frontend_type>
149
+ <sort_order>60</sort_order>
150
+ <show_in_default>1</show_in_default>
151
+ <show_in_website>1</show_in_website>
152
+ <show_in_store>1</show_in_store>
153
+ </search_radius>
154
+ <default_search_radius translate="label comment">
155
+ <label>Default Search Radius</label>
156
+ <frontend_type>text</frontend_type>
157
+ <sort_order>70</sort_order>
158
+ <show_in_default>1</show_in_default>
159
+ <show_in_website>1</show_in_website>
160
+ <show_in_store>1</show_in_store>
161
+ </default_search_radius>
162
+ <distance_units translate="label">
163
+ <label>Distance Unit</label>
164
+ <frontend_type>select</frontend_type>
165
+ <source_model>igex_storelocator/distanceunits</source_model>
166
+ <sort_order>80</sort_order>
167
+ <show_in_default>1</show_in_default>
168
+ <show_in_website>1</show_in_website>
169
+ <show_in_store>1</show_in_store>
170
+ </distance_units>
171
+ <state_search translate="label comment">
172
+ <label>Enable State Top Search Links</label>
173
+ <frontend_type>select</frontend_type>
174
+ <source_model>adminhtml/system_config_source_yesno</source_model>
175
+ <sort_order>40</sort_order>
176
+ <show_in_default>1</show_in_default>
177
+ <show_in_website>1</show_in_website>
178
+ <show_in_store>1</show_in_store>
179
+ </state_search>
180
+ </fields>
181
+ </search_options>
182
+
183
+ <display_options translate="label">
184
+ <label>FrontEnd Options</label>
185
+ <frontend_type>text</frontend_type>
186
+ <sort_order>30</sort_order>
187
+ <show_in_default>1</show_in_default>
188
+ <show_in_website>1</show_in_website>
189
+ <show_in_store>1</show_in_store>
190
+ <fields>
191
+ <show_image translate="label">
192
+ <label>Show Image on Front</label>
193
+ <frontend_type>select</frontend_type>
194
+ <source_model>adminhtml/system_config_source_yesno</source_model>
195
+ <sort_order>17</sort_order>
196
+ <show_in_default>1</show_in_default>
197
+ <show_in_website>1</show_in_website>
198
+ <show_in_store>1</show_in_store>
199
+ </show_image>
200
+ <show_top_link translate="label">
201
+ <label>Show Top Link</label>
202
+ <frontend_type>select</frontend_type>
203
+ <source_model>adminhtml/system_config_source_yesno</source_model>
204
+ <sort_order>100</sort_order>
205
+ <show_in_default>1</show_in_default>
206
+ <show_in_website>1</show_in_website>
207
+ <show_in_store>1</show_in_store>
208
+ </show_top_link>
209
+ <show_email_and_website translate="label">
210
+ <label>Show Email And Website</label>
211
+ <frontend_type>select</frontend_type>
212
+ <source_model>adminhtml/system_config_source_yesno</source_model>
213
+ <sort_order>110</sort_order>
214
+ <show_in_default>1</show_in_default>
215
+ <show_in_website>1</show_in_website>
216
+ <show_in_store>1</show_in_store>
217
+ </show_email_and_website>
218
+ <show_phone translate="label">
219
+ <label>Show Phone No.</label>
220
+ <frontend_type>select</frontend_type>
221
+ <source_model>adminhtml/system_config_source_yesno</source_model>
222
+ <sort_order>130</sort_order>
223
+ <show_in_default>1</show_in_default>
224
+ <show_in_website>1</show_in_website>
225
+ <show_in_store>1</show_in_store>
226
+ </show_phone>
227
+ </fields>
228
+ </display_options>
229
+ </groups>
230
+ </igex>
231
+ <!-- <storelocator1 translate="label" module="igex_storelocator">
232
+ <label>Info</label>
233
+ <tab>igex</tab>
234
+ <frontend_type>text</frontend_type>
235
+ <sort_order>101</sort_order>
236
+ <show_in_default>1</show_in_default>
237
+ <show_in_website>1</show_in_website>
238
+ <show_in_store>1</show_in_store>
239
+ </storelocator1> -->
240
+ </sections>
241
+ </config>
app/code/local/Igex/StoreLocator/sql/igex_storelocator_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+
4
+ $installer->startSetup();
5
+
6
+ /**
7
+ * Create table 'igex_storelocator/store'
8
+ */
9
+ $table = $installer->getConnection()
10
+ ->newTable($installer->getTable('igex_storelocator/store'))
11
+ ->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null,
12
+ array(
13
+ 'identity' => true,
14
+ 'nullable' => false,
15
+ 'primary' => true
16
+ ), 'StoreLocator ID')
17
+ ->addColumn('name', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
18
+ array(
19
+ 'nullable' => false
20
+ ), 'Block Title')
21
+ ->addColumn('address', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
22
+ array(
23
+ 'nullable' => false
24
+ ), 'StoreLocator Address')
25
+ ->addColumn('zipcode', Varien_Db_Ddl_Table::TYPE_VARCHAR, 10,
26
+ array(
27
+ 'nullable' => false
28
+ ), 'StoreLocator ZipCode')
29
+ ->addColumn('city', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
30
+ array(
31
+ 'nullable' => false
32
+ ), 'StoreLocator City')
33
+ ->addColumn('country_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
34
+ array(
35
+ 'nullable' => true
36
+ ), 'StoreLocator Country')
37
+ ->addColumn('phone', Varien_Db_Ddl_Table::TYPE_VARCHAR, 30,
38
+ array(
39
+ 'nullable' => true
40
+ ), 'StoreLocator Phone')
41
+ ->addColumn('fax', Varien_Db_Ddl_Table::TYPE_VARCHAR, 30,
42
+ array(
43
+ 'nullable' => true
44
+ ), 'StoreLocator Fax')
45
+ ->addColumn('description', Varien_Db_Ddl_Table::TYPE_TEXT, 255,
46
+ array(
47
+ 'nullable' => true
48
+ ), 'StoreLocator Description')
49
+ ->addColumn('store_url', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
50
+ array(
51
+ 'nullable' => true
52
+ ), 'StoreLocator Store Website')
53
+ ->addColumn('status', Varien_Db_Ddl_Table::TYPE_SMALLINT, 6,
54
+ array(
55
+ 'nullable' => false
56
+ ), 'StoreLocator Status')
57
+ ->addColumn('image', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
58
+ array(
59
+ 'nullable' => true
60
+ ), 'StoreLocator Image Link')
61
+ ->addColumn('marker', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
62
+ array(
63
+ 'nullable' => true
64
+ ), 'StoreLocator Marker Link')
65
+ ->addColumn('lat', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
66
+ array(
67
+ 'nullable' => true
68
+ ), 'StoreLocator Latitude Value')
69
+ ->addColumn('long', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
70
+ array(
71
+ 'nullable' => true
72
+ ), 'StoreLocator Longitude Value')
73
+ ->addColumn('created_time', Varien_Db_Ddl_Table::TYPE_DATETIME, null,
74
+ array(), 'StoreLocator Creation Time')
75
+ ->addColumn('update_time', Varien_Db_Ddl_Table::TYPE_DATETIME, null,
76
+ array(), 'StoreLocator Modification Time')
77
+ ->setComment('Igex StoreLocator Table');
78
+ $installer->getConnection()->createTable($table);
79
+
80
+ /**
81
+ * Create table 'igex_storelocator/stores'
82
+ */
83
+ $table = $installer->getConnection()
84
+ ->newTable($installer->getTable('igex_storelocator/stores'))
85
+ ->addColumn('storelocator_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null,
86
+ array(
87
+ 'nullable' => false,
88
+ 'primary' => true
89
+ ), 'StoreLocator ID')
90
+ ->addColumn('store_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null,
91
+ array(
92
+ 'unsigned' => true,
93
+ 'nullable' => false,
94
+ 'primary' => true
95
+ ), 'Store ID')
96
+ ->addForeignKey(
97
+ $installer->getFkName('igex_storelocator/stores', 'storelocator_id',
98
+ 'igex_storelocator/store', 'entity_id'), 'storelocator_id',
99
+ $installer->getTable('igex_storelocator/store'), 'entity_id',
100
+ Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
101
+ ->addForeignKey(
102
+ $installer->getFkName('igex_storelocator/stores', 'store_id',
103
+ 'core/store', 'store_id'), 'store_id',
104
+ $installer->getTable('core/store'), 'store_id',
105
+ Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
106
+ ->setComment('StoreLocator Store To Store Linkage Table');
107
+
108
+ $installer->getConnection()->createTable($table);
109
+
110
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/igex/storelocator.xml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <igex_storelocator_adminhtml_store_index>
4
+ <reference name="content">
5
+ <block type="igex_storelocator/adminhtml_store" name="igex_storelocator_store" />
6
+ </reference>
7
+ </igex_storelocator_adminhtml_store_index>
8
+
9
+ <igex_storelocator_adminhtml_store_new>
10
+ <update handle="igex_storelocator_store_edit" />
11
+ </igex_storelocator_adminhtml_store_new>
12
+
13
+ <igex_storelocator_adminhtml_store_edit>
14
+ <reference name="content">
15
+ <block type="igex_storelocator/adminhtml_store_edit" name="storelocator_store_edit"></block>
16
+ </reference>
17
+ </igex_storelocator_adminhtml_store_edit>
18
+
19
+ <igex_storelocator_adminhtml_import_index>
20
+ <reference name="content">
21
+ <block type="igex_storelocator/adminhtml_import" name="import" />
22
+ </reference>
23
+ </igex_storelocator_adminhtml_import_index>
24
+ </layout>
app/design/frontend/base/default/layout/igex/storelocator.xml ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="top.links">
5
+ <action method="addLink" translate="label title">
6
+ <label>Store Locator</label>
7
+ <url>igex_storelocator</url>
8
+ <title>Store Locator</title>
9
+ <prepare>true</prepare>
10
+ <urlParams/>
11
+ <position>6</position>
12
+ </action>
13
+ </reference>
14
+ </default>
15
+ <igex_storelocator_index_index>
16
+ <reference name="breadcrumbs">
17
+ <action method="addCrumb">
18
+ <crumbName>Home</crumbName>
19
+ <crumbInfo>
20
+ <label>Home</label>
21
+ <title>Home</title>
22
+ <link>{{baseUrl}}</link>
23
+ </crumbInfo>
24
+ </action>
25
+ <action method="addCrumb">
26
+ <crumbName>Store Finder</crumbName>
27
+ <crumbInfo>
28
+ <label>Store Finder</label>
29
+ <title>Store Finder</title>
30
+ <link></link>
31
+ </crumbInfo>
32
+ </action>
33
+ </reference>
34
+ <reference name="head">
35
+ <action method="setForcedTitle">
36
+ <title>Store Finder</title>
37
+ </action>
38
+ <action method="addCss">
39
+ <stylesheet>css/igex/storelocator.css</stylesheet>
40
+ </action>
41
+ <action method="addItem">
42
+ <type>js</type>
43
+ <name>igex/storelocator.js</name>
44
+ <params/>
45
+ </action>
46
+ </reference>
47
+ <reference name="root">
48
+ <action method="setHeaderTitle" translate="title">
49
+ <title>Store Finder</title>
50
+ </action>
51
+ <action method="setTemplate">
52
+ <template>page/1column.phtml</template>
53
+ </action>
54
+ </reference>
55
+ <reference name="content">
56
+ <block type="igex_storelocator/store" name="store" /> <!-- template="igex/storelocator/storelocator.phtml"/> -->
57
+ </reference>
58
+ </igex_storelocator_index_index>
59
+ <igex_storelocator_index_search>
60
+ <reference name="breadcrumbs">
61
+ <action method="addCrumb">
62
+ <crumbName>Home</crumbName>
63
+ <crumbInfo>
64
+ <label>Home</label>
65
+ <title>Home</title>
66
+ <link>{{baseUrl}}</link>
67
+ </crumbInfo>
68
+ </action>
69
+ <action method="addCrumb">
70
+ <crumbName>Store Finder</crumbName>
71
+ <crumbInfo>
72
+ <label>Store Finder</label>
73
+ <title>Store Finder</title>
74
+ <link></link>
75
+ </crumbInfo>
76
+ </action>
77
+ </reference>
78
+ <reference name="head">
79
+ <action method="setForcedTitle">
80
+ <title>Store Finder</title>
81
+ </action>
82
+ <action method="addCss">
83
+ <stylesheet>css/igex/storelocator.css</stylesheet>
84
+ </action>
85
+ <action method="addItem">
86
+ <type>js</type>
87
+ <name>igex/storelocator.js</name>
88
+ <params/>
89
+ </action>
90
+ </reference>
91
+ <reference name="root">
92
+ <action method="setHeaderTitle" translate="title">
93
+ <title>Store Finder</title>
94
+ </action>
95
+ <action method="setTemplate">
96
+ <template>page/1column.phtml</template>
97
+ </action>
98
+ </reference>
99
+ <reference name="content">
100
+ <block type="igex_storelocator/store" name="store" /> <!-- template="igex/storelocator/storelocator.phtml"/> -->
101
+ </reference>
102
+ </igex_storelocator_index_search>
103
+ <igex_storelocator_index_detail>
104
+ <reference name="breadcrumbs">
105
+ <action method="addCrumb">
106
+ <crumbName>Home</crumbName>
107
+ <crumbInfo>
108
+ <label>Home</label>
109
+ <title>Home</title>
110
+ <link>{{baseUrl}}</link>
111
+ </crumbInfo>
112
+ </action>
113
+ <action method="addCrumb">
114
+ <crumbName>Store Finder</crumbName>
115
+ <crumbInfo>
116
+ <label>Store Finder</label>
117
+ <title>Store Finder</title>
118
+ <link>{{baseUrl}}storelocator/</link>
119
+ </crumbInfo>
120
+ </action>
121
+ </reference>
122
+ <reference name="head">
123
+ <action method="setForcedTitle">
124
+ <title>Store Finder</title>
125
+ </action>
126
+ <action method="addCss">
127
+ <stylesheet>css/igex/storelocator.css</stylesheet>
128
+ </action>
129
+ <action method="addItem">
130
+ <type>js</type>
131
+ <name>igex/storelocator.js</name>
132
+ <params/>
133
+ </action>
134
+ </reference>
135
+ <reference name="root">
136
+ <action method="setHeaderTitle" translate="title">
137
+ <title>Store Finder</title>
138
+ </action>
139
+ <action method="setTemplate">
140
+ <template>page/1column.phtml</template>
141
+ </action>
142
+ </reference>
143
+ <reference name="content">
144
+ <block type="igex_storelocator/store" name="storedetail" template="igex/storelocator/store-detail.phtml"/>
145
+ </reference>
146
+ </igex_storelocator_index_detail>
147
+ </layout>
app/design/frontend/base/default/template/igex/storelocator/2columns.phtml ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $address = $this->getRequest()->getPost('address');
3
+ $state_or_stub = $this->getRequest()->getPost('state_or_stub');
4
+ $zipcode = $this->getRequest()->getPost('zipcode');
5
+
6
+ $search_add = Mage::getStoreConfig('igex/search_options/search_by_address');
7
+ $search_state = Mage::getStoreConfig('igex/search_options/search_by_state');
8
+ $search_zip = Mage::getStoreConfig('igex/search_options/search_by_zipcode');
9
+ $search_rad = Mage::getStoreConfig('igex/search_options/search_by_radius');
10
+ $show_state = Mage::getStoreConfig('igex/search_options/state_search');
11
+ $show_img = Mage::getStoreConfig('igex/display_options/show_image');
12
+ $show_email = Mage::getStoreConfig('igex/display_options/show_email_and_website');
13
+ $show_ph = Mage::getStoreConfig('igex/display_options/show_phone'); ?>
14
+
15
+ <h1><?php echo $this->__('Store Locator');?></h1>
16
+
17
+ <div class="str_add_box">
18
+ <?php
19
+ $speacialStoreAll = Mage::getModel('igex_storelocator/store')->getCollection()
20
+ ->addFieldToFilter('status',1)
21
+ ->addFieldToFilter('topvisible',1);
22
+
23
+ foreach($speacialStoreAll as $specialStore):
24
+ if(!is_null($specialStore->getImage()) || $specialStore->getImage() != ''){
25
+ $imgUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).$specialStore->getImage();
26
+ }elseif (!is_null(Mage::getStoreConfig('igex/storelocator_options/defaultimage')) && Mage::getStoreConfig('igex/storelocator_options/defaultimage') != ''){
27
+ $imgUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'storelocator/images/'.Mage::getStoreConfig('igex/storelocator_options/defaultimage');
28
+ }else{
29
+ $imgUrl = $this->getLogoSrc();
30
+ }
31
+ $specialStore->setImage($imgUrl);
32
+ ?>
33
+ <div class="str_add_box_lft">
34
+ <div class="str_add_left"><img src="<?php echo $specialStore->getImage(); ?>" width="185" height="150" alt="<?php echo $specialStore->getName(); ?>" /></div>
35
+ <div class="str_add_right">
36
+ <div class="str_add_right_head"><?php echo $specialStore->getName(); ?></div>
37
+ <div class="str_add_txt">
38
+ <ul>
39
+ <li><?php echo nl2br($specialStore->getAddress()); ?></li>
40
+ <li><?php echo $specialStore->getState()." ".$specialStore->getZipcode(); ?></li>
41
+ </ul>
42
+
43
+ <div class="add_tel"><?php if(!is_null($specialStore->getPhone())&& $specialStore->getPhone()!= ''):?>
44
+ <?php echo $this->__('T : %s', $specialStore->getPhone()); ?>
45
+ <?php endif; ?></div>
46
+ </div>
47
+ </div>
48
+ </div>
49
+ <?php endforeach; ?>
50
+ </div>
51
+ <div style="clear:both;"></div>
52
+ <br/>
53
+ <h3><?php echo $this->__('Search By:');?></h3>
54
+
55
+ <form action="<?php echo Mage::getUrl('igex_storelocator/'); ?>" method="post">
56
+ <div id="search" style="<?php if($search_add==0):?>display:none;<?php endif;?>">
57
+ <label for="address" class="label"><?php echo $this->__('Address : ');?></label>
58
+ <input type="text" class="igex_input_box" name="address" id="address" value="<?php echo $address; ?>" />
59
+ </div>
60
+
61
+ <div id="search" style="<?php if($search_state==0):?>display:none;<?php endif;?>">
62
+ <label for="state" class="label"><?php echo $this->__('State : ');?></label>
63
+ <input type="text" class="igex_input_box" name="state_or_stub" id="state_or_stub" value="<?php echo $state_or_stub; ?>" />
64
+ </div>
65
+
66
+ <div id="search" style="<?php if($search_zip==0 && $search_rad==0):?>display:none;<?php endif;?>">
67
+ <label for="zipcode" class="label"><?php echo $this->__('Zipcode : ');?></label>
68
+ <input type="text" class="igex_input_box" value="<?php echo $zipcode; ?>" name="zipcode" id="zipcode" />
69
+ </div>
70
+
71
+ <div id="search" style="<?php if($search_rad==0):?>display:none;<?php endif;?>">
72
+ <?php $searchRadiusOptions = Mage::helper('igex_storelocator')->getSearchRadiusOptions();?>
73
+ <?php if(count($searchRadiusOptions)):?>
74
+ <label for="radius" class="label"><?php echo $this->__('Search Radius :') ?></label>
75
+ <select name="radius" id="radius" class="igex_input_box">
76
+ <?php foreach ($searchRadiusOptions as $option):?>
77
+ <option value="<?php echo $option['value'] ?>" <?php if ($option['value'] == Mage::helper('igex_storelocator')->getSearchRadius()):?> selected<?php endif;?>><?php echo $option['label']?> </option>
78
+ <?php endforeach;?>
79
+ </select>
80
+ <?php endif;?>
81
+ </div>
82
+
83
+ <div id="search">
84
+ <button type="submit" title="<?php echo $this->__('Search') ?>" name="search" class="button"><span><span><?php echo $this->__('Search') ?></span></span></button>
85
+ </div>
86
+ <div id="search">
87
+ <button type="button" onclick="setLocation('<?php echo $this->getUrl('igex_storelocator')?>')" class="button" title="<?php echo $this->__('Reset') ?>"><span><span><?php echo $this->__('Reset') ?></span></span></button>
88
+ </div>
89
+ </form>
90
+ <div style="clear:both;"></div>
91
+ <br/>
92
+
93
+
94
+ <div class="st_link">
95
+ <ul>
96
+ <?php
97
+
98
+ if($show_state==1)
99
+ {
100
+ $stateLink = Mage::getModel('igex_storelocator/store')->getCollection()
101
+ ->addFieldToFilter('status',1)
102
+ ->addFieldToSelect(array('state'));
103
+ $stateArr = array();
104
+ foreach($stateLink as $state){
105
+ if($state['state'] && !(in_array($state['state'],$stateArr))){
106
+ $stateArr[] = $state['state'];
107
+ array_unique($stateArr);
108
+ }
109
+ }
110
+ arsort($stateArr);
111
+
112
+ for($x=0;$x<count($stateArr);$x++){
113
+ $cls='';
114
+ if($stateReq!='' && $stateReq== $stateArr[$x]){ $cls = 'class="active"'; }
115
+ else if($stateReq=='' && $zipcode=='' && $state_or_stub=='' && $x==0){ $cls = 'class="active"'; }
116
+ ?>
117
+ <li <?php echo $cls; ?>><a href="<?php echo Mage::getUrl('igex_storelocator/',array('state'=>$stateArr[$x])); ?>"><?php echo $stateArr[$x]; ?></a></li>
118
+ <?php
119
+ }
120
+ }
121
+ ?>
122
+ </ul>
123
+ </div>
124
+ <div style="clear:both;"></div>
125
+ <br/>
126
+ <div class="store-list">
127
+ <!--<?php echo count($this->getStores()); ?>-->
128
+ <h3><?php echo $this->__('All Stores ('.count($this->getCollection()).')');?></h3>
129
+ <?php foreach($this->getCollection() as $store) :?>
130
+
131
+ <table id="store-table" class="store-table">
132
+ <tbody>
133
+
134
+ <tr>
135
+ <td rowspan="10" class="store-image" style="<?php if($show_img==0):?>display:none;<?php endif;?>" width="140px">
136
+ <img src="<?php echo $store->getImage(); ?>" alt="<?php echo $store->getName()?>" width="120px" height="120px" style="border:1px solid #808D95;"/> <!-- alt="<?php echo $store->getName()?>" -->
137
+ </td>
138
+ </tr>
139
+ <tr>
140
+ <td>
141
+ <h3 class='store-name' id="store<?php echo $store->getId(); ?>"><?php echo $store->getName()?></h3>
142
+ </td>
143
+ </tr>
144
+ <tr>
145
+ <td class="col-address">
146
+ <?php echo $store->getAddress()?>
147
+ </td>
148
+ </tr>
149
+ <tr>
150
+ <td class="col-address">
151
+ <?php echo $store->getZipcode()." ".$store->getCity()?>
152
+ </td>
153
+ </tr>
154
+ <tr>
155
+ <td class="col-address">
156
+ <?php echo $store->getCountryId(); ?>
157
+ </td>
158
+ </tr>
159
+ <tr>
160
+ <td>
161
+ <?php if(!is_null($store->getStoreUrl()) && $store->getStoreUrl() != '' && $show_email==1):?>
162
+ <?php echo $this->__('<b>Website</b> : %s', "<a href='".$store->getStoreUrl()."' target='_blank'>");?><?php echo $this->__('%s', $store->getStoreUrl());?></a>
163
+ <?php endif; ?>
164
+ </td>
165
+ </tr>
166
+ <tr>
167
+ <td>
168
+ <?php if(!is_null($store->getEmail())&& $store->getEmail()!= '' && $show_email==1):?>
169
+ <?php echo $this->__('<b>Email</b> : %s', $store->getEmail()); ?>
170
+ <?php endif; ?>
171
+ </td>
172
+ </tr>
173
+ <tr>
174
+ <tr>
175
+ <td>
176
+ <?php if(!is_null($store->getPhone())&& $store->getPhone()!= '' && $show_ph==1):?>
177
+ <?php echo $this->__('<b>Phone</b> : %s', $store->getPhone()); ?>
178
+ <?php endif; ?>
179
+ </td>
180
+ </tr>
181
+ <tr>
182
+ <td>
183
+ <?php if(!is_null($store->getFax()) && $store->getFax() != ''):?>
184
+ <?php echo $this->__('Fax : %s', $store->getFax());?>
185
+ <?php endif; ?>
186
+ </td>
187
+ </tr>
188
+ </tbody>
189
+ </table>
190
+ <?php endforeach;?>
191
+ <?php if(count($this->getCollection())==0):?>
192
+ <div class="note">There are no stores matching your selection</div>
193
+ <?php endif;?>
194
+ </div>
195
+ <div id="maps">
196
+ <div id="map_canvas"></div>
197
+ </div>
198
+ <div id="panel"></div>
199
+
200
+ <script type="text/javascript">
201
+
202
+ var state_or_stubVar = document.getElementById('state_or_stub');
203
+ var zipcodeVar = document.getElementById('zipcode');
204
+ var allowFlag = 0;
205
+
206
+ function checkForm()
207
+ {
208
+ if(state_or_stubVar.value!=''){ allowFlag = 1; }
209
+ else if(zipcodeVar.value!=''){ allowFlag = 1; }
210
+
211
+ if(allowFlag == 1){ return true; }
212
+ alert('Enter Your State Or Postcode');
213
+ return false;
214
+ }
215
+
216
+ var estimateDirectionLabel = '<?php echo $this->__('Calculating the estimated'); ?>';
217
+ var gmapUrl = '<?php echo $this->getGoogleApiUrl(); ?>';
218
+ var apiSensor = <?php echo Mage::getStoreConfig('igex/storelocator_options/apisensor'); ?>;
219
+ var stores = <?php echo Mage::helper('core')->jsonEncode($this->getStores()->toArray()); ?>;
220
+ var mediaUrl = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) ?>';
221
+ var pathMarker = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) ?>';
222
+ var defaultMarker = '<?php echo $this->getDefaultMarker(); ?>';
223
+ var directionEnable = <?php echo Mage::getStoreConfig('igex/storelocator_options/direction'); ?>;
224
+
225
+ window.onload = loadScript;
226
+
227
+ </script>
app/design/frontend/base/default/template/igex/storelocator/2columns.phtml~ ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $address = $this->getRequest()->getPost('address');
3
+ $state_or_stub = $this->getRequest()->getPost('state_or_stub');
4
+ $zipcode = $this->getRequest()->getPost('zipcode');
5
+
6
+ $search_add = Mage::getStoreConfig('igex/search_options/search_by_address');
7
+ $search_state = Mage::getStoreConfig('igex/search_options/search_by_state');
8
+ $search_zip = Mage::getStoreConfig('igex/search_options/search_by_zipcode');
9
+ $search_rad = Mage::getStoreConfig('igex/search_options/search_by_radius');
10
+ $show_state = Mage::getStoreConfig('igex/search_options/state_search');
11
+ $show_img = Mage::getStoreConfig('igex/display_options/show_image');
12
+ $show_email = Mage::getStoreConfig('igex/display_options/show_email_and_website');
13
+ $show_ph = Mage::getStoreConfig('igex/display_options/show_phone'); ?>
14
+
15
+ <h1><?php echo $this->__('Store Locator');?></h1>
16
+
17
+ <div class="str_add_box">
18
+ <?php
19
+ $speacialStoreAll = Mage::getModel('igex_storelocator/store')->getCollection()
20
+ ->addFieldToFilter('status',1)
21
+ ->addFieldToFilter('topvisible',1);
22
+
23
+ foreach($speacialStoreAll as $specialStore):
24
+ if(!is_null($specialStore->getImage()) || $specialStore->getImage() != ''){
25
+ $imgUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).$specialStore->getImage();
26
+ }elseif (!is_null(Mage::getStoreConfig('igex/storelocator_options/defaultimage')) && Mage::getStoreConfig('igex/storelocator_options/defaultimage') != ''){
27
+ $imgUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'storelocator/images/'.Mage::getStoreConfig('igex/storelocator_options/defaultimage');
28
+ }else{
29
+ $imgUrl = $this->getLogoSrc();
30
+ }
31
+ $specialStore->setImage($imgUrl);
32
+ ?>
33
+ <div class="str_add_box_lft">
34
+ <div class="str_add_left"><img src="<?php echo $specialStore->getImage(); ?>" width="185" height="150" alt="<?php echo $specialStore->getName(); ?>" /></div>
35
+ <div class="str_add_right">
36
+ <div class="str_add_right_head"><?php echo $specialStore->getName(); ?></div>
37
+ <div class="str_add_txt">
38
+ <ul>
39
+ <li><?php echo nl2br($specialStore->getAddress()); ?></li>
40
+ <li><?php echo $specialStore->getState()." ".$specialStore->getZipcode(); ?></li>
41
+ </ul>
42
+
43
+ <div class="add_tel"><?php if(!is_null($specialStore->getPhone())&& $specialStore->getPhone()!= ''):?>
44
+ <?php echo $this->__('T : %s', $specialStore->getPhone()); ?>
45
+ <?php endif; ?></div>
46
+ </div>
47
+ </div>
48
+ </div>
49
+ <?php endforeach; ?>
50
+ </div>
51
+ <div style="clear:both;"></div>
52
+ <br/>
53
+ <h3><?php echo $this->__('Search By:');?></h3>
54
+
55
+ <form action="<?php echo Mage::getUrl('igex_storelocator/'); ?>" method="post">
56
+ <div id="search" style="<?php if($search_add==0):?>display:none;<?php endif;?>">
57
+ <label for="address" class="label"><?php echo $this->__('Address : ');?></label>
58
+ <input type="text" class="igex_input_box" name="address" id="address" value="<?php echo $address; ?>" />
59
+ </div>
60
+
61
+ <div id="search" style="<?php if($search_state==0):?>display:none;<?php endif;?>">
62
+ <label for="state" class="label"><?php echo $this->__('State : ');?></label>
63
+ <input type="text" class="igex_input_box" name="state_or_stub" id="state_or_stub" value="<?php echo $state_or_stub; ?>" />
64
+ </div>
65
+
66
+ <div id="search" style="<?php if($search_zip==0 && $search_rad==0):?>display:none;<?php endif;?>">
67
+ <label for="zipcode" class="label"><?php echo $this->__('Zipcode : ');?></label>
68
+ <input type="text" class="igex_input_box" value="<?php echo $zipcode; ?>" name="zipcode" id="zipcode" />
69
+ </div>
70
+
71
+ <div id="search" style="<?php if($search_rad==0):?>display:none;<?php endif;?>">
72
+ <?php $searchRadiusOptions = Mage::helper('igex_storelocator')->getSearchRadiusOptions();?>
73
+ <?php if(count($searchRadiusOptions)):?>
74
+ <label for="radius" class="label"><?php echo $this->__('Search Radius :') ?></label>
75
+ <select name="radius" id="radius" class="igex_input_box">
76
+ <?php foreach ($searchRadiusOptions as $option):?>
77
+ <option value="<?php echo $option['value'] ?>" <?php if ($option['value'] == Mage::helper('igex_storelocator')->getSearchRadius()):?> selected<?php endif;?>><?php echo $option['label']?> </option>
78
+ <?php endforeach;?>
79
+ </select>
80
+ <?php endif;?>
81
+ </div>
82
+
83
+ <div id="search">
84
+ <button type="submit" title="<?php echo $this->__('Search') ?>" name="search" class="button"><span><span><?php echo $this->__('Search') ?></span></span></button>
85
+ </div>
86
+ <div id="search">
87
+ <button type="button" onclick="setLocation('<?php echo $this->getUrl('igex_storelocator')?>')" class="button" title="<?php echo $this->__('Reset') ?>"><span><span><?php echo $this->__('Reset') ?></span></span></button>
88
+ </div>
89
+ </form>
90
+ <div style="clear:both;"></div>
91
+ <br/>
92
+
93
+
94
+ <div class="st_link">
95
+ <ul>
96
+ <?php
97
+
98
+ if($show_state==1)
99
+ {
100
+ $stateLink = Mage::getModel('igex_storelocator/store')->getCollection()
101
+ ->addFieldToFilter('status',1)
102
+ ->addFieldToSelect(array('state'));
103
+ $stateArr = array();
104
+ foreach($stateLink as $state){
105
+ if($state['state'] && !(in_array($state['state'],$stateArr))){
106
+ $stateArr[] = $state['state'];
107
+ array_unique($stateArr);
108
+ }
109
+ }
110
+ arsort($stateArr);
111
+
112
+ for($x=0;$x<count($stateArr);$x++){
113
+ $cls='';
114
+ if($stateReq!='' && $stateReq== $stateArr[$x]){ $cls = 'class="active"'; }
115
+ else if($stateReq=='' && $zipcode=='' && $state_or_stub=='' && $x==0){ $cls = 'class="active"'; }
116
+ ?>
117
+ <li <?php echo $cls; ?>><a href="<?php echo Mage::getUrl('igex_storelocator/',array('state'=>$stateArr[$x])); ?>"><?php echo $stateArr[$x]; ?></a></li>
118
+ <?php
119
+ }
120
+ }
121
+ ?>
122
+ </ul>
123
+ </div>
124
+ <div style="clear:both;"></div>
125
+ <br/>
126
+ <div class="store-list">
127
+ <!--<?php echo count($this->getStores()); ?>-->
128
+ <h3><?php echo $this->__('All Stores ('.count($this->getCollection()).')');?></h3>
129
+ <?php foreach($this->getCollection() as $store) :?>
130
+
131
+ <table id="store-table" class="store-table">
132
+ <tbody>
133
+
134
+ <tr>
135
+ <td rowspan="10" class="store-image" style="<?php if($show_img==0):?>display:none;<?php endif;?>" width="140px">
136
+ <img src="<?php echo $store->getImage(); ?>" alt="<?php echo $store->getName()?>" width="120px" height="120px" style="border:1px solid #808D95;"/> <!-- alt="<?php echo $store->getName()?>" -->
137
+ </td>
138
+ </tr>
139
+ <tr>
140
+ <td>
141
+ <h3 class='store-name' id="store<?php echo $store->getId(); ?>"><?php echo $store->getName()?></h3>
142
+ </td>
143
+ </tr>
144
+ <tr>
145
+ <td class="col-address">
146
+ <?php echo $store->getAddress()?>
147
+ </td>
148
+ </tr>
149
+ <tr>
150
+ <td class="col-address">
151
+ <?php echo $store->getZipcode()." ".$store->getCity()?>
152
+ </td>
153
+ </tr>
154
+ <tr>
155
+ <td class="col-address">
156
+ <?php echo $store->getCountryId(); ?>
157
+ </td>
158
+ </tr>
159
+ <tr>
160
+ <td>
161
+ <?php if(!is_null($store->getStoreUrl()) && $store->getStoreUrl() != '' && $show_email==1):?>
162
+ <?php echo $this->__('<b>Website</b> : %s', "<a href='".$store->getStoreUrl()."' target='_blank'>");?><?php echo $this->__('%s', $store->getStoreUrl());?></a>
163
+ <?php endif; ?>
164
+ </td>
165
+ </tr>
166
+ <tr>
167
+ <td>
168
+ <?php if(!is_null($store->getEmail())&& $store->getEmail()!= '' && $show_email==1):?>
169
+ <?php echo $this->__('Email : %s', $store->getEmail()); ?>
170
+ <?php endif; ?>
171
+ </td>
172
+ </tr>
173
+ <tr>
174
+ <tr>
175
+ <td>
176
+ <?php if(!is_null($store->getPhone())&& $store->getPhone()!= '' && $show_ph==1):?>
177
+ <?php echo $this->__('Phone : %s', $store->getPhone()); ?>
178
+ <?php endif; ?>
179
+ </td>
180
+ </tr>
181
+ <tr>
182
+ <td>
183
+ <?php if(!is_null($store->getFax()) && $store->getFax() != ''):?>
184
+ <?php echo $this->__('Fax : %s', $store->getFax());?>
185
+ <?php endif; ?>
186
+ </td>
187
+ </tr>
188
+ </tbody>
189
+ </table>
190
+ <?php endforeach;?>
191
+ <?php if(count($this->getCollection())==0):?>
192
+ <div class="note">There are no stores matching your selection</div>
193
+ <?php endif;?>
194
+ </div>
195
+ <div id="maps">
196
+ <div id="map_canvas"></div>
197
+ </div>
198
+ <div id="panel"></div>
199
+
200
+ <script type="text/javascript">
201
+
202
+ var state_or_stubVar = document.getElementById('state_or_stub');
203
+ var zipcodeVar = document.getElementById('zipcode');
204
+ var allowFlag = 0;
205
+
206
+ function checkForm()
207
+ {
208
+ if(state_or_stubVar.value!=''){ allowFlag = 1; }
209
+ else if(zipcodeVar.value!=''){ allowFlag = 1; }
210
+
211
+ if(allowFlag == 1){ return true; }
212
+ alert('Enter Your State Or Postcode');
213
+ return false;
214
+ }
215
+
216
+ var estimateDirectionLabel = '<?php echo $this->__('Calculating the estimated'); ?>';
217
+ var gmapUrl = '<?php echo $this->getGoogleApiUrl(); ?>';
218
+ var apiSensor = <?php echo Mage::getStoreConfig('igex/storelocator_options/apisensor'); ?>;
219
+ var stores = <?php echo Mage::helper('core')->jsonEncode($this->getStores()->toArray()); ?>;
220
+ var mediaUrl = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) ?>';
221
+ var pathMarker = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) ?>';
222
+ var defaultMarker = '<?php echo $this->getDefaultMarker(); ?>';
223
+ var directionEnable = <?php echo Mage::getStoreConfig('igex/storelocator_options/direction'); ?>;
224
+
225
+ window.onload = loadScript;
226
+
227
+ </script>
app/design/frontend/base/default/template/igex/storelocator/storelocator.phtml ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $address = $this->getRequest()->getPost('address');
2
+ $state_or_stub = $this->getRequest()->getPost('state_or_stub');
3
+ $zipcode = $this->getRequest()->getPost('zipcode');
4
+
5
+ $search_add = Mage::getStoreConfig('igex/search_options/search_by_address');
6
+ $search_state = Mage::getStoreConfig('igex/search_options/search_by_state');
7
+ $search_zip = Mage::getStoreConfig('igex/search_options/search_by_zipcode');
8
+ $search_rad = Mage::getStoreConfig('igex/search_options/search_by_radius');
9
+ $show_state = Mage::getStoreConfig('igex/search_options/state_search');
10
+ $show_img = Mage::getStoreConfig('igex/display_options/show_image');
11
+ $show_email = Mage::getStoreConfig('igex/display_options/show_email_and_website');
12
+ $show_ph = Mage::getStoreConfig('igex/display_options/show_phone'); ?>
13
+
14
+ <div class="page-title">
15
+ <h1><?php echo $this->__('Store Locator');?></h1>
16
+ </div>
17
+ <div class="str_add_box">
18
+ <?php
19
+ $speacialStoreAll = Mage::getModel('igex_storelocator/store')->getCollection()
20
+ ->addFieldToFilter('status',1)
21
+ ->addFieldToFilter('topvisible',1);
22
+
23
+ foreach($speacialStoreAll as $specialStore):
24
+ if(!is_null($specialStore->getImage()) || $specialStore->getImage() != ''){
25
+ $imgUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).$specialStore->getImage();
26
+ }elseif (!is_null(Mage::getStoreConfig('igex/storelocator_options/defaultimage')) && Mage::getStoreConfig('igex/storelocator_options/defaultimage') != ''){
27
+ $imgUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'storelocator/images/'.Mage::getStoreConfig('igex/storelocator_options/defaultimage');
28
+ }else{
29
+ $imgUrl = $this->getLogoSrc();
30
+ }
31
+ $specialStore->setImage($imgUrl);
32
+ ?>
33
+ <div class="str_add_box_lft">
34
+ <div class="str_add_left"><img src="<?php echo $specialStore->getImage(); ?>" width="185" height="150" alt="<?php echo $specialStore->getName(); ?>" /></div>
35
+ <div class="str_add_right">
36
+ <div class="str_add_right_head"><?php echo $specialStore->getName(); ?></div>
37
+ <div class="str_add_txt">
38
+ <ul>
39
+ <li><?php echo nl2br($specialStore->getAddress()); ?></li>
40
+ <li><?php echo $specialStore->getState()." ".$specialStore->getZipcode(); ?></li>
41
+ </ul>
42
+ <div class="add_tel"><?php if(!is_null($specialStore->getPhone())&& $specialStore->getPhone()!= ''):?>
43
+ <?php echo $this->__('T : %s', $specialStore->getPhone()); ?>
44
+ <?php endif; ?></div>
45
+ </div>
46
+ </div>
47
+ </div>
48
+ <?php endforeach; ?>
49
+ </div><div style="clear:both;"></div><br/>
50
+
51
+ <h3 class="legend" style="<?php if($search_rad==0 && $search_add==0 && $search_zip==0 && $search_state==0):?>display:none;<?php endif;?>"><?php echo $this->__('Search By:') ?></h3>
52
+
53
+ <form action="<?php echo Mage::getUrl('igex_storelocator/'); ?>" method="post">
54
+ <div id="search" style="<?php if($search_add==0):?>display:none;<?php endif;?>">
55
+ <label for="address" class="label"><?php echo $this->__('Address : ');?></label>
56
+ <input type="text" class="igex_input_box" name="address" id="address" value="<?php echo $address; ?>" />
57
+ </div>
58
+
59
+ <div id="search" style="<?php if($search_state==0):?>display:none;<?php endif;?>">
60
+ <label for="state" class="label"><?php echo $this->__('State : ');?></label>
61
+ <input type="text" class="igex_input_box" name="state_or_stub" id="state_or_stub" value="<?php echo $state_or_stub; ?>" />
62
+ </div>
63
+
64
+ <div id="search" style="<?php if($search_zip==0 && $search_rad==0):?>display:none;<?php endif;?>">
65
+ <label for="zipcode" class="label"><?php echo $this->__('Zipcode : ');?></label>
66
+ <input type="text" class="igex_input_box" value="<?php echo $zipcode; ?>" name="zipcode" id="zipcode" />
67
+ </div>
68
+
69
+ <div id="search" style="<?php if($search_rad==0):?>display:none;<?php endif;?>">
70
+ <?php $searchRadiusOptions = Mage::helper('igex_storelocator')->getSearchRadiusOptions();?>
71
+ <?php if(count($searchRadiusOptions)):?>
72
+ <label for="radius" class="label"><?php echo $this->__('Search Radius :') ?></label>
73
+ <select name="radius" id="radius" class="igex_input_box">
74
+ <?php foreach ($searchRadiusOptions as $option):?>
75
+ <option value="<?php echo $option['value'] ?>" <?php if ($option['value'] == Mage::helper('igex_storelocator')->getSearchRadius()):?> selected<?php endif;?>><?php echo $option['label']?> </option>
76
+ <?php endforeach;?>
77
+ </select>
78
+ <?php endif;?>
79
+ </div>
80
+ <div id="search" style="<?php if($search_rad==0 && $search_add==0 && $search_zip==0 && $search_state==0):?>display:none;<?php endif;?>">
81
+ <button type="submit" title="<?php echo $this->__('Search') ?>" name="search" class="button"><span><span><?php echo $this->__('Search') ?></span></span></button>
82
+
83
+ <button type="button" onclick="setLocation('<?php echo $this->getUrl('igex_storelocator')?>')" class="button" title="<?php echo $this->__('Reset') ?>"><span><span><?php echo $this->__('Reset') ?></span></span></button>
84
+ </div>
85
+ </form>
86
+ </div>
87
+
88
+ <div id="maps">
89
+ <div id="map_canvas" style="height:400px;width:880px;"></div>
90
+ </div>
91
+ <div id="panel"></div>
92
+ <div class="st_link">
93
+ <ul>
94
+ <?php
95
+
96
+ if($show_state==1)
97
+ {
98
+ $stateLink = Mage::getModel('igex_storelocator/store')->getCollection()
99
+ ->addFieldToFilter('status',1)
100
+ ->addFieldToSelect(array('state'));
101
+ $stateArr = array();
102
+ foreach($stateLink as $state){
103
+ if($state['state'] && !(in_array($state['state'],$stateArr))){
104
+ $stateArr[] = $state['state'];
105
+ array_unique($stateArr);
106
+ }
107
+ }
108
+ arsort($stateArr);
109
+
110
+ for($x=0;$x<count($stateArr);$x++){
111
+ $cls='';
112
+ if($stateReq!='' && $stateReq== $stateArr[$x]){ $cls = 'class="active"'; }
113
+ else if($stateReq=='' && $zipcode=='' && $state_or_stub=='' && $x==0){ $cls = 'class="active"'; }
114
+ ?>
115
+ <li <?php echo $cls; ?>><a href="<?php echo Mage::getUrl('igex_storelocator/',array('state'=>$stateArr[$x])); ?>"><?php echo $stateArr[$x]; ?></a></li>
116
+ <?php
117
+ }
118
+ }
119
+ ?>
120
+ </ul>
121
+ </div>
122
+ <div style="clear:both;"></div>
123
+ <br/>
124
+
125
+ <!--<?php echo count($this->getStores()); ?>-->
126
+ <h3><?php echo $this->__('All Stores ('.count($this->getStores()).')');?></h3>
127
+
128
+ <!--<?php echo $this->getPagerHtml();?>-->
129
+ <table class="data-table" id="store-table">
130
+ <colgroup>
131
+ <col>
132
+ <col>
133
+ <col width="130px">
134
+ <?php if($show_email==1): ?>
135
+ <col width="1">
136
+ <col width="1">
137
+ <?php endif; ?>
138
+ </colgroup>
139
+ <thead>
140
+ <tr>
141
+ <th><?php echo $this->__('Store') ?></th>
142
+ <th><?php echo $this->__('Address') ?></th>
143
+ <?php if($show_ph==1): ?>
144
+ <th><?php echo $this->__('Phone') ?></th>
145
+ <?php endif; ?>
146
+ <?php if($show_email==1): ?>
147
+ <th><?php echo $this->__('Email') ?></th>
148
+ <th><?php echo $this->__('Website') ?></th>
149
+ <?php endif; ?>
150
+ </tr>
151
+ </thead>
152
+ <tbody>
153
+ <?php $all = $this->getCollection();?>
154
+ <?php foreach($all as $store) :?>
155
+ <tr>
156
+ <td style="cursor: pointer;" id="store<?php echo $store->getId() ?>"><?php echo $store->getName()?></td>
157
+ <td><?php echo $store->getAddress()." ".$store->getZipcode()?></td>
158
+ <?php if($show_ph==1): ?>
159
+ <td><?php echo $store->getPhone()?></td>
160
+ <?php endif; ?>
161
+ <?php if($show_email==1): ?>
162
+ <td><?php echo $store->getEmail()?></td>
163
+ <td><?php echo $this->__("<a href='".$store->getStoreUrl()."' target='_blank'>");?><?php echo $store->getStoreUrl()?><?php echo $this->__("</a>");?></td>
164
+ <?php endif?>
165
+ </tr>
166
+ <?php endforeach;?>
167
+ </tbody>
168
+ </table>
169
+
170
+ <?php if(count($this->getStores())==0):?>
171
+ <div class="note">There are no stores matching your selection</div>
172
+ <?php endif;?>
173
+
174
+ <script type="text/javascript">
175
+
176
+ var state_or_stubVar = document.getElementById('state_or_stub');
177
+ var zipcodeVar = document.getElementById('zipcode');
178
+ var allowFlag = 0;
179
+
180
+ function checkForm()
181
+ {
182
+ if(state_or_stubVar.value!=''){ allowFlag = 1; }
183
+ else if(zipcodeVar.value!=''){ allowFlag = 1; }
184
+
185
+ if(allowFlag == 1){ return true; }
186
+ alert('Enter Your State Or Postcode');
187
+ return false;
188
+ }
189
+
190
+ var estimateDirectionLabel = '<?php echo $this->__('Calculating the estimated'); ?>';
191
+ var gmapUrl = '<?php echo $this->getGoogleApiUrl(); ?>';
192
+ var apiSensor = <?php echo Mage::getStoreConfig('igex/storelocator_options/apisensor'); ?>;
193
+ var stores = <?php echo Mage::helper('core')->jsonEncode($this->getStores()->toArray()); ?>;
194
+ var mediaUrl = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) ?>';
195
+ var pathMarker = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) ?>';
196
+ var defaultMarker = '<?php echo $this->getDefaultMarker(); ?>';
197
+ var directionEnable = <?php echo Mage::getStoreConfig('igex/storelocator_options/direction'); ?>;
198
+ window.onload = loadScript;
199
+
200
+ </script>
app/design/frontend/base/default/template/igex/storelocator/storelocator.phtml~ ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $address = $this->getRequest()->getPost('address');
2
+ $state_or_stub = $this->getRequest()->getPost('state_or_stub');
3
+ $zipcode = $this->getRequest()->getPost('zipcode');
4
+
5
+ $search_add = Mage::getStoreConfig('igex/search_options/search_by_address');
6
+ $search_state = Mage::getStoreConfig('igex/search_options/search_by_state');
7
+ $search_zip = Mage::getStoreConfig('igex/search_options/search_by_zipcode');
8
+ $search_rad = Mage::getStoreConfig('igex/search_options/search_by_radius');
9
+ $show_state = Mage::getStoreConfig('igex/search_options/state_search');
10
+ $show_img = Mage::getStoreConfig('igex/display_options/show_image');
11
+ $show_email = Mage::getStoreConfig('igex/display_options/show_email_and_website');
12
+ $show_ph = Mage::getStoreConfig('igex/display_options/show_phone'); ?>
13
+
14
+ <div class="page-title">
15
+ <h1><?php echo $this->__('Store Locator');?></h1>
16
+ </div>
17
+ <div class="str_add_box">
18
+ <?php
19
+ $speacialStoreAll = Mage::getModel('igex_storelocator/store')->getCollection()
20
+ ->addFieldToFilter('status',1)
21
+ ->addFieldToFilter('topvisible',1);
22
+
23
+ foreach($speacialStoreAll as $specialStore):
24
+ if(!is_null($specialStore->getImage()) || $specialStore->getImage() != ''){
25
+ $imgUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).$specialStore->getImage();
26
+ }elseif (!is_null(Mage::getStoreConfig('igex/storelocator_options/defaultimage')) && Mage::getStoreConfig('igex/storelocator_options/defaultimage') != ''){
27
+ $imgUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'storelocator/images/'.Mage::getStoreConfig('igex/storelocator_options/defaultimage');
28
+ }else{
29
+ $imgUrl = $this->getLogoSrc();
30
+ }
31
+ $specialStore->setImage($imgUrl);
32
+ ?>
33
+ <div class="str_add_box_lft">
34
+ <div class="str_add_left"><img src="<?php echo $specialStore->getImage(); ?>" width="185" height="150" alt="<?php echo $specialStore->getName(); ?>" /></div>
35
+ <div class="str_add_right">
36
+ <div class="str_add_right_head"><?php echo $specialStore->getName(); ?></div>
37
+ <div class="str_add_txt">
38
+ <ul>
39
+ <li><?php echo nl2br($specialStore->getAddress()); ?></li>
40
+ <li><?php echo $specialStore->getState()." ".$specialStore->getZipcode(); ?></li>
41
+ </ul>
42
+ <div class="add_tel"><?php if(!is_null($specialStore->getPhone())&& $specialStore->getPhone()!= ''):?>
43
+ <?php echo $this->__('T : %s', $specialStore->getPhone()); ?>
44
+ <?php endif; ?></div>
45
+ </div>
46
+ </div>
47
+ </div>
48
+ <?php endforeach; ?>
49
+ </div><div style="clear:both;"></div><br/>
50
+
51
+ <h3 class="legend" style="<?php if($search_rad==0 && $search_add==0 && $search_zip==0 && $search_state==0):?>display:none;<?php endif;?>"><?php echo $this->__('Search By:') ?></h3>
52
+
53
+ <form action="<?php echo Mage::getUrl('igex_storelocator/'); ?>" method="post">
54
+ <div id="search" style="<?php if($search_add==0):?>display:none;<?php endif;?>">
55
+ <label for="address" class="label"><?php echo $this->__('Address : ');?></label>
56
+ <input type="text" class="igex_input_box" name="address" id="address" value="<?php echo $address; ?>" />
57
+ </div>
58
+
59
+ <div id="search" style="<?php if($search_state==0):?>display:none;<?php endif;?>">
60
+ <label for="state" class="label"><?php echo $this->__('State : ');?></label>
61
+ <input type="text" class="igex_input_box" name="state_or_stub" id="state_or_stub" value="<?php echo $state_or_stub; ?>" />
62
+ </div>
63
+
64
+ <div id="search" style="<?php if($search_zip==0 && $search_rad==0):?>display:none;<?php endif;?>">
65
+ <label for="zipcode" class="label"><?php echo $this->__('Zipcode : ');?></label>
66
+ <input type="text" class="igex_input_box" value="<?php echo $zipcode; ?>" name="zipcode" id="zipcode" />
67
+ </div>
68
+
69
+ <div id="search" style="<?php if($search_rad==0):?>display:none;<?php endif;?>">
70
+ <?php $searchRadiusOptions = Mage::helper('igex_storelocator')->getSearchRadiusOptions();?>
71
+ <?php if(count($searchRadiusOptions)):?>
72
+ <label for="radius" class="label"><?php echo $this->__('Search Radius :') ?></label>
73
+ <select name="radius" id="radius" class="igex_input_box">
74
+ <?php foreach ($searchRadiusOptions as $option):?>
75
+ <option value="<?php echo $option['value'] ?>" <?php if ($option['value'] == Mage::helper('igex_storelocator')->getSearchRadius()):?> selected<?php endif;?>><?php echo $option['label']?> </option>
76
+ <?php endforeach;?>
77
+ </select>
78
+ <?php endif;?>
79
+ </div>
80
+ <div id="search" style="<?php if($search_rad==0 && $search_add==0 && $search_zip==0 && $search_state==0):?>display:none;<?php endif;?>">
81
+ <button type="submit" title="<?php echo $this->__('Search') ?>" name="search" class="button"><span><span><?php echo $this->__('Search') ?></span></span></button>
82
+
83
+ <button type="button" onclick="setLocation('<?php echo $this->getUrl('igex_storelocator')?>')" class="button" title="<?php echo $this->__('Reset') ?>"><span><span><?php echo $this->__('Reset') ?></span></span></button>
84
+ </div>
85
+ </form>
86
+ </div>
87
+
88
+ <div id="maps">
89
+ <div id="map_canvas" style="height:400px;width:880px;"></div>
90
+ </div>
91
+ <div id="panel"></div>
92
+ <div class="st_link">
93
+ <ul>
94
+ <?php
95
+
96
+ if($show_state==1)
97
+ {
98
+ $stateLink = Mage::getModel('igex_storelocator/store')->getCollection()
99
+ ->addFieldToFilter('status',1)
100
+ ->addFieldToSelect(array('state'));
101
+ $stateArr = array();
102
+ foreach($stateLink as $state){
103
+ if($state['state'] && !(in_array($state['state'],$stateArr))){
104
+ $stateArr[] = $state['state'];
105
+ array_unique($stateArr);
106
+ }
107
+ }
108
+ arsort($stateArr);
109
+
110
+ for($x=0;$x<count($stateArr);$x++){
111
+ $cls='';
112
+ if($stateReq!='' && $stateReq== $stateArr[$x]){ $cls = 'class="active"'; }
113
+ else if($stateReq=='' && $zipcode=='' && $state_or_stub=='' && $x==0){ $cls = 'class="active"'; }
114
+ ?>
115
+ <li <?php echo $cls; ?>><a href="<?php echo Mage::getUrl('igex_storelocator/',array('state'=>$stateArr[$x])); ?>"><?php echo $stateArr[$x]; ?></a></li>
116
+ <?php
117
+ }
118
+ }
119
+ ?>
120
+ </ul>
121
+ </div>
122
+ <div style="clear:both;"></div>
123
+ <br/>
124
+
125
+ <!--<?php echo count($this->getStores()); ?>-->
126
+ <h3><?php echo $this->__('All Stores ('.count($this->getStores()).')');?></h3>
127
+
128
+ <?php echo $this->getPagerHtml();?>
129
+ <table class="data-table" id="store-table">
130
+ <colgroup>
131
+ <col>
132
+ <col>
133
+ <col width="130px">
134
+ <?php if($show_email==1): ?>
135
+ <col width="1">
136
+ <col width="1">
137
+ <?php endif; ?>
138
+ </colgroup>
139
+ <thead>
140
+ <tr>
141
+ <th><?php echo $this->__('Store') ?></th>
142
+ <th><?php echo $this->__('Address') ?></th>
143
+ <?php if($show_ph==1): ?>
144
+ <th><?php echo $this->__('Phone') ?></th>
145
+ <?php endif; ?>
146
+ <?php if($show_email==1): ?>
147
+ <th><?php echo $this->__('Email') ?></th>
148
+ <th><?php echo $this->__('Website') ?></th>
149
+ <?php endif; ?>
150
+ </tr>
151
+ </thead>
152
+ <tbody>
153
+ <?php $all = $this->getCollection();?>
154
+ <?php foreach($all as $store) :?>
155
+ <tr>
156
+ <td style="cursor: pointer;" id="store<?php echo $store->getId() ?>"><?php echo $store->getName()?></td>
157
+ <td><?php echo $store->getAddress()." ".$store->getZipcode()?></td>
158
+ <?php if($show_ph==1): ?>
159
+ <td><?php echo $store->getPhone()?></td>
160
+ <?php endif; ?>
161
+ <?php if($show_email==1): ?>
162
+ <td><?php echo $store->getEmail()?></td>
163
+ <td><?php echo $this->__("<a href='".$store->getStoreUrl()."' target='_blank'>");?><?php echo $store->getStoreUrl()?><?php echo $this->__("</a>");?></td>
164
+ <?php endif?>
165
+ </tr>
166
+ <?php endforeach;?>
167
+ </tbody>
168
+ </table>
169
+
170
+ <?php if(count($this->getStores())==0):?>
171
+ <div class="note">There are no stores matching your selection</div>
172
+ <?php endif;?>
173
+
174
+ <script type="text/javascript">
175
+
176
+ var state_or_stubVar = document.getElementById('state_or_stub');
177
+ var zipcodeVar = document.getElementById('zipcode');
178
+ var allowFlag = 0;
179
+
180
+ function checkForm()
181
+ {
182
+ if(state_or_stubVar.value!=''){ allowFlag = 1; }
183
+ else if(zipcodeVar.value!=''){ allowFlag = 1; }
184
+
185
+ if(allowFlag == 1){ return true; }
186
+ alert('Enter Your State Or Postcode');
187
+ return false;
188
+ }
189
+
190
+ var estimateDirectionLabel = '<?php echo $this->__('Calculating the estimated'); ?>';
191
+ var gmapUrl = '<?php echo $this->getGoogleApiUrl(); ?>';
192
+ var apiSensor = <?php echo Mage::getStoreConfig('igex/storelocator_options/apisensor'); ?>;
193
+ var stores = <?php echo Mage::helper('core')->jsonEncode($this->getStores()->toArray()); ?>;
194
+ var mediaUrl = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) ?>';
195
+ var pathMarker = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) ?>';
196
+ var defaultMarker = '<?php echo $this->getDefaultMarker(); ?>';
197
+ var directionEnable = <?php echo Mage::getStoreConfig('igex/storelocator_options/direction'); ?>;
198
+ window.onload = loadScript;
199
+
200
+ </script>
app/etc/modules/Igex_StoreLocator.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Igex_StoreLocator>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ <key>T25pYmlfRnJlZQ==</key>
8
+ </Igex_StoreLocator>
9
+ </modules>
10
+ </config>
media/storelocator/images/Crosses.png ADDED
Binary file
media/storelocator/images/IMG_06182013_150241.jpg ADDED
Binary file
media/storelocator/images/add2.png ADDED
Binary file
media/storelocator/images/button.jpg ADDED
Binary file
media/storelocator/images/default/Jellyfish.jpg ADDED
Binary file
media/storelocator/images/default/add1.png ADDED
Binary file
media/storelocator/images/download.jpg ADDED
Binary file
media/storelocator/images/download_1_.jpg ADDED
Binary file
media/storelocator/images/download_2_.jpg ADDED
Binary file
media/storelocator/images/images.jpg ADDED
Binary file
media/storelocator/images/images_1_.jpg ADDED
Binary file
media/storelocator/markers/default/dealer_icon_1.png ADDED
Binary file
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Igex_Storelocator</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Free easy and customizable store locator extension for magento community stores</summary>
10
+ <description>The store locator extension offers customers to get in touch with the physical stores associated with your online store using google maps. This plugin not only provides the specific location of the stores, but also provides filters and other easily customizable options from both client and user side.</description>
11
+ <notes>First release of the extension.. But we look forward to make new improvements and advancements in a short while</notes>
12
+ <authors><author><name>iGex Solutions</name><user>igexsolutions</user><email>narendra@igexsolutions.com</email></author></authors>
13
+ <date>2015-01-01</date>
14
+ <time>06:48:03</time>
15
+ <contents><target name="magelocal"><dir name="Igex"><dir name="StoreLocator"><dir name="Block"><dir name="Adminhtml"><dir name="Import"><file name="Form.php" hash="5c605518ac8b59142a8f8cc8c97cee3b"/></dir><file name="Import.php" hash="7522ae000ae3d1272d518ebb108a0802"/><dir name="Store"><dir name="Edit"><file name="Form.php" hash="775b98ab81b510636d06f2ab111c6153"/></dir><file name="Edit.php" hash="c27668d4d31534809257b8470a42e05b"/><file name="Grid.php" hash="19e0af28c60411022797124663f524db"/><dir name="Renderer"><file name="Image.php" hash="12a534af62771a71eedbe430b9879b50"/></dir></dir><file name="Store.php" hash="c4db2807d618ca83ccf7d38eba5aaa70"/></dir><file name="Store.php" hash="df820b012c5490fab762f7bf40fe1837"/><file name="Store.php~" hash="60e22908bebb622e0af57d8c00033601"/><dir name="System"><dir name="Config"><file name="General.php" hash="8c75b09ca5dec2238a733047175be95e"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="cbd8464e0021b4fa4697c39e9958a1b3"/></dir><dir name="Model"><file name="Distanceunits.php" hash="cf71d05fac5735ef61171a1cdaaedd4a"/><file name="Pagedisplay.php" hash="ea43ea88d28ea3089e109dc5c5bfe749"/><dir name="Resource"><dir name="Store"><file name="Collection.php" hash="3e5b7a8461bf4ba9f02dce5a5503e3ea"/></dir><file name="Store.php" hash="7c338138100ed08d63179e285a62dfa4"/></dir><file name="Store.php" hash="58bf66acd7f84e6b39845af5fe245927"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Image.php" hash="438f69d1606a4f041b258ac91c4c94ec"/><file name="Marker.php" hash="cb6f17c80d2592d4f1d5343b806ffd07"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ImportController.php" hash="5bbe1920d7dfc2e875ef988f78386262"/><file name="StoreController.php" hash="61fd70f4130dc21eab663b0e60594f16"/></dir><file name="IndexController.php" hash="e21c2bc7017e96e28070a8c79cef135d"/></dir><dir name="etc"><file name="adminhtml.xml" hash="45546a5d586e492c7ca434e3b3b5fa2d"/><file name="config.xml" hash="513c3b9d5a3a408bd46403d989917a7e"/><file name="system.xml" hash="dec55488c57f59c19051c57e9b5f57bc"/></dir><dir name="sql"><dir name="igex_storelocator_setup"><file name="mysql4-install-1.0.0.php" hash="81bb903a0ad5078ee785cf3bbbe01053"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="igex"><file name="storelocator.xml" hash="cd4b5be1cece7b86c94e53dbd2d235b8"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="igex"><file name="storelocator.xml" hash="3fef0e3b693da62b98e4c509f19c0ad8"/></dir></dir><dir name="template"><dir name="igex"><dir name="storelocator"><file name="2columns.phtml" hash="2c19081f4a7d2fdcf4ac13abf6e5aa10"/><file name="2columns.phtml~" hash="c01b8e643ced06a02438017db43f7477"/><file name="storelocator.phtml" hash="61dc3e01aeb6d7c4b3fb4a413780ecad"/><file name="storelocator.phtml~" hash="0528fb05edb2b319629eed84398b8cdd"/></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="igex"><file name="storelocator.css" hash="6497262db7c8591b1ac2d93ffa936ee4"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Igex_StoreLocator.xml" hash="ce698f4b6c3e24d0021ca8a6dc857142"/></dir></target><target name="magemedia"><dir name="storelocator"><dir name="images"><file name="Crosses.png" hash="b90876d9dc1c97060f2f7626a4a334b2"/><file name="IMG_06182013_150241.jpg" hash="8b8fd81bbc6e7ab982e1f91338fc8f60"/><file name="add2.png" hash="b24e5caf9df1e02d953c8679c58f024d"/><file name="button.jpg" hash="28a268f7ef24ba94c047965edefbeed5"/><dir name="default"><file name="Jellyfish.jpg" hash="5a44c7ba5bbe4ec867233d67e4806848"/><file name="add1.png" hash="1c8cbd84d6b998c40ed0e7beacc3fcf6"/></dir><file name="download.jpg" hash="32c3cd3ba462df6f9bacacdda6b799b6"/><file name="download_1_.jpg" hash="5af01a9c6e95caa2a23926c507f3316b"/><file name="download_2_.jpg" hash="121cac4bcc828f31c9a87b82cbf0d37a"/><file name="images.jpg" hash="1554a6298af3485e6d994db4b286384e"/><file name="images_1_.jpg" hash="aa0125afd8c003e8b987abdd8d701b9d"/></dir><dir name="markers"><dir name="default"><file name="dealer_icon_1.png" hash="8e5d4d78a0e6f6830552f26d163b149e"/></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>
skin/frontend/base/default/css/igex/storelocator.css ADDED
@@ -0,0 +1,262 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #map_canvas{
2
+ width : 53%;
3
+ height : 514px;
4
+ float:left;
5
+ margin-left: 1%;
6
+ }
7
+
8
+ #panel{
9
+ float:left;
10
+ margin-top:15px;
11
+ }
12
+
13
+ .store-list{
14
+ width : 45%;
15
+ float : left;
16
+ height : 514px;
17
+ overflow-y:scroll;
18
+ }
19
+ .store-row{
20
+ padding-left: 10px;
21
+ }
22
+ .col-address{
23
+ width : 36%;
24
+ text-transform:uppercase;
25
+ }
26
+ .store-image{
27
+ width:4%;
28
+ }
29
+ .store-table{
30
+ border-bottom: 1px solid grey ;
31
+ width : 100%;
32
+ padding: 10px;
33
+ }
34
+ .first{
35
+ border-top: 1px solid grey ;
36
+ }
37
+
38
+ .store-name{
39
+ cursor: pointer;
40
+ text-decoration: none;
41
+ font-size: 14px;
42
+ }
43
+
44
+ #search .input-text {
45
+ width: 300px;
46
+ padding: 5px;
47
+ }
48
+ #search{
49
+ margin-bottom: 10px;
50
+ margin-right:10px;
51
+ float:left;
52
+ }
53
+
54
+
55
+ .igex_input_box {
56
+ border: 1px solid #b6b6b6;
57
+ font-size: 12px;
58
+ padding: 5px 5px 6px;
59
+ width: 254px;
60
+ }
61
+
62
+ .str_add_box {
63
+ float: left;
64
+ margin-top: 20px;
65
+ width: 100%;
66
+ }
67
+ .str_add_box_lft {
68
+ float: left;
69
+ width: 50%;
70
+ padding-bottom:10px;
71
+ }
72
+ .str_add_left {
73
+ float: left;
74
+ width: 42%;
75
+ }
76
+ .str_add_left img {
77
+ border: 1px solid #A6B1B8;
78
+ float: left;
79
+ width: 185px;
80
+ }
81
+
82
+ .str_add_right {
83
+ float: left;
84
+ width: 58%;
85
+ }
86
+
87
+ .str_add_right_head {
88
+ color: #E76200;
89
+ float: left;
90
+ font-size: 15px;
91
+ font-weight: bold;
92
+ text-transform: uppercase;
93
+ width: 100%;
94
+ margin-left:5px;
95
+ }
96
+
97
+ .str_add_txt {
98
+ float: left;
99
+ margin-top: 15px;
100
+ width: 100%;
101
+ }
102
+
103
+ .str_add_txt ul {
104
+ margin: 0;
105
+ padding: 0;
106
+ }
107
+
108
+ .add_tel {
109
+ color: #808D95;
110
+ float: left;
111
+ font-family: Arial,Helvetica,sans-serif;
112
+ font-size: 13px;
113
+ line-height: 20px;
114
+ margin-top: 8px;
115
+ width: 100%;
116
+ margin-left:5px;
117
+ }
118
+
119
+ .str_add_txt li {
120
+ color: #808D95;
121
+ float: left;
122
+ font-family: Arial,Helvetica,sans-serif;
123
+ font-size: 13px;
124
+ line-height: 20px;
125
+ width: 100%;
126
+ margin-left:5px;
127
+ }
128
+
129
+ .st_link {
130
+ float: left;
131
+ margin-top: 30px;
132
+ width: 100%;
133
+ }
134
+
135
+ .st_link ul {
136
+ margin: 0;
137
+ padding: 0;
138
+ }
139
+
140
+ .st_link li:first-child {
141
+ padding: 0 16px 0 0;
142
+ }
143
+
144
+ .st_link li {
145
+ float: left;
146
+ padding: 0 16px;
147
+ }
148
+
149
+ .st_link li.active a {
150
+ text-decoration: underline;
151
+ }
152
+
153
+ .st_link li a {
154
+ color: #808D95;
155
+ float: left;
156
+ font-family: Arial,Helvetica,sans-serif;
157
+ font-weight: bold;
158
+ text-align: center;
159
+ text-decoration: none;
160
+ }
161
+ .label {
162
+ color: #666666;
163
+ float: left;
164
+ font-weight: bold;
165
+ position: relative;
166
+ z-index: 0;
167
+ }
168
+
169
+ .button
170
+ {
171
+ color:#FFFFFF;
172
+ background:#E76200;
173
+ cursor:pointer;
174
+ font: 12px/33px Arial,Helvetica,sans-serif;
175
+ height:28px !important;
176
+ margin:0;
177
+ overflow:visible;
178
+ padding-left:12px;
179
+ padding-right:12px;
180
+ text-align: center;
181
+ white-space:nowrap;
182
+ width:auto;
183
+ font-weight:bold;
184
+ border:0;
185
+ }
186
+
187
+ .note
188
+ {
189
+ background-color: #FAFAEC;
190
+ border-color: #FCD344;
191
+ color: #3D6611;
192
+ background-position: 10px 9px !important;
193
+ background-repeat: no-repeat !important;
194
+ border-style: solid !important;
195
+ border-width: 1px !important;
196
+ font-size: 14px !important;
197
+ font-weight: bold !important;
198
+ min-height: 24px !important;
199
+ padding: 8px 8px 8px 32px !important;
200
+ }
201
+
202
+ .span-geoloc{
203
+ cursor:pointer;
204
+ background-color: #7e2222;
205
+ color:#fff;
206
+ border-top: 1px solid #000000;
207
+ border-left: 1px solid #000000;
208
+ border-bottom: 2px solid #808080;
209
+ border-right: 2px solid #808080;
210
+ /*-moz-box-shadow: inset -1px -1px grey;
211
+ -webkit-box-shadow: inset -1px -1px grey;
212
+ padding : 1px 5px 0px 5px;
213
+ clear:both;
214
+ float:right;
215
+ margin-top:5px;*/
216
+ }
217
+ .span-geoloc:active{
218
+ background-color: #6b1b1b;
219
+ border-bottom: 2px solid #696969;
220
+ border-right: 2px solid #696969;
221
+ }
222
+
223
+ .pac-container .pac-item{
224
+ text-align:left;
225
+ }
226
+
227
+ .store-description{
228
+ width:350px;
229
+ padding-top:10px;
230
+ clear:both;
231
+ overflow-y: auto;
232
+ max-height: 100px;
233
+ }
234
+
235
+ .store-info{
236
+ max-height:400px;
237
+ min-width:300px;
238
+ }
239
+ .store-image-infoWindow {
240
+ width:135px;
241
+ height:135px;
242
+ border:1px solid #808D95;
243
+ }
244
+
245
+ .store-image-div-infoWindow{
246
+ float:left;
247
+ }
248
+
249
+ .store-name-infoWindow{
250
+ width:150px;
251
+ float:left;
252
+ margin-left:15px;
253
+ }
254
+
255
+ .store-name-infoWindow h3{
256
+ font-size:14px;
257
+ }
258
+
259
+ .str_add_box_rgt {
260
+ float: left;
261
+ width: 50%;
262
+ }