Version Notes
Store locator first version release
Download this release
Release Info
Developer | Dattatray Yadav |
Extension | Datta_Storelocator |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Datta/StoreLocator/Block/Adminhtml/Store.php +37 -0
- app/code/community/Datta/StoreLocator/Block/Adminhtml/Store/Edit.php +162 -0
- app/code/community/Datta/StoreLocator/Block/Adminhtml/Store/Edit/Form.php +209 -0
- app/code/community/Datta/StoreLocator/Block/Adminhtml/Store/Grid.php +200 -0
- app/code/community/Datta/StoreLocator/Block/Adminhtml/Store/Renderer/Image.php +43 -0
- app/code/community/Datta/StoreLocator/Block/Store.php +107 -0
- app/code/community/Datta/StoreLocator/Helper/Data.php +32 -0
- app/code/community/Datta/StoreLocator/Model/Resource/Store.php +176 -0
- app/code/community/Datta/StoreLocator/Model/Resource/Store/Collection.php +173 -0
- app/code/community/Datta/StoreLocator/Model/Store.php +41 -0
- app/code/community/Datta/StoreLocator/Model/System/Config/Backend/Image.php +91 -0
- app/code/community/Datta/StoreLocator/Model/System/Config/Backend/Marker.php +92 -0
- app/code/community/Datta/StoreLocator/controllers/Adminhtml/StoreController.php +255 -0
- app/code/community/Datta/StoreLocator/controllers/IndexController.php +36 -0
- app/code/community/Datta/StoreLocator/etc/adminhtml.xml +76 -0
- app/code/community/Datta/StoreLocator/etc/config.xml +152 -0
- app/code/community/Datta/StoreLocator/etc/system.xml +129 -0
- app/code/community/Datta/StoreLocator/sql/datta_storelocator_setup/mysql4-install-1.0.0.php +139 -0
- app/design/adminhtml/default/default/layout/datta/storelocator.xml +47 -0
- app/design/frontend/ecart/ecart-theme/layout/datta/storelocator.xml +74 -0
- app/design/frontend/ecart/ecart-theme/template/datta/storelocator/storelocator.phtml +103 -0
- app/etc/modules/Datta_Storelocator.xml +38 -0
- package.xml +30 -0
- skin/frontend/ecart/ecart-theme/css/datta/storelocator.css +131 -0
app/code/community/Datta/StoreLocator/Block/Adminhtml/Store.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
* NOTICE OF LICENSE
|
5 |
+
*
|
6 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
+
* that is bundled with this package in the file LICENSE.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
17 |
+
* versions in the future. If you wish to customize Magento for your
|
18 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
19 |
+
*
|
20 |
+
* @category Datta
|
21 |
+
* @package Datta_StoreLocator
|
22 |
+
* @created Dattatray Yadav 2nd Dec,2013 1:45pm
|
23 |
+
* @author Clarion magento team<Dattatray Yadav>
|
24 |
+
* @purpose parent construct object load
|
25 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
26 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
27 |
+
*/
|
28 |
+
class Datta_StoreLocator_Block_Adminhtml_Store extends Mage_Adminhtml_Block_Widget_Grid_Container
|
29 |
+
{
|
30 |
+
public function __construct()
|
31 |
+
{
|
32 |
+
$this->_blockGroup = 'datta_storelocator';
|
33 |
+
$this->_controller = 'adminhtml_store';
|
34 |
+
$this->_headerText = $this->__('Store Locations');
|
35 |
+
parent::__construct();
|
36 |
+
}
|
37 |
+
}
|
app/code/community/Datta/StoreLocator/Block/Adminhtml/Store/Edit.php
ADDED
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
*
|
22 |
+
* @category Datta
|
23 |
+
* @package Datta_StoreLocator
|
24 |
+
* @created Dattatray Yadav 2nd Dec,2013 2:20pm
|
25 |
+
* @author Clarion magento team<Dattatray Yadav>
|
26 |
+
* @purpose Manage store location edit
|
27 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
28 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
29 |
+
*/
|
30 |
+
class Datta_StoreLocator_Block_Adminhtml_Store_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* initlization of class
|
34 |
+
*/
|
35 |
+
public function __construct()
|
36 |
+
{
|
37 |
+
$this->_objectId = 'id';
|
38 |
+
$this->_blockGroup = 'datta_storelocator';
|
39 |
+
$this->_controller = 'adminhtml_store';
|
40 |
+
parent::__construct();
|
41 |
+
$this->_updateButton('save', 'label', Mage::helper('datta_storelocator')->__('Save Store'));
|
42 |
+
$this->_updateButton('delete', 'label', Mage::helper('datta_storelocator')->__('Delete Store'));
|
43 |
+
$this->_addButton('saveandcontinue', array(
|
44 |
+
'label' => Mage::helper('datta_storelocator')->__('Save and Continue Edit'),
|
45 |
+
'onclick' => 'saveAndContinueEdit()',
|
46 |
+
'class' => 'save',
|
47 |
+
), -100);
|
48 |
+
|
49 |
+
$img="";
|
50 |
+
$apiKey = Mage::getStoreConfig('storelocator/general/apikey');
|
51 |
+
$apiUrl = Mage::getStoreConfig('storelocator/general/apiurl');
|
52 |
+
$apiSensor = Mage::getStoreConfig('storelocator/general/apisensor');
|
53 |
+
$sensor = ($apiSensor == 0) ? 'false' : 'true';
|
54 |
+
$marker = "var marker = new google.maps.Marker({position: latLng, map: map ,draggable: true});
|
55 |
+
google.maps.event.addListener(marker, 'dragend', function(marker){
|
56 |
+
var latLng = marker.latLng;
|
57 |
+
document.getElementById('lat').value = latLng.lat();
|
58 |
+
document.getElementById('long').value = latLng.lng();
|
59 |
+
});
|
60 |
+
";
|
61 |
+
if(!is_null(Mage::getStoreConfig('storelocator/general/mapicon')) && Mage::getStoreConfig('storelocator/general/mapicon') != '') {
|
62 |
+
$img = "var imgMarker = new google.maps.MarkerImage('".Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'storelocator/markers/'.Mage::getStoreConfig('storelocator/general/mapicon')."');";
|
63 |
+
$marker = "var marker = new google.maps.Marker({position: latLng, icon: imgMarker,map: map });";
|
64 |
+
}
|
65 |
+
$this->_formScripts[] = "
|
66 |
+
function loadScript(){
|
67 |
+
var script = document.createElement('script');
|
68 |
+
script.type = 'text/javascript';
|
69 |
+
script.src = '".$apiUrl."&callback=getLatLng&sensor=".$sensor."&key=".$apiKey."';
|
70 |
+
document.head.appendChild(script);
|
71 |
+
var div = document.createElement('div');
|
72 |
+
div.id='map_canvas';
|
73 |
+
document.getElementsByClassName('hor-scroll')[0].appendChild(div);
|
74 |
+
var img = document.createElement('img');
|
75 |
+
document.getElementsByClassName('form-list')[0].style.float='left';
|
76 |
+
document.getElementById('map_canvas').style.height='500px';
|
77 |
+
document.getElementById('map_canvas').style.width='500px';
|
78 |
+
document.getElementById('map_canvas').style.float='left';
|
79 |
+
document.getElementById('map_canvas').style.marginLeft='30px';
|
80 |
+
document.getElementById('map_canvas').style.marginTop='6px';
|
81 |
+
}
|
82 |
+
window.onload = loadScript;
|
83 |
+
|
84 |
+
function saveAndContinueEdit(){
|
85 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
86 |
+
}
|
87 |
+
|
88 |
+
function capitalize(str) {
|
89 |
+
var pieces = str.split(' ');
|
90 |
+
for ( var i = 0; i < pieces.length; i++ )
|
91 |
+
{
|
92 |
+
var j = pieces[i].charAt(0).toUpperCase();
|
93 |
+
pieces[i] = j + pieces[i].substr(1);
|
94 |
+
}
|
95 |
+
return pieces.join(' ');
|
96 |
+
}
|
97 |
+
function getLatLng(){
|
98 |
+
".$img."
|
99 |
+
var imgStore = storeImage = '';
|
100 |
+
var geocoder = new google.maps.Geocoder();
|
101 |
+
var address = document.getElementById('address').value;
|
102 |
+
var city = document.getElementById('city').value;
|
103 |
+
var country = document.getElementById('country_id').options[document.getElementById('country_id').selectedIndex].text;
|
104 |
+
if(document.getElementById('image_image')){
|
105 |
+
storeImage = document.getElementById('image_image').src;
|
106 |
+
imgStore = '<div><img src='+storeImage+' alt='+document.getElementById('name').value+' style=\'float:left;width:150px;\'/></div>';
|
107 |
+
}
|
108 |
+
if(document.getElementById('marker_image')){
|
109 |
+
storeMarker = document.getElementById('marker_image').src;
|
110 |
+
}
|
111 |
+
if(address != '' && city != ''){
|
112 |
+
var addressComplete = address + ', ' + city;
|
113 |
+
if(country != '') addressComplete = addressComplete + ' ' + country;
|
114 |
+
geocoder.geocode( { 'address': addressComplete}, function(results, status) {
|
115 |
+
if (status == google.maps.GeocoderStatus.OK) {
|
116 |
+
document.getElementById('lat').value = results[0].geometry.location.lat();
|
117 |
+
document.getElementById('long').value = results[0].geometry.location.lng();
|
118 |
+
document.getElementById('address').value = capitalize(document.getElementById('address').value);
|
119 |
+
document.getElementById('city').value = capitalize(document.getElementById('city').value);
|
120 |
+
var latLng = new google.maps.LatLng(document.getElementById('lat').value , document.getElementById('long').value);
|
121 |
+
var mapOption = {zoom: 18, center: latLng, mapTypeId: google.maps.MapTypeId.ROADMAP, disableDefaultUI : true };
|
122 |
+
map = new google.maps.Map(document.getElementById('map_canvas'), mapOption);
|
123 |
+
if(document.getElementById('marker_image')){
|
124 |
+
storeMarker = document.getElementById('marker_image').src;
|
125 |
+
var marker = new google.maps.Marker({position: latLng, icon: storeMarker,map: map });
|
126 |
+
}else{
|
127 |
+
".$marker."
|
128 |
+
}
|
129 |
+
var infoWindow = new google.maps.InfoWindow();
|
130 |
+
google.maps.event.addListener(marker, 'click', (function(marker) {
|
131 |
+
return function() {
|
132 |
+
var content = imgStore+'<div style=\'float:left;margin-top: 10px; overflow: auto; cursor: default; clear: both; position: relative; background-color: rgb(255, 255, 255); border: 1px solid rgb(204, 204, 204); border-top-left-radius: 10px; border-top-right-radius: 10px; border-bottom-right-radius: 10px; border-bottom-left-radius: 10px;\' ><h3>' + document.getElementById('name').value + '</h3>'
|
133 |
+
+ document.getElementById('address').value + '<br>'
|
134 |
+
+ document.getElementById('zipcode').value+' '+document.getElementById('city').value +' <br>'
|
135 |
+
+ document.getElementById('country_id').options[document.getElementById('country_id').selectedIndex].text+'<br>'
|
136 |
+
+ document.getElementById('phone').value + '<br>'
|
137 |
+
+ document.getElementById('fax').value + '<br>'
|
138 |
+
+'</div>';
|
139 |
+
infoWindow.setContent(content);
|
140 |
+
infoWindow.open(map,marker);
|
141 |
+
}
|
142 |
+
})(marker));
|
143 |
+
}
|
144 |
+
});
|
145 |
+
}
|
146 |
+
}
|
147 |
+
";
|
148 |
+
}
|
149 |
+
/**
|
150 |
+
* Get Header text
|
151 |
+
* @return string
|
152 |
+
*/
|
153 |
+
public function getHeaderText()
|
154 |
+
{
|
155 |
+
if (Mage::registry('datta_storelocator')->getId()) {
|
156 |
+
return $this->__('Edit Store Location');
|
157 |
+
}
|
158 |
+
else {
|
159 |
+
return $this->__('New Store Location');
|
160 |
+
}
|
161 |
+
}
|
162 |
+
}
|
app/code/community/Datta/StoreLocator/Block/Adminhtml/Store/Edit/Form.php
ADDED
@@ -0,0 +1,209 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
*
|
22 |
+
* @category Datta
|
23 |
+
* @package Datta_StoreLocator
|
24 |
+
* @created Dattatray Yadav 2nd Dec,2013 2:50pm
|
25 |
+
* @author Clarion magento team<Dattatray Yadav>
|
26 |
+
* @purpose Manage store locator edit form
|
27 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
28 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
29 |
+
*/
|
30 |
+
class Datta_StoreLocator_Block_Adminhtml_Store_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* Init class
|
34 |
+
*/
|
35 |
+
public function __construct()
|
36 |
+
{
|
37 |
+
parent::__construct();
|
38 |
+
|
39 |
+
$this->setId('store_form');
|
40 |
+
$this->setTitle($this->__('Store Information'));
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Setup form fields for inserts/updates
|
45 |
+
*
|
46 |
+
* return Mage_Adminhtml_Block_Widget_Form
|
47 |
+
*/
|
48 |
+
protected function _prepareForm()
|
49 |
+
{
|
50 |
+
$model = Mage::registry('datta_storelocator');
|
51 |
+
|
52 |
+
$form = new Varien_Data_Form(array(
|
53 |
+
'id' => 'edit_form',
|
54 |
+
'action' => $this->getData('action'),
|
55 |
+
'method' => 'post',
|
56 |
+
'enctype' => 'multipart/form-data')
|
57 |
+
);
|
58 |
+
|
59 |
+
$fieldset = $form->addFieldset('datta_storelocator_form', array(
|
60 |
+
'legend' => Mage::helper('checkout')->__('Store Information')
|
61 |
+
));
|
62 |
+
|
63 |
+
|
64 |
+
if ($model->getId()) {
|
65 |
+
$fieldset->addField('entity_id', 'hidden', array(
|
66 |
+
'name' => 'entity_id',
|
67 |
+
));
|
68 |
+
}
|
69 |
+
|
70 |
+
$fieldset->addField('created_time', 'hidden', array(
|
71 |
+
'name' => 'created_time',
|
72 |
+
));
|
73 |
+
|
74 |
+
$fieldset->addField('update_time', 'hidden', array(
|
75 |
+
'name' => 'update_time',
|
76 |
+
));
|
77 |
+
|
78 |
+
|
79 |
+
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Check is single store mode
|
83 |
+
*/
|
84 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
85 |
+
$field = $fieldset->addField('store_id', 'multiselect', array(
|
86 |
+
'name' => 'stores[]',
|
87 |
+
'label' => Mage::helper('datta_storelocator')->__('Store View'),
|
88 |
+
'title' => Mage::helper('datta_storelocator')->__('Store View'),
|
89 |
+
'required' => true,
|
90 |
+
'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
|
91 |
+
));
|
92 |
+
$renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
|
93 |
+
$field->setRenderer($renderer);
|
94 |
+
}
|
95 |
+
else {
|
96 |
+
$fieldset->addField('store_id', 'hidden', array(
|
97 |
+
'name' => 'stores[]',
|
98 |
+
'value' => Mage::app()->getStore(true)->getId()
|
99 |
+
));
|
100 |
+
$model->setStoreId(Mage::app()->getStore(true)->getId());
|
101 |
+
}
|
102 |
+
|
103 |
+
$fieldset->addField('name', 'text', array(
|
104 |
+
'label' => Mage::helper('datta_storelocator')->__('Store Name'),
|
105 |
+
'class' => 'required-entry',
|
106 |
+
'required' => true,
|
107 |
+
'name' => 'name',
|
108 |
+
));
|
109 |
+
|
110 |
+
$fieldset->addField('store_url', 'text', array(
|
111 |
+
'label' => Mage::helper('datta_storelocator')->__('Website URL'),
|
112 |
+
'required' => false,
|
113 |
+
'name' => 'store_url',
|
114 |
+
));
|
115 |
+
|
116 |
+
$fieldset->addField('image', 'image', array(
|
117 |
+
'label' => Mage::helper('datta_storelocator')->__('Store Image'),
|
118 |
+
'required' => false,
|
119 |
+
'name' => 'image',
|
120 |
+
));
|
121 |
+
|
122 |
+
$fieldset->addField('address', 'text', array(
|
123 |
+
'label' => Mage::helper('datta_storelocator')->__('Address'),
|
124 |
+
'class' => 'required-entry',
|
125 |
+
'required' => true,
|
126 |
+
'name' => 'address',
|
127 |
+
'onchange' => 'getLatLng()',
|
128 |
+
));
|
129 |
+
|
130 |
+
$fieldset->addField('city', 'text', array(
|
131 |
+
'label' => Mage::helper('datta_storelocator')->__('City'),
|
132 |
+
'class' => 'required-entry',
|
133 |
+
'required' => true,
|
134 |
+
'name' => 'city',
|
135 |
+
'onchange' => 'getLatLng()',
|
136 |
+
));
|
137 |
+
|
138 |
+
$fieldset->addField('zipcode', 'text', array(
|
139 |
+
'label' => Mage::helper('datta_storelocator')->__('Zip Code'),
|
140 |
+
'class' => 'required-entry',
|
141 |
+
'required' => true,
|
142 |
+
'name' => 'zipcode',
|
143 |
+
));
|
144 |
+
|
145 |
+
$countryList = Mage::getModel('directory/country')->getCollection()->toOptionArray();
|
146 |
+
|
147 |
+
$fieldset->addField('country_id', 'select', array(
|
148 |
+
'label' => Mage::helper('datta_storelocator')->__('Country'),
|
149 |
+
'name' => 'country_id',
|
150 |
+
'title' => 'country',
|
151 |
+
'values' => $countryList,
|
152 |
+
'onchange' => 'getLatLng()',
|
153 |
+
));
|
154 |
+
|
155 |
+
$fieldset->addField('phone', 'text', array(
|
156 |
+
'label' => Mage::helper('datta_storelocator')->__('Phone No'),
|
157 |
+
'name' => 'phone',
|
158 |
+
));
|
159 |
+
|
160 |
+
$fieldset->addField('fax', 'text', array(
|
161 |
+
'label' => Mage::helper('datta_storelocator')->__('Fax No'),
|
162 |
+
'name' => 'fax',
|
163 |
+
));
|
164 |
+
|
165 |
+
$fieldset->addField('lat', 'text', array(
|
166 |
+
'label' => Mage::helper('datta_storelocator')->__('Latitude'),
|
167 |
+
'required' => true,
|
168 |
+
'name' => 'lat',
|
169 |
+
));
|
170 |
+
|
171 |
+
$fieldset->addField('long', 'text', array(
|
172 |
+
'label' => Mage::helper('datta_storelocator')->__('Longitude'),
|
173 |
+
'required' => true,
|
174 |
+
'name' => 'long',
|
175 |
+
));
|
176 |
+
|
177 |
+
$fieldset->addField('description', 'textarea', array(
|
178 |
+
'label' => Mage::helper('datta_storelocator')->__('Short Description'),
|
179 |
+
'name' => 'description',
|
180 |
+
));
|
181 |
+
|
182 |
+
$fieldset->addField('marker', 'image', array(
|
183 |
+
'label' => Mage::helper('datta_storelocator')->__('Map Marker Image'),
|
184 |
+
'required' => false,
|
185 |
+
'name' => 'marker',
|
186 |
+
));
|
187 |
+
$fieldset->addField('status', 'select', array(
|
188 |
+
'label' => Mage::helper('datta_storelocator')->__('Status'),
|
189 |
+
'name' => 'status',
|
190 |
+
'values' => array(
|
191 |
+
array(
|
192 |
+
'value' => 1,
|
193 |
+
'label' => Mage::helper('datta_storelocator')->__('Enabled'),
|
194 |
+
),
|
195 |
+
|
196 |
+
array(
|
197 |
+
'value' => 0,
|
198 |
+
'label' => Mage::helper('datta_storelocator')->__('Disabled'),
|
199 |
+
),
|
200 |
+
),
|
201 |
+
));
|
202 |
+
|
203 |
+
$form->setValues($model->getData());
|
204 |
+
$form->setUseContainer(true);
|
205 |
+
$this->setForm($form);
|
206 |
+
|
207 |
+
return parent::_prepareForm();
|
208 |
+
}
|
209 |
+
}
|
app/code/community/Datta/StoreLocator/Block/Adminhtml/Store/Grid.php
ADDED
@@ -0,0 +1,200 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
*
|
22 |
+
* @category Datta
|
23 |
+
* @package Datta_StoreLocator
|
24 |
+
* @created Dattatray Yadav 2nd Dec,2013 2:20pm
|
25 |
+
* @author Clarion magento team<Dattatray Yadav>
|
26 |
+
* @purpose Manage store locator grid
|
27 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
28 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
29 |
+
*/
|
30 |
+
class Datta_StoreLocator_Block_Adminhtml_Store_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
31 |
+
{
|
32 |
+
public function __construct()
|
33 |
+
{
|
34 |
+
parent::__construct();
|
35 |
+
|
36 |
+
// Set some defaults for our grid
|
37 |
+
|
38 |
+
$this->setDefaultSort('entity_id');
|
39 |
+
$this->setId('StoreLocatorGrid');
|
40 |
+
$this->setDefaultDir('asc');
|
41 |
+
$this->setSaveParametersInSession(true);
|
42 |
+
|
43 |
+
}
|
44 |
+
|
45 |
+
protected function _getCollectionClass()
|
46 |
+
{
|
47 |
+
return 'datta_storelocator/store_collection';
|
48 |
+
}
|
49 |
+
|
50 |
+
protected function _prepareCollection()
|
51 |
+
{
|
52 |
+
// Get and set our collection for the grid
|
53 |
+
$collection = Mage::getResourceModel($this->_getCollectionClass());
|
54 |
+
$collection->setFirstStoreFlag(true);
|
55 |
+
//$collection = Mage::getModel('datta_storelocator/store')->getCollection();
|
56 |
+
$this->setCollection($collection);
|
57 |
+
return parent::_prepareCollection();
|
58 |
+
}
|
59 |
+
|
60 |
+
protected function _prepareColumns()
|
61 |
+
{
|
62 |
+
// Add the columns that should appear in the grid
|
63 |
+
$this->addColumn('entity_id',
|
64 |
+
array(
|
65 |
+
'header'=> Mage::helper('datta_storelocator')->__('ID'),
|
66 |
+
'align' =>'right',
|
67 |
+
'width' => '50px',
|
68 |
+
'align' =>'right',
|
69 |
+
'index' => 'entity_id'
|
70 |
+
)
|
71 |
+
);
|
72 |
+
|
73 |
+
$this->addColumn('image', array(
|
74 |
+
'header' => Mage::helper('datta_storelocator')->__('Image'),
|
75 |
+
'width' => '100',
|
76 |
+
'renderer' => 'datta_storelocator/adminhtml_store_renderer_image',
|
77 |
+
'index' => 'image',
|
78 |
+
));
|
79 |
+
|
80 |
+
$this->addColumn('name',
|
81 |
+
array(
|
82 |
+
'header'=> Mage::helper('datta_storelocator')->__('Name'),
|
83 |
+
'index' => 'name',
|
84 |
+
)
|
85 |
+
);
|
86 |
+
|
87 |
+
$this->addColumn('address',
|
88 |
+
array(
|
89 |
+
'header'=> Mage::helper('datta_storelocator')->__('Address'),
|
90 |
+
'index' => 'address',
|
91 |
+
)
|
92 |
+
);
|
93 |
+
|
94 |
+
$this->addColumn('zipcode',
|
95 |
+
array(
|
96 |
+
'header'=> Mage::helper('datta_storelocator')->__('Postal Code'),
|
97 |
+
'index' => 'zipcode',
|
98 |
+
)
|
99 |
+
);
|
100 |
+
|
101 |
+
$this->addColumn('city',
|
102 |
+
array(
|
103 |
+
'header'=> Mage::helper('datta_storelocator')->__('City'),
|
104 |
+
'index' => 'city',
|
105 |
+
)
|
106 |
+
);
|
107 |
+
|
108 |
+
$this->addColumn('country_id', array(
|
109 |
+
'header' => Mage::helper('customer')->__('Country'),
|
110 |
+
'width' => '100',
|
111 |
+
'type' => 'country',
|
112 |
+
'index' => 'country_id',
|
113 |
+
));
|
114 |
+
|
115 |
+
$this->addColumn('phone',
|
116 |
+
array(
|
117 |
+
'header'=> Mage::helper('datta_storelocator')->__('Phone'),
|
118 |
+
'index' => 'phone',
|
119 |
+
)
|
120 |
+
);
|
121 |
+
|
122 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
123 |
+
$this->addColumn('store_id', array(
|
124 |
+
'header' => Mage::helper('datta_storelocator')->__('Store View'),
|
125 |
+
'index' => 'store_id',
|
126 |
+
'type' => 'store',
|
127 |
+
'store_all' => false,
|
128 |
+
'store_view' => false,
|
129 |
+
'sortable' => true,
|
130 |
+
'filter_condition_callback'
|
131 |
+
=> array($this, '_filterStoreCondition'),
|
132 |
+
));
|
133 |
+
}
|
134 |
+
|
135 |
+
$this->addColumn('status',
|
136 |
+
array(
|
137 |
+
'header'=> Mage::helper('datta_storelocator')->__('Status'),
|
138 |
+
'index' => Mage::helper('datta_storelocator')->__('status'),
|
139 |
+
'type' => 'options',
|
140 |
+
'options' => array(
|
141 |
+
0 => Mage::helper('datta_storelocator')->__('Disabled'),
|
142 |
+
1 => Mage::helper('datta_storelocator')->__('Enabled'),
|
143 |
+
),
|
144 |
+
)
|
145 |
+
);
|
146 |
+
|
147 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('datta_storelocator')->__('CSV'));
|
148 |
+
return parent::_prepareColumns();
|
149 |
+
}
|
150 |
+
|
151 |
+
protected function _prepareMassaction()
|
152 |
+
{
|
153 |
+
$this->setMassactionIdField('entity_id');
|
154 |
+
$this->getMassactionBlock()->setFormFieldName('datta_storelocator');
|
155 |
+
|
156 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
157 |
+
'label' => Mage::helper('datta_storelocator')->__('Delete'),
|
158 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
159 |
+
'confirm' => Mage::helper('datta_storelocator')->__('Are you sure?')
|
160 |
+
));
|
161 |
+
|
162 |
+
$statuses = array(1 => Mage::helper('datta_storelocator')->__('Enabled'), 0 => Mage::helper('datta_storelocator')->__('Disabled'));
|
163 |
+
$this->getMassactionBlock()->addItem('status', array(
|
164 |
+
'label'=> Mage::helper('datta_storelocator')->__('Change status'),
|
165 |
+
'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
|
166 |
+
'additional' => array(
|
167 |
+
'visibility' => array(
|
168 |
+
'name' => 'status',
|
169 |
+
'type' => 'select',
|
170 |
+
'class' => 'required-entry',
|
171 |
+
'label' => Mage::helper('datta_storelocator')->__('Status'),
|
172 |
+
'values' => $statuses
|
173 |
+
)
|
174 |
+
)
|
175 |
+
));
|
176 |
+
return $this;
|
177 |
+
}
|
178 |
+
|
179 |
+
public function getRowUrl($row)
|
180 |
+
{
|
181 |
+
// This is where our row data will link to
|
182 |
+
return $this->getUrl('*/*/edit', array('entity_id' => $row->getId()));
|
183 |
+
}
|
184 |
+
|
185 |
+
protected function _afterLoadCollection()
|
186 |
+
{
|
187 |
+
$this->getCollection()->walk('afterLoad');
|
188 |
+
parent::_afterLoadCollection();
|
189 |
+
}
|
190 |
+
|
191 |
+
protected function _filterStoreCondition($collection, $column)
|
192 |
+
{
|
193 |
+
if (!$value = $column->getFilter()->getValue()) {
|
194 |
+
return;
|
195 |
+
}
|
196 |
+
|
197 |
+
$this->getCollection()->addStoreFilter($value);
|
198 |
+
}
|
199 |
+
|
200 |
+
}
|
app/code/community/Datta/StoreLocator/Block/Adminhtml/Store/Renderer/Image.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
*
|
22 |
+
* @category Magento
|
23 |
+
* @package Datta_StoreLocator
|
24 |
+
* @created Dattatray Yadav 2nd Dec,2013 2:40pm
|
25 |
+
* @author Clarion magento team<Dattatray Yadav>
|
26 |
+
* @purpose Store image renderer
|
27 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
28 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
29 |
+
*/
|
30 |
+
class Datta_StoreLocator_Block_Adminhtml_Store_Renderer_Image extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract{
|
31 |
+
|
32 |
+
public function render(Varien_Object $row)
|
33 |
+
{
|
34 |
+
if(!is_null($row->getData($this->getColumn()->getIndex()))){
|
35 |
+
$html = '<img ';
|
36 |
+
$html .= 'id="' . $this->getColumn()->getId() . '" ';
|
37 |
+
$html .= 'src="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).$row->getData($this->getColumn()->getIndex()) . '"';
|
38 |
+
$html .= 'width="100"';
|
39 |
+
$html .= 'class="grid-image ' . $this->getColumn()->getInlineCss() . '"/>';
|
40 |
+
return $html;
|
41 |
+
}
|
42 |
+
}
|
43 |
+
}
|
app/code/community/Datta/StoreLocator/Block/Store.php
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
*
|
22 |
+
* @category Datta
|
23 |
+
* @package Datta_StoreLocator
|
24 |
+
* @created Dattatray Yadav 2nd Dec,2013 1:45pm
|
25 |
+
* @author Clarion magento team<Dattatray Yadav>
|
26 |
+
* @purpose Retrieve the default sotre and google api url
|
27 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
28 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
29 |
+
*/
|
30 |
+
class Datta_StoreLocator_Block_Store extends Mage_Core_Block_Template
|
31 |
+
{
|
32 |
+
public function getDefaultMarker(){
|
33 |
+
$defaultMarker = '';
|
34 |
+
if(!is_null(Mage::getStoreConfig('storelocator/general/mapicon')) && Mage::getStoreConfig('storelocator/general/mapicon') != ''){
|
35 |
+
$defaultMarker = 'storelocator/markers/'.Mage::getStoreConfig('storelocator/general/mapicon');
|
36 |
+
}
|
37 |
+
return $defaultMarker;
|
38 |
+
}
|
39 |
+
public function getStores(){
|
40 |
+
$stores = Mage::getModel('datta_storelocator/store')->getCollection()
|
41 |
+
->addFieldToFilter('status',1)
|
42 |
+
->addStoreFilter($this->getCurrentStore())
|
43 |
+
->addFieldToSelect(
|
44 |
+
array(
|
45 |
+
'entity_id',
|
46 |
+
'name',
|
47 |
+
'address',
|
48 |
+
'zipcode',
|
49 |
+
'city',
|
50 |
+
'country_id',
|
51 |
+
'phone',
|
52 |
+
'fax',
|
53 |
+
'description',
|
54 |
+
'store_url',
|
55 |
+
'image',
|
56 |
+
'marker',
|
57 |
+
'lat',
|
58 |
+
'long'));
|
59 |
+
|
60 |
+
$storesCollection = new Varien_Data_Collection();
|
61 |
+
foreach($stores as $store){
|
62 |
+
if(!is_null($store->getCountryId())){
|
63 |
+
$store->setCountryId($this->getCountryByCode($store->getCountryId()));
|
64 |
+
}else{
|
65 |
+
$store->setCountryId($this->__('NC'));
|
66 |
+
}
|
67 |
+
if(!is_null($store->getImage()) || $store->getImage() != ''){
|
68 |
+
$imgUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).$store->getImage();
|
69 |
+
}elseif (!is_null(Mage::getStoreConfig('storelocator/general/defaultimage')) && Mage::getStoreConfig('storelocator/general/defaultimage') != ''){
|
70 |
+
$imgUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'storelocator/images/'.Mage::getStoreConfig('storelocator/general/defaultimage');
|
71 |
+
}else{
|
72 |
+
$imgUrl = $this->getLogoSrc();
|
73 |
+
}
|
74 |
+
$store->setImage($imgUrl);
|
75 |
+
$storesCollection->addItem($store);
|
76 |
+
}
|
77 |
+
return $storesCollection;
|
78 |
+
}
|
79 |
+
public function getGoogleApiUrl(){
|
80 |
+
$apiUrl = Mage::getStoreConfig('storelocator/general/apiurl');
|
81 |
+
if(is_null($apiUrl))
|
82 |
+
$apiUrl = "http://maps.googleapis.com/maps/api/js?v=3";
|
83 |
+
$apiKey = "&key=".Mage::getStoreConfig('storelocator/general/apikey');
|
84 |
+
$apiSensor = Mage::getStoreConfig('storelocator/general/apisensor');
|
85 |
+
$sensor = ($apiSensor == 0) ? 'false' : 'true';
|
86 |
+
$urlGoogleApi = $apiUrl."&sensor=".$sensor.$apiKey."&callback=initialize&libraries=places";
|
87 |
+
return $urlGoogleApi;
|
88 |
+
}
|
89 |
+
/**
|
90 |
+
* retrieve current store
|
91 |
+
* return Mage_Core_Model_Store
|
92 |
+
*/
|
93 |
+
public function getCurrentStore()
|
94 |
+
{
|
95 |
+
return Mage::app()->getStore()->getId();
|
96 |
+
}
|
97 |
+
public function getCountryByCode($code){
|
98 |
+
return Mage::getModel('directory/country')->loadByCode($code)->getName();
|
99 |
+
}
|
100 |
+
public function getLogoSrc()
|
101 |
+
{
|
102 |
+
if (empty($this->_data['logo_src'])) {
|
103 |
+
$this->_data['logo_src'] = Mage::getStoreConfig('design/header/logo_src');
|
104 |
+
}
|
105 |
+
return $this->getSkinUrl($this->_data['logo_src']);
|
106 |
+
}
|
107 |
+
}
|
app/code/community/Datta/StoreLocator/Helper/Data.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* Storlocator data helper
|
22 |
+
*
|
23 |
+
* @category Datta
|
24 |
+
* @package Datta_StoreLocator
|
25 |
+
* @created Dattatray Yadav 29th Nov,2013 4.55pm
|
26 |
+
* @author Clarion magento team<Dattatray Yadav>
|
27 |
+
* @purpose store locatore data helper
|
28 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
29 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
30 |
+
*/
|
31 |
+
class Datta_StoreLocator_Helper_Data extends Mage_Core_Helper_Abstract {
|
32 |
+
}
|
app/code/community/Datta/StoreLocator/Model/Resource/Store.php
ADDED
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
*
|
22 |
+
* @category Datta
|
23 |
+
* @package Datta_StoreLocator
|
24 |
+
* @created Dattatray Yadav 2nd Dec,2013 1:40pm
|
25 |
+
* @author Clarion magento team<Dattatray Yadav>
|
26 |
+
* @purpose Retribve the store information and sotre model
|
27 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
28 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
29 |
+
*/
|
30 |
+
class Datta_StoreLocator_Model_Resource_Store extends Mage_Core_Model_Resource_Db_Abstract
|
31 |
+
{
|
32 |
+
protected $_store = null;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Load core datta rewrite model
|
36 |
+
*
|
37 |
+
*/
|
38 |
+
protected function _construct()
|
39 |
+
{
|
40 |
+
$this->_init('datta_storelocator/store', 'entity_id');
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Assign page to store views
|
45 |
+
*
|
46 |
+
* @param Mage_Core_Model_Abstract $object
|
47 |
+
*/
|
48 |
+
protected function _afterSave(Mage_Core_Model_Abstract $object)
|
49 |
+
{
|
50 |
+
$oldStores = $this->lookupStoreIds($object->getId());
|
51 |
+
$newStores = (array)$object->getStores();
|
52 |
+
if (empty($newStores)) {
|
53 |
+
$newStores = (array)$object->getStoreId();
|
54 |
+
}
|
55 |
+
$table = $this->getTable('datta_storelocator/stores');
|
56 |
+
$insert = array_diff($newStores, $oldStores);
|
57 |
+
$delete = array_diff($oldStores, $newStores);
|
58 |
+
|
59 |
+
if ($delete) {
|
60 |
+
$where = array(
|
61 |
+
'storelocator_id = ?' => (int) $object->getId(),
|
62 |
+
'store_id IN (?)' => $delete
|
63 |
+
);
|
64 |
+
|
65 |
+
$this->_getWriteAdapter()->delete($table, $where);
|
66 |
+
}
|
67 |
+
|
68 |
+
if ($insert) {
|
69 |
+
$data = array();
|
70 |
+
|
71 |
+
foreach ($insert as $storeId) {
|
72 |
+
$data[] = array(
|
73 |
+
'storelocator_id' => (int) $object->getId(),
|
74 |
+
'store_id' => (int) $storeId
|
75 |
+
);
|
76 |
+
}
|
77 |
+
|
78 |
+
$this->_getWriteAdapter()->insertMultiple($table, $data);
|
79 |
+
}
|
80 |
+
|
81 |
+
return parent::_afterSave($object);
|
82 |
+
}
|
83 |
+
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Retrieve select object for load object data
|
87 |
+
*
|
88 |
+
* @param string $field
|
89 |
+
* @param mixed $value
|
90 |
+
* @return Zend_Db_Select
|
91 |
+
*/
|
92 |
+
protected function _getLoadSelect($field, $value, $object)
|
93 |
+
{
|
94 |
+
$select = parent::_getLoadSelect($field, $value, $object);
|
95 |
+
|
96 |
+
if ($object->getStoreId()) {
|
97 |
+
$storeIds = array(Mage_Core_Model_App::ADMIN_STORE_ID, (int)$object->getStoreId());
|
98 |
+
$select->join(
|
99 |
+
array('datta_storelocator_store' => $this->getTable('datta_storelocator/stores')),
|
100 |
+
$this->getMainTable() . '.page_id = datta_storelocator_store.storelocator_id',
|
101 |
+
array())
|
102 |
+
->where('datta_storelocator_store.store_id IN (?)', $storeIds)
|
103 |
+
->order('datta_storelocator_store.store_id DESC')
|
104 |
+
->limit(1);
|
105 |
+
}
|
106 |
+
|
107 |
+
return $select;
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Get store ids to which specified item is assigned
|
112 |
+
*
|
113 |
+
* @param int $id
|
114 |
+
* @return array
|
115 |
+
*/
|
116 |
+
public function lookupStoreIds($storeLocatorId)
|
117 |
+
{
|
118 |
+
$adapter = $this->_getReadAdapter();
|
119 |
+
$select = $adapter->select()
|
120 |
+
->from($this->getTable('datta_storelocator/stores'), 'store_id')
|
121 |
+
->where('storelocator_id = ?',(int)$storeLocatorId);
|
122 |
+
|
123 |
+
return $adapter->fetchCol($select);
|
124 |
+
}
|
125 |
+
|
126 |
+
protected function _afterLoad(Mage_Core_Model_Abstract $object)
|
127 |
+
{
|
128 |
+
if ($object->getId()) {
|
129 |
+
$stores = $this->lookupStoreIds($object->getId());
|
130 |
+
|
131 |
+
$object->setData('store_id', $stores);
|
132 |
+
|
133 |
+
}
|
134 |
+
|
135 |
+
return parent::_afterLoad($object);
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Add filter by store
|
140 |
+
*
|
141 |
+
* @param int|Mage_Core_Model_Store $store
|
142 |
+
* @param bool $withAdmin
|
143 |
+
*/
|
144 |
+
public function addStoreFilter($store, $withAdmin = true)
|
145 |
+
{
|
146 |
+
if ($store instanceof Mage_Core_Model_Store) {
|
147 |
+
$store = array($store->getId());
|
148 |
+
}
|
149 |
+
|
150 |
+
if (!is_array($store)) {
|
151 |
+
$store = array($store);
|
152 |
+
}
|
153 |
+
|
154 |
+
if ($withAdmin) {
|
155 |
+
$store[] = Mage_Core_Model_App::ADMIN_STORE_ID;
|
156 |
+
}
|
157 |
+
$this->addFilter('store_id', array('in' => $store), 'public');
|
158 |
+
|
159 |
+
return $this;
|
160 |
+
}
|
161 |
+
public function setStore($store)
|
162 |
+
{
|
163 |
+
$this->_store = $store;
|
164 |
+
return $this;
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* Retrieve store model
|
169 |
+
*
|
170 |
+
* @return Mage_Core_Model_Store
|
171 |
+
*/
|
172 |
+
public function getStore()
|
173 |
+
{
|
174 |
+
return Mage::app()->getStore($this->_store);
|
175 |
+
}
|
176 |
+
}
|
app/code/community/Datta/StoreLocator/Model/Resource/Store/Collection.php
ADDED
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
*
|
22 |
+
* @category Datta
|
23 |
+
* @package Datta_StoreLocator
|
24 |
+
* @created Dattatray Yadav 2nd Dec,2013 1:45pm
|
25 |
+
* @author Clarion magento team<Dattatray Yadav>
|
26 |
+
* @purpose Retrieve the sotre collection model
|
27 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
28 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
29 |
+
*/
|
30 |
+
class Datta_StoreLocator_Model_Resource_Store_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* Load data for preview flag
|
34 |
+
* @var bool
|
35 |
+
*/
|
36 |
+
protected $_previewFlag;
|
37 |
+
protected function _construct()
|
38 |
+
{
|
39 |
+
$this->_init('datta_storelocator/store');
|
40 |
+
$this->_map['fields']['entity_id'] = 'main_table.entity_id';
|
41 |
+
$this->_map['fields']['storelocator_id'] = 'datta_storelocator_stores.storelocator_id';
|
42 |
+
}
|
43 |
+
/**
|
44 |
+
* Set first store flag
|
45 |
+
*
|
46 |
+
* @param bool $flag
|
47 |
+
*/
|
48 |
+
public function setFirstStoreFlag($flag = false)
|
49 |
+
{
|
50 |
+
$this->_previewFlag = $flag;
|
51 |
+
return $this;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* deprecated after 1.4.0.1, use toOptionIdArray()
|
56 |
+
*
|
57 |
+
* @return array
|
58 |
+
*/
|
59 |
+
public function toOptionArray()
|
60 |
+
{
|
61 |
+
return $this->_toOptionArray('identifier', 'title');
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Returns pairs identifier - title for unique identifiers
|
66 |
+
* and pairs identifier|page_id - title for non-unique after first
|
67 |
+
*
|
68 |
+
* @return array
|
69 |
+
*/
|
70 |
+
public function toOptionIdArray()
|
71 |
+
{
|
72 |
+
$res = array();
|
73 |
+
$existingIdentifiers = array();
|
74 |
+
foreach ($this as $item) {
|
75 |
+
$identifier = $item->getData('identifier');
|
76 |
+
|
77 |
+
$data['value'] = $identifier;
|
78 |
+
$data['label'] = $item->getData('title');
|
79 |
+
|
80 |
+
if (in_array($identifier, $existingIdentifiers)) {
|
81 |
+
$data['value'] .= '|' . $item->getData('storelocator_id');
|
82 |
+
} else {
|
83 |
+
$existingIdentifiers[] = $identifier;
|
84 |
+
}
|
85 |
+
|
86 |
+
$res[] = $data;
|
87 |
+
}
|
88 |
+
return $res;
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Perform operations after collection load
|
93 |
+
*
|
94 |
+
*/
|
95 |
+
protected function _afterLoad()
|
96 |
+
{
|
97 |
+
if ($this->_previewFlag) {
|
98 |
+
$items = $this->getColumnValues('entity_id');
|
99 |
+
$connection = $this->getConnection();
|
100 |
+
if (count($items)) {
|
101 |
+
$select = $connection->select()
|
102 |
+
->from(array('datta_storelocator_stores'=>$this->getTable('datta_storelocator/stores')))
|
103 |
+
->where('datta_storelocator_stores.storelocator_id IN (?)', $items);
|
104 |
+
|
105 |
+
if ($result = $connection->fetchPairs($select)) {
|
106 |
+
foreach ($this as $item) {
|
107 |
+
if (!isset($result[$item->getData('entity_id')])) {
|
108 |
+
continue;
|
109 |
+
}
|
110 |
+
if ($result[$item->getData('entity_id')] == 0) {
|
111 |
+
$stores = Mage::app()->getStores(false, true);
|
112 |
+
$storeId = current($stores)->getId();
|
113 |
+
$storeCode = key($stores);
|
114 |
+
} else {
|
115 |
+
$storeId = $result[$item->getData('entity_id')];
|
116 |
+
$storeCode = Mage::app()->getStore($storeId)->getCode();
|
117 |
+
}
|
118 |
+
|
119 |
+
$item->setData('_first_store_id', $storeId);
|
120 |
+
$item->setData('store_code', $storeCode);
|
121 |
+
}
|
122 |
+
}
|
123 |
+
}
|
124 |
+
}
|
125 |
+
return parent::_afterLoad();
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Join store relation table if there is store filter
|
130 |
+
*/
|
131 |
+
protected function _renderFiltersBefore()
|
132 |
+
{
|
133 |
+
if ($this->getFilter('store_id')) {
|
134 |
+
$this->getSelect()->join(
|
135 |
+
array('datta_storelocator_stores' => $this->getTable('datta_storelocator/stores')),
|
136 |
+
'main_table.entity_id = datta_storelocator_stores.storelocator_id',
|
137 |
+
array()
|
138 |
+
)->group('main_table.entity_id');
|
139 |
+
|
140 |
+
/*
|
141 |
+
* Allow analytic functions usage because of one field grouping
|
142 |
+
*/
|
143 |
+
$this->_useAnalyticFunction = true;
|
144 |
+
}
|
145 |
+
return parent::_renderFiltersBefore();
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Add filter by store
|
150 |
+
*
|
151 |
+
* @param int|Mage_Core_Model_Store $store
|
152 |
+
* @param bool $withAdmin
|
153 |
+
*/
|
154 |
+
public function addStoreFilter($store, $withAdmin = true)
|
155 |
+
{
|
156 |
+
if (!$this->getFlag('store_filter_added')) {
|
157 |
+
if ($store instanceof Mage_Core_Model_Store) {
|
158 |
+
$store = array($store->getId());
|
159 |
+
}
|
160 |
+
|
161 |
+
if (!is_array($store)) {
|
162 |
+
$store = array($store);
|
163 |
+
}
|
164 |
+
|
165 |
+
if ($withAdmin) {
|
166 |
+
$store[] = Mage_Core_Model_App::ADMIN_STORE_ID;
|
167 |
+
}
|
168 |
+
|
169 |
+
$this->addFilter('store_id', array('in' => $store), 'public');
|
170 |
+
}
|
171 |
+
return $this;
|
172 |
+
}
|
173 |
+
}
|
app/code/community/Datta/StoreLocator/Model/Store.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
*
|
22 |
+
* @category Datta
|
23 |
+
* @package Datta_StoreLocator
|
24 |
+
* @created Dattatray Yadav 29th Nov,2013 6:20pm
|
25 |
+
* @author Clarion magento team<Dattatray Yadav>
|
26 |
+
* @purpose store locatore model
|
27 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
28 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
29 |
+
*/
|
30 |
+
class Datta_StoreLocator_Model_Store extends Mage_Core_Model_Abstract
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* Initialize resource model
|
34 |
+
*
|
35 |
+
*/
|
36 |
+
public function _construct()
|
37 |
+
{
|
38 |
+
parent::_construct();
|
39 |
+
$this->_init('datta_storelocator/store');
|
40 |
+
}
|
41 |
+
}
|
app/code/community/Datta/StoreLocator/Model/System/Config/Backend/Image.php
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
*
|
22 |
+
* @category Datta
|
23 |
+
* @package Datta_StoreLocator
|
24 |
+
* @created Dattatray Yadav 29th Nov,2013 6:20pm
|
25 |
+
* @author Clarion magento team<Dattatray Yadav>
|
26 |
+
* @purpose Backend model for uploading custom logo image
|
27 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
28 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
29 |
+
*/
|
30 |
+
class Datta_StoreLocator_Model_System_Config_Backend_Image extends Mage_Adminhtml_Model_System_Config_Backend_Image
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* The tail part of directory path for uploading
|
34 |
+
*/
|
35 |
+
const UPLOAD_DIR = 'storelocator/images';
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Token for the root part of directory path for uploading
|
39 |
+
*/
|
40 |
+
const UPLOAD_ROOT_TOKEN = 'system/filesystem/media';
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Upload max file size in kilobytes
|
44 |
+
*
|
45 |
+
* @var int
|
46 |
+
*/
|
47 |
+
protected $_maxFileSize = 2048;
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Return path to directory for upload file
|
51 |
+
*
|
52 |
+
* @return string
|
53 |
+
*/
|
54 |
+
protected function _getUploadDir()
|
55 |
+
{
|
56 |
+
$uploadDir = $this->_appendScopeInfo(self::UPLOAD_DIR);
|
57 |
+
$uploadRoot = $this->_getUploadRoot(self::UPLOAD_ROOT_TOKEN);
|
58 |
+
$uploadDir = $uploadRoot . DS . $uploadDir;
|
59 |
+
return $uploadDir;
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Makes a decision about whether to add info about the scope
|
64 |
+
*
|
65 |
+
* @return boolean
|
66 |
+
*/
|
67 |
+
protected function _addWhetherScopeInfo()
|
68 |
+
{
|
69 |
+
return true;
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Save uploaded file before saving config value
|
74 |
+
*
|
75 |
+
* Save changes and delete file if "delete" option passed
|
76 |
+
*
|
77 |
+
* @return Mage_Adminhtml_Model_System_Config_Backend_Email_Logo
|
78 |
+
*/
|
79 |
+
protected function _beforeSave()
|
80 |
+
{
|
81 |
+
$value = $this->getValue();
|
82 |
+
$deleteFlag = (is_array($value) && !empty($value['delete']));
|
83 |
+
$fileTmpName = $_FILES['groups']['tmp_name'][$this->getGroupId()]['fields'][$this->getField()]['value'];
|
84 |
+
|
85 |
+
if ($this->getOldValue() && ($fileTmpName || $deleteFlag)) {
|
86 |
+
$io = new Varien_Io_File();
|
87 |
+
$io->rm($this->_getUploadRoot(self::UPLOAD_ROOT_TOKEN) . DS . self::UPLOAD_DIR . DS . $this->getOldValue());
|
88 |
+
}
|
89 |
+
return parent::_beforeSave();
|
90 |
+
}
|
91 |
+
}
|
app/code/community/Datta/StoreLocator/Model/System/Config/Backend/Marker.php
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
*
|
23 |
+
* @category Datta
|
24 |
+
* @package Datta_StoreLocator
|
25 |
+
* @created Dattatray Yadav 29th Nov,2013 6:20pm
|
26 |
+
* @author Clarion magento team<Dattatray Yadav>
|
27 |
+
* @purpose Backend model for uploading transactional emails custom logo image
|
28 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
29 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
30 |
+
*/
|
31 |
+
class Datta_StoreLocator_Model_System_Config_Backend_Marker extends Mage_Adminhtml_Model_System_Config_Backend_Image
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* The tail part of directory path for uploading
|
35 |
+
*/
|
36 |
+
const UPLOAD_DIR = 'storelocator/markers';
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Token for the root part of directory path for uploading
|
40 |
+
*/
|
41 |
+
const UPLOAD_ROOT_TOKEN = 'system/filesystem/media';
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Upload max file size in kilobytes
|
45 |
+
*
|
46 |
+
* @var int
|
47 |
+
*/
|
48 |
+
protected $_maxFileSize = 2048;
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Return path to directory for upload file
|
52 |
+
*
|
53 |
+
* @return string
|
54 |
+
*/
|
55 |
+
protected function _getUploadDir()
|
56 |
+
{
|
57 |
+
$uploadDir = $this->_appendScopeInfo(self::UPLOAD_DIR);
|
58 |
+
$uploadRoot = $this->_getUploadRoot(self::UPLOAD_ROOT_TOKEN);
|
59 |
+
$uploadDir = $uploadRoot . DS . $uploadDir;
|
60 |
+
return $uploadDir;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Makes a decision about whether to add info about the scope
|
65 |
+
*
|
66 |
+
* @return boolean
|
67 |
+
*/
|
68 |
+
protected function _addWhetherScopeInfo()
|
69 |
+
{
|
70 |
+
return true;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Save uploaded file before saving config value
|
75 |
+
*
|
76 |
+
* Save changes and delete file if "delete" option passed
|
77 |
+
*
|
78 |
+
* @return Mage_Adminhtml_Model_System_Config_Backend_Email_Logo
|
79 |
+
*/
|
80 |
+
protected function _beforeSave()
|
81 |
+
{
|
82 |
+
$value = $this->getValue();
|
83 |
+
$deleteFlag = (is_array($value) && !empty($value['delete']));
|
84 |
+
$fileTmpName = $_FILES['groups']['tmp_name'][$this->getGroupId()]['fields'][$this->getField()]['value'];
|
85 |
+
|
86 |
+
if ($this->getOldValue() && ($fileTmpName || $deleteFlag)) {
|
87 |
+
$io = new Varien_Io_File();
|
88 |
+
$io->rm($this->_getUploadRoot(self::UPLOAD_ROOT_TOKEN) . DS . self::UPLOAD_DIR . DS . $this->getOldValue());
|
89 |
+
}
|
90 |
+
return parent::_beforeSave();
|
91 |
+
}
|
92 |
+
}
|
app/code/community/Datta/StoreLocator/controllers/Adminhtml/StoreController.php
ADDED
@@ -0,0 +1,255 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Enterprise
|
22 |
+
* @package Datta_StoreLocator
|
23 |
+
* @created Dattatray Yadav 2nd Dec,2013 2:05pm
|
24 |
+
* @author Clarion magento team<Dattatray Yadav>
|
25 |
+
* @purpose Store display action in admin area
|
26 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
27 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
28 |
+
*/
|
29 |
+
class Datta_StoreLocator_Adminhtml_StoreController extends Mage_Adminhtml_Controller_Action
|
30 |
+
{
|
31 |
+
public function indexAction()
|
32 |
+
{
|
33 |
+
$this->_initAction()->renderLayout();
|
34 |
+
}
|
35 |
+
public function newAction()
|
36 |
+
{
|
37 |
+
$this->_forward('edit');
|
38 |
+
}
|
39 |
+
public function editAction()
|
40 |
+
{
|
41 |
+
$this->_initAction();
|
42 |
+
$id = $this->getRequest()->getParam('entity_id');
|
43 |
+
$model = Mage::getModel('datta_storelocator/store');
|
44 |
+
|
45 |
+
if ($id) {
|
46 |
+
$model->load($id);
|
47 |
+
if (!$model->getId()) {
|
48 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('This store no longer exists.'));
|
49 |
+
$this->_redirect('*/*/');
|
50 |
+
return;
|
51 |
+
}
|
52 |
+
}
|
53 |
+
$this->_title($model->getId() ? $model->getName() : $this->__('New Store'));
|
54 |
+
$data = Mage::getSingleton('adminhtml/session')->getStoreData(true);
|
55 |
+
if (!empty($data)) {
|
56 |
+
$model->setData($data);
|
57 |
+
}
|
58 |
+
Mage::register('datta_storelocator', $model);
|
59 |
+
$this->_initAction()
|
60 |
+
->_addBreadcrumb($id ? Mage::helper('datta_storelocator')->__('Edit Store') : Mage::helper('datta_storelocator')->__('New Store'), $id ? Mage::helper('datta_storelocator')->__('Edit Store') : Mage::helper('datta_storelocator')->__('New Store'))
|
61 |
+
->renderLayout();
|
62 |
+
}
|
63 |
+
public function saveAction()
|
64 |
+
{
|
65 |
+
if ($postData = $this->getRequest()->getPost()) {
|
66 |
+
if(isset($_FILES['image']['name']) and (file_exists($_FILES['image']['tmp_name']))) {
|
67 |
+
try {
|
68 |
+
$uploader = new Varien_File_Uploader('image');
|
69 |
+
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
|
70 |
+
$uploader->setAllowRenameFiles(false);
|
71 |
+
$uploader->setFilesDispersion(false);
|
72 |
+
$locImg = 'storelocator/images/';
|
73 |
+
$path = Mage::getBaseDir('media') . DS . $locImg ;
|
74 |
+
$uploader->save($path, $_FILES['image']['name']);
|
75 |
+
$postData['image'] = $_FILES['image']['name'];
|
76 |
+
}catch(Exception $e) {
|
77 |
+
|
78 |
+
}
|
79 |
+
}else{
|
80 |
+
if(isset($postData['image']['delete']) && $postData['image']['delete'] == 1){
|
81 |
+
$postData['image'] = '';
|
82 |
+
}else{
|
83 |
+
unset($postData['image']);
|
84 |
+
}
|
85 |
+
}
|
86 |
+
/// check file is exist
|
87 |
+
if(isset($_FILES['marker']['name']) and (file_exists($_FILES['marker']['tmp_name']))) {
|
88 |
+
try {
|
89 |
+
$uploader = new Varien_File_Uploader('marker');
|
90 |
+
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
|
91 |
+
$uploader->setAllowRenameFiles(false);
|
92 |
+
$uploader->setFilesDispersion(false);
|
93 |
+
$locMarker = 'storelocator/markers/';
|
94 |
+
$path = Mage::getBaseDir('media') . DS . $locMarker ;
|
95 |
+
$uploader->save($path, $_FILES['marker']['name']);
|
96 |
+
$postData['marker'] = $_FILES['marker']['name'];
|
97 |
+
}catch(Exception $e) {
|
98 |
+
|
99 |
+
}
|
100 |
+
}else{
|
101 |
+
if(isset($postData['marker']['delete']) && $postData['marker']['delete'] == 1){
|
102 |
+
$postData['marker'] = '';
|
103 |
+
}else{
|
104 |
+
unset($postData['marker']);
|
105 |
+
}
|
106 |
+
}
|
107 |
+
$model = Mage::getSingleton('datta_storelocator/store');
|
108 |
+
if ($id = $this->getRequest()->getParam('entity_id')) {
|
109 |
+
$model->load($id);
|
110 |
+
}
|
111 |
+
|
112 |
+
$model->setData($postData);
|
113 |
+
|
114 |
+
try {
|
115 |
+
if(is_null($model->getCreatedTime()) || $model->getCreatedTime() == ''){
|
116 |
+
$model->setCreatedTime(time());
|
117 |
+
}
|
118 |
+
$model->setUpdateTime(time());
|
119 |
+
if(substr_compare($model->getStoreUrl(), "http://", 0, 7) > 0 && substr_compare($model->getStoreUrl(), "https://", 0, 8) > 0){
|
120 |
+
$model->setStoreUrl("http://".$model->getStoreUrl());
|
121 |
+
}
|
122 |
+
|
123 |
+
if(!is_null($model->getImage()) && $model->getImage() != ''){
|
124 |
+
$filename = str_replace(" ", "_", $model->getImage());
|
125 |
+
$filename = str_replace(":", "_", $filename);
|
126 |
+
$model->setImage($locImg.$filename);
|
127 |
+
}
|
128 |
+
|
129 |
+
if(!is_null($model->getMarker()) && $model->getMarker() != ''){
|
130 |
+
$filename = str_replace(" ", "_", $model->getMarker());
|
131 |
+
$filename = str_replace(":", "_", $filename);
|
132 |
+
$model->setMarker($locMarker.$filename);
|
133 |
+
}
|
134 |
+
$model->save();
|
135 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The store has been saved.'));
|
136 |
+
if ($this->getRequest()->getParam('back')) {
|
137 |
+
$this->_redirect('*/*/edit', array('entity_id' => $model->getId()));
|
138 |
+
return;
|
139 |
+
}
|
140 |
+
$this->_redirect('*/*/');
|
141 |
+
return;
|
142 |
+
}
|
143 |
+
catch (Mage_Core_Exception $e) {
|
144 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
145 |
+
}
|
146 |
+
catch (Exception $e) {
|
147 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('An error occurred while saving this store.'));
|
148 |
+
}
|
149 |
+
|
150 |
+
Mage::getSingleton('adminhtml/session')->setStoreData($postData);
|
151 |
+
$this->_redirectReferer();
|
152 |
+
}
|
153 |
+
}
|
154 |
+
public function deleteAction() {
|
155 |
+
if( $this->getRequest()->getParam('entity_id') > 0 ) {
|
156 |
+
try {
|
157 |
+
$model = Mage::getModel('datta_storelocator/store');
|
158 |
+
|
159 |
+
$model->setId($this->getRequest()->getParam('entity_id'))
|
160 |
+
->delete();
|
161 |
+
|
162 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('datta_storelocator')->__('Store was successfully deleted'));
|
163 |
+
$this->_redirect('*/*/');
|
164 |
+
} catch (Exception $e) {
|
165 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
166 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
167 |
+
}
|
168 |
+
}
|
169 |
+
$this->_redirect('*/*/');
|
170 |
+
}
|
171 |
+
|
172 |
+
public function massDeleteAction() {
|
173 |
+
$storelocatorIds = $this->getRequest()->getParam('datta_storelocator');
|
174 |
+
if(!is_array($storelocatorIds)) {
|
175 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('datta_storelocator')->__('Please select store(s)'));
|
176 |
+
} else {
|
177 |
+
try {
|
178 |
+
foreach ($storelocatorIds as $storelocatorId) {
|
179 |
+
$storelocator = Mage::getModel('datta_storelocator/store')->load($storelocatorId);
|
180 |
+
$storelocator->delete();
|
181 |
+
}
|
182 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
183 |
+
Mage::helper('datta_storelocator')->__(
|
184 |
+
'Total of %d record(s) were successfully deleted', count($storelocatorIds)
|
185 |
+
)
|
186 |
+
);
|
187 |
+
} catch (Exception $e) {
|
188 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
189 |
+
}
|
190 |
+
}
|
191 |
+
$this->_redirect('*/*/index');
|
192 |
+
}
|
193 |
+
|
194 |
+
public function massStatusAction()
|
195 |
+
{
|
196 |
+
$storelocatorIds = $this->getRequest()->getParam('datta_storelocator');
|
197 |
+
if(!is_array($storelocatorIds)) {
|
198 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select store(s)'));
|
199 |
+
} else {
|
200 |
+
try {
|
201 |
+
foreach ($storelocatorIds as $storelocatorId) {
|
202 |
+
$storelocator = Mage::getSingleton('datta_storelocator/store')
|
203 |
+
->load($storelocatorId)
|
204 |
+
->setStatus($this->getRequest()->getParam('status'))
|
205 |
+
->setUpdateTime(time())
|
206 |
+
->setIsMassupdate(true)
|
207 |
+
->save();
|
208 |
+
}
|
209 |
+
$this->_getSession()->addSuccess(
|
210 |
+
$this->__('Total of %d record(s) were successfully updated', count($storelocatorIds))
|
211 |
+
);
|
212 |
+
} catch (Exception $e) {
|
213 |
+
$this->_getSession()->addError($e->getMessage());
|
214 |
+
}
|
215 |
+
}
|
216 |
+
$this->_redirect('*/*/index');
|
217 |
+
}
|
218 |
+
public function messageAction()
|
219 |
+
{
|
220 |
+
$data = Mage::getModel('datta_storelocator/store')->load($this->getRequest()->getParam('entity_id'));
|
221 |
+
echo $data->getContent();
|
222 |
+
}
|
223 |
+
/**
|
224 |
+
* Initialize action
|
225 |
+
* Here, we set the breadcrumbs and the active menu
|
226 |
+
* return Mage_Adminhtml_Controller_Action
|
227 |
+
*/
|
228 |
+
protected function _initAction()
|
229 |
+
{
|
230 |
+
$this->loadLayout()
|
231 |
+
// Make the active menu match the menu config nodes (without 'children' inbetween)
|
232 |
+
->_setActiveMenu('datta/datta_storelocator')
|
233 |
+
->_title($this->__('Datta'))->_title($this->__('Store'))
|
234 |
+
->_addBreadcrumb($this->__('Datta'), $this->__('Datta'))
|
235 |
+
->_addBreadcrumb($this->__('Store'), $this->__('Store'));
|
236 |
+
return $this;
|
237 |
+
}
|
238 |
+
/**
|
239 |
+
* Check currently called action by permissions for current user
|
240 |
+
* @return bool
|
241 |
+
*/
|
242 |
+
protected function _isAllowed()
|
243 |
+
{
|
244 |
+
return Mage::getSingleton('admin/session')->isAllowed('datta/datta_storelocator');
|
245 |
+
}
|
246 |
+
/**
|
247 |
+
* Export order grid to CSV format
|
248 |
+
*/
|
249 |
+
public function exportCsvAction()
|
250 |
+
{
|
251 |
+
$fileName = 'stores.csv';
|
252 |
+
$grid = $this->getLayout()->createBlock('datta_storelocator/adminhtml_store_grid');
|
253 |
+
$this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
|
254 |
+
}
|
255 |
+
}
|
app/code/community/Datta/StoreLocator/controllers/IndexController.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Datta
|
22 |
+
* @package Datta_StoreLocator
|
23 |
+
* @created Dattatray Yadav 2nd Dec,2013 1:50pm
|
24 |
+
* @author Clarion magento team<Dattatray Yadav>
|
25 |
+
* @purpose Store display action
|
26 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
27 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
28 |
+
*/
|
29 |
+
class Datta_StoreLocator_IndexController extends Mage_Core_Controller_Front_Action
|
30 |
+
{
|
31 |
+
public function indexAction()
|
32 |
+
{
|
33 |
+
$this->loadLayout();
|
34 |
+
$this->renderLayout();
|
35 |
+
}
|
36 |
+
}
|
app/code/community/Datta/StoreLocator/etc/adminhtml.xml
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Datta
|
23 |
+
* @package Datta_StoreLocator
|
24 |
+
* @created Dattatray Yadav 29th Nov,2013 4.45pm
|
25 |
+
* @author Clarion magento team<Dattatray Yadav>
|
26 |
+
* @purpose admin configuration settigs
|
27 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
28 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
29 |
+
*/
|
30 |
+
-->
|
31 |
+
<config>
|
32 |
+
<menu>
|
33 |
+
<datta translate="title">
|
34 |
+
<title>Store Location</title>
|
35 |
+
<sort_order>90</sort_order>
|
36 |
+
<children>
|
37 |
+
<datta_storelocator translate="title" module="datta_storelocator">
|
38 |
+
<title>Store Locator</title>
|
39 |
+
<sort_order>1</sort_order>
|
40 |
+
<action>datta_storelocator/adminhtml_store</action>
|
41 |
+
</datta_storelocator>
|
42 |
+
</children>
|
43 |
+
</datta>
|
44 |
+
</menu>
|
45 |
+
<acl>
|
46 |
+
<resources>
|
47 |
+
<all>
|
48 |
+
<title>Allow Everything</title>
|
49 |
+
</all>
|
50 |
+
<admin>
|
51 |
+
<children>
|
52 |
+
<datta translate="title">
|
53 |
+
<title>Store Location </title>
|
54 |
+
<children>
|
55 |
+
<datta_storelocator translate="title" module="datta_storelocator">
|
56 |
+
<title>StoreLocator</title>
|
57 |
+
<sort_order>30</sort_order>
|
58 |
+
</datta_storelocator>
|
59 |
+
</children>
|
60 |
+
</datta>
|
61 |
+
<system>
|
62 |
+
<children>
|
63 |
+
<config>
|
64 |
+
<children>
|
65 |
+
<storelocator translate="title" module="datta_storelocator">
|
66 |
+
<title>Clarion StoreLocator</title>
|
67 |
+
</storelocator>
|
68 |
+
</children>
|
69 |
+
</config>
|
70 |
+
</children>
|
71 |
+
</system>
|
72 |
+
</children>
|
73 |
+
</admin>
|
74 |
+
</resources>
|
75 |
+
</acl>
|
76 |
+
</config>
|
app/code/community/Datta/StoreLocator/etc/config.xml
ADDED
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Datta
|
23 |
+
* @package Datta_StoreLocator
|
24 |
+
* @created Dattatray Yadav 29th Nov,2013 3.40pm
|
25 |
+
* @author Clarion magento team<Dattatray Yadav>
|
26 |
+
* @purpose congfigure module configuration setting
|
27 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
28 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
29 |
+
*/
|
30 |
+
-->
|
31 |
+
<config>
|
32 |
+
<modules>
|
33 |
+
<Datta_StoreLocator>
|
34 |
+
<version>1.1.2</version>
|
35 |
+
</Datta_StoreLocator>
|
36 |
+
</modules>
|
37 |
+
<global>
|
38 |
+
<blocks>
|
39 |
+
<datta_storelocator>
|
40 |
+
<class>Datta_StoreLocator_Block</class>
|
41 |
+
</datta_storelocator>
|
42 |
+
</blocks>
|
43 |
+
<helpers>
|
44 |
+
<datta_storelocator>
|
45 |
+
<class>Datta_StoreLocator_Helper</class>
|
46 |
+
</datta_storelocator>
|
47 |
+
</helpers>
|
48 |
+
<models>
|
49 |
+
<datta_storelocator>
|
50 |
+
<class>Datta_StoreLocator_Model</class>
|
51 |
+
<resourceModel>datta_storelocator_resource</resourceModel>
|
52 |
+
</datta_storelocator>
|
53 |
+
<datta_storelocator_resource>
|
54 |
+
<class>Datta_StoreLocator_Model_Resource</class>
|
55 |
+
<entities>
|
56 |
+
<store>
|
57 |
+
<table>datta_storelocator</table>
|
58 |
+
</store>
|
59 |
+
<stores>
|
60 |
+
<table>datta_storelocator_stores</table>
|
61 |
+
</stores>
|
62 |
+
</entities>
|
63 |
+
</datta_storelocator_resource>
|
64 |
+
</models>
|
65 |
+
<resources>
|
66 |
+
<datta_storelocator_setup>
|
67 |
+
<setup>
|
68 |
+
<module>Datta_StoreLocator</module>
|
69 |
+
<class>Mage_Customer_Model_Entity_Setup</class>
|
70 |
+
</setup>
|
71 |
+
<connection>
|
72 |
+
<use>core_setup</use>
|
73 |
+
</connection>
|
74 |
+
</datta_storelocator_setup>
|
75 |
+
<datta_storelocator_write>
|
76 |
+
<connection>
|
77 |
+
<use>core_write</use>
|
78 |
+
</connection>
|
79 |
+
</datta_storelocator_write>
|
80 |
+
<datta_storelocator_read>
|
81 |
+
<connection>
|
82 |
+
<use>core_read</use>
|
83 |
+
</connection>
|
84 |
+
</datta_storelocator_read>
|
85 |
+
</resources>
|
86 |
+
</global>
|
87 |
+
<frontend>
|
88 |
+
<translate>
|
89 |
+
<modules>
|
90 |
+
<datta_storelocator>
|
91 |
+
<files>
|
92 |
+
<default>Datta/Datta_StoreLocator.csv</default>
|
93 |
+
</files>
|
94 |
+
</datta_storelocator>
|
95 |
+
</modules>
|
96 |
+
</translate>
|
97 |
+
<routers>
|
98 |
+
<datta_storelocator>
|
99 |
+
<use>standard</use>
|
100 |
+
<args>
|
101 |
+
<module>Datta_StoreLocator</module>
|
102 |
+
<frontName>storelocator</frontName>
|
103 |
+
</args>
|
104 |
+
</datta_storelocator>
|
105 |
+
</routers>
|
106 |
+
<layout>
|
107 |
+
<updates>
|
108 |
+
<storelocator>
|
109 |
+
<file>datta/storelocator.xml</file>
|
110 |
+
</storelocator>
|
111 |
+
</updates>
|
112 |
+
</layout>
|
113 |
+
</frontend>
|
114 |
+
<admin>
|
115 |
+
<routers>
|
116 |
+
<datta_storelocator>
|
117 |
+
<use>admin</use>
|
118 |
+
<args>
|
119 |
+
<module>Datta_StoreLocator</module>
|
120 |
+
<frontName>datta_storelocator</frontName>
|
121 |
+
</args>
|
122 |
+
</datta_storelocator>
|
123 |
+
</routers>
|
124 |
+
</admin>
|
125 |
+
<adminhtml>
|
126 |
+
<translate>
|
127 |
+
<modules>
|
128 |
+
<Datta_StoreLocator>
|
129 |
+
<files>
|
130 |
+
<default>Datta/Datta_StoreLocator.csv</default>
|
131 |
+
</files>
|
132 |
+
</Datta_StoreLocator>
|
133 |
+
</modules>
|
134 |
+
</translate>
|
135 |
+
<layout>
|
136 |
+
<updates>
|
137 |
+
<storelocator>
|
138 |
+
<file>datta/storelocator.xml</file>
|
139 |
+
</storelocator>
|
140 |
+
</updates>
|
141 |
+
</layout>
|
142 |
+
</adminhtml>
|
143 |
+
<default>
|
144 |
+
<storelocator>
|
145 |
+
<general>
|
146 |
+
<apiurl>http://maps.googleapis.com/maps/api/js?v=3</apiurl>
|
147 |
+
<apisensor>1</apisensor>
|
148 |
+
<direction>1</direction>
|
149 |
+
</general>
|
150 |
+
</storelocator>
|
151 |
+
</default>
|
152 |
+
</config>
|
app/code/community/Datta/StoreLocator/etc/system.xml
ADDED
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Datta
|
23 |
+
* @package Datta_StoreLocator
|
24 |
+
* @created Dattatray Yadav 29th Nov,2013 4.20pm
|
25 |
+
* @author Clarion magento team<Dattatray Yadav>
|
26 |
+
* @purpose System configuration settings
|
27 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
28 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
29 |
+
*/
|
30 |
+
-->
|
31 |
+
<config>
|
32 |
+
<tabs>
|
33 |
+
<datta>
|
34 |
+
<label>Store Locator Settings</label>
|
35 |
+
<sort_order>5</sort_order>
|
36 |
+
</datta>
|
37 |
+
</tabs>
|
38 |
+
<sections>
|
39 |
+
<storelocator translate="label" module="datta_storelocator">
|
40 |
+
<label>Store Locator</label>
|
41 |
+
<tab>datta</tab>
|
42 |
+
<frontend_type>text</frontend_type>
|
43 |
+
<sort_order>500</sort_order>
|
44 |
+
<show_in_default>1</show_in_default>
|
45 |
+
<show_in_website>1</show_in_website>
|
46 |
+
<show_in_store>1</show_in_store>
|
47 |
+
<groups>
|
48 |
+
<general translate="label">
|
49 |
+
<label>General Configuration</label>
|
50 |
+
<frontend_type>text</frontend_type>
|
51 |
+
<sort_order>10</sort_order>
|
52 |
+
<show_in_default>1</show_in_default>
|
53 |
+
<show_in_website>1</show_in_website>
|
54 |
+
<show_in_store>1</show_in_store>
|
55 |
+
<fields>
|
56 |
+
<serial translate="label">
|
57 |
+
<label>Serial</label>
|
58 |
+
<frontend_type>text</frontend_type>
|
59 |
+
<sort_order>1</sort_order>
|
60 |
+
<show_in_default>1</show_in_default>
|
61 |
+
<show_in_website>1</show_in_website>
|
62 |
+
<show_in_store>1</show_in_store>
|
63 |
+
</serial>
|
64 |
+
<apiurl translate="label">
|
65 |
+
<label>Google API Url</label>
|
66 |
+
<frontend_type>text</frontend_type>
|
67 |
+
<sort_order>10</sort_order>
|
68 |
+
<show_in_default>1</show_in_default>
|
69 |
+
<show_in_website>1</show_in_website>
|
70 |
+
<show_in_store>1</show_in_store>
|
71 |
+
<comment>Enter your Google API Url.</comment>
|
72 |
+
</apiurl>
|
73 |
+
<apikey translate="label">
|
74 |
+
<label>API Key</label>
|
75 |
+
<frontend_type>text</frontend_type>
|
76 |
+
<sort_order>11</sort_order>
|
77 |
+
<show_in_default>1</show_in_default>
|
78 |
+
<show_in_website>1</show_in_website>
|
79 |
+
<show_in_store>1</show_in_store>
|
80 |
+
<comment>Enter your Google API key</comment>
|
81 |
+
</apikey>
|
82 |
+
<apisensor translate="label">
|
83 |
+
<label>Api Sensor</label>
|
84 |
+
<frontend_type>select</frontend_type>
|
85 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
86 |
+
<sort_order>12</sort_order>
|
87 |
+
<show_in_default>1</show_in_default>
|
88 |
+
<show_in_website>1</show_in_website>
|
89 |
+
<show_in_store>1</show_in_store>
|
90 |
+
<comment>You can enable the sensor to use the geolocation</comment>
|
91 |
+
</apisensor>
|
92 |
+
<direction translate="label">
|
93 |
+
<label>Enable Direction</label>
|
94 |
+
<frontend_type>select</frontend_type>
|
95 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
96 |
+
<sort_order>13</sort_order>
|
97 |
+
<show_in_default>1</show_in_default>
|
98 |
+
<show_in_website>1</show_in_website>
|
99 |
+
<show_in_store>1</show_in_store>
|
100 |
+
<comment>Enable the get direction</comment>
|
101 |
+
</direction>
|
102 |
+
<defaultimage translate="label comment">
|
103 |
+
<label>Default Store Image</label>
|
104 |
+
<comment>Allowed file types: PNG, JPG, JPEG.</comment>
|
105 |
+
<frontend_type>image</frontend_type>
|
106 |
+
<backend_model>datta_storelocator/system_config_backend_image</backend_model>
|
107 |
+
<base_url type="media" scope_info="1">storelocator/images</base_url>
|
108 |
+
<sort_order>14</sort_order>
|
109 |
+
<show_in_default>1</show_in_default>
|
110 |
+
<show_in_website>1</show_in_website>
|
111 |
+
<show_in_store>1</show_in_store>
|
112 |
+
</defaultimage>
|
113 |
+
<mapicon translate="label comment">
|
114 |
+
<label>Marker Icon</label>
|
115 |
+
<comment>Allowed file types: PNG, JPG, JPEG.</comment>
|
116 |
+
<frontend_type>image</frontend_type>
|
117 |
+
<backend_model>datta_storelocator/system_config_backend_marker</backend_model>
|
118 |
+
<base_url type="media" scope_info="1">storelocator/markers</base_url>
|
119 |
+
<sort_order>15</sort_order>
|
120 |
+
<show_in_default>1</show_in_default>
|
121 |
+
<show_in_website>1</show_in_website>
|
122 |
+
<show_in_store>1</show_in_store>
|
123 |
+
</mapicon>
|
124 |
+
</fields>
|
125 |
+
</general>
|
126 |
+
</groups>
|
127 |
+
</storelocator>
|
128 |
+
</sections>
|
129 |
+
</config>
|
app/code/community/Datta/StoreLocator/sql/datta_storelocator_setup/mysql4-install-1.0.0.php
ADDED
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Enterprise Edition
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
*
|
22 |
+
* @category Datta
|
23 |
+
* @package Datta_StoreLocator
|
24 |
+
* @created Dattatray Yadav 29th Nov,2013 5.10pm
|
25 |
+
* @author Clarion magento team<Dattatray Yadav>
|
26 |
+
* @purpose store locatore database script
|
27 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
28 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
29 |
+
*/
|
30 |
+
|
31 |
+
$installer = $this;
|
32 |
+
|
33 |
+
$installer->startSetup();
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Create table 'datta_storelocator/store'
|
37 |
+
*/
|
38 |
+
$table = $installer->getConnection()
|
39 |
+
->newTable($installer->getTable('datta_storelocator/store'))
|
40 |
+
->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null,
|
41 |
+
array(
|
42 |
+
'identity' => true,
|
43 |
+
'nullable' => false,
|
44 |
+
'primary' => true
|
45 |
+
), 'StoreLocator ID')
|
46 |
+
->addColumn('name', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
|
47 |
+
array(
|
48 |
+
'nullable' => false
|
49 |
+
), 'Block Title')
|
50 |
+
->addColumn('address', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
|
51 |
+
array(
|
52 |
+
'nullable' => false
|
53 |
+
), 'StoreLocator Address')
|
54 |
+
->addColumn('zipcode', Varien_Db_Ddl_Table::TYPE_VARCHAR, 10,
|
55 |
+
array(
|
56 |
+
'nullable' => false
|
57 |
+
), 'StoreLocator ZipCode')
|
58 |
+
->addColumn('city', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
|
59 |
+
array(
|
60 |
+
'nullable' => false
|
61 |
+
), 'StoreLocator City')
|
62 |
+
->addColumn('country_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
|
63 |
+
array(
|
64 |
+
'nullable' => true
|
65 |
+
), 'StoreLocator Country')
|
66 |
+
->addColumn('phone', Varien_Db_Ddl_Table::TYPE_VARCHAR, 30,
|
67 |
+
array(
|
68 |
+
'nullable' => true
|
69 |
+
), 'StoreLocator Phone')
|
70 |
+
->addColumn('fax', Varien_Db_Ddl_Table::TYPE_VARCHAR, 30,
|
71 |
+
array(
|
72 |
+
'nullable' => true
|
73 |
+
), 'StoreLocator Fax')
|
74 |
+
->addColumn('description', Varien_Db_Ddl_Table::TYPE_TEXT, 255,
|
75 |
+
array(
|
76 |
+
'nullable' => true
|
77 |
+
), 'StoreLocator Description')
|
78 |
+
->addColumn('store_url', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
|
79 |
+
array(
|
80 |
+
'nullable' => true
|
81 |
+
), 'StoreLocator Store Website')
|
82 |
+
->addColumn('status', Varien_Db_Ddl_Table::TYPE_SMALLINT, 6,
|
83 |
+
array(
|
84 |
+
'nullable' => false
|
85 |
+
), 'StoreLocator Status')
|
86 |
+
->addColumn('image', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
|
87 |
+
array(
|
88 |
+
'nullable' => true
|
89 |
+
), 'StoreLocator Image Link')
|
90 |
+
->addColumn('marker', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
|
91 |
+
array(
|
92 |
+
'nullable' => true
|
93 |
+
), 'StoreLocator Marker Link')
|
94 |
+
->addColumn('lat', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
|
95 |
+
array(
|
96 |
+
'nullable' => true
|
97 |
+
), 'StoreLocator Latitude Value')
|
98 |
+
->addColumn('long', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
|
99 |
+
array(
|
100 |
+
'nullable' => true
|
101 |
+
), 'StoreLocator Longitude Value')
|
102 |
+
->addColumn('created_time', Varien_Db_Ddl_Table::TYPE_DATETIME, null,
|
103 |
+
array(), 'StoreLocator Creation Time')
|
104 |
+
->addColumn('update_time', Varien_Db_Ddl_Table::TYPE_DATETIME, null,
|
105 |
+
array(), 'StoreLocator Modification Time')
|
106 |
+
->setComment('Datta StoreLocator Table');
|
107 |
+
$installer->getConnection()->createTable($table);
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Create table 'datta_storelocator/stores'
|
111 |
+
*/
|
112 |
+
$table = $installer->getConnection()
|
113 |
+
->newTable($installer->getTable('datta_storelocator/stores'))
|
114 |
+
->addColumn('storelocator_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null,
|
115 |
+
array(
|
116 |
+
'nullable' => false,
|
117 |
+
'primary' => true
|
118 |
+
), 'StoreLocator ID')
|
119 |
+
->addColumn('store_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null,
|
120 |
+
array(
|
121 |
+
'unsigned' => true,
|
122 |
+
'nullable' => false,
|
123 |
+
'primary' => true
|
124 |
+
), 'Store ID')
|
125 |
+
->addForeignKey(
|
126 |
+
$installer->getFkName('datta_storelocator/stores', 'storelocator_id',
|
127 |
+
'datta_storelocator/store', 'entity_id'), 'storelocator_id',
|
128 |
+
$installer->getTable('datta_storelocator/store'), 'entity_id',
|
129 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
|
130 |
+
->addForeignKey(
|
131 |
+
$installer->getFkName('datta_storelocator/stores', 'store_id',
|
132 |
+
'core/store', 'store_id'), 'store_id',
|
133 |
+
$installer->getTable('core/store'), 'store_id',
|
134 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
|
135 |
+
->setComment('StoreLocator Store To Store Linkage Table');
|
136 |
+
|
137 |
+
$installer->getConnection()->createTable($table);
|
138 |
+
|
139 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/datta/storelocator.xml
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!-- /**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
*
|
22 |
+
* @category design
|
23 |
+
* @package default_default
|
24 |
+
* @created Dattatray Yadav 2nd Dec,2013 3:20pm
|
25 |
+
* @author Clarion magento team<Dattatray Yadav>
|
26 |
+
* @purpose Manage store locator admin
|
27 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
28 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
29 |
+
*/ -->
|
30 |
+
|
31 |
+
<layout version="0.1.0">
|
32 |
+
<datta_storelocator_adminhtml_store_index>
|
33 |
+
<reference name="content">
|
34 |
+
<block type="datta_storelocator/adminhtml_store" name="datta_storelocator_store" />
|
35 |
+
</reference>
|
36 |
+
</datta_storelocator_adminhtml_store_index>
|
37 |
+
|
38 |
+
<datta_storelocator_adminhtml_store_new>
|
39 |
+
<update handle="datta_storelocator_store_edit" />
|
40 |
+
</datta_storelocator_adminhtml_store_new>
|
41 |
+
|
42 |
+
<datta_storelocator_adminhtml_store_edit>
|
43 |
+
<reference name="content">
|
44 |
+
<block type="datta_storelocator/adminhtml_store_edit" name="storelocator_store_edit"></block>
|
45 |
+
</reference>
|
46 |
+
</datta_storelocator_adminhtml_store_edit>
|
47 |
+
</layout>
|
app/design/frontend/ecart/ecart-theme/layout/datta/storelocator.xml
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
*
|
23 |
+
* @category design
|
24 |
+
* @package ecart_ecart-theme
|
25 |
+
* @created Dattatray Yadav 2nd Dec,2013 3:00pm
|
26 |
+
* @author Clarion magento team<Dattatray Yadav>
|
27 |
+
* @purpose Manage store locator layout
|
28 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
29 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
30 |
+
*/
|
31 |
+
-->
|
32 |
+
<layout version="0.1.0">
|
33 |
+
<default>
|
34 |
+
<reference name="top.links">
|
35 |
+
<action method="addLink" translate="label title">
|
36 |
+
<label>Store Location's</label>
|
37 |
+
<url>datta_storelocator</url>
|
38 |
+
<title>Store Location's</title>
|
39 |
+
<prepare>true</prepare>
|
40 |
+
<urlParams/>
|
41 |
+
<position>6</position>
|
42 |
+
</action>
|
43 |
+
</reference>
|
44 |
+
</default>
|
45 |
+
<datta_storelocator_index_index>
|
46 |
+
<reference name="head">
|
47 |
+
<action method="addCss"><stylesheet>css/datta/storelocator.css</stylesheet></action>
|
48 |
+
<action method="addItem"><type>js</type><name>datta/storelocator.js</name><params/></action>
|
49 |
+
</reference>
|
50 |
+
<reference name="root">
|
51 |
+
<action method="setTemplate"><template>page/1column.phtml</template></action>
|
52 |
+
</reference>
|
53 |
+
<reference name="content">
|
54 |
+
<block type="datta_storelocator/store" name="store" template="datta/storelocator/storelocator.phtml"/>
|
55 |
+
</reference>
|
56 |
+
<reference name="breadcrumbs">
|
57 |
+
<action method="addCrumb">
|
58 |
+
<crumbName>Home</crumbName>
|
59 |
+
<crumbInfo>
|
60 |
+
<label>Home</label>
|
61 |
+
<title>Home</title>
|
62 |
+
<link>/</link>
|
63 |
+
</crumbInfo>
|
64 |
+
</action>
|
65 |
+
<action method="addCrumb">
|
66 |
+
<crumbName>Store Location's</crumbName>
|
67 |
+
<crumbInfo>
|
68 |
+
<label>Store Location's</label>
|
69 |
+
<title>Store Location's</title>
|
70 |
+
</crumbInfo>
|
71 |
+
</action>
|
72 |
+
</reference>
|
73 |
+
</datta_storelocator_index_index>
|
74 |
+
</layout>
|
app/design/frontend/ecart/ecart-theme/template/datta/storelocator/storelocator.phtml
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
* *
|
21 |
+
* @category design
|
22 |
+
* @package default_default
|
23 |
+
* @created Dattatray Yadav 2nd Dec,2013 3:20pm
|
24 |
+
* @author Clarion magento team<Dattatray Yadav>
|
25 |
+
* @purpose Manage store locator view page
|
26 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
27 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
28 |
+
*/
|
29 |
+
?>
|
30 |
+
<h2><?php echo $this->__('Store Locations');?></h2>
|
31 |
+
<div id="search">
|
32 |
+
<label for="address"><?php echo $this->__('Find Store : ');?></label>
|
33 |
+
<input type="text" name="address" id="address" class="input-text"/>
|
34 |
+
</div>
|
35 |
+
<div class="store-list">
|
36 |
+
<?php foreach($this->getStores() as $store) :?>
|
37 |
+
<table id="store-table" class="store-table">
|
38 |
+
<tbody>
|
39 |
+
<tr>
|
40 |
+
<td rowspan="8" class="store-image">
|
41 |
+
<img src="<?php echo $store->getImage(); ?>" alt="<?php echo $store->getName()?>" width="150">
|
42 |
+
</td>
|
43 |
+
</tr>
|
44 |
+
<tr>
|
45 |
+
<td>
|
46 |
+
<h3 class='store-name' id="store<?php echo $store->getId(); ?>"><?php echo $store->getName()?></h3>
|
47 |
+
</td>
|
48 |
+
</tr>
|
49 |
+
<tr>
|
50 |
+
<td class="col-address">
|
51 |
+
<?php echo $store->getAddress()?>
|
52 |
+
</td>
|
53 |
+
</tr>
|
54 |
+
<tr>
|
55 |
+
<td class="col-address">
|
56 |
+
<?php echo $store->getZipcode()." ".$store->getCity()?>
|
57 |
+
</td>
|
58 |
+
</tr>
|
59 |
+
<tr>
|
60 |
+
<td class="col-address">
|
61 |
+
<?php echo $store->getCountryId(); ?>
|
62 |
+
</td>
|
63 |
+
</tr>
|
64 |
+
<tr>
|
65 |
+
<td>
|
66 |
+
<?php if(!is_null($store->getStoreUrl()) && $store->getStoreUrl() != ''):?>
|
67 |
+
<?php echo $this->__('Website : %s', "<a href='".$store->getStoreUrl()."' target='_blank'>");?><?php echo $this->__('%s', $store->getStoreUrl());?></a>
|
68 |
+
<?php endif; ?>
|
69 |
+
</td>
|
70 |
+
</tr>
|
71 |
+
<tr>
|
72 |
+
<td>
|
73 |
+
<?php if(!is_null($store->getPhone())&& $store->getPhone()!= ''):?>
|
74 |
+
<?php echo $this->__('Phone : %s', $store->getPhone()); ?>
|
75 |
+
<?php endif; ?>
|
76 |
+
</td>
|
77 |
+
</tr>
|
78 |
+
<tr>
|
79 |
+
<td>
|
80 |
+
<?php if(!is_null($store->getFax()) && $store->getFax() != ''):?>
|
81 |
+
<?php echo $this->__('Fax : %s', $store->getFax());?>
|
82 |
+
<?php endif; ?>
|
83 |
+
</td>
|
84 |
+
</tr>
|
85 |
+
</tbody>
|
86 |
+
</table>
|
87 |
+
<?php endforeach;?>
|
88 |
+
</div>
|
89 |
+
<div id="maps">
|
90 |
+
<div id="map_canvas"></div>
|
91 |
+
</div>
|
92 |
+
<div id="panel"></div>
|
93 |
+
<script type="text/javascript">
|
94 |
+
var estimateDirectionLabel = '<?php echo $this->__('Calculating the estimated'); ?>';
|
95 |
+
var gmapUrl = '<?php echo $this->getGoogleApiUrl(); ?>';
|
96 |
+
var apiSensor = <?php echo Mage::getStoreConfig('storelocator/general/apisensor'); ?>;
|
97 |
+
var stores = <?php echo Mage::helper('core')->jsonEncode($this->getStores()->toArray()); ?>;
|
98 |
+
var mediaUrl = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) ?>';
|
99 |
+
var pathMarker = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) ?>';
|
100 |
+
var defaultMarker = '<?php echo $this->getDefaultMarker(); ?>';
|
101 |
+
var directionEnable = <?php echo Mage::getStoreConfig('storelocator/general/direction'); ?>;
|
102 |
+
window.onload = loadScript;
|
103 |
+
</script>
|
app/etc/modules/Datta_Storelocator.xml
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento Enterprise Edition
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Datta
|
23 |
+
* @package Datta_StoreLocator
|
24 |
+
* @created Dattatray Yadav 29th Nov,2013 3.25pm
|
25 |
+
* @author Clarion magento team<Dattatray Yadav>
|
26 |
+
* @purpose module configuration
|
27 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
28 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
29 |
+
*/
|
30 |
+
-->
|
31 |
+
<config>
|
32 |
+
<modules>
|
33 |
+
<Datta_StoreLocator>
|
34 |
+
<active>true</active>
|
35 |
+
<codePool>community</codePool>
|
36 |
+
</Datta_StoreLocator>
|
37 |
+
</modules>
|
38 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Datta_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 3.0)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Store locator allow to locate multiple stores on the Google map. It allow to administrator to add multiple store locations and allow point/mark to exact store location on the Google map. It will store the longitude and latitude and it will displayed store location's based on the back end stored information on the front end. Visitors can able to view store location on the Google map. </summary>
|
10 |
+
<description>Store locator is extension which allow to add multiple store locations using admin back end panel and map them on the Google map. This extension is provide the system configuration settings in configuration "system->store locator setting -> store locator" for store locator. In the store locator configuration setting you need to add Google API URL and your API key. It will also allow you to upload default store image and custom marker image. Once you add the required information in you can able to see the able to see the Google map on the store location page on the front end. 
|
11 |
+
After the configuration settings admin can able add your multiple store location's using 
|
12 |
+
Store location -> store locator using this link. It show the existing store location's in grid. From here admin can able to add new store location or edit existing store information. while adding/editing the store information you need enter the required information. once add required information and make status enabled, store will displayed on the front end store location page on Google map. if visitor click on the Google map marker it will show the store location information with store image on Google map in window info.
|
13 |
+

|
14 |
+
This extension help you to manage your different store locations. 
|
15 |
+
Key features : 
|
16 |
+

|
17 |
+
1. Store location will show on the Google map by using added information by the admin user. Admin needs to add store location information like store name, address, URL, city etc. According to entered information location will get detected and it will show the marker on map. Admin can able to move the marker and longitude, latitude will change. Once admin save that information that will show on the map in front end site. While adding the store information there are some fields are mandatory like Store name, address, city, zip code, longitude, latitude etc. 
|
18 |
+
2. Upload default store image and marker image. 
|
19 |
+
3. Show store location image and information 
|
20 |
+
4. Import and export information
|
21 |
+
5. List the all the stores in admin
|
22 |
+
6. Update store information </description>
|
23 |
+
<notes>Store locator first version release </notes>
|
24 |
+
<authors><author><name>Dattatray Yadav</name><user>dattayadav03</user><email>dattayadav03@gmail.com</email></author></authors>
|
25 |
+
<date>2014-03-25</date>
|
26 |
+
<time>11:56:44</time>
|
27 |
+
<contents><target name="magecommunity"><dir name="Datta"><dir name="StoreLocator"><dir name="Block"><dir name="Adminhtml"><dir name="Store"><dir name="Edit"><file name="Form.php" hash="4bf4e8951279211807fbaeb1ff2a97d7"/></dir><file name="Edit.php" hash="2ae32758ca81f7c47790023cc6d8a558"/><file name="Grid.php" hash="0c58a303f570760f0477b0f661a3d198"/><dir name="Renderer"><file name="Image.php" hash="5ab6acbed99dcfb852b5d644ea53a31d"/></dir></dir><file name="Store.php" hash="bab97951f1408a85fd74160f68fa7447"/></dir><file name="Store.php" hash="56753219f6e4c69b6fd0473345996ac7"/></dir><dir name="Helper"><file name="Data.php" hash="16463dae2226743497e40cf743f84fe2"/></dir><dir name="Model"><dir name="Resource"><dir name="Store"><file name="Collection.php" hash="9114d3e7127817bee44f32af005b9b47"/></dir><file name="Store.php" hash="3d7ac08d07de2aa0b22e11270b749592"/></dir><file name="Store.php" hash="c36f7e03dbeaad6338260bba74f2856a"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Image.php" hash="ec1a473d1042c5308c4685bdda5142f3"/><file name="Marker.php" hash="81e54be1873f6f980ffb5623032b9fc8"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="StoreController.php" hash="ed45a27403e6599fe1a4a280fa120a75"/></dir><file name="IndexController.php" hash="7fbb2ecb94e3c7b27d5efc9ce8128073"/></dir><dir name="etc"><file name="adminhtml.xml" hash="4ff449806654eb1c23c5f909af233f35"/><file name="config.xml" hash="c16424d85cedd0573f387c44c862d7f0"/><file name="system.xml" hash="0fc751f3b1900656d8e73031966fdd9f"/></dir><dir name="sql"><dir name="datta_storelocator_setup"><file name="mysql4-install-1.0.0.php" hash="b8812323bbd7df1a525e478aa9b3326f"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Datta_Storelocator.xml" hash="69e2689303be1bcd9e96acc52c0943b2"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="ecart"><dir name="ecart-theme"><dir name="template"><dir name="datta"><dir name="storelocator"><file name="storelocator.phtml" hash="99d502aad0039f3a0fffb7c1784c3cd5"/></dir></dir></dir><dir name="layout"><dir name="datta"><file name="storelocator.xml" hash="13daac525666f1ff8a7e5ea963da29ed"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="datta"><file name="storelocator.xml" hash="645704ed2ce741c83a7ac12e0442ccf7"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="ecart"><dir name="ecart-theme"><dir name="css"><dir name="datta"><file name="storelocator.css" hash="3bbf7b1580b432670bee84a529b294d0"/></dir></dir></dir></dir></dir></target></contents>
|
28 |
+
<compatible/>
|
29 |
+
<dependencies><required><php><min>1.0.0</min><max>9.9.99</max></php></required></dependencies>
|
30 |
+
</package>
|
skin/frontend/ecart/ecart-theme/css/datta/storelocator.css
ADDED
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Magento
|
3 |
+
*
|
4 |
+
* NOTICE OF LICENSE
|
5 |
+
*
|
6 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
+
* that is bundled with this package in the file LICENSE.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
17 |
+
* versions in the future. If you wish to customize Magento for your
|
18 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
19 |
+
*
|
20 |
+
* @category design
|
21 |
+
* @package Datta_StoreLocator
|
22 |
+
* @created Dattatray Yadav 2nd Dec,2013 3:45pm
|
23 |
+
* @author Clarion magento team<Dattatray Yadav>
|
24 |
+
* @purpose Store locator css
|
25 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
26 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
27 |
+
*/
|
28 |
+
.store-list{
|
29 |
+
float : left;
|
30 |
+
width : 45%;
|
31 |
+
height : 514px;
|
32 |
+
overflow-y : hidden;
|
33 |
+
}
|
34 |
+
.store-row{
|
35 |
+
padding-left: 10px;
|
36 |
+
}
|
37 |
+
.col-address{
|
38 |
+
width : 36%;
|
39 |
+
}
|
40 |
+
.store-image{
|
41 |
+
width:4%;
|
42 |
+
}
|
43 |
+
.store-table{
|
44 |
+
border-bottom: 1px solid grey ;
|
45 |
+
width : 100%;
|
46 |
+
padding: 10px;
|
47 |
+
}
|
48 |
+
.first{
|
49 |
+
border-top: 1px solid grey ;
|
50 |
+
}
|
51 |
+
.span-geoloc:active{
|
52 |
+
background-color: #6b1b1b;
|
53 |
+
border-right: 2px solid #696969;
|
54 |
+
border-bottom: 2px solid #696969;
|
55 |
+
}
|
56 |
+
.store-name{
|
57 |
+
cursor: pointer;
|
58 |
+
text-decoration: underline;
|
59 |
+
font-size: 14px;
|
60 |
+
}
|
61 |
+
#map_canvas{
|
62 |
+
float:left;
|
63 |
+
width : 50%;
|
64 |
+
margin-left: 4%;
|
65 |
+
height : 514px;
|
66 |
+
}
|
67 |
+
.store-description{
|
68 |
+
width:350px;
|
69 |
+
padding-top:10px;
|
70 |
+
clear:both;
|
71 |
+
overflow-y: auto;
|
72 |
+
max-height: 100px;
|
73 |
+
}
|
74 |
+
.store-info{
|
75 |
+
max-height:400px;
|
76 |
+
min-width:300px;
|
77 |
+
overflow: auto;
|
78 |
+
cursor: default;
|
79 |
+
clear: both;
|
80 |
+
position: relative;
|
81 |
+
background-color: rgb(255, 255, 255);
|
82 |
+
border: 1px solid rgb(204, 204, 204);
|
83 |
+
border-top-left-radius: 10px;
|
84 |
+
border-top-right-radius: 10px;
|
85 |
+
border-bottom-right-radius: 10px;
|
86 |
+
border-bottom-left-radius: 10px;
|
87 |
+
padding: 5px;
|
88 |
+
}
|
89 |
+
.store-image-infoWindow {
|
90 |
+
width:100px;
|
91 |
+
}
|
92 |
+
.span-geoloc{
|
93 |
+
cursor:pointer;
|
94 |
+
background-color: #7e2222;
|
95 |
+
color:#fff;
|
96 |
+
border-right: 2px solid #808080;
|
97 |
+
padding : 1px 5px 0px 5px;
|
98 |
+
float:right;
|
99 |
+
margin-top:5px;
|
100 |
+
border-top: 1px solid #000000;
|
101 |
+
border-left: 1px solid #000000;
|
102 |
+
border-bottom: 2px solid #808080;
|
103 |
+
clear:both;
|
104 |
+
}
|
105 |
+
.store-image-div-infoWindow{
|
106 |
+
float:left;
|
107 |
+
}
|
108 |
+
.store-name-infoWindow{
|
109 |
+
width:150px;
|
110 |
+
float:left;
|
111 |
+
margin-left:15px;
|
112 |
+
}
|
113 |
+
#search{
|
114 |
+
border-bottom: 1px solid #CFCFCF;
|
115 |
+
margin-bottom: 10px;
|
116 |
+
padding: 5px;
|
117 |
+
}
|
118 |
+
#panel{
|
119 |
+
float:left;
|
120 |
+
margin-top:15px;
|
121 |
+
}
|
122 |
+
.pac-container .pac-item{
|
123 |
+
text-align:left;
|
124 |
+
}
|
125 |
+
.store-name-infoWindow h3{
|
126 |
+
font-size:14px;
|
127 |
+
}
|
128 |
+
#search .input-text {
|
129 |
+
width: 300px;
|
130 |
+
padding: 5px;
|
131 |
+
}
|