storelocator_webskills - Version 0.1.1

Version Notes

Clear Cache after installing and re-login to magento admin.

Download this release

Release Info

Developer Rohit Dhiman
Extension storelocator_webskills
Version 0.1.1
Comparing to
See all releases


Code changes from version 0.1.0 to 0.1.1

app/code/local/Webskills/Storelocator/Block/Adminhtml/Storelocator.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Webskills_Storelocator_Block_Adminhtml_Storelocator extends Mage_Adminhtml_Block_Widget_Grid_Container{
5
+
6
+ public function __construct()
7
+ {
8
+
9
+ $this->_controller = "adminhtml_storelocator";
10
+ $this->_blockGroup = "storelocator";
11
+ $this->_headerText = Mage::helper("storelocator")->__("Storelocator Manager");
12
+ $this->_addButtonLabel = Mage::helper("storelocator")->__("Add New Item");
13
+ parent::__construct();
14
+
15
+ }
16
+
17
+ }
app/code/local/Webskills/Storelocator/Block/Adminhtml/Storelocator/Edit.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Webskills_Storelocator_Block_Adminhtml_Storelocator_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+
8
+ parent::__construct();
9
+ $this->_objectId = "id";
10
+ $this->_blockGroup = "storelocator";
11
+ $this->_controller = "adminhtml_storelocator";
12
+ $this->_updateButton("save", "label", Mage::helper("storelocator")->__("Save Item"));
13
+ $this->_updateButton("delete", "label", Mage::helper("storelocator")->__("Delete Item"));
14
+
15
+ $this->_addButton("saveandcontinue", array(
16
+ "label" => Mage::helper("storelocator")->__("Save And Continue Edit"),
17
+ "onclick" => "saveAndContinueEdit()",
18
+ "class" => "save",
19
+ ), -100);
20
+
21
+
22
+
23
+ $this->_formScripts[] = "
24
+
25
+ function saveAndContinueEdit(){
26
+ editForm.submit($('edit_form').action+'back/edit/');
27
+ }
28
+ ";
29
+ }
30
+
31
+ public function getHeaderText()
32
+ {
33
+ if( Mage::registry("storelocator_data") && Mage::registry("storelocator_data")->getId() ){
34
+
35
+ return Mage::helper("storelocator")->__("Edit Item '%s'", $this->htmlEscape(Mage::registry("storelocator_data")->getId()));
36
+
37
+ }
38
+ else{
39
+
40
+ return Mage::helper("storelocator")->__("Add Item");
41
+
42
+ }
43
+ }
44
+ }
app/code/local/Webskills/Storelocator/Block/Adminhtml/Storelocator/Edit/Form.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Webskills_Storelocator_Block_Adminhtml_Storelocator_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+ protected function _prepareForm()
5
+ {
6
+ $form = new Varien_Data_Form(array(
7
+ "id" => "edit_form",
8
+ "action" => $this->getUrl("*/*/save", array("id" => $this->getRequest()->getParam("id"))),
9
+ "method" => "post",
10
+ "enctype" =>"multipart/form-data",
11
+ )
12
+ );
13
+ $form->setUseContainer(true);
14
+ $this->setForm($form);
15
+ return parent::_prepareForm();
16
+ }
17
+ }
app/code/local/Webskills/Storelocator/Block/Adminhtml/Storelocator/Edit/Tab/Form.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Webskills_Storelocator_Block_Adminhtml_Storelocator_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+ protected function _prepareForm()
5
+ {
6
+
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $fieldset = $form->addFieldset("storelocator_form", array("legend"=>Mage::helper("storelocator")->__("Item information")));
10
+
11
+
12
+ $fieldset->addField("name", "text", array(
13
+ "label" => Mage::helper("storelocator")->__("Name"),
14
+ "class" => "required-entry",
15
+ "required" => true,
16
+ "name" => "name",
17
+ ));
18
+
19
+ $fieldset->addField("address", "text", array(
20
+ "label" => Mage::helper("storelocator")->__("Address"),
21
+ "class" => "required-entry",
22
+ "required" => true,
23
+ "name" => "address",
24
+ ));
25
+
26
+ $fieldset->addField("city", "text", array(
27
+ "label" => Mage::helper("storelocator")->__("City"),
28
+ "class" => "required-entry",
29
+ "required" => true,
30
+ "name" => "city",
31
+ ));
32
+
33
+ $fieldset->addField("state", "text", array(
34
+ "label" => Mage::helper("storelocator")->__("State"),
35
+ "class" => "required-entry",
36
+ "required" => true,
37
+ "name" => "state",
38
+ ));
39
+
40
+
41
+ if (Mage::getSingleton("adminhtml/session")->getStorelocatorData())
42
+ {
43
+ $form->setValues(Mage::getSingleton("adminhtml/session")->getStorelocatorData());
44
+ Mage::getSingleton("adminhtml/session")->setStorelocatorData(null);
45
+ }
46
+ elseif(Mage::registry("storelocator_data")) {
47
+ $form->setValues(Mage::registry("storelocator_data")->getData());
48
+ }
49
+ return parent::_prepareForm();
50
+ }
51
+ }
app/code/local/Webskills/Storelocator/Block/Adminhtml/Storelocator/Edit/Tabs.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Webskills_Storelocator_Block_Adminhtml_Storelocator_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $this->setId("storelocator_tabs");
8
+ $this->setDestElementId("edit_form");
9
+ $this->setTitle(Mage::helper("storelocator")->__("Item Information"));
10
+ }
11
+ protected function _beforeToHtml()
12
+ {
13
+ $this->addTab("form_section", array(
14
+ "label" => Mage::helper("storelocator")->__("Item Information"),
15
+ "title" => Mage::helper("storelocator")->__("Item Information"),
16
+ "content" => $this->getLayout()->createBlock("storelocator/adminhtml_storelocator_edit_tab_form")->toHtml(),
17
+ ));
18
+ return parent::_beforeToHtml();
19
+ }
20
+
21
+ }
app/code/local/Webskills/Storelocator/Block/Adminhtml/Storelocator/Grid.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Webskills_Storelocator_Block_Adminhtml_Storelocator_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId("storelocatorGrid");
10
+ $this->setDefaultSort("id");
11
+ $this->setDefaultDir("DESC");
12
+ $this->setSaveParametersInSession(true);
13
+ }
14
+
15
+ protected function _prepareCollection()
16
+ {
17
+ $collection = Mage::getModel("storelocator/storelocator")->getCollection();
18
+ $this->setCollection($collection);
19
+ return parent::_prepareCollection();
20
+ }
21
+ protected function _prepareColumns()
22
+ {
23
+ $this->addColumn("id", array(
24
+ "header" => Mage::helper("storelocator")->__("ID"),
25
+ "align" =>"right",
26
+ "width" => "50px",
27
+ "type" => "number",
28
+ "index" => "id",
29
+ ));
30
+
31
+ $this->addColumn("name", array(
32
+ "header" => Mage::helper("storelocator")->__("Name"),
33
+ "index" => "name",
34
+ ));
35
+ $this->addColumn("address", array(
36
+ "header" => Mage::helper("storelocator")->__("Address"),
37
+ "index" => "address",
38
+ ));
39
+ $this->addColumn("city", array(
40
+ "header" => Mage::helper("storelocator")->__("City"),
41
+ "index" => "city",
42
+ ));
43
+ $this->addColumn("state", array(
44
+ "header" => Mage::helper("storelocator")->__("State"),
45
+ "index" => "state",
46
+ ));
47
+ $this->addColumn("lat", array(
48
+ "header" => Mage::helper("storelocator")->__("Latitude"),
49
+ "index" => "lat",
50
+ ));
51
+ $this->addColumn("lng", array(
52
+ "header" => Mage::helper("storelocator")->__("Longitude"),
53
+ "index" => "lng",
54
+ ));
55
+ $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
56
+ $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel'));
57
+
58
+ return parent::_prepareColumns();
59
+ }
60
+
61
+ public function getRowUrl($row)
62
+ {
63
+ return $this->getUrl("*/*/edit", array("id" => $row->getId()));
64
+ }
65
+
66
+
67
+
68
+ protected function _prepareMassaction()
69
+ {
70
+ $this->setMassactionIdField('id');
71
+ $this->getMassactionBlock()->setFormFieldName('ids');
72
+ $this->getMassactionBlock()->setUseSelectAll(true);
73
+ $this->getMassactionBlock()->addItem('remove_storelocator', array(
74
+ 'label'=> Mage::helper('storelocator')->__('Remove Storelocator'),
75
+ 'url' => $this->getUrl('*/adminhtml_storelocator/massRemove'),
76
+ 'confirm' => Mage::helper('storelocator')->__('Are you sure?')
77
+ ));
78
+ return $this;
79
+ }
80
+
81
+
82
+ }
app/code/local/Webskills/Storelocator/Block/Index.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Webskills_Storelocator_Block_Index extends Mage_Core_Block_Template{
3
+
4
+
5
+
6
+
7
+
8
+ }
app/code/local/Webskills/Storelocator/Helper/Data.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Webskills_Storelocator_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ }
5
+
app/code/local/Webskills/Storelocator/Model/Mysql4/Storelocator.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Webskills_Storelocator_Model_Mysql4_Storelocator extends Mage_Core_Model_Mysql4_Abstract
3
+ {
4
+ protected function _construct()
5
+ {
6
+ $this->_init("storelocator/storelocator", "id");
7
+ }
8
+ }
app/code/local/Webskills/Storelocator/Model/Mysql4/Storelocator/Collection.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Webskills_Storelocator_Model_Mysql4_Storelocator_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
3
+ {
4
+
5
+ public function _construct(){
6
+ $this->_init("storelocator/storelocator");
7
+ }
8
+
9
+
10
+
11
+ }
12
+
app/code/local/Webskills/Storelocator/Model/Storelocator.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Webskills_Storelocator_Model_Storelocator extends Mage_Core_Model_Abstract
4
+ {
5
+ protected function _construct(){
6
+
7
+ $this->_init("storelocator/storelocator");
8
+
9
+ }
10
+
11
+ }
12
+
app/code/local/Webskills/Storelocator/controllers/Adminhtml/StorelocatorController.php ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Webskills_Storelocator_Adminhtml_StorelocatorController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ protected function _initAction()
6
+ {
7
+ $this->loadLayout()->_setActiveMenu("storelocator/storelocator")->_addBreadcrumb(Mage::helper("adminhtml")->__("Storelocator Manager"),Mage::helper("adminhtml")->__("Storelocator Manager"));
8
+ return $this;
9
+ }
10
+ public function indexAction()
11
+ {
12
+ $this->_title($this->__("Storelocator"));
13
+ $this->_title($this->__("Manager Storelocator"));
14
+
15
+ $this->_initAction();
16
+ $this->renderLayout();
17
+ }
18
+ public function editAction()
19
+ {
20
+ $this->_title($this->__("Storelocator"));
21
+ $this->_title($this->__("Storelocator"));
22
+ $this->_title($this->__("Edit Item"));
23
+
24
+ $id = $this->getRequest()->getParam("id");
25
+ $model = Mage::getModel("storelocator/storelocator")->load($id);
26
+ if ($model->getId()) {
27
+ Mage::register("storelocator_data", $model);
28
+ $this->loadLayout();
29
+ $this->_setActiveMenu("storelocator/storelocator");
30
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Storelocator Manager"), Mage::helper("adminhtml")->__("Storelocator Manager"));
31
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Storelocator Description"), Mage::helper("adminhtml")->__("Storelocator Description"));
32
+ $this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
33
+ $this->_addContent($this->getLayout()->createBlock("storelocator/adminhtml_storelocator_edit"))->_addLeft($this->getLayout()->createBlock("storelocator/adminhtml_storelocator_edit_tabs"));
34
+ $this->renderLayout();
35
+ }
36
+ else {
37
+ Mage::getSingleton("adminhtml/session")->addError(Mage::helper("storelocator")->__("Item does not exist."));
38
+ $this->_redirect("*/*/");
39
+ }
40
+ }
41
+
42
+ public function newAction()
43
+ {
44
+
45
+ $this->_title($this->__("Storelocator"));
46
+ $this->_title($this->__("Storelocator"));
47
+ $this->_title($this->__("New Item"));
48
+
49
+ $id = $this->getRequest()->getParam("id");
50
+ $model = Mage::getModel("storelocator/storelocator")->load($id);
51
+
52
+ $data = Mage::getSingleton("adminhtml/session")->getFormData(true);
53
+ if (!empty($data)) {
54
+ $model->setData($data);
55
+ }
56
+
57
+ Mage::register("storelocator_data", $model);
58
+
59
+ $this->loadLayout();
60
+ $this->_setActiveMenu("storelocator/storelocator");
61
+
62
+ $this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
63
+
64
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Storelocator Manager"), Mage::helper("adminhtml")->__("Storelocator Manager"));
65
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Storelocator Description"), Mage::helper("adminhtml")->__("Storelocator Description"));
66
+
67
+
68
+ $this->_addContent($this->getLayout()->createBlock("storelocator/adminhtml_storelocator_edit"))->_addLeft($this->getLayout()->createBlock("storelocator/adminhtml_storelocator_edit_tabs"));
69
+
70
+ $this->renderLayout();
71
+
72
+ }
73
+ public function saveAction()
74
+ {
75
+
76
+ $post_data=$this->getRequest()->getPost();
77
+
78
+
79
+ if ($post_data) {
80
+
81
+ try {
82
+
83
+ /****** Calculate Longitude and Latitude ******/
84
+ $postfields = $this->getRequest()->getParams();
85
+ $Address = urlencode($postfields['address'].'+'.$postfields['city'].'+'.$postfields['state']);
86
+ $request_url = "http://maps.googleapis.com/maps/api/geocode/xml?address=".$Address."&sensor=false&sensor=true";
87
+ $xml = simplexml_load_file($request_url) ;
88
+ $status = $xml->status;
89
+ if ($status=="OK")
90
+ {
91
+ $Lat = $xml->result->geometry->location->lat;
92
+ $Lon = $xml->result->geometry->location->lng;
93
+ }
94
+ /****** End Calculate Longitude and Latitude ******/
95
+
96
+ $model = Mage::getModel("storelocator/storelocator")
97
+ ->addData($post_data)
98
+ ->setId($this->getRequest()->getParam("id"))
99
+ ->setlat($Lat)
100
+ ->setlng($Lon)
101
+ ->save();
102
+
103
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Storelocator was successfully saved"));
104
+ Mage::getSingleton("adminhtml/session")->setStorelocatorData(false);
105
+
106
+ if ($this->getRequest()->getParam("back")) {
107
+ $this->_redirect("*/*/edit", array("id" => $model->getId()));
108
+ return;
109
+ }
110
+ $this->_redirect("*/*/");
111
+ return;
112
+ }
113
+ catch (Exception $e) {
114
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
115
+ Mage::getSingleton("adminhtml/session")->setStorelocatorData($this->getRequest()->getPost());
116
+ $this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
117
+ return;
118
+ }
119
+
120
+ }
121
+ $this->_redirect("*/*/");
122
+ }
123
+
124
+
125
+
126
+ public function deleteAction()
127
+ {
128
+ if( $this->getRequest()->getParam("id") > 0 ) {
129
+ try {
130
+ $model = Mage::getModel("storelocator/storelocator");
131
+ $model->setId($this->getRequest()->getParam("id"))->delete();
132
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Item was successfully deleted"));
133
+ $this->_redirect("*/*/");
134
+ }
135
+ catch (Exception $e) {
136
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
137
+ $this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
138
+ }
139
+ }
140
+ $this->_redirect("*/*/");
141
+ }
142
+
143
+
144
+ public function massRemoveAction()
145
+ {
146
+ try {
147
+ $ids = $this->getRequest()->getPost('ids', array());
148
+ foreach ($ids as $id) {
149
+ $model = Mage::getModel("storelocator/storelocator");
150
+ $model->setId($id)->delete();
151
+ }
152
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Item(s) was successfully removed"));
153
+ }
154
+ catch (Exception $e) {
155
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
156
+ }
157
+ $this->_redirect('*/*/');
158
+ }
159
+
160
+ /**
161
+ * Export order grid to CSV format
162
+ */
163
+ public function exportCsvAction()
164
+ {
165
+ $fileName = 'storelocator.csv';
166
+ $grid = $this->getLayout()->createBlock('storelocator/adminhtml_storelocator_grid');
167
+ $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
168
+ }
169
+ /**
170
+ * Export order grid to Excel XML format
171
+ */
172
+ public function exportExcelAction()
173
+ {
174
+ $fileName = 'storelocator.xml';
175
+ $grid = $this->getLayout()->createBlock('storelocator/adminhtml_storelocator_grid');
176
+ $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
177
+ }
178
+ }
app/code/local/Webskills/Storelocator/controllers/IndexController.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Webskills_Storelocator_IndexController extends Mage_Core_Controller_Front_Action{
3
+ public function IndexAction() {
4
+
5
+ $this->loadLayout();
6
+ $this->getLayout()->getBlock("head")->setTitle($this->__("Storelocator"));
7
+ $breadcrumbs = $this->getLayout()->getBlock("breadcrumbs");
8
+ $breadcrumbs->addCrumb("home", array(
9
+ "label" => $this->__("Home Page"),
10
+ "title" => $this->__("Home Page"),
11
+ "link" => Mage::getBaseUrl()
12
+ ));
13
+
14
+ $breadcrumbs->addCrumb("storelocator", array(
15
+ "label" => $this->__("Storelocator"),
16
+ "title" => $this->__("Storelocator")
17
+ ));
18
+
19
+ $this->renderLayout();
20
+
21
+ }
22
+
23
+ public function MapAction()
24
+ {
25
+ function parseToXML($htmlStr)
26
+ {
27
+ $xmlStr=str_replace('<','&lt;',$htmlStr);
28
+ $xmlStr=str_replace('>','&gt;',$xmlStr);
29
+ $xmlStr=str_replace('"','&quot;',$xmlStr);
30
+ $xmlStr=str_replace("'",'&#39;',$xmlStr);
31
+ $xmlStr=str_replace("&",'&amp;',$xmlStr);
32
+ return $xmlStr;
33
+ }
34
+
35
+ $data = array();
36
+ $collection = Mage::getModel('storelocator/storelocator')->getCollection();
37
+ header("Content-type: text/xml");
38
+
39
+ echo '<markers>';
40
+
41
+ foreach ($collection as $record)
42
+ if ($record->lat != '' ){
43
+ {
44
+ echo '<marker ';
45
+ echo 'name="' . parseToXML($record->name) . '" ';
46
+ echo 'address="' . parseToXML($record->address) . '" ';
47
+ echo 'lat="' . $record->lat . '" ';
48
+ echo 'lng="' . $record->lng . '" ';
49
+ echo '/>';
50
+ }}
51
+ echo '</markers>';
52
+
53
+ }
54
+ }
app/code/local/Webskills/Storelocator/etc/config.xml ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Webskills_Storelocator>
5
+ <version>0.1.0</version>
6
+ </Webskills_Storelocator>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <storelocator>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Webskills_Storelocator</module>
14
+ <frontName>storelocator</frontName>
15
+ </args>
16
+ </storelocator>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <storelocator>
21
+ <file>storelocator.xml</file>
22
+ </storelocator>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <global>
27
+ <helpers>
28
+ <storelocator>
29
+ <class>Webskills_Storelocator_Helper</class>
30
+ </storelocator>
31
+ </helpers>
32
+ <blocks>
33
+ <storelocator>
34
+ <class>Webskills_Storelocator_Block</class>
35
+ </storelocator>
36
+ </blocks>
37
+ <models>
38
+ <storelocator>
39
+ <class>Webskills_Storelocator_Model</class>
40
+ <resourceModel>storelocator_mysql4</resourceModel>
41
+ </storelocator>
42
+ <storelocator_mysql4>
43
+ <class>Webskills_Storelocator_Model_Mysql4</class>
44
+ <entities>
45
+ <storelocator>
46
+ <table>storelocator_information</table>
47
+ </storelocator>
48
+ </entities>
49
+ </storelocator_mysql4>
50
+ </models>
51
+ <resources>
52
+ <storelocator_setup>
53
+ <setup>
54
+ <module>Webskills_Storelocator</module>
55
+ </setup>
56
+ <connection>
57
+ <use>core_setup</use>
58
+ </connection>
59
+ </storelocator_setup>
60
+ <storelocator_write>
61
+ <connection>
62
+ <use>core_write</use>
63
+ </connection>
64
+ </storelocator_write>
65
+ <storelocator_read>
66
+ <connection>
67
+ <use>core_read</use>
68
+ </connection>
69
+ </storelocator_read>
70
+ </resources>
71
+ </global>
72
+ <admin>
73
+ <routers>
74
+ <storelocator>
75
+ <use>admin</use>
76
+ <args>
77
+ <module>Webskills_Storelocator</module>
78
+ <frontName>storelocator</frontName>
79
+ </args>
80
+ </storelocator>
81
+ </routers>
82
+ </admin>
83
+ <adminhtml>
84
+ <menu>
85
+ <storelocator module="storelocator">
86
+ <title>Web Skills</title>
87
+ <sort_order>100</sort_order>
88
+ <children>
89
+ <storelocator module="storelocator">
90
+ <title>Manage Stores</title>
91
+ <sort_order>0</sort_order>
92
+ <action>storelocator/adminhtml_storelocator</action>
93
+ </storelocator>
94
+ </children>
95
+ </storelocator>
96
+ </menu>
97
+ <acl>
98
+ <resources>
99
+ <all>
100
+ <title>Allow Everything</title>
101
+ </all>
102
+ <admin>
103
+ <children>
104
+ <storelocator translate="title" module="storelocator">
105
+ <title>Storelocator</title>
106
+ <sort_order>1000</sort_order>
107
+ <children>
108
+ <storelocator translate="title">
109
+ <title>Manage Storelocator</title>
110
+ <sort_order>0</sort_order>
111
+ </storelocator>
112
+ </children>
113
+ </storelocator>
114
+ </children>
115
+ </admin>
116
+ </resources>
117
+ </acl>
118
+ <layout>
119
+ <updates>
120
+ <storelocator>
121
+ <file>storelocator.xml</file>
122
+ </storelocator>
123
+ </updates>
124
+ </layout>
125
+ </adminhtml>
126
+ </config>
app/code/local/Webskills/Storelocator/sql/storelocator_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+ $installer->run("
5
+
6
+ CREATE TABLE {$this->getTable('storelocator_information')} (
7
+ `id` int(11) NOT NULL auto_increment,
8
+ `name` varchar(60) NOT NULL,
9
+ `address` varchar(255) NOT NULL,
10
+ `city` varchar(60) NOT NULL,
11
+ `state` varchar(60) NOT NULL,
12
+ `lat` float(10,6) NOT NULL,
13
+ `lng` float(10,6) NOT NULL,
14
+ PRIMARY KEY (`id`)
15
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
16
+
17
+ ");
18
+
19
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/storelocator.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <storelocator_adminhtml_storelocator_index>
4
+ <reference name="content">
5
+ <block type="storelocator/adminhtml_storelocator" name="storelocator" />
6
+ </reference>
7
+ </storelocator_adminhtml_storelocator_index>
8
+ </layout>
app/design/frontend/base/default/layout/storelocator.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <storelocator_index_index>
4
+ <reference name="root">
5
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
6
+ </reference>
7
+ <reference name="content">
8
+ <block type="storelocator/index" name="storelocator_index" template="storelocator/index.phtml"/>
9
+ </reference>
10
+ </storelocator_index_index>
11
+ </layout>
12
+
app/design/frontend/base/default/template/storelocator/index.phtml ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
2
+ <script type="text/javascript">
3
+ //<![CDATA[
4
+
5
+ var customIcons = {
6
+ restaurant: {
7
+ icon: 'http://labs.google.com/ridefinder/images/mm_20_blue.png'
8
+ },
9
+ bar: {
10
+ icon: 'http://labs.google.com/ridefinder/images/mm_20_red.png'
11
+ }
12
+ };
13
+
14
+ function load() {
15
+ var map = new google.maps.Map(document.getElementById("map"), {
16
+ center: new google.maps.LatLng('40.7536854', '-73.9991637'),
17
+ zoom: 0,
18
+ mapTypeId: 'roadmap'
19
+ });
20
+ var infoWindow = new google.maps.InfoWindow;
21
+ // Change this depending on the name of your PHP file
22
+ downloadUrl("storelocator/index/map", function(data) {
23
+ var xml = data.responseXML;
24
+ var markers = xml.documentElement.getElementsByTagName("marker");
25
+ for (var i = 0; i < markers.length; i++) {
26
+ var name = markers[i].getAttribute("name");
27
+ var address = markers[i].getAttribute("address");
28
+ var type = markers[i].getAttribute("type");
29
+ var point = new google.maps.LatLng(
30
+ parseFloat(markers[i].getAttribute("lat")),
31
+ parseFloat(markers[i].getAttribute("lng")));
32
+ var html = "<b>" + name + "</b> <br/>" + address;
33
+ var icon = customIcons[type] || {};
34
+ var marker = new google.maps.Marker({
35
+ map: map,
36
+ position: point,
37
+ icon: icon.icon
38
+ });
39
+ bindInfoWindow(marker, map, infoWindow, html);
40
+ }
41
+ });
42
+ }
43
+
44
+ function bindInfoWindow(marker, map, infoWindow, html) {
45
+ google.maps.event.addListener(marker, 'click', function() {
46
+ infoWindow.setContent(html);
47
+ infoWindow.open(map, marker);
48
+ });
49
+ }
50
+
51
+ function downloadUrl(url, callback) {
52
+ var request = window.ActiveXObject ?
53
+ new ActiveXObject('Microsoft.XMLHTTP') :
54
+ new XMLHttpRequest;
55
+
56
+ request.onreadystatechange = function() {
57
+ if (request.readyState == 4) {
58
+ request.onreadystatechange = doNothing;
59
+ callback(request, request.status);
60
+ }
61
+ };
62
+
63
+ request.open('GET', url, true);
64
+ request.send(null);
65
+ }
66
+
67
+ function doNothing() {}
68
+
69
+ //]]>
70
+
71
+ </script>
72
+
73
+ <body onload="load()">
74
+ <div id="map" style="width:766px; height: 400px"></div>
75
+ </body>
app/etc/modules/Webskills_Storelocator.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Webskills_Storelocator>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ <version>0.1.0</version>
8
+ </Webskills_Storelocator>
9
+ </modules>
10
+ </config>
package.xml CHANGED
@@ -1,19 +1,21 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>storelocator_webskills</name>
4
- <version>0.1.0</version>
5
  <stability>stable</stability>
6
  <license>OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Storelocator is a simple extension in which admin can show magento physical stores in google maps.</summary>
10
- <description>Storelocator is a simple extension in which admin can show magento physical stores in google maps.Admin can add,remove stores from backend and also can edit them.Admin can export store and can remove multiple stores.User can call it in any cms page as follows: {{block type="core/template" template="storelocator/index.phtml"}} or simply can view http://yourdomain/storelocator</description>
11
- <notes>Simple and very lite extension.&#xD;
12
- After installing clear cache and re login your magento admin panel.</notes>
 
 
13
  <authors><author><name>Rohit Dhiman</name><user>rohitjesus</user><email>rohitdoll@gmail.com</email></author></authors>
14
- <date>2014-05-20</date>
15
- <time>18:43:20</time>
16
- <contents><target name="magedesign"><dir name="."><dir name="app"><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="storelocator.xml" hash=""/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="storelocator.xml" hash=""/></dir></dir></dir></dir></dir></dir></dir></target></contents>
17
  <compatible/>
18
- <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
19
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>storelocator_webskills</name>
4
+ <version>0.1.1</version>
5
  <stability>stable</stability>
6
  <license>OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Storelocator is a simple extension in which admin can show magento physical stores in google maps.</summary>
10
+ <description>Storelocator is a simple extension in which admin can show magento physical stores in google maps.Admin can add,remove stores from backend and also can edit them.Admin can export store and can remove multiple stores.User can call it in any cms page as follows:&#xD;
11
+ {{block type="core/template" template="storelocator/index.phtml"}}&#xD;
12
+ &#xD;
13
+ or simply can view http://yourdomain/storelocator</description>
14
+ <notes>Clear Cache after installing and re-login to magento admin.</notes>
15
  <authors><author><name>Rohit Dhiman</name><user>rohitjesus</user><email>rohitdoll@gmail.com</email></author></authors>
16
+ <date>2014-06-03</date>
17
+ <time>05:53:55</time>
18
+ <contents><target name="magelocal"><dir name="Webskills"><dir name="Storelocator"><dir name="Block"><dir name="Adminhtml"><dir name="Storelocator"><dir name="Edit"><file name="Form.php" hash="0b956b2516cd51f2f58c02bab6e06d08"/><dir name="Tab"><file name="Form.php" hash="a2dd863296ea5d30fb85076cbc80b99f"/></dir><file name="Tabs.php" hash="cedf9f60d4508a2a07d9ba2fa219cdbe"/></dir><file name="Edit.php" hash="18db99be07d5c4a38eac6d2ca8931c25"/><file name="Grid.php" hash="0ad6dcadc763ad3f0f0754df7cd5d785"/></dir><file name="Storelocator.php" hash="f58473da1671b72ec756eab45dfade78"/></dir><file name="Index.php" hash="f839893bedf9f030dd6e9ba81f0c22ac"/></dir><dir name="Helper"><file name="Data.php" hash="888fd51dc1ec89e24cc5cc4213ce90b9"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Storelocator"><file name="Collection.php" hash="13b6c3bb383a88deef9640f887aa84f3"/></dir><file name="Storelocator.php" hash="207da3076e5d4905cd379f9072331bac"/></dir><file name="Storelocator.php" hash="70848a6906ea0b4f3e7ddc638c4a2052"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="StorelocatorController.php" hash="cc939b16ace68e74d82bea8fab36244d"/></dir><file name="IndexController.php" hash="96b44945a8311d5086b39c10aad383ba"/></dir><dir name="etc"><file name="config.xml" hash="b07de55bab7c77959e8b3ece42f72cd1"/></dir><dir name="sql"><dir name="storelocator_setup"><file name="mysql4-install-0.1.0.php" hash="5cad446054c86601089bf598dde83d0f"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="storelocator.xml" hash="cdd8bcb9e8ab712c726878b91c2cb644"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="storelocator"><file name="index.phtml" hash="37d494f16a64e1d3829ad1197eef82f8"/></dir></dir><dir name="layout"><file name="storelocator.xml" hash="6ee24d1e5def550d5bd5c751d789382c"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Webskills_Storelocator.xml" hash="4a1f7260e56f3f4167d898a80c2c5e87"/></dir></target></contents>
19
  <compatible/>
20
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.7</min><max>1.9</max></package><extension><name>gd</name><min>2.0.28</min><max>3.0</max></extension></required></dependencies>
21
  </package>