Clarion_Storelocator - Version 1.0.0

Version Notes

First stable release 1.0.0

Download this release

Release Info

Developer Clarion Tech
Extension Clarion_Storelocator
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (39) hide show
  1. app/code/community/Clarion/Storelocator/Block/Adminhtml/Storelocator.php +42 -0
  2. app/code/community/Clarion/Storelocator/Block/Adminhtml/Storelocator/Edit.php +68 -0
  3. app/code/community/Clarion/Storelocator/Block/Adminhtml/Storelocator/Edit/Form.php +29 -0
  4. app/code/community/Clarion/Storelocator/Block/Adminhtml/Storelocator/Edit/Tab/Description.php +46 -0
  5. app/code/community/Clarion/Storelocator/Block/Adminhtml/Storelocator/Edit/Tab/Display.php +36 -0
  6. app/code/community/Clarion/Storelocator/Block/Adminhtml/Storelocator/Edit/Tab/Form.php +112 -0
  7. app/code/community/Clarion/Storelocator/Block/Adminhtml/Storelocator/Edit/Tab/Googlemap.PHP +56 -0
  8. app/code/community/Clarion/Storelocator/Block/Adminhtml/Storelocator/Edit/Tabs.php +59 -0
  9. app/code/community/Clarion/Storelocator/Block/Adminhtml/Storelocator/Grid.php +219 -0
  10. app/code/community/Clarion/Storelocator/Block/List.php +230 -0
  11. app/code/community/Clarion/Storelocator/Block/View.php +107 -0
  12. app/code/community/Clarion/Storelocator/Helper/Admin.php +21 -0
  13. app/code/community/Clarion/Storelocator/Helper/Data.php +129 -0
  14. app/code/community/Clarion/Storelocator/Helper/Image.php +200 -0
  15. app/code/community/Clarion/Storelocator/Model/Enabledisable.php +29 -0
  16. app/code/community/Clarion/Storelocator/Model/Resource/Setup.php +12 -0
  17. app/code/community/Clarion/Storelocator/Model/Resource/Storelocator.php +51 -0
  18. app/code/community/Clarion/Storelocator/Model/Resource/Storelocator/Collection.php +47 -0
  19. app/code/community/Clarion/Storelocator/Model/Storelocator.php +33 -0
  20. app/code/community/Clarion/Storelocator/controllers/Adminhtml/ManagestorelocatorController.php +477 -0
  21. app/code/community/Clarion/Storelocator/controllers/IndexController.php +118 -0
  22. app/code/community/Clarion/Storelocator/data/clarion_storelocator_setup/data-install-0.1.0.php +134 -0
  23. app/code/community/Clarion/Storelocator/etc/adminhtml.xml +68 -0
  24. app/code/community/Clarion/Storelocator/etc/config.xml +156 -0
  25. app/code/community/Clarion/Storelocator/etc/system.xml +92 -0
  26. app/code/community/Clarion/Storelocator/sql/clarion_storelocator_setup/install-0.1.0.php +133 -0
  27. app/design/adminhtml/default/default/layout/clarion_storelocator.xml +41 -0
  28. app/design/frontend/base/default/layout/clarion_storelocator.xml +81 -0
  29. app/design/frontend/base/default/template/clarion/storelocator/list.phtml +230 -0
  30. app/design/frontend/base/default/template/clarion/storelocator/view.phtml +166 -0
  31. app/etc/modules/Clarion_Storelocator.xml +17 -0
  32. media/clarion_storelocator/demo1.png +0 -0
  33. media/clarion_storelocator/demo2.png +0 -0
  34. media/clarion_storelocator/demo3.png +0 -0
  35. media/clarion_storelocator/demo4.png +0 -0
  36. media/clarion_storelocator/demo5.png +0 -0
  37. package.xml +18 -0
  38. skin/frontend/base/default/css/clarion_storelocator.css +146 -0
  39. skin/frontend/base/default/js/clarion_storelocator/storelocator.js +103 -0
app/code/community/Clarion/Storelocator/Block/Adminhtml/Storelocator.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Grid container file
4
+ *
5
+ * @category Clarion
6
+ * @package Clarion_Storelocator
7
+ * @author Clarion Magento Team
8
+ *
9
+ */
10
+ class Clarion_Storelocator_Block_Adminhtml_Storelocator extends Mage_Adminhtml_Block_Widget_Grid_Container
11
+ {
12
+ public function __construct()
13
+ {
14
+ /*both these variables tell magento the location of our Grid.php(grid block) file.
15
+ * $this->_blockGroup.'/' . $this->_controller . '_grid'
16
+ * i.e clarion_storelocator/adminhtml_storelocator_grid
17
+ * $_blockGroup - is your module's name.
18
+ * $_controller - is the path to your grid block.
19
+ */
20
+ $this->_controller = 'adminhtml_storelocator';
21
+ $this->_blockGroup = 'clarion_storelocator';
22
+ $this->_headerText = Mage::helper('clarion_storelocator')->__('Manage Stores');
23
+
24
+ parent::__construct();
25
+
26
+ //$this->_addButtonLabel = Mage::helper('clarion_storelocator')->__('Add New Store');
27
+
28
+ if (Mage::helper('clarion_storelocator/admin')->isActionAllowed('save')) {
29
+ $this->_updateButton('add', 'label', Mage::helper('clarion_storelocator')->__('Add New Store'));
30
+ } else {
31
+ $this->_removeButton('add');
32
+ }
33
+
34
+ $this->addButton(
35
+ 'flush_stores_images_cache',
36
+ array(
37
+ 'label' => Mage::helper('clarion_storelocator')->__('Flush Stores Images Cache'),
38
+ 'onclick' => 'setLocation(\'' . $this->getUrl('*/*/flush') . '\')',
39
+ )
40
+ );
41
+ }
42
+ }
app/code/community/Clarion/Storelocator/Block/Adminhtml/Storelocator/Edit.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Store locator form container
4
+ *
5
+ * @category Clarion
6
+ * @package Clarion_Storelocator
7
+ * @author Clarion Magento Team
8
+ */
9
+ class Clarion_Storelocator_Block_Adminhtml_Storelocator_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
10
+ {
11
+ public function __construct()
12
+ {
13
+ /**
14
+ * This variable is used in the form URL’s.
15
+ * This variable has the forms entity primary key, e.g the delete button URL would be
16
+ * module/controller/action/$this->_objectid/3
17
+ */
18
+ $this->_objectId = 'store_id';
19
+
20
+ /*
21
+ * There two variables are very important, these variables are used to find FORM tags php file.
22
+ * i.e the path of the form tags php file should be
23
+ * {$this->_blockGroup . ‘/’ . $this->_controller . ‘_’ . $this->_mode . ‘_form’}.
24
+ * The value of $this->_mode by default is ‘edit’. So the path of the php file which contains
25
+ * the form tag in our case would be ‘clarion_storelocator/adminhtml_storelocator_edit_form’.
26
+ */
27
+ $this->_blockGroup = 'clarion_storelocator';
28
+ $this->_controller = 'adminhtml_storelocator';
29
+
30
+ parent::__construct();
31
+
32
+ /**
33
+ * $this->_updateButton() and $this->_addButton() are used to add update/add buttons to the form container.
34
+ */
35
+ $this->_updateButton('save', 'label', Mage::helper('clarion_storelocator')->__('Save Store'));
36
+ $this->_updateButton('delete', 'label', Mage::helper('clarion_storelocator')->__('Delete Store'));
37
+
38
+ $this->_addButton(
39
+ 'saveandcontinue',
40
+ array(
41
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
42
+ 'onclick' => 'saveAndContinueEdit()',
43
+ 'class' => 'save',
44
+ ),
45
+ 100
46
+ );
47
+
48
+ $this->_formScripts[] = "
49
+ function saveAndContinueEdit(){
50
+ editForm.submit($('edit_form').action+'back/edit/');
51
+ }
52
+ ";
53
+ }
54
+
55
+ /**
56
+ * This function return’s the Text to display as the form header.
57
+ */
58
+ public function getHeaderText()
59
+ {
60
+ if (Mage::registry('storelocator_data')->getId()) {
61
+ return Mage::helper('clarion_storelocator')->__("Edit Store '%s'", $this->escapeHtml(Mage::registry('storelocator_data')->getName()));
62
+ }
63
+ else {
64
+ return Mage::helper('clarion_storelocator')->__('New Store');
65
+ }
66
+ }
67
+
68
+ }
app/code/community/Clarion/Storelocator/Block/Adminhtml/Storelocator/Edit/Form.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Form tag class file
4
+ *
5
+ * @category Clarion
6
+ * @package Clarion_Storelocator
7
+ * @author Clarion Magento Team
8
+ */
9
+ class Clarion_Storelocator_Block_Adminhtml_Storelocator_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
10
+ {
11
+ /*
12
+ * Adds form tag
13
+ */
14
+ protected function _prepareForm()
15
+ {
16
+ $form = new Varien_Data_Form(array(
17
+ 'id' => 'edit_form',
18
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
19
+ 'method' => 'post',
20
+ 'enctype' => 'multipart/form-data'
21
+ )
22
+ );
23
+
24
+ $form->setUseContainer(true);
25
+ // This line is important because it is the line that actually causes the form renderer to output the surrounding <form> tags.
26
+ $this->setForm($form);
27
+ return parent::_prepareForm();
28
+ }
29
+ }
app/code/community/Clarion/Storelocator/Block/Adminhtml/Storelocator/Edit/Tab/Description.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Description tab class file
4
+ *
5
+ * @category Clarion
6
+ * @package Clarion_Storelocator
7
+ * @author Clarion Magento Team
8
+ */
9
+
10
+ class Clarion_Storelocator_Block_Adminhtml_Storelocator_Edit_Tab_Description extends Mage_Adminhtml_Block_Widget_Form
11
+ {
12
+ /**
13
+ * Load Wysiwyg on demand and Prepare layout
14
+ */
15
+ protected function _prepareLayout()
16
+ {
17
+ parent::_prepareLayout();
18
+ if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
19
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
20
+ }
21
+ }
22
+
23
+ protected function _prepareForm()
24
+ {
25
+ $model = Mage::registry('storelocator_data');
26
+
27
+ $form = new Varien_Data_Form();
28
+ $this->setForm($form);
29
+ $fieldset = $form->addFieldset('form_General', array('legend'=>Mage::helper('clarion_storelocator')->__('Description')));
30
+
31
+ $wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig(
32
+ array('tab_id' => $this->getTabId())
33
+ );
34
+
35
+ $fieldset->addField('description', 'editor', array(
36
+ 'label' => Mage::helper('clarion_storelocator')->__('Description'),
37
+ 'title' => Mage::helper('clarion_storelocator')->__('Description'),
38
+ 'name' => 'description',
39
+ 'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(),
40
+ 'style' => 'height:20em; width:53em',
41
+ ));
42
+
43
+ $form->setValues($model->getData());
44
+ return parent::_prepareForm();
45
+ }
46
+ }
app/code/community/Clarion/Storelocator/Block/Adminhtml/Storelocator/Edit/Tab/Display.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Display tab class file
4
+ *
5
+ * @category Clarion
6
+ * @package Clarion_Storelocator
7
+ * @author Clarion Magento Team
8
+ */
9
+
10
+ class Clarion_Storelocator_Block_Adminhtml_Storelocator_Edit_Tab_Display extends Mage_Adminhtml_Block_Widget_Form
11
+ {
12
+ protected function _prepareForm()
13
+ {
14
+ $model = Mage::registry('storelocator_data');
15
+ $yesno = Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray();
16
+ $enabledisable = Mage::getModel('adminhtml/system_config_source_enabledisable')->toOptionArray();
17
+
18
+ $form = new Varien_Data_Form();
19
+ $this->setForm($form);
20
+ $fieldset = $form->addFieldset('form_Genera_Display', array('legend'=>Mage::helper('clarion_storelocator')->__('Display')));
21
+
22
+ $fieldset->addField('status', 'select', array(
23
+ 'name' => 'status',
24
+ 'label' => Mage::helper('clarion_storelocator')->__('Status'),
25
+ 'title' => Mage::helper('clarion_storelocator')->__('Status'),
26
+ 'value' => '1',
27
+ 'values' => $enabledisable,
28
+ ));
29
+
30
+ $data = $model->getData();
31
+ if(!empty($data)) {
32
+ $form->setValues($data);
33
+ }
34
+ return parent::_prepareForm();
35
+ }
36
+ }
app/code/community/Clarion/Storelocator/Block/Adminhtml/Storelocator/Edit/Tab/Form.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * General tab class file
4
+ *
5
+ * @category Clarion
6
+ * @package Clarion_Storelocator
7
+ * @author Clarion Magento Team
8
+ */
9
+
10
+ class Clarion_Storelocator_Block_Adminhtml_Storelocator_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
11
+ {
12
+ protected function _prepareForm()
13
+ {
14
+ $model = Mage::registry('storelocator_data');
15
+
16
+ if ($data = $model->getData()) {
17
+ if(isset($data['store_logo'])) {
18
+ $data['store_logo'] = 'clarion_storelocator/' . $data['store_logo'];
19
+ }
20
+ } else {
21
+ $data = array();
22
+ }
23
+
24
+ $form = new Varien_Data_Form();
25
+ $this->setForm($form);
26
+ $fieldset = $form->addFieldset('form_General', array('legend'=>Mage::helper('clarion_storelocator')->__('General information')));
27
+
28
+ if ($model->getId()) {
29
+ $fieldset->addField('store_id', 'hidden', array(
30
+ 'name' => 'store_id',
31
+ ));
32
+ }
33
+
34
+ $fieldset->addField('name', 'text', array(
35
+ 'label' => Mage::helper('clarion_storelocator')->__('Store Name'),
36
+ 'class' => 'required-entry',
37
+ 'required' => true,
38
+ 'name' => 'name',
39
+ ));
40
+
41
+ $fieldset->addField('street_address', 'text', array(
42
+ 'label' => Mage::helper('clarion_storelocator')->__('Street Address'),
43
+ 'name' => 'street_address',
44
+ ));
45
+
46
+ $fieldset->addField('country', 'select', array(
47
+ 'name' => 'country',
48
+ 'class' => 'required-select',
49
+ 'required' => true,
50
+ 'label' => 'Country',
51
+ 'values' => Mage::getModel('adminhtml/system_config_source_country')->toOptionArray(),
52
+ ));
53
+
54
+ $fieldset->addField('state', 'text', array(
55
+ 'label' => Mage::helper('clarion_storelocator')->__('State'),
56
+ 'class' => 'required-entry',
57
+ 'required' => true,
58
+ 'name' => 'state',
59
+ ));
60
+
61
+ $fieldset->addField('city', 'text', array(
62
+ 'label' => Mage::helper('clarion_storelocator')->__('City'),
63
+ 'class' => 'required-entry',
64
+ 'required' => true,
65
+ 'name' => 'city',
66
+ ));
67
+
68
+ $fieldset->addField('zipcode', 'text', array(
69
+ 'label' => Mage::helper('clarion_storelocator')->__('Zipcode'),
70
+ 'required' => true,
71
+ 'name' => 'zipcode',
72
+ ));
73
+
74
+ $fieldset->addField('phone', 'text', array(
75
+ 'label' => Mage::helper('clarion_storelocator')->__('Phone'),
76
+ 'name' => 'phone',
77
+ ));
78
+
79
+ $fieldset->addField('fax', 'text', array(
80
+ 'label' => Mage::helper('clarion_storelocator')->__('Fax'),
81
+ 'name' => 'fax',
82
+ ));
83
+
84
+ $fieldset->addField('url', 'text', array(
85
+ 'label' => Mage::helper('clarion_storelocator')->__('Store Url'),
86
+ 'class' => 'validate-clean-url',
87
+ 'name' => 'url',
88
+ ));
89
+
90
+ $fieldset->addField('email', 'text', array(
91
+ 'label' => Mage::helper('clarion_storelocator')->__('Email'),
92
+ 'class' => 'validate-email',
93
+ 'name' => 'email',
94
+ ));
95
+
96
+ $fieldset->addField('store_logo', 'image', array(
97
+ 'label' => Mage::helper('clarion_storelocator')->__('Store Logo'),
98
+ 'name' => 'store_logo',
99
+ 'note' => 'Allowed extensions are jpg, jpeg, gif, png',
100
+ ));
101
+
102
+ $fieldset->addField('trading_hours', 'text', array(
103
+ 'label' => Mage::helper('clarion_storelocator')->__('Trading Hours'),
104
+ 'name' => 'trading_hours',
105
+ ));
106
+
107
+ if(!empty($data)) {
108
+ $form->setValues($data);
109
+ }
110
+ return parent::_prepareForm();
111
+ }
112
+ }
app/code/community/Clarion/Storelocator/Block/Adminhtml/Storelocator/Edit/Tab/Googlemap.PHP ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Google map tab class file
4
+ *
5
+ * @category Clarion
6
+ * @package Clarion_Storelocator
7
+ * @author Clarion Magento Team
8
+ */
9
+
10
+ class Clarion_Storelocator_Block_Adminhtml_Storelocator_Edit_Tab_Googlemap extends Mage_Adminhtml_Block_Widget_Form
11
+ {
12
+ protected function _prepareForm()
13
+ {
14
+ $model = Mage::registry('storelocator_data');
15
+
16
+ $form = new Varien_Data_Form();
17
+ $this->setForm($form);
18
+ $fieldset = $form->addFieldset('form_General_Googlemap', array('legend'=>Mage::helper('clarion_storelocator')->__('Google Map')));
19
+
20
+ $radiusConfigValue = Mage::getStoreConfig('clarion_storelocator_general_setting/clarion_storelocator_display_setting/default_radius');
21
+ $fieldset->addField('radius', 'text', array(
22
+ 'label' => Mage::helper('clarion_storelocator')->__('Radius'),
23
+ 'note' => Mage::helper('clarion_storelocator')->__('Radius is in miles. If kept blank then default configured radius will be used (System > Configuration > Store Locator)'),
24
+ 'name' => 'radius',
25
+ 'value' => $radiusConfigValue,
26
+ ));
27
+
28
+ $fieldset->addField('latitude', 'text', array(
29
+ 'label' => Mage::helper('clarion_storelocator')->__('Latitude'),
30
+ 'class' => 'validate-number',
31
+ 'required' => true,
32
+ 'name' => 'latitude',
33
+ ));
34
+
35
+ $fieldset->addField('longitude', 'text', array(
36
+ 'label' => Mage::helper('clarion_storelocator')->__('Longitude'),
37
+ 'class' => 'validate-number',
38
+ 'required' => true,
39
+ 'name' => 'longitude',
40
+ ));
41
+
42
+ $zoomLevelConfigValue = Mage::getStoreConfig('clarion_storelocator_general_setting/clarion_storelocator_display_setting/zoom_level');
43
+ $fieldset->addField('zoom_level', 'text', array(
44
+ 'label' => Mage::helper('clarion_storelocator')->__('Zoom Level '),
45
+ 'note' => Mage::helper('clarion_storelocator')->__('If kept blank then default configured zoom level will be used (System > Configuration > Store Locator)'),
46
+ 'name' => 'zoom_level',
47
+ 'value' => $zoomLevelConfigValue,
48
+ ));
49
+
50
+ $data = $model->getData();
51
+ if(!empty($data)) {
52
+ $form->setValues($data);
53
+ }
54
+ return parent::_prepareForm();
55
+ }
56
+ }
app/code/community/Clarion/Storelocator/Block/Adminhtml/Storelocator/Edit/Tabs.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Form tabs class file
4
+ *
5
+ * @category Clarion
6
+ * @package Clarion_Storelocator
7
+ * @author Clarion Magento Team
8
+ */
9
+ class Clarion_Storelocator_Block_Adminhtml_Storelocator_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
10
+ {
11
+ /*
12
+ * constructor function
13
+ */
14
+ public function __construct()
15
+ {
16
+ parent::__construct();
17
+ $this->setId('storelocator_tabs');
18
+ $this->setDestElementId('edit_form'); // this should be same as the form id define in form tag class file
19
+ $this->setTitle(Mage::helper('clarion_storelocator')->__('Store Information'));
20
+ }
21
+
22
+ /**
23
+ * So in the _beforeToHtml() function we specified the actual form field's location.
24
+ * ie for the first tab, we want to create the file Form.php in the location
25
+ * Excellence/Employee/Block/Adminhtml/Employee/Edit/Tab and for the second tab
26
+ * we want to create Image.php in the location Excellence/Employee/Block/Adminhtml/Employee/Edit/Tab.
27
+ */
28
+ protected function _beforeToHtml()
29
+ {
30
+ /**
31
+ * $this->addTab function used to add as many tabs as you want in your form.
32
+ */
33
+ $this->addTab('form_section_general', array(
34
+ 'label' => Mage::helper('clarion_storelocator')->__('General'),
35
+ 'title' => Mage::helper('clarion_storelocator')->__('General'),
36
+ 'content' => $this->getLayout()->createBlock('clarion_storelocator/adminhtml_storelocator_edit_tab_form')->toHtml(),
37
+ ));
38
+
39
+ $this->addTab('form_section_google_map', array(
40
+ 'label' => Mage::helper('clarion_storelocator')->__('Google Map'),
41
+ 'title' => Mage::helper('clarion_storelocator')->__('Google Map'),
42
+ 'content' => $this->getLayout()->createBlock('clarion_storelocator/adminhtml_storelocator_edit_tab_googlemap')->toHtml(),
43
+ ));
44
+
45
+ $this->addTab('form_section_display', array(
46
+ 'label' => Mage::helper('clarion_storelocator')->__('Display'),
47
+ 'title' => Mage::helper('clarion_storelocator')->__('Display'),
48
+ 'content' => $this->getLayout()->createBlock('clarion_storelocator/adminhtml_storelocator_edit_tab_display')->toHtml(),
49
+ ));
50
+
51
+ $this->addTab('form_section_description', array(
52
+ 'label' => Mage::helper('clarion_storelocator')->__('Description'),
53
+ 'title' => Mage::helper('clarion_storelocator')->__('Description'),
54
+ 'content' => $this->getLayout()->createBlock('clarion_storelocator/adminhtml_storelocator_edit_tab_description')->toHtml(),
55
+ ));
56
+
57
+ return parent::_beforeToHtml();
58
+ }
59
+ }
app/code/community/Clarion/Storelocator/Block/Adminhtml/Storelocator/Grid.php ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Manage Storelocator grid block
4
+ *
5
+ * @category Clarion
6
+ * @package Clarion_Storelocator
7
+ * @author Clarion Magento Team
8
+ *
9
+ */
10
+ class Clarion_Storelocator_Block_Adminhtml_Storelocator_Grid extends Mage_Adminhtml_Block_Widget_Grid
11
+ {
12
+ public function __construct()
13
+ {
14
+ parent::__construct();
15
+ /** This set’s the ID of our grid i.e the html id attribute of the <div>.
16
+ * If you’re using multiple grids in a page then id needs to be unique.
17
+ */
18
+ $this->setId('StorelocatorGrid');
19
+
20
+ /**
21
+ * This tells which sorting column to use in our grid. Which column
22
+ * should be used for default sorting
23
+ */
24
+ $this->setDefaultSort('store_id');
25
+
26
+ /**
27
+ * The default sorting order, ascending or descending
28
+ */
29
+ $this->setDefaultDir('DESC');
30
+
31
+ /**
32
+ * this basically sets your grid operations in session. Example, if we
33
+ * were on page2 of grid or we had searched something on grid when
34
+ * refreshing or coming back to the page, the grid operations will
35
+ * still be there. It won’t revert back to its default form.
36
+ */
37
+ $this->setSaveParametersInSession(true);
38
+ $this->setUseAjax(true);
39
+ }
40
+
41
+ /**
42
+ * Prepare storelocator grid collection object
43
+ *
44
+ * @return Clarion_Storelocator_Block_Adminhtml_Storelocator_Grid
45
+ */
46
+ protected function _prepareCollection()
47
+ {
48
+ $collection = Mage::getModel('clarion_storelocator/storelocator')->getCollection();
49
+ /* @var $collection Clarion_Storelocator_Model_Resource_Storelocator_Collection */
50
+ $this->setCollection($collection);
51
+ return parent::_prepareCollection();
52
+ }
53
+
54
+ /**
55
+ * Prepare default grid column
56
+ *
57
+ * @return Clarion_Storelocator_Block_Adminhtml_Storelocator_Grid
58
+ */
59
+ protected function _prepareColumns()
60
+ {
61
+ /**
62
+ * ‘id’ an unique id for column
63
+ * ‘header’ is the name of the column
64
+ * ‘index’ is the field from our collection. This ‘id’ column needs to be
65
+ * present in our collection’s models.
66
+ */
67
+
68
+ $enableDisable = Mage::getModel('clarion_storelocator/enabledisable')->toArray();
69
+
70
+ $this->addColumn('store_id', array(
71
+ 'header'=>Mage::helper('clarion_storelocator')->__('Store Id'),
72
+ 'sortable'=>true,
73
+ 'type' => 'number',
74
+ 'index'=>'store_id'
75
+ ));
76
+
77
+ $this->addColumn('name', array(
78
+ 'header'=>Mage::helper('clarion_storelocator')->__('Store Name'),
79
+ 'sortable'=>true,
80
+ 'index'=>'name'
81
+ ));
82
+
83
+ $this->addColumn('country', array(
84
+ 'header'=>Mage::helper('clarion_storelocator')->__('Country'),
85
+ 'sortable'=>true,
86
+ 'index'=>'country',
87
+ 'type' => 'country',
88
+ ));
89
+
90
+ $this->addColumn('state', array(
91
+ 'header'=>Mage::helper('clarion_storelocator')->__('State'),
92
+ 'sortable'=>true,
93
+ 'index'=>'state'
94
+ ));
95
+
96
+ $this->addColumn('city', array(
97
+ 'header'=>Mage::helper('clarion_storelocator')->__('City'),
98
+ 'sortable'=>true,
99
+ 'index'=>'city'
100
+ ));
101
+
102
+ $this->addColumn('zipcode', array(
103
+ 'header'=>Mage::helper('clarion_storelocator')->__('Zipcode'),
104
+ 'sortable'=>true,
105
+ 'index'=>'zipcode'
106
+ ));
107
+
108
+ $this->addColumn('status', array(
109
+ 'header'=>Mage::helper('clarion_storelocator')->__('Status'),
110
+ 'index' => 'status',
111
+ 'width'=>'100px',
112
+ 'type' => 'options',
113
+ 'options' => $enableDisable,
114
+ ));
115
+
116
+ /**
117
+ * Adding Different Options To Grid Rows
118
+ */
119
+ $this->addColumn('action',
120
+ array(
121
+ 'header' => Mage::helper('clarion_storelocator')->__('Action'),
122
+ 'type' => 'action',
123
+ 'getter' => 'getId',
124
+ 'actions' => array(
125
+ array(
126
+ 'caption' => Mage::helper('clarion_storelocator')->__('Edit'),
127
+ 'url' => array('base'=> '*/*/edit'),
128
+ 'field' => 'store_id'
129
+ )
130
+ ),
131
+ 'filter' => false,
132
+ 'sortable' => false,
133
+ 'index' => 'stores',
134
+ 'is_system' => true,
135
+ ));
136
+
137
+ //Import Export functionality
138
+ $this->addExportType('*/*/exportCsv', Mage::helper('clarion_storelocator')->__('CSV'));
139
+ $this->addExportType('*/*/exportXml', Mage::helper('clarion_storelocator')->__('XML'));
140
+
141
+ return parent::_prepareColumns();
142
+ }
143
+
144
+ /**
145
+ * Row click url.
146
+ * when user click on any rows of the grid it goes to a specific URL.
147
+ * URL is of the editAction of your controller and it passed the row’s id as a parameter.
148
+ * @param object $row Data row object
149
+ * @return string
150
+ */
151
+ public function getRowUrl($row)
152
+ {
153
+ return $this->getUrl('*/*/edit', array('store_id' => $row->getId()));
154
+ }
155
+
156
+ /**
157
+ * Mass Actions.
158
+ *
159
+ * These used basically to do operations on multiple rows together.
160
+ */
161
+ protected function _prepareMassaction()
162
+ {
163
+ /**
164
+ * id is the database column that serves as the unique identifier throughout
165
+ * your data structure, including: db table, single product magento model
166
+ * , and the collection.
167
+ */
168
+ $this->setMassactionIdField('store_id');
169
+
170
+ /**
171
+ * By using this we can set name of checkbox, used for selection. Which
172
+ * is used to pass all the ids to the controller.
173
+ */
174
+ $this->getMassactionBlock()->setFormFieldName('storeIds');
175
+
176
+ /**
177
+ * url - sets url for the delete action
178
+ * confirm - This shows the user a confirm dialog before submitting the URL
179
+ */
180
+ $this->getMassactionBlock()->addItem('delete', array(
181
+ 'label' => Mage::helper('clarion_storelocator')->__('Delete'),
182
+ 'url' => $this->getUrl('*/*/massDelete'),
183
+ 'confirm' => Mage::helper('clarion_storelocator')->__('Are you sure?')
184
+ ));
185
+
186
+ /**
187
+ * Get the enable disable drop down array
188
+ */
189
+ $enableDisable = Mage::getModel('clarion_storelocator/enabledisable')->toOptionArray();
190
+
191
+ $this->getMassactionBlock()->addItem('status', array(
192
+ 'label'=> Mage::helper('clarion_storelocator')->__('Change status'),
193
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
194
+ 'additional' => array(
195
+ 'visibility' => array(
196
+ 'name' => 'status',
197
+ 'type' => 'select',
198
+ 'class' => 'required-entry',
199
+ 'label' => Mage::helper('clarion_storelocator')->__('Status'),
200
+ 'values' => $enableDisable
201
+ )
202
+ )
203
+ ));
204
+ return $this;
205
+ }
206
+
207
+ /**
208
+ * Used for Ajax Based Grid
209
+ *
210
+ * URL which is called in the Ajax Request, to the get
211
+ * the content of the grid. _current Uses the current module, controller,
212
+ * action and parameters.
213
+ *
214
+ */
215
+ public function getGridUrl()
216
+ {
217
+ return $this->getUrl('*/*/grid', array('_current'=>true));
218
+ }
219
+ }
app/code/community/Clarion/Storelocator/Block/List.php ADDED
@@ -0,0 +1,230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Store List block
4
+ *
5
+ * @category Clarion
6
+ * @package Clarion_Storelocator
7
+ * @author Clarion Magento Team
8
+ *
9
+ */
10
+ class Clarion_Storelocator_Block_List extends Mage_Core_Block_Template
11
+ {
12
+
13
+ /**
14
+ * Stores collection
15
+ *
16
+ * @var Clarion_Storelocator_Model_Resource_Storelocator_Collection
17
+ */
18
+ protected $_storesCollection = null;
19
+
20
+ /**
21
+ * Retrieve stores collection
22
+ *
23
+ * @return Clarion_Storelocator_Model_Resource_Storelocator_Collection
24
+ */
25
+ protected function _getStoreCollection()
26
+ {
27
+ $collection = Mage::getModel('clarion_storelocator/storelocator')->getCollection()
28
+ ->addStatusFilter();
29
+ return $collection;
30
+ }
31
+
32
+ /**
33
+ * Retrieve prepared stores collection
34
+ *
35
+ * @return Clarion_Storelocator_Model_Resource_Storelocator_Collection
36
+ */
37
+ public function getStoreCollection()
38
+ {
39
+ //search by country state city
40
+ $data = $this->getRequest()->getQuery();
41
+ $country = '';
42
+ $state = '';
43
+ $city = '';
44
+ if(!empty($data)){
45
+ if(isset($data['country'])){
46
+ $country = $data['country'];
47
+ }
48
+
49
+ if(isset($data['state'])){
50
+ $state = $data['state'];
51
+ }
52
+
53
+ if(isset($data['city'])){
54
+ $city = $data['city'];
55
+ }
56
+ }
57
+
58
+ //Zend_Debug::dump($data);
59
+
60
+ if (is_null($this->_storesCollection)) {
61
+ $this->_storesCollection = $this->_getStoreCollection();
62
+ $this->_storesCollection->prepareForList($this->getCurrentPage());
63
+ //search by country
64
+ if(!empty($country)){
65
+ $this->_storesCollection->addFieldToFilter('country', array('like'=>$country));
66
+ }
67
+
68
+ //search by state
69
+ if(!empty($state)){
70
+ $this->_storesCollection->addFieldToFilter('state', array('like'=>$state));
71
+ }
72
+
73
+ //search by city
74
+ if(!empty($city)){
75
+ $this->_storesCollection->addFieldToFilter('city', array('like'=>$city));
76
+ }
77
+ }
78
+ //echo $this->_storesCollection->getSelect();
79
+ return $this->_storesCollection;
80
+ }
81
+
82
+ /**
83
+ * Return URL to stores's view page
84
+ *
85
+ * @param Clarion_Storelocator_Model_Storelocator $storelocator
86
+ * @return string
87
+ */
88
+ public function getStoreUrl($storelocator)
89
+ {
90
+ return $this->getUrl('*/*/view', array('id' => $storelocator->getId()));
91
+ }
92
+
93
+ /**
94
+ * Fetch the current page for the stores list
95
+ *
96
+ * @return int
97
+ */
98
+ public function getCurrentPage()
99
+ {
100
+ return $this->getData('current_page') ? $this->getData('current_page') : 1;
101
+ }
102
+
103
+ /**
104
+ * Get a pager
105
+ *
106
+ * @return string|null
107
+ */
108
+ public function getPager()
109
+ {
110
+ $pager = $this->getChild('stores.list.pager');
111
+ if ($pager) {
112
+ $storesPerPage = Mage::helper('clarion_storelocator')->getStoresPerPage();
113
+ $pager->setAvailableLimit(array($storesPerPage => $storesPerPage));
114
+ $pager->setTotalNum($this->getStoreCollection()->getSize());
115
+ $pager->setPagerUrl(array('country'=>'india'));
116
+ $pager->setCollection($this->getStoreCollection());
117
+ $pager->setShowPerPage(true);
118
+
119
+ return $pager->toHtml();
120
+ }
121
+
122
+ return null;
123
+ }
124
+
125
+ /**
126
+ * Retrieve form posting url
127
+ *
128
+ * @return string
129
+ */
130
+ public function getPostActionUrl()
131
+ {
132
+ return $this->helper('clarion_storelocator')->getSearchPostUrl();
133
+ }
134
+
135
+ /**
136
+ * Retrieve form data
137
+ *
138
+ * @return Varien_Object
139
+ */
140
+ public function getFormData()
141
+ {
142
+ $data = $this->getData('form_data');
143
+ if (is_null($data)) {
144
+ //session form data
145
+ $formData = Mage::getSingleton('core/session')->getSearchFormData(true);
146
+ $data = new Varien_Object();
147
+ if ($formData) {
148
+ $data->addData($formData);
149
+ }else {
150
+ //post form data
151
+ $formPostData = $this->getRequest()->getQuery();
152
+ if($formPostData){
153
+ $data->addData($formPostData);
154
+ }
155
+ }
156
+ $this->setData('form_data', $data);
157
+ }
158
+ return $data;
159
+ }
160
+
161
+ /**
162
+ * Return country collection
163
+ *
164
+ * @return Mage_Directory_Model_Mysql4_Country_Collection
165
+ */
166
+ public function getCountries()
167
+ {
168
+ $_countries = Mage::getModel('directory/country')->getCollection()
169
+ ->loadData()
170
+ ->toOptionArray(false);
171
+ // ZEND_DEBUG::dump($_countries);
172
+ return $_countries;
173
+ }
174
+
175
+ /**
176
+ * get country name by county code
177
+ * @param string $countryCode country code
178
+ * @return string
179
+ */
180
+ public function getCountryName($countryCode)
181
+ {
182
+ return $this->helper('clarion_storelocator')->getCountryNameByCode($countryCode);
183
+ }
184
+
185
+ /**
186
+ * Return store zoom level/default zoom level
187
+ *
188
+ * @param Clarion_Storelocator_Model_Storelocator $storelocator
189
+ * @return int
190
+ */
191
+ public function getZoomLevel($storelocator=NULL)
192
+ {
193
+ //Return store zoom level
194
+ if(!is_null($storelocator)) {
195
+ if($storelocator->getZoomLevel()){
196
+ return $storelocator->getZoomLevel();
197
+ } else {
198
+ // Return default config zoom level
199
+ return Mage::helper('clarion_storelocator')->getConfigZoomLevel();
200
+ }
201
+ } else {
202
+ // Return default config zoom level
203
+ return Mage::helper('clarion_storelocator')->getConfigZoomLevel();
204
+ }
205
+ return;
206
+ }
207
+
208
+ /**
209
+ * Return store radius/default radius
210
+ *
211
+ * @param Clarion_Storelocator_Model_Storelocator $storelocator
212
+ * @return int
213
+ */
214
+ public function getRadius($storelocator=NULL)
215
+ {
216
+ //Return store radius
217
+ if(!is_null($storelocator)) {
218
+ if($storelocator->getRadius()){
219
+ return $storelocator->getRadius();
220
+ } else {
221
+ // Return default config radius
222
+ return Mage::helper('clarion_storelocator')->getConfigRadius();
223
+ }
224
+ } else {
225
+ // Return default config radius
226
+ return Mage::helper('clarion_storelocator')->getConfigRadius();
227
+ }
228
+ return;
229
+ }
230
+ }
app/code/community/Clarion/Storelocator/Block/View.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Store View block
4
+ *
5
+ * @category Clarion
6
+ * @package Clarion_Storelocator
7
+ * @author Clarion Magento Team
8
+ *
9
+ */
10
+ class Clarion_Storelocator_Block_View extends Mage_Core_Block_Template
11
+ {
12
+ /**
13
+ * Current news item instance
14
+ *
15
+ * @var Clarion_Storelocator_Model_Storelocator
16
+ */
17
+ protected $_store;
18
+
19
+ /**
20
+ * Return parameters for back url
21
+ *
22
+ * @param array $additionalParams
23
+ * @return array
24
+ */
25
+ protected function _getBackUrlQueryParams($additionalParams = array())
26
+ {
27
+ return array_merge(array('p' => $this->getPage()), $additionalParams);
28
+ }
29
+
30
+ /**
31
+ * Return URL to the store view page
32
+ *
33
+ * @return string
34
+ */
35
+ public function getBackUrl()
36
+ {
37
+ return $this->getUrl('*/', array('_query' => $this->_getBackUrlQueryParams()));
38
+ }
39
+
40
+ /**
41
+ * Return URL for resized News Item image
42
+ *
43
+ * @param Clarion_Storelocator_Model_Storelocator $store
44
+ * @param integer $width
45
+ * @return string|false
46
+ */
47
+ public function getImageUrl($store, $width)
48
+ {
49
+ return Mage::helper('clarion_storelocator/image')->resize($store, $width);
50
+ }
51
+
52
+ /**
53
+ * Return store zoom level/default zoom level
54
+ *
55
+ * @param Clarion_Storelocator_Model_Storelocator $storelocator
56
+ * @return int
57
+ */
58
+ public function getZoomLevel($storelocator=NULL)
59
+ {
60
+ //Return store zoom level
61
+ if(!is_null($storelocator)) {
62
+ if($storelocator->getZoomLevel()){
63
+ return $storelocator->getZoomLevel();
64
+ } else {
65
+ // Return default config zoom level
66
+ return Mage::helper('clarion_storelocator')->getConfigZoomLevel();
67
+ }
68
+ } else {
69
+ // Return default config zoom level
70
+ return Mage::helper('clarion_storelocator')->getConfigZoomLevel();
71
+ }
72
+ return;
73
+ }
74
+
75
+ /**
76
+ * Return store radius/default radius
77
+ *
78
+ * @param Clarion_Storelocator_Model_Storelocator $storelocator
79
+ * @return int
80
+ */
81
+ public function getRadius($storelocator=NULL)
82
+ {
83
+ //Return store radius
84
+ if(!is_null($storelocator)) {
85
+ if($storelocator->getRadius()){
86
+ return $storelocator->getRadius();
87
+ } else {
88
+ // Return default config radius
89
+ return Mage::helper('clarion_storelocator')->getConfigRadius();
90
+ }
91
+ } else {
92
+ // Return default config radius
93
+ return Mage::helper('clarion_storelocator')->getConfigRadius();
94
+ }
95
+ return;
96
+ }
97
+
98
+ /**
99
+ * get country name by county code
100
+ * @param string $countryCode country code
101
+ * @return string
102
+ */
103
+ public function getCountryName($countryCode)
104
+ {
105
+ return $this->helper('clarion_storelocator')->getCountryNameByCode($countryCode);
106
+ }
107
+ }
app/code/community/Clarion/Storelocator/Helper/Admin.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Store locator admin helper
4
+ *
5
+ * @category Clarion
6
+ * @package Clarion_Storelocator
7
+ * @author Clarion Magento Team
8
+ */
9
+ class Clarion_Storelocator_Helper_Admin extends Mage_Core_Helper_Abstract
10
+ {
11
+ /**
12
+ * Check permission for passed action
13
+ *
14
+ * @param string $action
15
+ * @return bool
16
+ */
17
+ public function isActionAllowed($action)
18
+ {
19
+ return Mage::getSingleton('admin/session')->isAllowed('clarion_storelocator/clarion_manage_storelocator/' . $action);
20
+ }
21
+ }
app/code/community/Clarion/Storelocator/Helper/Data.php ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Store locator data helper
4
+ *
5
+ * @category Clarion
6
+ * @package Clarion_Storelocator
7
+ * @author Clarion Magento Team
8
+ */
9
+ class Clarion_Storelocator_Helper_Data extends Mage_Core_Helper_Abstract
10
+ {
11
+ /**
12
+ * Path to store config if front-end output is enabled
13
+ *
14
+ * @var string
15
+ */
16
+ const XML_PATH_ENABLED = 'clarion_storelocator_general_setting/clarion_storelocator_status/enable';
17
+
18
+ /**
19
+ * Default radius
20
+ *
21
+ * @var string
22
+ */
23
+ const XML_PATH_DEFAULT_RADIUS = 'clarion_storelocator_general_setting/clarion_storelocator_display_setting/default_radius';
24
+
25
+
26
+ /**
27
+ * Default zoom level
28
+ *
29
+ * @var string
30
+ */
31
+ const XML_PATH_DEFAULT_ZOOM_LEVEl = 'clarion_storelocator_general_setting/clarion_storelocator_display_setting/zoom_level';
32
+
33
+ /**
34
+ * Default stores per page
35
+ *
36
+ * @var string
37
+ */
38
+ const XML_PATH_STORES_PER_PAGE = 'clarion_storelocator_general_setting/clarion_storelocator_display_setting/stores_per_page';
39
+
40
+ /**
41
+ * Store view instance for lazy loading
42
+ *
43
+ * @var clarion_storelocator_model_storelocator
44
+ */
45
+ protected $_storeViewInstance;
46
+
47
+ /**
48
+ * Checks whether news can be displayed in the frontend
49
+ *
50
+ * @param integer|string|Mage_Core_Model_Store $store
51
+ * @return boolean
52
+ */
53
+ public function isEnabled($store = null)
54
+ {
55
+ return Mage::getStoreConfigFlag(self::XML_PATH_ENABLED, $store);
56
+ }
57
+
58
+ /**
59
+ * Return current store instance from the Registry
60
+ *
61
+ * @return clarion_storelocator_model_storelocator
62
+ */
63
+ public function getStoreViewInstance()
64
+ {
65
+ if (!$this->_storeViewInstance) {
66
+ $this->_storeViewInstance = Mage::registry('store_view');
67
+
68
+ if (!$this->_storeViewInstance) {
69
+ Mage::throwException($this->__('Store view instance does not exist in Registry'));
70
+ }
71
+ }
72
+
73
+ return $this->_storeViewInstance;
74
+ }
75
+
76
+ /**
77
+ * Return radius configured from admin
78
+ *
79
+ * @param integer|string|Mage_Core_Model_Store $store
80
+ * @return int
81
+ */
82
+ public function getConfigRadius($store = null)
83
+ {
84
+ return abs(Mage::getStoreConfig(self::XML_PATH_DEFAULT_RADIUS, $store));
85
+ }
86
+
87
+ /**
88
+ * Return zoom level configured from admin
89
+ *
90
+ * @param integer|string|Mage_Core_Model_Store $store
91
+ * @return int
92
+ */
93
+ public function getConfigZoomLevel($store = null)
94
+ {
95
+ return abs((int)Mage::getStoreConfig(self::XML_PATH_DEFAULT_ZOOM_LEVEl, $store));
96
+ }
97
+
98
+ /**
99
+ * Return the number of stores per page
100
+ *
101
+ * @param integer|string|Mage_Core_Model_Store $store
102
+ * @return int
103
+ */
104
+ public function getStoresPerPage($store = null)
105
+ {
106
+ return abs((int)Mage::getStoreConfig(self::XML_PATH_STORES_PER_PAGE, $store));
107
+ }
108
+
109
+ /**
110
+ * Retrieve store search form post url
111
+ *
112
+ * @return string
113
+ */
114
+ public function getSearchPostUrl()
115
+ {
116
+ return $this->_getUrl('storelocator/index/search');
117
+ }
118
+
119
+ /**
120
+ * Get country name by county code
121
+ * @param string $countryCode country code
122
+ * @return string
123
+ */
124
+ public function getCountryNameByCode($countryCode)
125
+ {
126
+ $countryModel = Mage::getModel('directory/country')->loadByCode($countryCode);
127
+ return $countryName = $countryModel->getName();
128
+ }
129
+ }
app/code/community/Clarion/Storelocator/Helper/Image.php ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Store locator Image helper
4
+ *
5
+ * @category Clarion
6
+ * @package Clarion_Storelocator
7
+ * @author Clarion Magento Team
8
+ */
9
+ class Clarion_Storelocator_Helper_Image extends Mage_Core_Helper_Abstract
10
+ {
11
+ /**
12
+ * Media path to extension imahes
13
+ *
14
+ * @var string
15
+ */
16
+ const MEDIA_PATH = 'clarion_storelocator';
17
+
18
+ /**
19
+ * Maximum size for image in bytes
20
+ * Default value is 1M
21
+ *
22
+ * @var int
23
+ */
24
+ const MAX_FILE_SIZE = 1048576;
25
+
26
+ /**
27
+ * Manimum image height in pixels
28
+ *
29
+ * @var int
30
+ */
31
+ const MIN_HEIGHT = 50;
32
+
33
+ /**
34
+ * Maximum image height in pixels
35
+ *
36
+ * @var int
37
+ */
38
+ const MAX_HEIGHT = 800;
39
+
40
+ /**
41
+ * Manimum image width in pixels
42
+ *
43
+ * @var int
44
+ */
45
+ const MIN_WIDTH = 50;
46
+
47
+ /**
48
+ * Maximum image width in pixels
49
+ *
50
+ * @var int
51
+ */
52
+ const MAX_WIDTH = 800;
53
+
54
+ /**
55
+ * Array of image size limitation
56
+ *
57
+ * @var array
58
+ */
59
+ protected $_imageSize = array(
60
+ 'minheight' => self::MIN_HEIGHT,
61
+ 'minwidth' => self::MIN_WIDTH,
62
+ 'maxheight' => self::MAX_HEIGHT,
63
+ 'maxwidth' => self::MAX_WIDTH,
64
+ );
65
+
66
+ /**
67
+ * Array of allowed file extensions
68
+ *
69
+ * @var array
70
+ */
71
+ protected $_allowedExtensions = array('jpg', 'gif', 'png','jpeg');
72
+
73
+ /**
74
+ * Return the base media directory for store images
75
+ *
76
+ * @return string
77
+ */
78
+ public function getBaseDir()
79
+ {
80
+ return Mage::getBaseDir('media') . DS . self::MEDIA_PATH;
81
+ }
82
+
83
+ /**
84
+ * Return the Base URL for store images
85
+ *
86
+ * @return string
87
+ */
88
+ public function getBaseUrl()
89
+ {
90
+ return Mage::getBaseUrl('media') . '/' . self::MEDIA_PATH;
91
+ }
92
+
93
+ /**
94
+ * Remove store image by image filename
95
+ *
96
+ * @param string $imageFile
97
+ * @return bool
98
+ */
99
+ public function removeImage($imageFile)
100
+ {
101
+ $io = new Varien_Io_File();
102
+ $io->open(array('path' => $this->getBaseDir()));
103
+ if ($io->fileExists($imageFile)) {
104
+ return $io->rm($imageFile);
105
+ }
106
+ return false;
107
+ }
108
+
109
+ /**
110
+ * Upload image and return uploaded image file name or false
111
+ *
112
+ * @throws Mage_Core_Exception
113
+ * @param string $scope the request key for file
114
+ * @return bool|string
115
+ */
116
+ public function uploadImage($scope)
117
+ {
118
+ $adapter = new Zend_File_Transfer_Adapter_Http();
119
+ $adapter->addValidator('ImageSize', true, $this->_imageSize);
120
+ $adapter->addValidator('Size', true, self::MAX_FILE_SIZE);
121
+ if ($adapter->isUploaded($scope)) {
122
+ // validate image
123
+ if (!$adapter->isValid($scope)) {
124
+ Mage::throwException(Mage::helper('clarion_storelocator')->__('Uploaded image is not valid'));
125
+ }
126
+ $upload = new Varien_File_Uploader($scope);
127
+ $upload->setAllowCreateFolders(true);
128
+ $upload->setAllowedExtensions($this->_allowedExtensions);
129
+ $upload->setAllowRenameFiles(true);
130
+ $upload->setFilesDispersion(false);
131
+ if ($upload->save($this->getBaseDir())) {
132
+ return $upload->getUploadedFileName();
133
+ }
134
+ }
135
+ return false;
136
+ }
137
+
138
+ /**
139
+ * Return URL for resized store Image
140
+ *
141
+ * @param Clarion_Storelocator_Model_View $store
142
+ * @param integer $width
143
+ * @param integer $height
144
+ * @return bool|string
145
+ */
146
+ public function resize(Clarion_Storelocator_Model_Storelocator $store, $width, $height = null)
147
+ {
148
+ if (!$store->getStoreLogo()) {
149
+ return false;
150
+ }
151
+
152
+ if ($width < self::MIN_WIDTH || $width > self::MAX_WIDTH) {
153
+ //return false;
154
+ }
155
+ $width = (int)$width;
156
+
157
+ if (!is_null($height)) {
158
+ if ($height < self::MIN_HEIGHT || $height > self::MAX_HEIGHT) {
159
+ //return false;
160
+ }
161
+ $height = (int)$height;
162
+ }
163
+
164
+ $imageFile = $store->getStoreLogo();
165
+ $cacheDir = $this->getBaseDir() . DS . 'cache' . DS . $width;
166
+ $cacheUrl = $this->getBaseUrl() . '/' . 'cache' . '/' . $width . '/';
167
+
168
+ $io = new Varien_Io_File();
169
+ $io->checkAndCreateFolder($cacheDir);
170
+ $io->open(array('path' => $cacheDir));
171
+ if ($io->fileExists($imageFile)) {
172
+ return $cacheUrl . $imageFile;
173
+ }
174
+
175
+ try {
176
+ $image = new Varien_Image($this->getBaseDir() . DS . $imageFile);
177
+ $image->resize($width, $height);
178
+ $image->save($cacheDir . DS . $imageFile);
179
+ return $cacheUrl . $imageFile;
180
+ } catch (Exception $e) {
181
+ Mage::logException($e);
182
+ return false;
183
+ }
184
+ }
185
+
186
+ /**
187
+ * Removes folder with cached images
188
+ *
189
+ * @return boolean
190
+ */
191
+ public function flushImagesCache()
192
+ {
193
+ $cacheDir = $this->getBaseDir() . DS . 'cache' . DS ;
194
+ $io = new Varien_Io_File();
195
+ if ($io->fileExists($cacheDir, false) ) {
196
+ return $io->rmdir($cacheDir, true);
197
+ }
198
+ return true;
199
+ }
200
+ }
app/code/community/Clarion/Storelocator/Model/Enabledisable.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Enable Disable Model
4
+ *
5
+ * @category Clarion
6
+ * @package Clarion_Storelocator
7
+ * @author Clarion Magento Team
8
+ *
9
+ */
10
+
11
+ /**
12
+ * Used in displaying options Enable|Disable
13
+ */
14
+ class Clarion_Storelocator_Model_Enabledisable extends Mage_Adminhtml_Model_System_Config_Source_Enabledisable
15
+ {
16
+ /**
17
+ * Get options in "key-value" format
18
+ *
19
+ * @return array
20
+ */
21
+ public function toArray()
22
+ {
23
+ return array(
24
+ 1 => Mage::helper('adminhtml')->__('Enable'),
25
+ 0 => Mage::helper('adminhtml')->__('Disable'),
26
+ );
27
+ }
28
+ }
29
+ ?>
app/code/community/Clarion/Storelocator/Model/Resource/Setup.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Storelocator Setup Resource class
4
+ *
5
+ * @category Clarion
6
+ * @package Clarion_Storelocator
7
+ * @author Clarion Magento Team
8
+ *
9
+ */
10
+ class Clarion_Storelocator_Model_Resource_Setup extends Mage_Sales_Model_Resource_Setup
11
+ {
12
+ }
app/code/community/Clarion/Storelocator/Model/Resource/Storelocator.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Storelocation Resource Model
4
+ *
5
+ * @category Clarion
6
+ * @package Clarion_Storelocator
7
+ * @author Clarion Magento Team
8
+ *
9
+ */
10
+ class Clarion_Storelocator_Model_Resource_Storelocator extends Mage_Core_Model_Resource_Db_Abstract
11
+ {
12
+ /**
13
+ * Initialize connection and define main table and primary key
14
+ */
15
+ protected function _construct()
16
+ {
17
+ $this->_init('clarion_storelocator/storelocator', 'store_id');
18
+ }
19
+
20
+ /**
21
+ * Check if store exists
22
+ *
23
+ * @param $storeName store name
24
+ * @param $storeId store id
25
+ * @return array|false
26
+ */
27
+ public function storeExists($storeName, $storeId)
28
+ {
29
+ $adapter = $this->_getReadAdapter();
30
+ $select = $adapter->select();
31
+
32
+ if(empty($storeId)){
33
+ $binds = array(
34
+ 'name' => $storeName,
35
+ );
36
+
37
+ $select->from($this->getMainTable())
38
+ ->where('(name = :name)');
39
+ } else {
40
+ $binds = array(
41
+ 'name' => $storeName,
42
+ 'store_id' => (int) $storeId,
43
+ );
44
+
45
+ $select->from($this->getMainTable())
46
+ ->where('(name = :name)')
47
+ ->where('store_id <> :store_id');
48
+ }
49
+ return $adapter->fetchRow($select, $binds);
50
+ }
51
+ }
app/code/community/Clarion/Storelocator/Model/Resource/Storelocator/Collection.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Storelocation Collection Resource Model
4
+ *
5
+ * @category Clarion
6
+ * @package Clarion_Storelocator
7
+ * @author Clarion Magento Team
8
+ *
9
+ */
10
+ class Clarion_Storelocator_Model_Resource_Storelocator_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
11
+ {
12
+ /**
13
+ * Define collection model
14
+ *
15
+ */
16
+ protected function _construct()
17
+ {
18
+ $this->_init('clarion_storelocator/storelocator');
19
+ }
20
+
21
+ /**
22
+ * Specify filter by "is_visible" field
23
+ *
24
+ * @return Clarion_Storelocator_Model_Resource_Storelocator_Collection
25
+ */
26
+ public function addStatusFilter()
27
+ {
28
+ return $this->addFieldToFilter('status', 1);
29
+ }
30
+
31
+ /**
32
+ * Prepare for displaying in list
33
+ *
34
+ * @param integer $page
35
+ * @return Clarion_Storelocator_Model_Resource_Storelocator_Collection
36
+ */
37
+ public function prepareForList($page)
38
+ {
39
+ //Set collection page size
40
+ $this->setPageSize(Mage::helper('clarion_storelocator')->getStoresPerPage());
41
+ //Set current page
42
+ $this->setCurPage($page);
43
+ //Set select order
44
+ $this->setOrder('created_at', Varien_Data_Collection::SORT_ORDER_DESC);
45
+ return $this;
46
+ }
47
+ }
app/code/community/Clarion/Storelocator/Model/Storelocator.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Storelocation model
4
+ *
5
+ * @category Clarion
6
+ * @package Clarion_Storelocator
7
+ * @author Clarion Magento Team
8
+ *
9
+ */
10
+ class Clarion_Storelocator_Model_Storelocator extends Mage_Core_Model_Abstract
11
+ {
12
+ /**
13
+ * Define resource model
14
+ */
15
+ protected function _construct()
16
+ {
17
+ $this->_init('clarion_storelocator/storelocator');
18
+ }
19
+
20
+ /**
21
+ * Check if store exists based on its name
22
+ *
23
+ * @param $storeName store name
24
+ * @param $storeId store id
25
+ * @return boolean
26
+ */
27
+ public function storeExists($storeName, $storeId = null)
28
+ {
29
+ $result = $this->_getResource()->storeExists($storeName, $storeId);
30
+ return (is_array($result) && count($result) > 0) ? true : false;
31
+ }
32
+
33
+ }
app/code/community/Clarion/Storelocator/controllers/Adminhtml/ManagestorelocatorController.php ADDED
@@ -0,0 +1,477 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Manage store locator admin controller
4
+ *
5
+ * @category Clarion
6
+ * @package Clarion_Storelocator
7
+ * @author Clarion Magento Team
8
+ */
9
+ class Clarion_Storelocator_Adminhtml_ManagestorelocatorController extends Mage_Adminhtml_Controller_Action
10
+ {
11
+ /**
12
+ * Init actions
13
+ *
14
+ */
15
+ protected function _initAction()
16
+ {
17
+ // load layout, set active menu and breadcrumbs
18
+ $this->_title($this->__('Store Locator'));
19
+
20
+ $this->loadLayout()
21
+ ->_setActiveMenu('clarion_storelocator/clarion_manage_storelocator')
22
+ ->_addBreadcrumb(Mage::helper('clarion_storelocator')->__('Store Locator'), Mage::helper('clarion_storelocator')->__('Store Locator'))
23
+ ;
24
+ return $this;
25
+ }
26
+
27
+ /**
28
+ * Index action method
29
+ */
30
+ public function indexAction()
31
+ {
32
+ $this->_initAction();
33
+ $this->renderLayout();
34
+ }
35
+
36
+ /**
37
+ * Used for Ajax Based Grid
38
+ *
39
+ */
40
+ public function gridAction()
41
+ {
42
+ $this->loadLayout();
43
+ $this->getResponse()->setBody(
44
+ $this->getLayout()->createBlock('clarion_storelocator/adminhtml_storelocator_grid')->toHtml()
45
+ );
46
+ }
47
+
48
+ /**
49
+ * Export csv
50
+ *
51
+ */
52
+ public function exportCsvAction()
53
+ {
54
+ $fileName = 'storelocator.csv';
55
+ $content = $this->getLayout()->createBlock('clarion_storelocator/adminhtml_storelocator_grid')
56
+ ->getCsv();
57
+
58
+ $this->_sendUploadResponse($fileName, $content);
59
+ }
60
+
61
+ /**
62
+ * Export xml
63
+ *
64
+ */
65
+ public function exportXmlAction()
66
+ {
67
+ $fileName = 'storelocator.xml';
68
+ $content = $this->getLayout()->createBlock('clarion_storelocator/adminhtml_storelocator_grid')
69
+ ->getXml();
70
+
71
+ $this->_sendUploadResponse($fileName, $content);
72
+ }
73
+
74
+ /**
75
+ * Export csv and xml
76
+ *
77
+ */
78
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
79
+ {
80
+ $response = $this->getResponse();
81
+ $response->setHeader('HTTP/1.1 200 OK','');
82
+ $response->setHeader('Pragma', 'public', true);
83
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
84
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
85
+ $response->setHeader('Last-Modified', date('r'));
86
+ $response->setHeader('Accept-Ranges', 'bytes');
87
+ $response->setHeader('Content-Length', strlen($content));
88
+ $response->setHeader('Content-type', $contentType);
89
+ $response->setBody($content);
90
+ $response->sendResponse();
91
+ die;
92
+ }
93
+
94
+ /**
95
+ * Multiple store deletion
96
+ *
97
+ */
98
+ public function massDeleteAction()
99
+ {
100
+ //Get store ids from selected checkbox
101
+ $storeIds = $this->getRequest()->getParam('storeIds');
102
+
103
+ if (!is_array($storeIds)) {
104
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select store(s).'));
105
+ } else {
106
+ if (!empty($storeIds)) {
107
+ try {
108
+ foreach ($storeIds as $storeId) {
109
+ $storelocator = Mage::getSingleton('clarion_storelocator/storelocator')->load($storeId);
110
+ //delete image file
111
+ if($storelocator->getStoreLogo()) {
112
+ $oldFileTargetPath = Mage::getBaseDir('media') . DS . 'clarion_storelocator' . DS . $storelocator->getStoreLogo();
113
+ $this->deleteFile($oldFileTargetPath);
114
+ }
115
+ //delete record
116
+ $storelocator->delete();
117
+ }
118
+ Mage::getSingleton('adminhtml/session')->addSuccess(
119
+ $this->__('Total of %d record(s) have been deleted.', count($storeIds))
120
+ );
121
+ } catch (Exception $e) {
122
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
123
+ }
124
+ }
125
+ }
126
+ $this->_redirect('*/*/');
127
+ }
128
+
129
+ /**
130
+ * Multiple store status update
131
+ *
132
+ */
133
+ public function massStatusAction()
134
+ {
135
+ //Get store ids from selected checkbox
136
+ $storeIds = $this->getRequest()->getParam('storeIds');
137
+
138
+ if (!is_array($storeIds)) {
139
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select store(s)'));
140
+ } else {
141
+ try {
142
+ foreach ($storeIds as $storeId) {
143
+ Mage::getSingleton('clarion_storelocator/storelocator')
144
+ ->load($storeId)
145
+ ->setStatus($this->getRequest()->getParam('status'))
146
+ ->setIsMassupdate(true)
147
+ ->save();
148
+ }
149
+ Mage::getSingleton('adminhtml/session')->addSuccess(
150
+ $this->__('Total of %d record(s) were successfully updated', count($storeIds))
151
+ );
152
+ } catch (Exception $e) {
153
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
154
+ }
155
+ }
156
+ $this->_redirect('*/*/index');
157
+ }
158
+
159
+ /**
160
+ * Create new store action
161
+ */
162
+ public function newAction()
163
+ {
164
+ // the same form is used to create and edit
165
+ $this->_forward('edit');
166
+ }
167
+
168
+ /**
169
+ * Edit store action
170
+ */
171
+ public function editAction()
172
+ {
173
+ $this->_title($this->__('Store Locator'))
174
+ ->_title($this->__('Manage Store Locator'));
175
+
176
+ // 1. Get ID and create model
177
+ $id = $this->getRequest()->getParam('store_id');
178
+ $model = Mage::getModel('clarion_storelocator/storelocator');
179
+
180
+ // 2. Initial checking
181
+ if ($id) {
182
+ $model->load($id);
183
+ if (! $model->getId()) {
184
+ Mage::getSingleton('adminhtml/session')->addError(
185
+ Mage::helper('clarion_storelocator')->__('This store no longer exists.'));
186
+ $this->_redirect('*/*/');
187
+ return;
188
+ }
189
+ }
190
+
191
+ $this->_title($model->getId() ? $model->getName() : $this->__('New Store'));
192
+
193
+ // 3. Set entered data if was error when we do save
194
+ $data = Mage::getSingleton('adminhtml/session')->getStorelocatorData(true);
195
+ if (!empty($data)) {
196
+ $model->setData($data);
197
+ }
198
+
199
+ // 4. Register model to use later in blocks
200
+ Mage::register('storelocator_data', $model);
201
+
202
+ // 5. Build edit form
203
+ $this->_initAction()
204
+ ->_addBreadcrumb(
205
+ $id ? Mage::helper('clarion_storelocator')->__('Edit Store')
206
+ : Mage::helper('clarion_storelocator')->__('New Store'),
207
+ $id ? Mage::helper('clarion_storelocator')->__('Edit Store')
208
+ : Mage::helper('clarion_storelocator')->__('New Store'));
209
+
210
+ $this->_addContent($this->getLayout()->createBlock('clarion_storelocator/adminhtml_storelocator_edit'))
211
+ ->_addLeft($this->getLayout()->createBlock('clarion_storelocator/adminhtml_storelocator_edit_tabs'));
212
+
213
+ $this->renderLayout();
214
+ }
215
+
216
+ /**
217
+ * Upload new file
218
+ *
219
+ * @param string $targetPath Target directory
220
+ * @throws Mage_Core_Exception
221
+ * @return array File info Array
222
+ */
223
+ public function uploadFile($targetPath)
224
+ {
225
+ try {
226
+ $imageName = $_FILES['store_logo']['name']; //file name
227
+ $uploader = new Mage_Core_Model_File_Uploader('store_logo'); //load class
228
+ $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));//Allowed extension for file
229
+ $uploader->setAllowCreateFolders(true); //for creating the directory if not exists
230
+ $uploader->setAllowRenameFiles(true); //if true, uploaded file's name will be changed, if file with the same name already exists directory.
231
+ $uploader->setFilesDispersion(false);
232
+
233
+ $result = $uploader->save($targetPath, $imageName); //save the file on the specified path
234
+
235
+ if (!$result) {
236
+ Mage::throwException( Mage::helper('clarion_storelocator')->__('Cannot upload file.') );
237
+ }
238
+ return $result;
239
+ } catch (Exception $e) {
240
+ $this->_getSession()->addException($e, $e->getMessage());
241
+ }
242
+ }
243
+
244
+ /**
245
+ * Delete file
246
+ *
247
+ * @param string $targetPath File path to be deleted
248
+ * @return boolean
249
+ */
250
+ public function deleteFile($targetPath)
251
+ {
252
+ $result = false;
253
+ $io = new Varien_Io_File();
254
+
255
+ if($io->fileExists($targetPath)) {
256
+ $result = $io->rm($targetPath);
257
+ }
258
+ return $result;
259
+ }
260
+
261
+ /**
262
+ * Save action
263
+ */
264
+ public function saveAction()
265
+ {
266
+ // check if data sent
267
+ if ($data = $this->getRequest()->getPost()) {
268
+
269
+ $id = $this->getRequest()->getParam('store_id');
270
+ $model = Mage::getModel('clarion_storelocator/storelocator');
271
+ $session = Mage::getSingleton('adminhtml/session');
272
+ /* @var $session Mage_Core_Model_Session */
273
+
274
+ if ($id) {
275
+ $model->load($id);
276
+ if (!$model->getId()) {
277
+ $session->addError(Mage::helper('clarion_storelocator')->__('This store no longer exists.'));
278
+ $this->_redirect('*/*/');
279
+ return;
280
+ }
281
+ }
282
+
283
+ // validate form
284
+ $validate = $this->validate($data);
285
+ if($validate !== true){
286
+ if (is_array($validate)) {
287
+ foreach ($validate as $errorMessage) {
288
+ $session->addError($errorMessage);
289
+ }
290
+ }
291
+ else {
292
+ $session->addError($this->__('Unable to add/edit store.'));
293
+ }
294
+ $session->setStorelocatorData($data);
295
+ $this->_redirect('*/*/edit', array('store_id' => $this->getRequest()->getParam('store_id')));
296
+ return;
297
+ }
298
+
299
+ // Store logo Image upload
300
+ if(isset($_FILES['store_logo']['name']) && $_FILES['store_logo']['name'] != '') {
301
+ $targetPath = Mage::getBaseDir('media') . DS . 'clarion_storelocator' . DS; //desitnation directory
302
+ //upload file
303
+ $result = $this->uploadFile($targetPath);
304
+
305
+ if($result['file']) {
306
+ $data['store_logo'] = $result['file'];
307
+ }
308
+
309
+ //delete old file
310
+ if ($id) {
311
+ $oldFileTargetPath = Mage::getBaseDir('media') . DS . 'clarion_storelocator' . DS . $model->getStoreLogo();
312
+ $this->deleteFile($oldFileTargetPath);
313
+ }
314
+ } else {
315
+ //if you are using an image field type, (image is set in addField)
316
+ if(isset($data['store_logo']['delete']) && $data['store_logo']['delete'] == 1) {
317
+
318
+ //delete old file
319
+ if ($id) {
320
+ $oldFileTargetPath = Mage::getBaseDir('media') . DS . 'clarion_storelocator' . DS . $model->getStoreLogo();
321
+ $this->deleteFile($oldFileTargetPath);
322
+ }
323
+
324
+ $data['store_logo'] = '';
325
+ } else {
326
+ unset($data['store_logo']);
327
+ }
328
+ }
329
+
330
+ $currentTimestamp = Mage::getModel('core/date')->timestamp(time());
331
+ if ($id) {
332
+ $data['updated_at'] = $currentTimestamp;
333
+ }else {
334
+ $data['created_at'] = $currentTimestamp;
335
+ }
336
+
337
+ // init model and set data
338
+ $model->setData($data);
339
+
340
+ // try to save it
341
+ try {
342
+ // save the data
343
+ $model->save();
344
+ // display success message
345
+ $session->addSuccess(Mage::helper('clarion_storelocator')->__('The store has been saved.'));
346
+ // clear previously saved data from session
347
+ $session->setStorelocatorData(false);
348
+
349
+ // check if 'Save and Continue'
350
+ if ($this->getRequest()->getParam('back')) {
351
+ $this->_redirect('*/*/edit', array('store_id' => $model->getId(), '_current'=>true));
352
+ return;
353
+ }
354
+ // go to grid
355
+ $this->_redirect('*/*/');
356
+ return;
357
+
358
+ } catch (Mage_Core_Exception $e) {
359
+ $session->addError($e->getMessage());
360
+ }
361
+ catch (Exception $e) {
362
+ $session->addException($e,
363
+ Mage::helper('clarion_storelocator')->__('An error occurred while saving the store.'));
364
+ }
365
+ $session->setStorelocatorData($data);
366
+ $this->_redirect('*/*/edit', array('store_id' => $this->getRequest()->getParam('store_id')));
367
+ return;
368
+ }
369
+ $this->_redirect('*/*/');
370
+ }
371
+
372
+ public function validate($data)
373
+ {
374
+ $errors = array();
375
+
376
+ $storelocator = Mage::getModel('clarion_storelocator/storelocator');
377
+ $storeName = isset($data['name']) ? $data['name'] : '';
378
+ $storeId = isset($data['store_id']) ? $data['store_id'] : '';
379
+
380
+ if($storelocator->storeExists($storeName, $storeId)) {
381
+ $errors[] = Mage::helper('clarion_storelocator')->__('Store name already exists');
382
+ }
383
+
384
+ //store image file validation
385
+ if ($_FILES['store_logo']['error'] == 0) {
386
+ $allowedExtensions = array('gif', 'jpeg', 'jpg', 'png');
387
+ $fileName = $_FILES['store_logo']['name'];
388
+ $fileExtension = pathinfo($fileName, PATHINFO_EXTENSION);
389
+ if($fileExtension){
390
+ if(!in_array($fileExtension, $allowedExtensions)) {
391
+ $errors[] = Mage::helper('clarion_storelocator')->__('Allowed image extension are jpg, jpeg, gif, png');
392
+ }
393
+ }
394
+ }
395
+
396
+ if (empty($errors)) {
397
+ return true;
398
+ }
399
+ return $errors;
400
+ }
401
+
402
+ /**
403
+ * Delete action
404
+ */
405
+ public function deleteAction()
406
+ {
407
+ // check if we know what should be deleted
408
+ if ($id = $this->getRequest()->getParam('store_id')) {
409
+ try {
410
+ // init model and delete
411
+ $model = Mage::getModel('clarion_storelocator/storelocator');
412
+ $model->load($id);
413
+ //delete image file
414
+ if ($model->getStoreLogo()) {
415
+ $oldFileTargetPath = Mage::getBaseDir('media') . DS . 'clarion_storelocator' . DS . $model->getStoreLogo();
416
+ $this->deleteFile($oldFileTargetPath);
417
+ }
418
+ //delete store
419
+ $model->delete();
420
+ // display success message
421
+ Mage::getSingleton('adminhtml/session')->addSuccess(
422
+ Mage::helper('clarion_storelocator')->__('The store has been deleted.'));
423
+ // go to grid
424
+ $this->_redirect('*/*/');
425
+ return;
426
+
427
+ } catch (Exception $e) {
428
+ // display error message
429
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
430
+ // go back to edit form
431
+ $this->_redirect('*/*/edit', array('store_id' => $id));
432
+ return;
433
+ }
434
+ }
435
+ // display error message
436
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('clarion_storelocator')->__('Unable to find a store to delete.'));
437
+ // go to grid
438
+ $this->_redirect('*/*/');
439
+ }
440
+
441
+ /**
442
+ * Check the permission to run it
443
+ *
444
+ * @return boolean
445
+ */
446
+ protected function _isAllowed()
447
+ {
448
+ switch ($this->getRequest()->getActionName()) {
449
+ case 'new':
450
+ case 'save':
451
+ return Mage::getSingleton('admin/session')->isAllowed('clarion_storelocator/clarion_manage_storelocator/save');
452
+ break;
453
+ case 'massDelete':
454
+ return Mage::getSingleton('admin/session')->isAllowed('clarion_storelocator/clarion_manage_storelocator/delete');
455
+ break;
456
+ case 'delete':
457
+ return Mage::getSingleton('admin/session')->isAllowed('clarion_storelocator/clarion_manage_storelocator/delete');
458
+ break;
459
+ default:
460
+ return Mage::getSingleton('admin/session')->isAllowed('clarion_storelocator/clarion_manage_storelocator');
461
+ break;
462
+ }
463
+ }
464
+
465
+ /**
466
+ * Flush stores Images Cache action
467
+ */
468
+ public function flushAction()
469
+ {
470
+ if (Mage::helper('clarion_storelocator/image')->flushImagesCache()) {
471
+ $this->_getSession()->addSuccess('Cache successfully flushed');
472
+ } else {
473
+ $this->_getSession()->addError('There was error during flushing cache');
474
+ }
475
+ $this->_forward('index');
476
+ }
477
+ }
app/code/community/Clarion/Storelocator/controllers/IndexController.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Fontend index controller
4
+ *
5
+ * @category Clarion
6
+ * @package Clarion_Storelocator
7
+ * @author Clarion Magento Team
8
+ *
9
+ */
10
+ class Clarion_Storelocator_IndexController extends Mage_Core_Controller_Front_Action
11
+ {
12
+ /**
13
+ * Pre dispatch action that allows to redirect to no route page in case of disabled extension through admin panel
14
+ */
15
+ public function preDispatch()
16
+ {
17
+ parent::preDispatch();
18
+
19
+ if (!Mage::helper('clarion_storelocator')->isEnabled()) {
20
+ $this->setFlag('', 'no-dispatch', true);
21
+ $this->_redirect('noRoute');
22
+ }
23
+ }
24
+
25
+ function indexAction()
26
+ {
27
+ $this->loadLayout();
28
+
29
+ $listBlock = $this->getLayout()->getBlock('stores.list');
30
+ if ($listBlock) {
31
+ $currentPage = abs(intval($this->getRequest()->getParam('p')));
32
+ if ($currentPage < 1) {
33
+ $currentPage = 1;
34
+ }
35
+ $listBlock->setCurrentPage($currentPage);
36
+ }
37
+
38
+ $this->renderLayout();
39
+ }
40
+
41
+ /**
42
+ * Stores view action
43
+ */
44
+ public function viewAction()
45
+ {
46
+ $storeId = $this->getRequest()->getParam('id');
47
+ if (!$storeId) {
48
+ return $this->_forward('noRoute');
49
+ }
50
+
51
+ /** @var $model Clarion_Storelocator_Model_Storelocator */
52
+ $model = Mage::getModel('clarion_storelocator/storelocator');
53
+ $model->load($storeId);
54
+
55
+ if (!$model->getId()) {
56
+ return $this->_forward('noRoute');
57
+ }
58
+ Mage::register('store_view', $model);
59
+ $this->loadLayout();
60
+ $this->renderLayout();
61
+ }
62
+
63
+ /**
64
+ * Stores search action
65
+ */
66
+ public function searchAction()
67
+ {
68
+ //search form validation
69
+ $post = $this->getRequest()->getQuery();
70
+ if ( !empty($post) ) {
71
+ try {
72
+ $error = false;
73
+ if(isset($post['country'])) {
74
+ if (Zend_Validate::is(trim($post['country']) , 'NotEmpty')) {
75
+ $error = true;
76
+ }
77
+ }
78
+
79
+ if(isset($post['state'])) {
80
+ if (Zend_Validate::is(trim($post['state']) , 'NotEmpty')) {
81
+ $error = true;
82
+ }
83
+ }
84
+
85
+ if(isset($post['city'])) {
86
+ if (Zend_Validate::is(trim($post['city']), 'NotEmpty')) {
87
+ $error = true;
88
+ }
89
+ }
90
+ if (!$error) {
91
+ throw new Exception('Please enter Country or State or City');
92
+ }
93
+ } catch (Exception $e) {
94
+
95
+ Mage::getSingleton('core/session')->addError($e->getMessage());
96
+ Mage::getSingleton('core/session')->setSearchFormData($post);
97
+ $this->_redirect('*/*/*');
98
+ return;
99
+ }
100
+ }
101
+
102
+ Mage::getSingleton('core/session')->setSearchFormData(false);
103
+
104
+ $this->loadLayout();
105
+
106
+ $listBlock = $this->getLayout()->getBlock('stores.list');
107
+ if ($listBlock) {
108
+ $currentPage = abs(intval($this->getRequest()->getParam('p')));
109
+ if ($currentPage < 1) {
110
+ $currentPage = 1;
111
+ }
112
+ $listBlock->setCurrentPage($currentPage);
113
+ }
114
+
115
+ $this->renderLayout();
116
+ }
117
+
118
+ }
app/code/community/Clarion/Storelocator/data/clarion_storelocator_setup/data-install-0.1.0.php ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Storelocator data installation script
4
+ *
5
+ * @category Clarion
6
+ * @package Clarion_Storelocator
7
+ * @author Clarion Magento Team
8
+ *
9
+ */
10
+ /**
11
+ * @var $installer Mage_Core_Model_Resource_Setup
12
+ */
13
+ $installer = $this;
14
+ /**
15
+ * Fill table clarion_storelocator/storelocator
16
+ */
17
+
18
+ //Get current timestamp
19
+ $currentTimestamp = Mage::getModel('core/date')->timestamp(time());
20
+
21
+ $stores = array(
22
+ array(
23
+ 'name' => 'Demo1',
24
+ 'status' => 1,
25
+ 'street_address' =>'NY Road',
26
+ 'country' =>'US',
27
+ 'state' =>'New York',
28
+ 'city' =>'New York',
29
+ 'zipcode' =>'10007',
30
+ 'phone' =>'111-111-1111',
31
+ 'fax' =>'1-111-111 1111',
32
+ 'url' =>'http://www.magento.com',
33
+ 'email' =>'test@gmail.com',
34
+ 'store_logo' =>'demo1.png',
35
+ 'description' =>'This is for testing.',
36
+ 'trading_hours' =>'10AM-1PM 2PM-10PM',
37
+ 'radius' =>'100',
38
+ 'latitude' =>'40.712784',
39
+ 'longitude' =>'-74.005941',
40
+ 'zoom_level' =>'6',
41
+ 'created_at' =>$currentTimestamp
42
+ ),
43
+ array(
44
+ 'name' => 'Demo2',
45
+ 'status' => 1,
46
+ 'street_address' =>'LA Road',
47
+ 'country' =>'US',
48
+ 'state' =>'California',
49
+ 'city' =>'Los Angeles',
50
+ 'zipcode' =>'90012',
51
+ 'phone' =>'111-111-1111',
52
+ 'fax' =>'1-111-111 1111',
53
+ 'url' =>'http://www.magento.com',
54
+ 'email' =>'test@gmail.com',
55
+ 'store_logo' =>'demo2.png',
56
+ 'description' =>'This is for testing.',
57
+ 'trading_hours' =>'10AM-1PM 2PM-10PM',
58
+ 'radius' =>'100',
59
+ 'latitude' =>'34.052234',
60
+ 'longitude' =>'-118.243685',
61
+ 'zoom_level' =>'6',
62
+ 'created_at' =>$currentTimestamp
63
+ ),
64
+ array(
65
+ 'name' => 'Demo3',
66
+ 'status' => 1,
67
+ 'street_address' =>'CH Road',
68
+ 'country' =>'US',
69
+ 'state' =>'Illinois',
70
+ 'city' =>'Chicago',
71
+ 'zipcode' =>'60602',
72
+ 'phone' =>'111-111-1111',
73
+ 'fax' =>'1-111-111 1111',
74
+ 'url' =>'http://www.magento.com',
75
+ 'email' =>'test@gmail.com',
76
+ 'store_logo' =>'demo3.png',
77
+ 'description' =>'This is for testing.',
78
+ 'trading_hours' =>'10AM-1PM 2PM-10PM',
79
+ 'radius' =>'100',
80
+ 'latitude' =>'41.878114',
81
+ 'longitude' =>'-87.629798',
82
+ 'zoom_level' =>'6',
83
+ 'created_at' =>$currentTimestamp
84
+ ),
85
+ array(
86
+ 'name' => 'Demo4',
87
+ 'status' => 1,
88
+ 'street_address' =>'HO Road',
89
+ 'country' =>'US',
90
+ 'state' =>'Texas',
91
+ 'city' =>'Houston',
92
+ 'zipcode' =>'77002',
93
+ 'phone' =>'111-111-1111',
94
+ 'fax' =>'1-111-111 1111',
95
+ 'url' =>'http://www.magento.com',
96
+ 'email' =>'test@gmail.com',
97
+ 'store_logo' =>'demo4.png',
98
+ 'description' =>'This is for testing.',
99
+ 'trading_hours' =>'10AM-1PM 2PM-10PM',
100
+ 'radius' =>'100',
101
+ 'latitude' =>'29.760193',
102
+ 'longitude' =>'-95.369390',
103
+ 'zoom_level' =>'6',
104
+ 'created_at' =>$currentTimestamp
105
+ ),
106
+ array(
107
+ 'name' => 'Demo5',
108
+ 'status' => 1,
109
+ 'street_address' =>'LV Road',
110
+ 'country' =>'US',
111
+ 'state' =>'Nevada',
112
+ 'city' =>'Las Vegas',
113
+ 'zipcode' =>'89101',
114
+ 'phone' =>'111-111-1111',
115
+ 'fax' =>'1-111-111 1111',
116
+ 'url' =>'http://www.magento.com',
117
+ 'email' =>'test@gmail.com',
118
+ 'store_logo' =>'demo5.png',
119
+ 'description' =>'This is for testing.',
120
+ 'trading_hours' =>'10AM-1PM 2PM-10PM',
121
+ 'radius' =>'100',
122
+ 'latitude' =>'36.255123',
123
+ 'longitude' =>'-115.238349',
124
+ 'zoom_level' =>'6',
125
+ 'created_at' =>$currentTimestamp
126
+ )
127
+ );
128
+
129
+ /**
130
+ * Insert data into storelocator table for testing/demo
131
+ */
132
+ foreach ($stores as $data) {
133
+ Mage::getModel('clarion_storelocator/storelocator')->setData($data)->save();
134
+ }
app/code/community/Clarion/Storelocator/etc/adminhtml.xml ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <!--
3
+ /**
4
+ * Configuration file for admin menu and access permission
5
+ *
6
+ * @category Mage
7
+ * @package Clarion_Storelocator
8
+ * @author Clarion Magento Team
9
+ */
10
+ -->
11
+ <config>
12
+ <!-- Added menu "Storelocator" in admin -->
13
+ <menu>
14
+ <clarion_storelocator translate="title" module="clarion_storelocator">
15
+ <title>Store Locator</title>
16
+ <sort_order>91</sort_order>
17
+ <children>
18
+ <clarion_manage_storelocator translate="title" module="clarion_storelocator">
19
+ <title>Manage Stores</title>
20
+ <sort_order>1</sort_order>
21
+ <action>adminhtml/managestorelocator</action>
22
+ </clarion_manage_storelocator>
23
+ <clarion_storelocator_general_settings translate="title" module="clarion_storelocator">
24
+ <title>General Settings</title>
25
+ <sort_order>2</sort_order>
26
+ <action>adminhtml/system_config/edit/section/clarion_storelocator_general_setting</action>
27
+ </clarion_storelocator_general_settings>
28
+ </children>
29
+ </clarion_storelocator>
30
+ </menu>
31
+
32
+ <!-- Access permissions -->
33
+ <acl>
34
+ <resources>
35
+ <all>
36
+ <title>Allow Everything</title>
37
+ </all>
38
+ <admin>
39
+ <children>
40
+ <clarion_storelocator translate="title" module="clarion_storelocator">
41
+ <title>Storelocator</title>
42
+ <sort_order>91</sort_order>
43
+ <children>
44
+ <clarion_manage_storelocator translate="title" module="clarion_storelocator">
45
+ <title>Manage Storelocator</title>
46
+ <sort_order>1</sort_order>
47
+ <children>
48
+ <save translate="title" module="clarion_storelocator">
49
+ <title>Save Store</title>
50
+ <sort_order>0</sort_order>
51
+ </save>
52
+ <delete translate="title" module="clarion_storelocator">
53
+ <title>Delete Store</title>
54
+ <sort_order>1</sort_order>
55
+ </delete>
56
+ </children>
57
+ </clarion_manage_storelocator>
58
+ <clarion_storelocator_general_settings translate="title" module="clarion_storelocator">
59
+ <title>General Settings</title>
60
+ <sort_order>2</sort_order>
61
+ </clarion_storelocator_general_settings>
62
+ </children>
63
+ </clarion_storelocator>
64
+ </children>
65
+ </admin>
66
+ </resources>
67
+ </acl>
68
+ </config>
app/code/community/Clarion/Storelocator/etc/config.xml ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Configuration file
5
+ *
6
+ * @category Clarion
7
+ * @package Clarion_Storelocator
8
+ * @author Clarion Magento Team
9
+ */
10
+ -->
11
+ <config>
12
+ <modules>
13
+ <Clarion_Storelocator>
14
+ <version>0.1.0</version>
15
+ </Clarion_Storelocator>
16
+ </modules>
17
+
18
+ <global>
19
+ <models>
20
+ <clarion_storelocator>
21
+ <class>Clarion_Storelocator_Model</class>
22
+ <resourceModel>storelocator_resource</resourceModel>
23
+ </clarion_storelocator>
24
+ <storelocator_resource>
25
+ <class>Clarion_Storelocator_Model_Resource</class>
26
+ <entities>
27
+ <storelocator>
28
+ <table>clarion_storelocator</table>
29
+ </storelocator>
30
+ </entities>
31
+ </storelocator_resource>
32
+ </models>
33
+
34
+ <helpers>
35
+ <clarion_storelocator>
36
+ <class>Clarion_Storelocator_Helper</class>
37
+ </clarion_storelocator>
38
+ </helpers>
39
+
40
+ <blocks>
41
+ <clarion_storelocator>
42
+ <class>Clarion_Storelocator_Block</class>
43
+ </clarion_storelocator>
44
+ </blocks>
45
+
46
+ <resources>
47
+ <clarion_storelocator_setup>
48
+ <setup>
49
+ <module>Clarion_Storelocator</module>
50
+ <class>Clarion_Storelocator_Model_Resource_Setup</class>
51
+ </setup>
52
+ <connection>
53
+ <use>core_setup</use>
54
+ </connection>
55
+ </clarion_storelocator_setup>
56
+
57
+ <clarion_storelocator_write>
58
+ <connection>
59
+ <use>core_write</use>
60
+ </connection>
61
+ </clarion_storelocator_write>
62
+
63
+ <clarion_storelocator_read>
64
+ <connection>
65
+ <use>core_read</use>
66
+ </connection>
67
+ </clarion_storelocator_read>
68
+ </resources>
69
+
70
+ </global>
71
+
72
+ <frontend>
73
+ <routers>
74
+ <clarion_storelocator>
75
+ <use>standard</use>
76
+ <args>
77
+ <module>Clarion_Storelocator</module>
78
+ <frontName>storelocator</frontName>
79
+ </args>
80
+ </clarion_storelocator>
81
+ </routers>
82
+
83
+ <!-- set frontend layout file-->
84
+ <layout>
85
+ <updates>
86
+ <clarion_storelocator>
87
+ <file>clarion_storelocator.xml</file>
88
+ </clarion_storelocator>
89
+ </updates>
90
+ </layout>
91
+ </frontend>
92
+
93
+ <admin>
94
+ <routers>
95
+ <adminhtml>
96
+ <args>
97
+ <modules>
98
+ <Clarion_Storelocator after="Mage_Adminhtml">Clarion_Storelocator_Adminhtml</Clarion_Storelocator>
99
+ </modules>
100
+ </args>
101
+ </adminhtml>
102
+ </routers>
103
+ </admin>
104
+
105
+
106
+ <adminhtml>
107
+ <!-- ACL for sections -->
108
+ <acl>
109
+ <resources>
110
+ <all>
111
+ <title>Allow Everything</title>
112
+ </all>
113
+ <admin>
114
+ <children>
115
+ <system>
116
+ <children>
117
+ <config>
118
+ <children>
119
+ <clarion_storelocator_general_setting translate="title" module="clarion_storelocator">
120
+ <title>Store Locator General Settings</title>
121
+ </clarion_storelocator_general_setting>
122
+ </children>
123
+ </config>
124
+ </children>
125
+ </system>
126
+ </children>
127
+ </admin>
128
+ </resources>
129
+ </acl>
130
+
131
+ <!-- Admin layout configuration -->
132
+ <layout>
133
+ <updates>
134
+ <clarion_storelocator>
135
+ <file>clarion_storelocator.xml</file>
136
+ </clarion_storelocator>
137
+ </updates>
138
+ </layout>
139
+
140
+ </adminhtml>
141
+
142
+ <!-- Set default values for system varablses -->
143
+ <default>
144
+ <clarion_storelocator_general_setting>
145
+ <clarion_storelocator_status>
146
+ <enable>1</enable>
147
+ </clarion_storelocator_status>
148
+
149
+ <clarion_storelocator_display_setting>
150
+ <default_radius>100</default_radius>
151
+ <zoom_level>6</zoom_level>
152
+ <stores_per_page>8</stores_per_page>
153
+ </clarion_storelocator_display_setting>
154
+ </clarion_storelocator_general_setting>
155
+ </default>
156
+ </config>
app/code/community/Clarion/Storelocator/etc/system.xml ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <!--
3
+ /**
4
+ * System config file
5
+ *
6
+ * @category Clarion
7
+ * @package Clarion_Storelocator
8
+ * @author Clarion Magento Team
9
+ */
10
+ -->
11
+ <config>
12
+ <tabs>
13
+ <clarion_storelocator_tab translate="label" module="clarion_storelocator">
14
+ <label>Store Locator</label>
15
+ <sort_order>0</sort_order>
16
+ </clarion_storelocator_tab>
17
+ </tabs>
18
+
19
+ <sections>
20
+ <clarion_storelocator_general_setting translate="label" module="clarion_storelocator">
21
+ <label>General Settings</label>
22
+ <tab>clarion_storelocator_tab</tab>
23
+ <frontend_type>text</frontend_type>
24
+ <sort_order>0</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
+ <groups>
29
+ <clarion_storelocator_status translate="label">
30
+ <label>Status</label>
31
+ <frontend_type>text</frontend_type>
32
+ <sort_order>0</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
+ <fields>
37
+ <enable translate="label">
38
+ <label>Enable Store Locator On Frontend</label>
39
+ <frontend_type>select</frontend_type>
40
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
41
+ <sort_order>0</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
+ </enable>
46
+ </fields>
47
+ </clarion_storelocator_status>
48
+
49
+ <clarion_storelocator_display_setting translate="label">
50
+ <label>Display Settings</label>
51
+ <frontend_type>text</frontend_type>
52
+ <sort_order>1</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>1</show_in_store>
56
+ <fields>
57
+ <default_radius translate="label">
58
+ <label>Default Radius</label>
59
+ <frontend_type>text</frontend_type>
60
+ <sort_order>0</sort_order>
61
+ <show_in_default>1</show_in_default>
62
+ <show_in_website>1</show_in_website>
63
+ <show_in_store>1</show_in_store>
64
+ <comment>Radius is in miles</comment>
65
+ <validate>required-entry validate-number</validate>
66
+ </default_radius>
67
+
68
+ <zoom_level translate="label">
69
+ <label>Zoom Level</label>
70
+ <frontend_type>text</frontend_type>
71
+ <sort_order>1</sort_order>
72
+ <show_in_default>1</show_in_default>
73
+ <show_in_website>1</show_in_website>
74
+ <show_in_store>1</show_in_store>
75
+ <validate>required-entry validate-digits</validate>
76
+ </zoom_level>
77
+
78
+ <stores_per_page translate="label">
79
+ <label>Stores Per Page</label>
80
+ <comment>Empty value is the same as default 8.</comment>
81
+ <sort_order>2</sort_order>
82
+ <show_in_default>1</show_in_default>
83
+ <show_in_website>1</show_in_website>
84
+ <show_in_store>1</show_in_store>
85
+ <validate>required-entry validate-digits</validate>
86
+ </stores_per_page>
87
+ </fields>
88
+ </clarion_storelocator_display_setting>
89
+ </groups>
90
+ </clarion_storelocator_general_setting>
91
+ </sections>
92
+ </config>
app/code/community/Clarion/Storelocator/sql/clarion_storelocator_setup/install-0.1.0.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Storelocator installation script
4
+ *
5
+ * @category Clarion
6
+ * @package Clarion_Storelocator
7
+ * @author Clarion Magento Team
8
+ *
9
+ */
10
+ /**
11
+ * @var $installer Mage_Core_Model_Resource_Setup
12
+ */
13
+ $installer = $this;
14
+
15
+ /**
16
+ * Prepare database for install
17
+ */
18
+ $installer->startSetup();
19
+
20
+ $table = $installer->getConnection()
21
+ ->newTable($installer->getTable('clarion_storelocator/storelocator'))
22
+ ->addColumn('store_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
23
+ 'identity' => true,
24
+ 'unsigned' => true,
25
+ 'nullable' => false,
26
+ 'primary' => true,
27
+ ), 'Store Id')
28
+
29
+ ->addColumn('name', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
30
+ ), 'Store Name')
31
+
32
+ ->addColumn('status', Varien_Db_Ddl_Table::TYPE_TINYINT, null, array(
33
+ 'nullable' => false,
34
+ 'default' => '1',
35
+ ), 'Staus')
36
+
37
+ ->addColumn('street_address', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
38
+ 'nullable' => true,
39
+ 'default' => null,
40
+ ), 'Street Address')
41
+
42
+ ->addColumn('country', Varien_Db_Ddl_Table::TYPE_TEXT, 64, array(
43
+ 'nullable' => true,
44
+ 'default' => null,
45
+ ), 'Country')
46
+
47
+ ->addColumn('state', Varien_Db_Ddl_Table::TYPE_TEXT, 64, array(
48
+ 'nullable' => true,
49
+ 'default' => null,
50
+ ), 'State')
51
+
52
+ ->addColumn('city', Varien_Db_Ddl_Table::TYPE_TEXT, 64, array(
53
+ 'nullable' => true,
54
+ 'default' => null,
55
+ ), 'City')
56
+
57
+ ->addColumn('zipcode', Varien_Db_Ddl_Table::TYPE_TEXT, 64, array(
58
+ 'nullable' => true,
59
+ 'default' => null,
60
+ ), 'Zipcode')
61
+
62
+ ->addColumn('phone', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
63
+ 'nullable' => true,
64
+ 'default' => null,
65
+ ), 'Phone')
66
+
67
+ ->addColumn('fax', Varien_Db_Ddl_Table::TYPE_TEXT, 64, array(
68
+ 'nullable' => true,
69
+ 'default' => null,
70
+ ), 'Fax')
71
+
72
+ ->addColumn('url', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
73
+ 'nullable' => true,
74
+ 'default' => null,
75
+ ), 'Store Url')
76
+
77
+ ->addColumn('email', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
78
+ 'nullable' => true,
79
+ 'default' => null,
80
+ ), 'Email')
81
+
82
+ ->addColumn('store_logo', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
83
+ 'nullable' => true,
84
+ 'default' => null,
85
+ ), 'Store Logo')
86
+
87
+ ->addColumn('description', Varien_Db_Ddl_Table::TYPE_TEXT, '64K', array(
88
+ 'nullable' => true,
89
+ 'default' => null,
90
+ ), 'Description')
91
+
92
+ ->addColumn('trading_hours', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
93
+ 'nullable' => true,
94
+ 'default' => null,
95
+ ), 'Trading Hours')
96
+
97
+ ->addColumn('radius', Varien_Db_Ddl_Table::TYPE_TEXT, 64, array(
98
+ 'nullable' => true,
99
+ 'default' => null,
100
+ ), 'Radius')
101
+
102
+ ->addColumn('latitude', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
103
+ 'nullable' => true,
104
+ 'default' => null,
105
+ ), 'Latitude')
106
+
107
+ ->addColumn('longitude', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
108
+ 'nullable' => true,
109
+ 'default' => null,
110
+ ), 'Longitude')
111
+
112
+ ->addColumn('zoom_level', Varien_Db_Ddl_Table::TYPE_TEXT, 64, array(
113
+ 'nullable' => true,
114
+ 'default' => null,
115
+ ), 'Zoom level')
116
+
117
+ ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
118
+ 'nullable' => true,
119
+ 'default' => null,
120
+ ), 'Creation Time')
121
+
122
+ ->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
123
+ 'nullable' => true,
124
+ 'default' => null,
125
+ ), 'Store Updated Date')
126
+
127
+ ->setComment('Clarion Storelocator Table');
128
+
129
+ $installer->getConnection()->createTable($table);
130
+ /**
131
+ * Prepare database after install
132
+ */
133
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/clarion_storelocator.xml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <!--
3
+ /**
4
+ * @category design
5
+ * @package default_default
6
+ * @author Clarion Magento Team
7
+ */
8
+ -->
9
+ <layout version="0.1.0">
10
+ <!-- For wysiwyg editor -->
11
+ <default>
12
+ <reference name="head">
13
+ <action method="setCanLoadExtJs"><flag>1</flag></action>
14
+ <action method="setCanLoadTinyMce"><flag>1</flag></action>
15
+ <action method="addJs"><script>mage/adminhtml/variables.js</script></action>
16
+ <action method="addJs"><script>mage/adminhtml/wysiwyg/widget.js</script></action>
17
+ <action method="addJs"><script>lib/flex.js</script></action>
18
+ <action method="addJs"><script>lib/FABridge.js</script></action>
19
+ <action method="addJs"><script>mage/adminhtml/flexuploader.js</script></action>
20
+ <action method="addJs"><script>mage/adminhtml/browser.js</script></action>
21
+ <action method="addJs"><script>prototype/window.js</script></action>
22
+ <action method="addJs"><script>prototype/prototype.js</script></action>
23
+ <action method="addItem"><type>js_css</type><name>prototype/windows/themes/default.css</name></action>
24
+ <action method="addCss"><name>lib/prototype/windows/themes/magento.css</name></action>
25
+ </reference>
26
+ </default>
27
+
28
+ <adminhtml_managestorelocator_index>
29
+ <reference name="content">
30
+ <block type="clarion_storelocator/adminhtml_storelocator" name="storelocator.grid.container" />
31
+ </reference>
32
+ </adminhtml_managestorelocator_index>
33
+
34
+ <adminhtml_managestorelocator_new>
35
+ <update handle="adminhtml_managestorelocator_edit" />
36
+ </adminhtml_managestorelocator_new>
37
+
38
+ <adminhtml_managestorelocator_edit>
39
+ <update handle="editor"/>
40
+ </adminhtml_managestorelocator_edit>
41
+ </layout>
app/design/frontend/base/default/layout/clarion_storelocator.xml ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Storelocator frontend layout file
5
+ *
6
+ * @category design
7
+ * @package base_default
8
+ * @author Clarion Magento Team
9
+ */
10
+ -->
11
+ <layout version="0.1.0">
12
+ <default>
13
+ <reference name="top.links">
14
+ <action method="addLink" translate="label title" module="clarion_storelocator"
15
+ ifconfig="clarion_storelocator_general_setting/clarion_storelocator_status/enable">
16
+ <label>Store Locator</label>
17
+ <url>storelocator</url>
18
+ <title>Store Locator</title>
19
+ <prepare>true</prepare>
20
+ <position>10</position>
21
+ </action>
22
+ </reference>
23
+ </default>
24
+ <clarion_storelocator_index_index translate="label">
25
+ <label>Store List Page</label>
26
+ <reference name="head">
27
+ <!-- css for store locator extension -->
28
+ <action method="addCss"><stylesheet>css/clarion_storelocator.css</stylesheet></action>
29
+ <!-- Include google map js file-->
30
+ <block type="core/text" name="gmap_external_js">
31
+ <action method="setText">
32
+ <text><![CDATA[<script language="javascript" type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>]]></text>
33
+ </action>
34
+ </block>
35
+ <!-- Add storelocator js file-->
36
+ <action method="addItem"><type>skin_js</type><name>js/clarion_storelocator/storelocator.js</name></action>
37
+ <action method="setTitle" translate="title" module="clarion_storelocator"><title>Find Store</title></action>
38
+ </reference>
39
+ <reference name="root">
40
+ <action method="setTemplate">
41
+ <template>page/2columns-right.phtml</template>
42
+ </action>
43
+ <action method="setHeaderTitle" translate="title" module="clarion_storelocator">
44
+ <title>Storelocator</title>
45
+ </action>
46
+ </reference>
47
+ <reference name="content">
48
+ <block type="clarion_storelocator/list" name="stores.list" template="clarion/storelocator/list.phtml">
49
+ <block type="page/html_pager" name="stores.list.pager" />
50
+ </block>
51
+ </reference>
52
+ </clarion_storelocator_index_index>
53
+
54
+ <clarion_storelocator_index_view translate="label">
55
+ <label>Store View Page</label>
56
+ <reference name="head">
57
+ <!-- css for store locator extension -->
58
+ <action method="addCss"><stylesheet>css/clarion_storelocator.css</stylesheet></action>
59
+ <!-- Include google map js file-->
60
+ <block type="core/text" name="gmap_external_js">
61
+ <action method="setText">
62
+ <text><![CDATA[<script language="javascript" type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>]]></text>
63
+ </action>
64
+ </block>
65
+ <!-- Add storelocator js file-->
66
+ <action method="addItem"><type>skin_js</type><name>js/clarion_storelocator/storelocator.js</name></action>
67
+ <action method="setTitle" translate="title" module="clarion_storelocator"><title>View Store</title></action>
68
+ </reference>
69
+ <reference name="root">
70
+ <action method="setTemplate">
71
+ <template>page/2columns-right.phtml</template>
72
+ </action>
73
+ </reference>
74
+ <reference name="content">
75
+ <block type="clarion_storelocator/view" name="store.view" template="clarion/storelocator/view.phtml" />
76
+ </reference>
77
+ </clarion_storelocator_index_view>
78
+ <clarion_storelocator_index_search translate="label">
79
+ <update handle="clarion_storelocator_index_index"/>
80
+ </clarion_storelocator_index_search>
81
+ </layout>
app/design/frontend/base/default/template/clarion/storelocator/list.phtml ADDED
@@ -0,0 +1,230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Storelocator template for stores list
4
+ *
5
+ * @author Magento
6
+ */
7
+
8
+ /**
9
+ * @var $this Clarion_Storelocator_Block_List
10
+ * @see Clarion_Storelocator_Block_List
11
+ */
12
+ ?>
13
+ <?php
14
+ $markers = array();
15
+ ?>
16
+ <div class="page-title">
17
+ <h1><?php echo Mage::helper('clarion_storelocator')->__('Store Locator') ?></h1>
18
+ </div>
19
+ <table border="0" id="search-store">
20
+ <tr>
21
+ <td style="width: 45%">
22
+ <form action="<?php echo $this->getPostActionUrl() ?>" method="get" id="addressSearch">
23
+ <div class="fieldset">
24
+ <h2 class="legend">Search Store</h2>
25
+ <ul class="form-list store-list">
26
+ <?php $_countries = $this->getCountries();?>
27
+ <?php if (count($_countries) > 0): ?>
28
+ <li>
29
+ <label for="country"><?php echo $this->__('Country') ?></label>
30
+ <div class="input-box">
31
+ <select name="country" id="country" class="select" title="<?php echo $this->__('Country') ?>">
32
+ <option value=""><?php echo $this->__('-- Please Select --'); ?></option>
33
+ <?php foreach($_countries as $_country): ?>
34
+ <option value="<?php echo $_country['value'] ?>"
35
+ <?php if($this->getFormData()->getCountry() == $_country['value']):?>selected="selected"<?php endif;?>>
36
+ <?php echo $_country['label'] ?>
37
+ </option>
38
+ <?php endforeach; ?>
39
+ </select>
40
+ </div>
41
+ </li>
42
+ <?php endif; ?>
43
+ <li>
44
+ <label for="state" ><?php echo $this->__('State') ?></label>
45
+ <div class="input-box">
46
+ <input type="text" name="state" id="state" value="<?php echo $this->escapeHtml($this->getFormData()->getState()) ?>" title="<?php echo $this->__('state') ?>" class="input-text" />
47
+ </div>
48
+ </li>
49
+ <li>
50
+ <label for="city" ><?php echo $this->__('City') ?></label>
51
+ <div class="input-box">
52
+ <input type="text" name="city" id="city" value="<?php echo $this->escapeHtml($this->getFormData()->getCity()) ?>" title="<?php echo $this->__('City') ?>" class="input-text" />
53
+ </div>
54
+ </li>
55
+ <li>
56
+ <button type="submit" title="<?php echo $this->__('Search') ?>" class="button"><span><span><?php echo $this->__('Search') ?></span></span></button>
57
+ <button type="reset" title="<?php echo $this->__('Reset') ?>" class="button" onClick="setLocation('<?php echo Mage::getUrl('*/*/index') ?>')"><span><span><?php echo $this->__('Reset') ?></span></span></button>
58
+ </li>
59
+ </ul>
60
+ </div>
61
+ </form>
62
+ </td>
63
+ </tr>
64
+ </table>
65
+ <?php
66
+ $_StoreCollection = $this->getStoreCollection();
67
+ $i = 1;
68
+ $totalStoreCount = $_StoreCollection->count();
69
+ ?>
70
+ <div class="your-store-title">
71
+ <?php echo Mage::helper('clarion_storelocator')->__('Your Stores') ?>
72
+ </div>
73
+ <div id="stores-list-div">
74
+ <table border="0" id="stores">
75
+ <?php if(!$totalStoreCount): ?>
76
+ <tr>
77
+ <td><p class="note-msg"><?php echo $this->__('There are no stores.') ?></p></td>
78
+ </tr>
79
+ <?php else: ?>
80
+ <tr>
81
+ <?php foreach ($_StoreCollection as $store): ?>
82
+ <td valign="top" class="stores-view">
83
+ <table id="stores-inner">
84
+ <tr><td class="stores-name"><a href="<?php echo $this->getStoreUrl($store);?>"><?php echo $this->escapeHtml(ucfirst($store->getName())) ?></a></td></tr>
85
+ <tr>
86
+ <td>
87
+ <!-- country -->
88
+ <?php if($store->getCountry()): ?>
89
+ <?php echo ucfirst($this->getCountryName($store->getCountry())); ?><br>
90
+ <?php endif; ?>
91
+ </td>
92
+ </tr>
93
+ <tr>
94
+ <td>
95
+ <!-- State -->
96
+ <?php if($store->getState()): ?>
97
+ <?php echo $this->escapeHtml(ucfirst($store->getState())); ?><br>
98
+ <?php endif; ?>
99
+ </td>
100
+ </tr>
101
+ <tr>
102
+ <td>
103
+ <!-- City -->
104
+ <?php if($store->getCity()): ?>
105
+ <?php echo $this->escapeHtml(ucfirst($store->getCity())) ;?><br>
106
+ <?php endif; ?>
107
+ </td>
108
+ </tr>
109
+ <tr>
110
+ <td>
111
+ <!-- Store Address -->
112
+ <?php if($store->getStreetAddress()): ?>
113
+ <?php echo $this->escapeHtml($store->getStreetAddress()) ?><br>
114
+ <?php endif; ?>
115
+ </td>
116
+ </tr>
117
+ <tr>
118
+ <td>
119
+ <!-- Zip Code -->
120
+ <?php if($store->getZipcode()): ?>
121
+ Zip Code:<?php echo $this->escapeHtml($store->getZipcode()) ?><br>
122
+ <?php endif; ?>
123
+ </td>
124
+ </tr>
125
+ <tr>
126
+ <td>
127
+ <!-- Phone -->
128
+ <?php if($store->getPhone()): ?>
129
+ Phone:<?php echo $this->escapeHtml($store->getPhone()) ?><br>
130
+ <?php endif; ?>
131
+ </td>
132
+ </tr>
133
+ <tr><td>&nbsp;</td></tr>
134
+ <tr>
135
+ <td>
136
+ <table>
137
+ <tr>
138
+ <td>
139
+ <button onclick="setLocation('<?php echo $this->getStoreUrl($store);?>');" class="button" title="<?php echo Mage::helper('clarion_storelocator')->__('View Details') ?>" type="button">
140
+ <span>
141
+ <span>
142
+ <?php echo Mage::helper('clarion_storelocator')->__('View Details') ?>
143
+ </span>
144
+ </span>
145
+ </button>
146
+ </td>
147
+
148
+ <td width="1px">&nbsp;</td>
149
+ <td>
150
+ <?php
151
+ //Get store google map related information
152
+ $storeName = $store->getName();
153
+ $storeLat = $store->getLatitude();
154
+ $storeLong = $store->getLongitude();
155
+ $storeRadius = $this->getRadius($store);
156
+ $storeZoomLevel = $this->getZoomLevel($store);
157
+ ?>
158
+ <?php if($storeLat && $storeLong): ?>
159
+ <button onclick="initialize(<?php echo $storeLat ;?>, <?php echo $storeLong ;?>, <?php echo $storeRadius ;?>, <?php echo $storeZoomLevel ;?>, '<?php echo $storeName ;?>', 'store-list-map-canvas');" class="button" title="<?php echo Mage::helper('clarion_storelocator')->__('View Map') ?>" type="button">
160
+ <span>
161
+ <span>
162
+ <?php echo Mage::helper('clarion_storelocator')->__('View Map') ?>
163
+ </span>
164
+ </span>
165
+ </button>
166
+ <?php endif ;?>
167
+ </td>
168
+ </tr>
169
+ </table>
170
+
171
+ </td>
172
+ </tr>
173
+ </table>
174
+ </td>
175
+ <?php if ($i++ % 2 == 0) :?>
176
+ </tr><tr>
177
+ <?php endif; ?>
178
+ <?php
179
+ // for google map
180
+ $markers[$i]['name'] = $store->getName();
181
+ $markers[$i]['lat'] = $store->getLatitude();
182
+ $markers[$i]['long'] = $store->getLongitude();
183
+ ?>
184
+ <?php endforeach; ?>
185
+ <?php endif; ?>
186
+ </tr>
187
+ <tr>
188
+ <td align="right">&nbsp;</td>
189
+ </tr>
190
+ <tr>
191
+ <td align="right" colspan="3"><?php echo $this->getPager() ?></td>
192
+ </tr>
193
+ </table>
194
+ </div>
195
+ <?php if($totalStoreCount): ?>
196
+ <div id="stores-list-gmap-div">
197
+ <div id="store-list-map-canvas">&nbsp;</div>
198
+ </div>
199
+ <?php if(is_array($markers) && count($markers)>0 ) :?>
200
+ <script>
201
+ //<![CDATA[
202
+ var markers = [
203
+ <?php foreach ($markers as $marker) : ?>
204
+ ['<?php echo $marker['name'];?>',<?php echo $marker['lat'];?>,<?php echo $marker['long'];?>],
205
+ <?php endforeach ?>
206
+ ];
207
+ //]]>
208
+ </script>
209
+ <?php endif ?>
210
+ <div id="show-all-store">
211
+ <button onclick="place_multiple_markers(markers, googleMapDivId);" class="button" title="<?php echo Mage::helper('clarion_storelocator')->__('Show All Stores') ?>" type="button">
212
+ <span>
213
+ <span>
214
+ <?php echo Mage::helper('clarion_storelocator')->__('Show All Stores') ?>
215
+ </span>
216
+ </span>
217
+ </button>
218
+ </div>
219
+ <script type="text/javascript">
220
+ //<![CDATA[
221
+ var addressSearch = new VarienForm('addressSearch', true);
222
+ //]]>
223
+ </script>
224
+ <script>
225
+ //<![CDATA[
226
+ var googleMapDivId = 'store-list-map-canvas';
227
+ google.maps.event.addDomListener(window, 'load', place_multiple_markers(markers, googleMapDivId));
228
+ //]]>
229
+ </script>
230
+ <?php endif ?>
app/design/frontend/base/default/template/clarion/storelocator/view.phtml ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Storelocator template for store view
4
+ *
5
+ * @author Magento
6
+ */
7
+
8
+ /**
9
+ * @var $this Clarion_Storelocator_Block_View
10
+ * @see Clarion_Storelocator_Block_View
11
+ */
12
+ ?>
13
+ <?php $_storeView = $this->helper('clarion_storelocator')->getStoreViewInstance(); ?>
14
+ <!-- Add Google Map Listener -->
15
+
16
+ <div class="page-title">
17
+ <h1><?php echo $this->escapeHtml($_storeView->getName()) ?> - Store Detail</h1>
18
+ </div>
19
+ <table border="0" id="store-view-detail">
20
+ <tr>
21
+ <td>
22
+ <button onclick="setLocation('<?php echo $this->getBackUrl() ?>');" class="button" title="<?php echo Mage::helper('clarion_storelocator')->__('Back') ?>" type="button">
23
+ <span>
24
+ <span>
25
+ <?php echo Mage::helper('clarion_storelocator')->__('Back') ?>
26
+ </span>
27
+ </span>
28
+ </button>
29
+ </td>
30
+ </tr>
31
+ <tr><td>&nbsp;</td></tr>
32
+ <tr>
33
+ <td id="store-detail">
34
+ <table id="store-view-detail-table" class="store-view-detail-data-table">
35
+ <tbody>
36
+ <?php if ($imageUrl = $this->getImageUrl($_storeView, 400)): ?>
37
+ <tr>
38
+ <td colspan="2">
39
+ <p><img src="<?php echo $imageUrl ?>" alt="<?php echo $this->escapeHtml($_storeView->getName()) ?>" title="<?php echo $this->escapeHtml($_storeView->getName()) ?>" /></p>
40
+ </td></tr>
41
+ <?php endif; ?>
42
+ <tr>
43
+ <th class="label">Store</th>
44
+ <td><?php echo $this->escapeHtml(ucfirst($_storeView->getName())) ?></td>
45
+ </tr>
46
+ <tr>
47
+ <th class="label">Country</th>
48
+ <td ><?php echo ucfirst($this->getCountryName($_storeView->getCountry())); ?></td>
49
+ </tr>
50
+ <tr>
51
+ <th class="label">State</th>
52
+ <td><?php echo $this->escapeHtml(ucfirst($_storeView->getState())) ?></td>
53
+ </tr>
54
+ <tr>
55
+ <th class="label">City</th>
56
+ <td><?php echo $this->escapeHtml(ucfirst($_storeView->getCity())) ?></td>
57
+ </tr>
58
+ <!-- Store Address -->
59
+ <?php if($_storeView->getStreetAddress()): ?>
60
+ <tr>
61
+ <th class="label">Street Address</th>
62
+ <td><?php echo $this->escapeHtml($_storeView->getStreetAddress()) ?></td>
63
+ </tr>
64
+ <?php endif; ?>
65
+ <!-- Zip Code -->
66
+ <?php if($_storeView->getZipcode()): ?>
67
+ <tr>
68
+ <th class="label">Zip Code</th>
69
+ <td><?php echo $this->escapeHtml($_storeView->getZipcode()) ?></td>
70
+ </tr>
71
+ <?php endif; ?>
72
+ <!-- Phone -->
73
+ <?php if($_storeView->getPhone()): ?>
74
+ <tr>
75
+ <th class="label">Phone</th>
76
+ <td><?php echo $this->escapeHtml($_storeView->getPhone()) ?></td>
77
+ </tr>
78
+ <?php endif; ?>
79
+ <!-- Phone -->
80
+ <?php if($_storeView->getPhone()): ?>
81
+ <tr>
82
+ <th class="label">Phone</th>
83
+ <td><?php echo $this->escapeHtml($_storeView->getPhone()) ?></td>
84
+ </tr>
85
+ <?php endif; ?>
86
+ <!-- Fax -->
87
+ <?php if($_storeView->getFax()): ?>
88
+ <tr>
89
+ <th class="label">Fax</th>
90
+ <td><?php echo $this->escapeHtml($_storeView->getFax()) ?></td>
91
+ </tr>
92
+ <?php endif; ?>
93
+ <!-- Store Url -->
94
+ <?php if($_storeView->getUrl()): ?>
95
+ <tr>
96
+ <th class="label">Store Url</th>
97
+ <td><?php echo $this->escapeHtml($_storeView->getUrl()) ?></td>
98
+ </tr>
99
+ <?php endif; ?>
100
+ <!-- Email -->
101
+ <?php if($_storeView->getEmail()): ?>
102
+ <tr>
103
+ <th class="label">Email</th>
104
+ <td><?php echo $this->escapeHtml($_storeView->getEmail()) ?></td>
105
+ </tr>
106
+ <?php endif; ?>
107
+ <!-- Trading Hours -->
108
+ <?php if($_storeView->getTradingHours()): ?>
109
+ <tr>
110
+ <th class="label">Trading Hours</th>
111
+ <td><?php echo $this->escapeHtml($_storeView->getTradingHours()) ?></td>
112
+ </tr>
113
+ <?php endif; ?>
114
+ <!-- Radius -->
115
+ <?php if($_storeView->getRadius()): ?>
116
+ <tr>
117
+ <th class="label">Radius</th>
118
+ <td><?php echo $this->escapeHtml($_storeView->getRadius()) ?></td>
119
+ </tr>
120
+ <?php endif; ?>
121
+ <!-- Description -->
122
+ <?php if($_storeView->getDescription()): ?>
123
+ <tr>
124
+ <th class="label">Description</th>
125
+ <td><?php echo $_storeView->getDescription(); ?></td>
126
+ </tr>
127
+ <?php endif; ?>
128
+ </tbody>
129
+ </table>
130
+ </td>
131
+ <td id="store-gmap" style="valign:top"><div id="googleMap" style="width:430px;height:600px;"></div></td>
132
+ </tr>
133
+ <tr><td>&nbsp;</td></tr>
134
+ <tr>
135
+ <td>
136
+ <button onclick="setLocation('<?php echo $this->getBackUrl() ?>');" class="button" title="<?php echo Mage::helper('clarion_storelocator')->__('Back') ?>" type="button">
137
+ <span>
138
+ <span>
139
+ <?php echo Mage::helper('clarion_storelocator')->__('Back') ?>
140
+ </span>
141
+ </span>
142
+ </button>
143
+ </td>
144
+ </tr>
145
+ </table>
146
+ <?php
147
+ //Get store google map related information
148
+ $storeName = $_storeView->getName();
149
+ $storeLat = $_storeView->getLatitude();
150
+ $storeLong = $_storeView->getLongitude();
151
+ $storeRadius = $this->getRadius($_storeView);
152
+ $storeZoomLevel = $this->getZoomLevel($_storeView);
153
+ ?>
154
+ <?php if($storeLat && $storeLong): ?>
155
+ <script>
156
+ //<![CDATA[
157
+ var storeLat = <?php echo $storeLat ;?>;
158
+ var storeLong = <?php echo $storeLong ;?>;
159
+ var storeRadius = <?php echo $storeRadius ;?>;
160
+ var storeZoomLevel = <?php echo $storeZoomLevel ;?>;
161
+ var storeInfoText = '<?php echo $storeName ;?>';
162
+ var googleMapDivId = 'googleMap';
163
+ google.maps.event.addDomListener(window, 'load', initialize(storeLat, storeLong, storeRadius, storeZoomLevel, storeInfoText, googleMapDivId));
164
+ //]]>
165
+ </script>
166
+ <?php endif ?>
app/etc/modules/Clarion_Storelocator.xml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Module configuration file
5
+ * @category Clarion
6
+ * @package Clarion_Storelocator
7
+ * @author Clarion Magento Team
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Clarion_Storelocator>
13
+ <active>true</active>
14
+ <codePool>community</codePool>
15
+ </Clarion_Storelocator>
16
+ </modules>
17
+ </config>
media/clarion_storelocator/demo1.png ADDED
Binary file
media/clarion_storelocator/demo2.png ADDED
Binary file
media/clarion_storelocator/demo3.png ADDED
Binary file
media/clarion_storelocator/demo4.png ADDED
Binary file
media/clarion_storelocator/demo5.png ADDED
Binary file
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Clarion_Storelocator</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Store Locator With Google Map</summary>
10
+ <description>Store locator extension helps to manage multiple stores from admin panel. Customers can search nearest stores. Customers can view individual store details. Stores shown on the Google map.</description>
11
+ <notes>First stable release 1.0.0</notes>
12
+ <authors><author><name>Clarion Technologies</name><user>Clariontech</user><email>magento@clariontechnologies.co.in</email></author></authors>
13
+ <date>2014-07-10</date>
14
+ <time>07:30:47</time>
15
+ <contents><target name="magecommunity"><dir name="Clarion"><dir name="Storelocator"><dir name="Block"><dir name="Adminhtml"><dir name="Storelocator"><dir name="Edit"><file name="Form.php" hash="6ae73ab1e08b67ece7ef0b8090fa58ac"/><dir name="Tab"><file name="Description.php" hash="6d7713c768072d32e669f43e82ed43b6"/><file name="Display.php" hash="98f53775cdfff51f1b18594d769fd5cc"/><file name="Form.php" hash="ab9dff23f35e17e2a46957adbddf497b"/><file name="Googlemap.PHP" hash="5f6a32c06b19e78b6a67a4f54e6c735f"/></dir><file name="Tabs.php" hash="ee6cf57f633fc54c41f2a0097b02292b"/></dir><file name="Edit.php" hash="99123b14b87648755c790cd4517778a4"/><file name="Grid.php" hash="0fc226f076bd0a966157d9bd8b35ccc9"/></dir><file name="Storelocator.php" hash="8408bd9a6cd03628fbeb189b5ea25796"/></dir><file name="List.php" hash="aea899ad2098df8193bf18fb7eb00a7f"/><file name="View.php" hash="851850836d6bb8e4228a6173dce2375d"/></dir><dir name="Helper"><file name="Admin.php" hash="c3b93859c4e926afd7dfa1931b805040"/><file name="Data.php" hash="5ddcdaf83c7c3e34ddafdcbd9fd61d47"/><file name="Image.php" hash="f57436a272c1bd566239a52ea7429c5a"/></dir><dir name="Model"><file name="Enabledisable.php" hash="9a4274b006e955c1da42253260ec3fa3"/><dir name="Resource"><file name="Setup.php" hash="d626686cd920168f17d332b1edd3860d"/><dir name="Storelocator"><file name="Collection.php" hash="a3369d973ebed6c82cf5c7e46da7b485"/></dir><file name="Storelocator.php" hash="44158f03768473e415a060d60ccefab3"/></dir><file name="Storelocator.php" hash="2339ba82ce2082ea53f0b956c21ac8b0"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ManagestorelocatorController.php" hash="9352766c15d65212e7b6e9a38ba0803b"/></dir><file name="IndexController.php" hash="03c5faa977d65241b1d853deab5beff9"/></dir><dir name="data"><dir name="clarion_storelocator_setup"><file name="data-install-0.1.0.php" hash="c1a712b8a0832f53afd0a9de4289ef61"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="cdc622c940dc5be38dbc0ac0f4692827"/><file name="config.xml" hash="8d93985cdeaba92f959d41798c574917"/><file name="system.xml" hash="b22b364f771a8d79762e468f438c040b"/></dir><dir name="sql"><dir name="clarion_storelocator_setup"><file name="install-0.1.0.php" hash="837a059b999021a4fca8714dae95ed7c"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="clarion_storelocator.xml" hash="ed85f66f43d0abed92fbc8e6a4752e7a"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="clarion_storelocator.xml" hash="657e24dc7c3ea71c9cb5241611f1c43f"/></dir><dir name="template"><dir name="clarion"><dir name="storelocator"><file name="list.phtml" hash="a321d7338a3317883487d55a825dd60b"/><file name="view.phtml" hash="5e216c02a4ecde43d2548572e60e6e47"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Clarion_Storelocator.xml" hash="64d157a8f5d3806f9294495058042a8b"/></dir></target><target name="magemedia"><dir name="clarion_storelocator"><file name="demo1.png" hash="36d5e5281767ac6ed3ed4373945a00a1"/><file name="demo2.png" hash="1e691b78821ad95c4fd12f2e66990f93"/><file name="demo3.png" hash="e821fde1f20f200dea31e9e9e39cddd7"/><file name="demo4.png" hash="1f90c8d847fd50d9062ac6fda4d9104d"/><file name="demo5.png" hash="098844050ba3cec618963253a3956c90"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="clarion_storelocator.css" hash="e012deb8f48fff3d466aeff420097d7b"/></dir><dir name="js"><dir name="clarion_storelocator"><file name="storelocator.js" hash="cd71dbe51c5b86e8ab0f94a00660c3ce"/></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>
skin/frontend/base/default/css/clarion_storelocator.css ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Storelocator css file
3
+ *
4
+ * @category design
5
+ * @package base_default
6
+ * @author Clarion Magento Team
7
+ */
8
+ /* Search stores*/
9
+ #search-store {
10
+ width: 100%;
11
+ border-collapse: collapse;
12
+ }
13
+ /* store list page */
14
+ #stores-list-div {
15
+ width: 48%;
16
+ float: left;
17
+ }
18
+
19
+ #stores-list-gmap-div {
20
+ width: 50%;
21
+ border: 1px solid silver;
22
+ float: right;
23
+ margin-left: 1px;
24
+ position: relative;
25
+ overflow: hidden;
26
+ }
27
+
28
+ #store-list-map-canvas {
29
+ width:432px;
30
+ height:600px;
31
+ float: right;
32
+ }
33
+
34
+ #show-all-store {
35
+ float: right;
36
+ padding: 10px
37
+ }
38
+ #stores {
39
+ width: 100%;
40
+ border-collapse: collapse;
41
+ }
42
+
43
+ .stores-view {
44
+ font-size: 12px;
45
+ border: 1px solid silver;
46
+ padding: 5px 0px 5px 1px;
47
+ }
48
+
49
+ #stores-inner{
50
+ width: 100%;
51
+ border-collapse: collapse;
52
+ }
53
+
54
+ .stores-name {
55
+ font-size: 14px;
56
+ font-weight: bold;
57
+ }
58
+
59
+ .store-list input, .store-list select {
60
+ border: 1px solid #cccccc;
61
+ height: auto !important;
62
+ }
63
+ .store-list select {
64
+ margin: 0;
65
+ padding: 2px !important;
66
+ }
67
+ .store-list label {
68
+ float: left;
69
+ width: 10%;
70
+ }
71
+ .form-list label {
72
+ float: left;
73
+ font-weight: bold;
74
+ margin: 0 0 2px;
75
+ position: relative;
76
+ z-index: 0;
77
+ }
78
+ .form-list select {
79
+ width: 200px !important;
80
+ }
81
+
82
+ .form-list input {
83
+ width: 200px !important;
84
+ }
85
+ .your-store-title {
86
+ border-bottom: 1px solid #ededed;
87
+ color: #636363;
88
+ font-family: "Raleway","Helvetica Neue",Verdana,Arial,sans-serif;
89
+ font-size: 18px;
90
+ font-style: normal;
91
+ font-weight: 400;
92
+ line-height: 1.4;
93
+ margin: 0 0 15px;
94
+ padding-bottom: 7px;
95
+ text-rendering: optimizespeed;
96
+ text-transform: uppercase;
97
+ }
98
+ /* store view detail page */
99
+ #store-detail {
100
+ width: 50%;
101
+ vertical-align: top;
102
+ border-top: 1px solid silver;
103
+ border-left: 1px solid silver;
104
+ border-bottom: 1px solid silver;
105
+ }
106
+ #store-view-detail {
107
+ width: 100%;
108
+ border-collapse: collapse;
109
+ }
110
+
111
+ #store-gmap {
112
+ width: 50%;
113
+ vertical-align: top;
114
+ padding: 10px;
115
+ border: 1px solid silver;
116
+ }
117
+
118
+ #store-view-detail-table {
119
+ max-width: 50em;
120
+ }
121
+ .store-view-detail-data-table{
122
+ width: 100%;
123
+ padding: 10px;
124
+ vertical-align: top;
125
+ }
126
+ #store-view-detail-table th {
127
+ border-bottom: 1px solid silver;
128
+ border-right: 1px solid silver;
129
+ width: 30%;
130
+ }
131
+
132
+ .store-view-detail-data-table th {
133
+ background: none repeat scroll 0 0 #f4f4f4;
134
+ line-height: 1.4;
135
+ text-transform: uppercase;
136
+ white-space: nowrap;
137
+ }
138
+
139
+ .store-view-detail-data-table td, .store-view-detail-data-table th {
140
+ padding: 10px;
141
+ vertical-align: top;
142
+ }
143
+
144
+ .store-view-detail-data-table tbody td {
145
+ border-bottom: 1px solid silver;
146
+ }
skin/frontend/base/default/js/clarion_storelocator/storelocator.js ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Locate store on gogle map
3
+ *
4
+ * @category design
5
+ * @package base_default
6
+ * @author Clarion Magento Team
7
+ */
8
+
9
+ /**
10
+ * Return parameters for back url
11
+ *
12
+ * @param storeLat latitude
13
+ * @param storeLong logitude
14
+ * @param storeRadius store radius
15
+ * @param storeZoomLevel google map zoom level
16
+ * @param storeInfoText display infobox on google map
17
+ * @return null
18
+ */
19
+ function initialize(storeLat, storeLong, storeRadius, storeZoomLevel, storeInfoText, googleMapDivId)
20
+ {
21
+ var myCenter = new google.maps.LatLng(storeLat, storeLong);
22
+ //convert distance from miles to meters
23
+ var storeRadius = storeRadius * 1609.34;
24
+ var mapProp = {
25
+ center : myCenter,
26
+ zoom : storeZoomLevel,
27
+ mapTypeId : google.maps.MapTypeId.ROADMAP
28
+ };
29
+
30
+ var map = new google.maps.Map(document.getElementById(''+googleMapDivId), mapProp);
31
+
32
+ //Draw marker
33
+ var marker = new google.maps.Marker({
34
+ position : myCenter,
35
+ });
36
+ marker.setMap(map);
37
+
38
+ //Draw circle radius is in meter
39
+ if(storeRadius) {
40
+ var myCity = new google.maps.Circle({
41
+ center : myCenter,
42
+ radius : storeRadius,
43
+ strokeColor : "#FF00C4",
44
+ strokeOpacity : 0.8,
45
+ strokeWeight : 1,
46
+ fillColor : "#CF74C5",
47
+ fillOpacity : 0.4
48
+ });
49
+ myCity.setMap(map);
50
+ }
51
+
52
+ // Open information window
53
+ if(storeInfoText) {
54
+ var infowindow = new google.maps.InfoWindow({
55
+ content:storeInfoText
56
+ });
57
+ infowindow.open(map, marker);
58
+ }
59
+ }
60
+
61
+ /**
62
+ * add multiple stores on google map
63
+ *
64
+ * @param array markers markers
65
+ * @param string googleMapDivId div id
66
+ */
67
+ function place_multiple_markers(markers, googleMapDivId)
68
+ {
69
+ var map;
70
+ var bounds = new google.maps.LatLngBounds();
71
+ var mapOptions = {
72
+ mapTypeId: 'roadmap'
73
+ };
74
+
75
+ // Display a map on the page
76
+ map = new google.maps.Map(document.getElementById(''+googleMapDivId), mapOptions);
77
+ map.setTilt(45);
78
+
79
+ // Display multiple markers on a map
80
+ var infoWindow = new google.maps.InfoWindow(), marker, i;
81
+
82
+ // Loop through our array of markers & place each one on the map
83
+ for( i = 0; i < markers.length; i++ ) {
84
+ var position = new google.maps.LatLng(markers[i][1], markers[i][2]);
85
+ bounds.extend(position);
86
+ marker = new google.maps.Marker({
87
+ position: position,
88
+ map: map,
89
+ title: markers[i][0]
90
+ });
91
+
92
+ // Allow each marker to have an info window
93
+ google.maps.event.addListener(marker, 'click', (function(marker, i) {
94
+ return function() {
95
+ infoWindow.setContent(markers[i][0]);
96
+ infoWindow.open(map, marker);
97
+ }
98
+ })(marker, i));
99
+
100
+ // Automatically center the map fitting all markers on the screen
101
+ map.fitBounds(bounds);
102
+ }
103
+ }