Clarion_Storelocator - Version 1.0.1

Version Notes

Added multiple store views functionality.

Download this release

Release Info

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


Code changes from version 1.0.0 to 1.0.1

Files changed (21) hide show
  1. app/code/community/Clarion/Storelocator/Block/Adminhtml/Storelocator/Edit.php +1 -1
  2. app/code/community/Clarion/Storelocator/Block/Adminhtml/Storelocator/Edit/Tab/Form.php +26 -4
  3. app/code/community/Clarion/Storelocator/Block/Adminhtml/Storelocator/Grid.php +41 -12
  4. app/code/community/Clarion/Storelocator/Block/List.php +3 -2
  5. app/code/community/Clarion/Storelocator/Model/Resource/Storelocator.php +126 -7
  6. app/code/community/Clarion/Storelocator/Model/Resource/Storelocator/Collection.php +45 -1
  7. app/code/community/Clarion/Storelocator/Model/Storelocator.php +3 -3
  8. app/code/community/Clarion/Storelocator/controllers/Adminhtml/ManagestorelocatorController.php +20 -20
  9. app/code/community/Clarion/Storelocator/controllers/IndexController.php +5 -4
  10. app/code/community/Clarion/Storelocator/data/clarion_storelocator_setup/data-install-0.1.1.php +139 -0
  11. app/code/community/Clarion/Storelocator/data/clarion_storelocator_setup/data-upgrade-0.1.0-0.1.1.php +30 -0
  12. app/code/community/Clarion/Storelocator/etc/config.xml +4 -1
  13. app/code/community/Clarion/Storelocator/sql/clarion_storelocator_setup/install-0.1.1.php +166 -0
  14. app/code/community/Clarion/Storelocator/sql/clarion_storelocator_setup/upgrade-0.1.0-0.1.1.php +53 -0
  15. media/clarion_storelocator/cache/400/demo2.png +0 -0
  16. media/clarion_storelocator/cache/400/demo4.png +0 -0
  17. media/clarion_storelocator/cache/400/demo5.png +0 -0
  18. media/clarion_storelocator/cache/400/red3.jpeg +0 -0
  19. media/clarion_storelocator/demo1.png +0 -0
  20. media/clarion_storelocator/demo5.png +0 -0
  21. package.xml +5 -5
app/code/community/Clarion/Storelocator/Block/Adminhtml/Storelocator/Edit.php CHANGED
@@ -15,7 +15,7 @@ class Clarion_Storelocator_Block_Adminhtml_Storelocator_Edit extends Mage_Adminh
15
  * This variable has the forms entity primary key, e.g the delete button URL would be
16
  * module/controller/action/$this->_objectid/3
17
  */
18
- $this->_objectId = 'store_id';
19
 
20
  /*
21
  * There two variables are very important, these variables are used to find FORM tags php file.
15
  * This variable has the forms entity primary key, e.g the delete button URL would be
16
  * module/controller/action/$this->_objectid/3
17
  */
18
+ $this->_objectId = 'storelocator_id';
19
 
20
  /*
21
  * There two variables are very important, these variables are used to find FORM tags php file.
app/code/community/Clarion/Storelocator/Block/Adminhtml/Storelocator/Edit/Tab/Form.php CHANGED
@@ -12,8 +12,8 @@ class Clarion_Storelocator_Block_Adminhtml_Storelocator_Edit_Tab_Form extends Ma
12
  protected function _prepareForm()
13
  {
14
  $model = Mage::registry('storelocator_data');
15
-
16
- if ($data = $model->getData()) {
17
  if(isset($data['store_logo'])) {
18
  $data['store_logo'] = 'clarion_storelocator/' . $data['store_logo'];
19
  }
@@ -26,11 +26,33 @@ class Clarion_Storelocator_Block_Adminhtml_Storelocator_Edit_Tab_Form extends Ma
26
  $fieldset = $form->addFieldset('form_General', array('legend'=>Mage::helper('clarion_storelocator')->__('General information')));
27
 
28
  if ($model->getId()) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  $fieldset->addField('store_id', 'hidden', array(
30
- 'name' => 'store_id',
 
31
  ));
32
  }
33
-
34
  $fieldset->addField('name', 'text', array(
35
  'label' => Mage::helper('clarion_storelocator')->__('Store Name'),
36
  'class' => 'required-entry',
12
  protected function _prepareForm()
13
  {
14
  $model = Mage::registry('storelocator_data');
15
+ $data = $model->getData();
16
+ if ($data) {
17
  if(isset($data['store_logo'])) {
18
  $data['store_logo'] = 'clarion_storelocator/' . $data['store_logo'];
19
  }
26
  $fieldset = $form->addFieldset('form_General', array('legend'=>Mage::helper('clarion_storelocator')->__('General information')));
27
 
28
  if ($model->getId()) {
29
+ $fieldset->addField('storelocator_id', 'hidden', array(
30
+ 'name' => 'storelocator_id',
31
+ ));
32
+ }
33
+
34
+ /**
35
+ * Check is single store mode
36
+ */
37
+ if (!Mage::app()->isSingleStoreMode()) {
38
+ $field = $fieldset->addField('store_id', 'multiselect', array(
39
+ 'name' => 'stores[]',
40
+ 'label' => Mage::helper('clarion_storelocator')->__('Store View'),
41
+ 'title' => Mage::helper('clarion_storelocator')->__('Store View'),
42
+ 'required' => true,
43
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
44
+ ));
45
+
46
+ $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
47
+ $field->setRenderer($renderer);
48
+ }
49
+ else {
50
  $fieldset->addField('store_id', 'hidden', array(
51
+ 'name' => 'stores[]',
52
+ 'value' => Mage::app()->getStore(true)->getId(),
53
  ));
54
  }
55
+
56
  $fieldset->addField('name', 'text', array(
57
  'label' => Mage::helper('clarion_storelocator')->__('Store Name'),
58
  'class' => 'required-entry',
app/code/community/Clarion/Storelocator/Block/Adminhtml/Storelocator/Grid.php CHANGED
@@ -21,7 +21,7 @@ class Clarion_Storelocator_Block_Adminhtml_Storelocator_Grid extends Mage_Adminh
21
  * This tells which sorting column to use in our grid. Which column
22
  * should be used for default sorting
23
  */
24
- $this->setDefaultSort('store_id');
25
 
26
  /**
27
  * The default sorting order, ascending or descending
@@ -48,6 +48,7 @@ class Clarion_Storelocator_Block_Adminhtml_Storelocator_Grid extends Mage_Adminh
48
  $collection = Mage::getModel('clarion_storelocator/storelocator')->getCollection();
49
  /* @var $collection Clarion_Storelocator_Model_Resource_Storelocator_Collection */
50
  $this->setCollection($collection);
 
51
  return parent::_prepareCollection();
52
  }
53
 
@@ -67,13 +68,6 @@ class Clarion_Storelocator_Block_Adminhtml_Storelocator_Grid extends Mage_Adminh
67
 
68
  $enableDisable = Mage::getModel('clarion_storelocator/enabledisable')->toArray();
69
 
70
- $this->addColumn('store_id', array(
71
- 'header'=>Mage::helper('clarion_storelocator')->__('Store Id'),
72
- 'sortable'=>true,
73
- 'type' => 'number',
74
- 'index'=>'store_id'
75
- ));
76
-
77
  $this->addColumn('name', array(
78
  'header'=>Mage::helper('clarion_storelocator')->__('Store Name'),
79
  'sortable'=>true,
@@ -105,6 +99,22 @@ class Clarion_Storelocator_Block_Adminhtml_Storelocator_Grid extends Mage_Adminh
105
  'index'=>'zipcode'
106
  ));
107
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  $this->addColumn('status', array(
109
  'header'=>Mage::helper('clarion_storelocator')->__('Status'),
110
  'index' => 'status',
@@ -125,7 +135,7 @@ class Clarion_Storelocator_Block_Adminhtml_Storelocator_Grid extends Mage_Adminh
125
  array(
126
  'caption' => Mage::helper('clarion_storelocator')->__('Edit'),
127
  'url' => array('base'=> '*/*/edit'),
128
- 'field' => 'store_id'
129
  )
130
  ),
131
  'filter' => false,
@@ -150,7 +160,7 @@ class Clarion_Storelocator_Block_Adminhtml_Storelocator_Grid extends Mage_Adminh
150
  */
151
  public function getRowUrl($row)
152
  {
153
- return $this->getUrl('*/*/edit', array('store_id' => $row->getId()));
154
  }
155
 
156
  /**
@@ -165,13 +175,13 @@ class Clarion_Storelocator_Block_Adminhtml_Storelocator_Grid extends Mage_Adminh
165
  * your data structure, including: db table, single product magento model
166
  * , and the collection.
167
  */
168
- $this->setMassactionIdField('store_id');
169
 
170
  /**
171
  * By using this we can set name of checkbox, used for selection. Which
172
  * is used to pass all the ids to the controller.
173
  */
174
- $this->getMassactionBlock()->setFormFieldName('storeIds');
175
 
176
  /**
177
  * url - sets url for the delete action
@@ -216,4 +226,23 @@ class Clarion_Storelocator_Block_Adminhtml_Storelocator_Grid extends Mage_Adminh
216
  {
217
  return $this->getUrl('*/*/grid', array('_current'=>true));
218
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  }
21
  * This tells which sorting column to use in our grid. Which column
22
  * should be used for default sorting
23
  */
24
+ $this->setDefaultSort('storelocator_id');
25
 
26
  /**
27
  * The default sorting order, ascending or descending
48
  $collection = Mage::getModel('clarion_storelocator/storelocator')->getCollection();
49
  /* @var $collection Clarion_Storelocator_Model_Resource_Storelocator_Collection */
50
  $this->setCollection($collection);
51
+ //echo $collection->getSelect();
52
  return parent::_prepareCollection();
53
  }
54
 
68
 
69
  $enableDisable = Mage::getModel('clarion_storelocator/enabledisable')->toArray();
70
 
 
 
 
 
 
 
 
71
  $this->addColumn('name', array(
72
  'header'=>Mage::helper('clarion_storelocator')->__('Store Name'),
73
  'sortable'=>true,
99
  'index'=>'zipcode'
100
  ));
101
 
102
+ /**
103
+ * Check is single store mode
104
+ */
105
+ if (!Mage::app()->isSingleStoreMode()) {
106
+ $this->addColumn('store_id', array(
107
+ 'header' => Mage::helper('clarion_storelocator')->__('Store View'),
108
+ 'index' => 'store_id',
109
+ 'type' => 'store',
110
+ 'store_all' => true,
111
+ 'store_view' => true,
112
+ 'sortable' => false,
113
+ 'filter_condition_callback'
114
+ => array($this, '_filterStoreCondition'),
115
+ ));
116
+ }
117
+
118
  $this->addColumn('status', array(
119
  'header'=>Mage::helper('clarion_storelocator')->__('Status'),
120
  'index' => 'status',
135
  array(
136
  'caption' => Mage::helper('clarion_storelocator')->__('Edit'),
137
  'url' => array('base'=> '*/*/edit'),
138
+ 'field' => 'storelocator_id'
139
  )
140
  ),
141
  'filter' => false,
160
  */
161
  public function getRowUrl($row)
162
  {
163
+ return $this->getUrl('*/*/edit', array('storelocator_id' => $row->getId()));
164
  }
165
 
166
  /**
175
  * your data structure, including: db table, single product magento model
176
  * , and the collection.
177
  */
178
+ $this->setMassactionIdField('storelocator_id');
179
 
180
  /**
181
  * By using this we can set name of checkbox, used for selection. Which
182
  * is used to pass all the ids to the controller.
183
  */
184
+ $this->getMassactionBlock()->setFormFieldName('storelocatorIds');
185
 
186
  /**
187
  * url - sets url for the delete action
226
  {
227
  return $this->getUrl('*/*/grid', array('_current'=>true));
228
  }
229
+
230
+ /**
231
+ * This allows us to filter the grid on the store view.
232
+ *
233
+ */
234
+ protected function _filterStoreCondition($collection, $column)
235
+ {
236
+ if (!$value = $column->getFilter()->getValue()) {
237
+ return;
238
+ }
239
+
240
+ $this->getCollection()->addStoreFilter($value);
241
+ }
242
+
243
+ protected function _afterLoadCollection()
244
+ {
245
+ $this->getCollection()->walk('afterLoad');
246
+ parent::_afterLoadCollection();
247
+ }
248
  }
app/code/community/Clarion/Storelocator/Block/List.php CHANGED
@@ -25,6 +25,7 @@ class Clarion_Storelocator_Block_List extends Mage_Core_Block_Template
25
  protected function _getStoreCollection()
26
  {
27
  $collection = Mage::getModel('clarion_storelocator/storelocator')->getCollection()
 
28
  ->addStatusFilter();
29
  return $collection;
30
  }
@@ -112,10 +113,10 @@ class Clarion_Storelocator_Block_List extends Mage_Core_Block_Template
112
  $storesPerPage = Mage::helper('clarion_storelocator')->getStoresPerPage();
113
  $pager->setAvailableLimit(array($storesPerPage => $storesPerPage));
114
  $pager->setTotalNum($this->getStoreCollection()->getSize());
115
- $pager->setPagerUrl(array('country'=>'india'));
116
  $pager->setCollection($this->getStoreCollection());
117
  $pager->setShowPerPage(true);
118
-
119
  return $pager->toHtml();
120
  }
121
 
25
  protected function _getStoreCollection()
26
  {
27
  $collection = Mage::getModel('clarion_storelocator/storelocator')->getCollection()
28
+ ->addStoreFilter(Mage::app()->getStore()->getId())
29
  ->addStatusFilter();
30
  return $collection;
31
  }
113
  $storesPerPage = Mage::helper('clarion_storelocator')->getStoresPerPage();
114
  $pager->setAvailableLimit(array($storesPerPage => $storesPerPage));
115
  $pager->setTotalNum($this->getStoreCollection()->getSize());
116
+ // $pager->setPagerUrl(array('country'=>'india'));
117
  $pager->setCollection($this->getStoreCollection());
118
  $pager->setShowPerPage(true);
119
+ $pager->setShowAmounts(true);
120
  return $pager->toHtml();
121
  }
122
 
app/code/community/Clarion/Storelocator/Model/Resource/Storelocator.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @category Clarion
6
  * @package Clarion_Storelocator
7
- * @author Clarion Magento Team
8
  *
9
  */
10
  class Clarion_Storelocator_Model_Resource_Storelocator extends Mage_Core_Model_Resource_Db_Abstract
@@ -14,22 +14,39 @@ class Clarion_Storelocator_Model_Resource_Storelocator extends Mage_Core_Model_R
14
  */
15
  protected function _construct()
16
  {
17
- $this->_init('clarion_storelocator/storelocator', 'store_id');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  }
19
 
20
  /**
21
  * Check if store exists
22
  *
23
  * @param $storeName store name
24
- * @param $storeId store id
25
  * @return array|false
26
  */
27
- public function storeExists($storeName, $storeId)
28
  {
29
  $adapter = $this->_getReadAdapter();
30
  $select = $adapter->select();
31
 
32
- if(empty($storeId)){
33
  $binds = array(
34
  'name' => $storeName,
35
  );
@@ -39,13 +56,115 @@ class Clarion_Storelocator_Model_Resource_Storelocator extends Mage_Core_Model_R
39
  } else {
40
  $binds = array(
41
  'name' => $storeName,
42
- 'store_id' => (int) $storeId,
43
  );
44
 
45
  $select->from($this->getMainTable())
46
  ->where('(name = :name)')
47
- ->where('store_id <> :store_id');
48
  }
49
  return $adapter->fetchRow($select, $binds);
50
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  }
4
  *
5
  * @category Clarion
6
  * @package Clarion_Storelocator
7
+ * @author Clarion Magento Team <pandurang.babar@clariontechnologies.co.in>
8
  *
9
  */
10
  class Clarion_Storelocator_Model_Resource_Storelocator extends Mage_Core_Model_Resource_Db_Abstract
14
  */
15
  protected function _construct()
16
  {
17
+ $this->_init('clarion_storelocator/storelocator', 'storelocator_id');
18
+ }
19
+
20
+ /**
21
+ * Process storelocator data before deleting
22
+ *
23
+ * @param Mage_Core_Model_Abstract $object
24
+ * @return Clarion_Storelocator_Model_Resource_Storelocator
25
+ */
26
+ protected function _beforeDelete(Mage_Core_Model_Abstract $object)
27
+ {
28
+ $condition = array(
29
+ 'storelocator_id = ?' => (int) $object->getId(),
30
+ );
31
+
32
+ $this->_getWriteAdapter()->delete($this->getTable('clarion_storelocator/storelocator_store'), $condition);
33
+
34
+ return parent::_beforeDelete($object);
35
  }
36
 
37
  /**
38
  * Check if store exists
39
  *
40
  * @param $storeName store name
41
+ * @param $storelocatorId storelocaror id
42
  * @return array|false
43
  */
44
+ public function storeExists($storeName, $storelocatorId)
45
  {
46
  $adapter = $this->_getReadAdapter();
47
  $select = $adapter->select();
48
 
49
+ if(empty($storelocatorId)){
50
  $binds = array(
51
  'name' => $storeName,
52
  );
56
  } else {
57
  $binds = array(
58
  'name' => $storeName,
59
+ 'storelocator_id' => (int) $storelocatorId,
60
  );
61
 
62
  $select->from($this->getMainTable())
63
  ->where('(name = :name)')
64
+ ->where('storelocator_id <> :storelocator_id');
65
  }
66
  return $adapter->fetchRow($select, $binds);
67
  }
68
+
69
+ /**
70
+ * Assign storelocator to store views
71
+ *
72
+ * @param Mage_Core_Model_Abstract $object
73
+ * @return Clarion_Storelocator_Model_Resource_Storelocator
74
+ */
75
+ protected function _afterSave(Mage_Core_Model_Abstract $object)
76
+ {
77
+ $oldStores = $this->lookupStoreIds($object->getId());
78
+ $newStores = (array)$object->getStores();
79
+ if (empty($newStores)) {
80
+ $newStores = (array)$object->getStoreId();
81
+ }
82
+ $table = $this->getTable('clarion_storelocator/storelocator_store');
83
+ $insert = array_diff($newStores, $oldStores);
84
+ $delete = array_diff($oldStores, $newStores);
85
+
86
+ if ($delete) {
87
+ $where = array(
88
+ 'storelocator_id = ?' => (int) $object->getId(),
89
+ 'store_id IN (?)' => $delete
90
+ );
91
+
92
+ $this->_getWriteAdapter()->delete($table, $where);
93
+ }
94
+
95
+ if ($insert) {
96
+ $data = array();
97
+
98
+ foreach ($insert as $storeId) {
99
+ $data[] = array(
100
+ 'storelocator_id' => (int) $object->getId(),
101
+ 'store_id' => (int) $storeId
102
+ );
103
+ }
104
+
105
+ $this->_getWriteAdapter()->insertMultiple($table, $data);
106
+ }
107
+
108
+ return parent::_afterSave($object);
109
+ }
110
+
111
+ /**
112
+ * Get store ids to which specified item is assigned
113
+ *
114
+ * @param int $storelocatorId
115
+ * @return array
116
+ */
117
+ public function lookupStoreIds($storelocatorId)
118
+ {
119
+ $adapter = $this->_getReadAdapter();
120
+
121
+ $select = $adapter->select()
122
+ ->from($this->getTable('clarion_storelocator/storelocator_store'), 'store_id')
123
+ ->where('storelocator_id = ?',(int)$storelocatorId);
124
+ return $adapter->fetchCol($select);
125
+ }
126
+
127
+ /**
128
+ * Perform operations after object load
129
+ *
130
+ * @param Mage_Core_Model_Abstract $object
131
+ * @return Mage_Cms_Model_Resource_Page
132
+ */
133
+ protected function _afterLoad(Mage_Core_Model_Abstract $object)
134
+ {
135
+ if ($object->getId()) {
136
+ $stores = $this->lookupStoreIds($object->getId());
137
+
138
+ $object->setData('store_id', $stores);
139
+
140
+ }
141
+ return parent::_afterLoad($object);
142
+ }
143
+
144
+ /**
145
+ * Retrieve select object for load object data
146
+ *
147
+ * @param string $field
148
+ * @param mixed $value
149
+ * @param Mage_Cms_Model_Page $object
150
+ * @return Zend_Db_Select
151
+ */
152
+ protected function _getLoadSelect($field, $value, $object)
153
+ {
154
+ $select = parent::_getLoadSelect($field, $value, $object);
155
+
156
+ if ($object->getStoreId()) {
157
+ $storeIds = array(Mage_Core_Model_App::ADMIN_STORE_ID, (int)$object->getStoreId());
158
+ $select->join(
159
+ array('clarion_storelocator_store' => $this->getTable('clarion_storelocator/storelocator_store')),
160
+ $this->getMainTable() . '.storelocator_id = clarion_storelocator_store.storelocator_id',
161
+ array())
162
+ ->where('status = ?', 1)
163
+ ->where('clarion_storelocator_store.store_id IN (?)', $storeIds)
164
+ ->order('clarion_storelocator_store.store_id DESC')
165
+ ->limit(1);
166
+ }
167
+ return $select;
168
+ }
169
+
170
  }
app/code/community/Clarion/Storelocator/Model/Resource/Storelocator/Collection.php CHANGED
@@ -15,7 +15,9 @@ class Clarion_Storelocator_Model_Resource_Storelocator_Collection extends Mage_C
15
  */
16
  protected function _construct()
17
  {
18
- $this->_init('clarion_storelocator/storelocator');
 
 
19
  }
20
 
21
  /**
@@ -44,4 +46,46 @@ class Clarion_Storelocator_Model_Resource_Storelocator_Collection extends Mage_C
44
  $this->setOrder('created_at', Varien_Data_Collection::SORT_ORDER_DESC);
45
  return $this;
46
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  }
15
  */
16
  protected function _construct()
17
  {
18
+ $this->_init('clarion_storelocator/storelocator');
19
+ $this->_map['fields']['storelocator_id'] = 'main_table.storelocator_id';
20
+ $this->_map['fields']['store'] = 'store_table.store_id';
21
  }
22
 
23
  /**
46
  $this->setOrder('created_at', Varien_Data_Collection::SORT_ORDER_DESC);
47
  return $this;
48
  }
49
+
50
+ /**
51
+ * Add filter by store
52
+ *
53
+ * @param int|Mage_Core_Model_Store $store
54
+ * @param bool $withAdmin
55
+ * @return Clarion_Storelocator_Model_Resource_Storelocator_Collection
56
+ */
57
+ public function addStoreFilter($store, $withAdmin = true)
58
+ {
59
+ if (!$this->getFlag('store_filter_added')) {
60
+ if ($store instanceof Mage_Core_Model_Store) {
61
+ $store = array($store->getId());
62
+ }
63
+
64
+ if (!is_array($store)) {
65
+ $store = array($store);
66
+ }
67
+
68
+ if ($withAdmin) {
69
+ $store[] = Mage_Core_Model_App::ADMIN_STORE_ID;
70
+ }
71
+
72
+ $this->addFilter('store', array('in' => $store), 'public');
73
+ }
74
+ return $this;
75
+ }
76
+
77
+ /**
78
+ * Join store relation table if there is store filter
79
+ */
80
+ protected function _renderFiltersBefore()
81
+ {
82
+ if ($this->getFilter('store')) {
83
+ $this->getSelect()->join(
84
+ array('store_table' => $this->getTable('clarion_storelocator/storelocator_store')),
85
+ 'main_table.storelocator_id = store_table.storelocator_id',
86
+ array()
87
+ );
88
+ }
89
+ return parent::_renderFiltersBefore();
90
+ }
91
  }
app/code/community/Clarion/Storelocator/Model/Storelocator.php CHANGED
@@ -21,12 +21,12 @@ class Clarion_Storelocator_Model_Storelocator extends Mage_Core_Model_Abstract
21
  * Check if store exists based on its name
22
  *
23
  * @param $storeName store name
24
- * @param $storeId store id
25
  * @return boolean
26
  */
27
- public function storeExists($storeName, $storeId = null)
28
  {
29
- $result = $this->_getResource()->storeExists($storeName, $storeId);
30
  return (is_array($result) && count($result) > 0) ? true : false;
31
  }
32
 
21
  * Check if store exists based on its name
22
  *
23
  * @param $storeName store name
24
+ * @param $storelocatorId storelocator id
25
  * @return boolean
26
  */
27
+ public function storeExists($storeName, $storelocatorId = null)
28
  {
29
+ $result = $this->_getResource()->storeExists($storeName, $storelocatorId);
30
  return (is_array($result) && count($result) > 0) ? true : false;
31
  }
32
 
app/code/community/Clarion/Storelocator/controllers/Adminhtml/ManagestorelocatorController.php CHANGED
@@ -98,15 +98,15 @@ class Clarion_Storelocator_Adminhtml_ManagestorelocatorController extends Mage_A
98
  public function massDeleteAction()
99
  {
100
  //Get store ids from selected checkbox
101
- $storeIds = $this->getRequest()->getParam('storeIds');
102
 
103
- if (!is_array($storeIds)) {
104
  Mage::getSingleton('adminhtml/session')->addError($this->__('Please select store(s).'));
105
  } else {
106
- if (!empty($storeIds)) {
107
  try {
108
- foreach ($storeIds as $storeId) {
109
- $storelocator = Mage::getSingleton('clarion_storelocator/storelocator')->load($storeId);
110
  //delete image file
111
  if($storelocator->getStoreLogo()) {
112
  $oldFileTargetPath = Mage::getBaseDir('media') . DS . 'clarion_storelocator' . DS . $storelocator->getStoreLogo();
@@ -116,7 +116,7 @@ class Clarion_Storelocator_Adminhtml_ManagestorelocatorController extends Mage_A
116
  $storelocator->delete();
117
  }
118
  Mage::getSingleton('adminhtml/session')->addSuccess(
119
- $this->__('Total of %d record(s) have been deleted.', count($storeIds))
120
  );
121
  } catch (Exception $e) {
122
  Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
@@ -133,21 +133,21 @@ class Clarion_Storelocator_Adminhtml_ManagestorelocatorController extends Mage_A
133
  public function massStatusAction()
134
  {
135
  //Get store ids from selected checkbox
136
- $storeIds = $this->getRequest()->getParam('storeIds');
137
 
138
- if (!is_array($storeIds)) {
139
  Mage::getSingleton('adminhtml/session')->addError($this->__('Please select store(s)'));
140
  } else {
141
  try {
142
- foreach ($storeIds as $storeId) {
143
  Mage::getSingleton('clarion_storelocator/storelocator')
144
- ->load($storeId)
145
  ->setStatus($this->getRequest()->getParam('status'))
146
  ->setIsMassupdate(true)
147
  ->save();
148
  }
149
  Mage::getSingleton('adminhtml/session')->addSuccess(
150
- $this->__('Total of %d record(s) were successfully updated', count($storeIds))
151
  );
152
  } catch (Exception $e) {
153
  Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
@@ -174,7 +174,7 @@ class Clarion_Storelocator_Adminhtml_ManagestorelocatorController extends Mage_A
174
  ->_title($this->__('Manage Store Locator'));
175
 
176
  // 1. Get ID and create model
177
- $id = $this->getRequest()->getParam('store_id');
178
  $model = Mage::getModel('clarion_storelocator/storelocator');
179
 
180
  // 2. Initial checking
@@ -266,7 +266,7 @@ class Clarion_Storelocator_Adminhtml_ManagestorelocatorController extends Mage_A
266
  // check if data sent
267
  if ($data = $this->getRequest()->getPost()) {
268
 
269
- $id = $this->getRequest()->getParam('store_id');
270
  $model = Mage::getModel('clarion_storelocator/storelocator');
271
  $session = Mage::getSingleton('adminhtml/session');
272
  /* @var $session Mage_Core_Model_Session */
@@ -292,7 +292,7 @@ class Clarion_Storelocator_Adminhtml_ManagestorelocatorController extends Mage_A
292
  $session->addError($this->__('Unable to add/edit store.'));
293
  }
294
  $session->setStorelocatorData($data);
295
- $this->_redirect('*/*/edit', array('store_id' => $this->getRequest()->getParam('store_id')));
296
  return;
297
  }
298
 
@@ -348,7 +348,7 @@ class Clarion_Storelocator_Adminhtml_ManagestorelocatorController extends Mage_A
348
 
349
  // check if 'Save and Continue'
350
  if ($this->getRequest()->getParam('back')) {
351
- $this->_redirect('*/*/edit', array('store_id' => $model->getId(), '_current'=>true));
352
  return;
353
  }
354
  // go to grid
@@ -363,7 +363,7 @@ class Clarion_Storelocator_Adminhtml_ManagestorelocatorController extends Mage_A
363
  Mage::helper('clarion_storelocator')->__('An error occurred while saving the store.'));
364
  }
365
  $session->setStorelocatorData($data);
366
- $this->_redirect('*/*/edit', array('store_id' => $this->getRequest()->getParam('store_id')));
367
  return;
368
  }
369
  $this->_redirect('*/*/');
@@ -375,9 +375,9 @@ class Clarion_Storelocator_Adminhtml_ManagestorelocatorController extends Mage_A
375
 
376
  $storelocator = Mage::getModel('clarion_storelocator/storelocator');
377
  $storeName = isset($data['name']) ? $data['name'] : '';
378
- $storeId = isset($data['store_id']) ? $data['store_id'] : '';
379
 
380
- if($storelocator->storeExists($storeName, $storeId)) {
381
  $errors[] = Mage::helper('clarion_storelocator')->__('Store name already exists');
382
  }
383
 
@@ -405,7 +405,7 @@ class Clarion_Storelocator_Adminhtml_ManagestorelocatorController extends Mage_A
405
  public function deleteAction()
406
  {
407
  // check if we know what should be deleted
408
- if ($id = $this->getRequest()->getParam('store_id')) {
409
  try {
410
  // init model and delete
411
  $model = Mage::getModel('clarion_storelocator/storelocator');
@@ -428,7 +428,7 @@ class Clarion_Storelocator_Adminhtml_ManagestorelocatorController extends Mage_A
428
  // display error message
429
  Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
430
  // go back to edit form
431
- $this->_redirect('*/*/edit', array('store_id' => $id));
432
  return;
433
  }
434
  }
98
  public function massDeleteAction()
99
  {
100
  //Get store ids from selected checkbox
101
+ $storelocatorIds = $this->getRequest()->getParam('storelocatorIds');
102
 
103
+ if (!is_array($storelocatorIds)) {
104
  Mage::getSingleton('adminhtml/session')->addError($this->__('Please select store(s).'));
105
  } else {
106
+ if (!empty($storelocatorIds)) {
107
  try {
108
+ foreach ($storelocatorIds as $storelocatorId) {
109
+ $storelocator = Mage::getSingleton('clarion_storelocator/storelocator')->load($storelocatorId);
110
  //delete image file
111
  if($storelocator->getStoreLogo()) {
112
  $oldFileTargetPath = Mage::getBaseDir('media') . DS . 'clarion_storelocator' . DS . $storelocator->getStoreLogo();
116
  $storelocator->delete();
117
  }
118
  Mage::getSingleton('adminhtml/session')->addSuccess(
119
+ $this->__('Total of %d record(s) have been deleted.', count($storelocatorIds))
120
  );
121
  } catch (Exception $e) {
122
  Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
133
  public function massStatusAction()
134
  {
135
  //Get store ids from selected checkbox
136
+ $storelocatorIds = $this->getRequest()->getParam('storelocatorIds');
137
 
138
+ if (!is_array($storelocatorIds)) {
139
  Mage::getSingleton('adminhtml/session')->addError($this->__('Please select store(s)'));
140
  } else {
141
  try {
142
+ foreach ($storelocatorIds as $storelocatorId) {
143
  Mage::getSingleton('clarion_storelocator/storelocator')
144
+ ->load($storelocatorId)
145
  ->setStatus($this->getRequest()->getParam('status'))
146
  ->setIsMassupdate(true)
147
  ->save();
148
  }
149
  Mage::getSingleton('adminhtml/session')->addSuccess(
150
+ $this->__('Total of %d record(s) were successfully updated', count($storelocatorIds))
151
  );
152
  } catch (Exception $e) {
153
  Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
174
  ->_title($this->__('Manage Store Locator'));
175
 
176
  // 1. Get ID and create model
177
+ $id = $this->getRequest()->getParam('storelocator_id');
178
  $model = Mage::getModel('clarion_storelocator/storelocator');
179
 
180
  // 2. Initial checking
266
  // check if data sent
267
  if ($data = $this->getRequest()->getPost()) {
268
 
269
+ $id = $this->getRequest()->getParam('storelocator_id');
270
  $model = Mage::getModel('clarion_storelocator/storelocator');
271
  $session = Mage::getSingleton('adminhtml/session');
272
  /* @var $session Mage_Core_Model_Session */
292
  $session->addError($this->__('Unable to add/edit store.'));
293
  }
294
  $session->setStorelocatorData($data);
295
+ $this->_redirect('*/*/edit', array('storelocator_id' => $this->getRequest()->getParam('storelocator_id')));
296
  return;
297
  }
298
 
348
 
349
  // check if 'Save and Continue'
350
  if ($this->getRequest()->getParam('back')) {
351
+ $this->_redirect('*/*/edit', array('storelocator_id' => $model->getId(), '_current'=>true));
352
  return;
353
  }
354
  // go to grid
363
  Mage::helper('clarion_storelocator')->__('An error occurred while saving the store.'));
364
  }
365
  $session->setStorelocatorData($data);
366
+ $this->_redirect('*/*/edit', array('storelocator_id' => $this->getRequest()->getParam('storelocator_id')));
367
  return;
368
  }
369
  $this->_redirect('*/*/');
375
 
376
  $storelocator = Mage::getModel('clarion_storelocator/storelocator');
377
  $storeName = isset($data['name']) ? $data['name'] : '';
378
+ $storelocatorId = isset($data['storelocator_id']) ? $data['storelocator_id'] : '';
379
 
380
+ if($storelocator->storeExists($storeName, $storelocatorId)) {
381
  $errors[] = Mage::helper('clarion_storelocator')->__('Store name already exists');
382
  }
383
 
405
  public function deleteAction()
406
  {
407
  // check if we know what should be deleted
408
+ if ($id = $this->getRequest()->getParam('storelocator_id')) {
409
  try {
410
  // init model and delete
411
  $model = Mage::getModel('clarion_storelocator/storelocator');
428
  // display error message
429
  Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
430
  // go back to edit form
431
+ $this->_redirect('*/*/edit', array('storelocator_id' => $id));
432
  return;
433
  }
434
  }
app/code/community/Clarion/Storelocator/controllers/IndexController.php CHANGED
@@ -43,14 +43,15 @@ class Clarion_Storelocator_IndexController extends Mage_Core_Controller_Front_Ac
43
  */
44
  public function viewAction()
45
  {
46
- $storeId = $this->getRequest()->getParam('id');
47
- if (!$storeId) {
48
  return $this->_forward('noRoute');
49
  }
50
 
51
  /** @var $model Clarion_Storelocator_Model_Storelocator */
52
- $model = Mage::getModel('clarion_storelocator/storelocator');
53
- $model->load($storeId);
 
54
 
55
  if (!$model->getId()) {
56
  return $this->_forward('noRoute');
43
  */
44
  public function viewAction()
45
  {
46
+ $storelocatorId = $this->getRequest()->getParam('id');
47
+ if (!$storelocatorId) {
48
  return $this->_forward('noRoute');
49
  }
50
 
51
  /** @var $model Clarion_Storelocator_Model_Storelocator */
52
+ $model = Mage::getModel('clarion_storelocator/storelocator')
53
+ ->setStoreId(Mage::app()->getStore()->getId())
54
+ ->load($storelocatorId);
55
 
56
  if (!$model->getId()) {
57
  return $this->_forward('noRoute');
app/code/community/Clarion/Storelocator/data/clarion_storelocator_setup/data-install-0.1.1.php ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Storelocator data installation script
4
+ *
5
+ * @category Clarion
6
+ * @package Clarion_Storelocator
7
+ * @author Clarion Magento Team <pandurang.babar@clariontechnologies.co.in>
8
+ *
9
+ */
10
+ /**
11
+ * @var $installer Mage_Core_Model_Resource_Setup
12
+ */
13
+ $installer = $this;
14
+ /**
15
+ * Fill table clarion_storelocator/storelocator
16
+ */
17
+
18
+ //Get current timestamp
19
+ $currentTimestamp = Mage::getModel('core/date')->timestamp(time());
20
+
21
+ $stores = array(
22
+ array(
23
+ 'name' => 'Demo1',
24
+ 'status' => 1,
25
+ 'street_address' =>'NY Road',
26
+ 'country' =>'US',
27
+ 'state' =>'New York',
28
+ 'city' =>'New York',
29
+ 'zipcode' =>'10007',
30
+ 'phone' =>'111-111-1111',
31
+ 'fax' =>'1-111-111 1111',
32
+ 'url' =>'http://www.magento.com',
33
+ 'email' =>'test@gmail.com',
34
+ 'store_logo' =>'demo1.png',
35
+ 'description' =>'This is for testing.',
36
+ 'trading_hours' =>'10AM-1PM 2PM-10PM',
37
+ 'radius' =>'100',
38
+ 'latitude' =>'40.712784',
39
+ 'longitude' =>'-74.005941',
40
+ 'zoom_level' =>'6',
41
+ 'created_at' =>$currentTimestamp,
42
+ 'stores' => array(0)
43
+ ),
44
+ array(
45
+ 'name' => 'Demo2',
46
+ 'status' => 1,
47
+ 'street_address' =>'LA Road',
48
+ 'country' =>'US',
49
+ 'state' =>'California',
50
+ 'city' =>'Los Angeles',
51
+ 'zipcode' =>'90012',
52
+ 'phone' =>'111-111-1111',
53
+ 'fax' =>'1-111-111 1111',
54
+ 'url' =>'http://www.magento.com',
55
+ 'email' =>'test@gmail.com',
56
+ 'store_logo' =>'demo2.png',
57
+ 'description' =>'This is for testing.',
58
+ 'trading_hours' =>'10AM-1PM 2PM-10PM',
59
+ 'radius' =>'100',
60
+ 'latitude' =>'34.052234',
61
+ 'longitude' =>'-118.243685',
62
+ 'zoom_level' =>'6',
63
+ 'created_at' =>$currentTimestamp,
64
+ 'stores' => array(0)
65
+ ),
66
+ array(
67
+ 'name' => 'Demo3',
68
+ 'status' => 1,
69
+ 'street_address' =>'CH Road',
70
+ 'country' =>'US',
71
+ 'state' =>'Illinois',
72
+ 'city' =>'Chicago',
73
+ 'zipcode' =>'60602',
74
+ 'phone' =>'111-111-1111',
75
+ 'fax' =>'1-111-111 1111',
76
+ 'url' =>'http://www.magento.com',
77
+ 'email' =>'test@gmail.com',
78
+ 'store_logo' =>'demo3.png',
79
+ 'description' =>'This is for testing.',
80
+ 'trading_hours' =>'10AM-1PM 2PM-10PM',
81
+ 'radius' =>'100',
82
+ 'latitude' =>'41.878114',
83
+ 'longitude' =>'-87.629798',
84
+ 'zoom_level' =>'6',
85
+ 'created_at' =>$currentTimestamp,
86
+ 'stores' => array(0)
87
+ ),
88
+ array(
89
+ 'name' => 'Demo4',
90
+ 'status' => 1,
91
+ 'street_address' =>'HO Road',
92
+ 'country' =>'US',
93
+ 'state' =>'Texas',
94
+ 'city' =>'Houston',
95
+ 'zipcode' =>'77002',
96
+ 'phone' =>'111-111-1111',
97
+ 'fax' =>'1-111-111 1111',
98
+ 'url' =>'http://www.magento.com',
99
+ 'email' =>'test@gmail.com',
100
+ 'store_logo' =>'demo4.png',
101
+ 'description' =>'This is for testing.',
102
+ 'trading_hours' =>'10AM-1PM 2PM-10PM',
103
+ 'radius' =>'100',
104
+ 'latitude' =>'29.760193',
105
+ 'longitude' =>'-95.369390',
106
+ 'zoom_level' =>'6',
107
+ 'created_at' =>$currentTimestamp,
108
+ 'stores' => array(0)
109
+ ),
110
+ array(
111
+ 'name' => 'Demo5',
112
+ 'status' => 1,
113
+ 'street_address' =>'LV Road',
114
+ 'country' =>'US',
115
+ 'state' =>'Nevada',
116
+ 'city' =>'Las Vegas',
117
+ 'zipcode' =>'89101',
118
+ 'phone' =>'111-111-1111',
119
+ 'fax' =>'1-111-111 1111',
120
+ 'url' =>'http://www.magento.com',
121
+ 'email' =>'test@gmail.com',
122
+ 'store_logo' =>'demo5.png',
123
+ 'description' =>'This is for testing.',
124
+ 'trading_hours' =>'10AM-1PM 2PM-10PM',
125
+ 'radius' =>'100',
126
+ 'latitude' =>'36.255123',
127
+ 'longitude' =>'-115.238349',
128
+ 'zoom_level' =>'6',
129
+ 'created_at' =>$currentTimestamp,
130
+ 'stores' => array(0)
131
+ )
132
+ );
133
+
134
+ /**
135
+ * Insert data into storelocator table for testing/demo
136
+ */
137
+ foreach ($stores as $data) {
138
+ Mage::getModel('clarion_storelocator/storelocator')->setData($data)->save();
139
+ }
app/code/community/Clarion/Storelocator/data/clarion_storelocator_setup/data-upgrade-0.1.0-0.1.1.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Storelocator data installation script
4
+ *
5
+ * @category Clarion
6
+ * @package Clarion_Storelocator
7
+ * @author Clarion Magento Team <pandurang.babar@clariontechnologies.co.in>
8
+ *
9
+ */
10
+ /**
11
+ * @var $installer Mage_Core_Model_Resource_Setup
12
+ */
13
+ $installer = $this;
14
+
15
+ /**
16
+ * Update table 'clarion_storelocator/storelocator_store' for multiple store view
17
+ */
18
+
19
+ //test stores in the table 'clarion_storelocator/storelocator'
20
+ $testStores = array('Demo1', 'Demo2', 'Demo3', 'Demo4', 'Demo5');
21
+
22
+ foreach ($testStores as $testStore) {
23
+ $testStorelocator = Mage::getModel('clarion_storelocator/storelocator')->load($testStore,'name');
24
+ if ($testStorelocator->getId()) {
25
+ $stores = $testStorelocator->getStores();
26
+ if(empty($stores)){
27
+ $testStorelocator->setStores(array(0))->save();
28
+ }
29
+ }
30
+ }
app/code/community/Clarion/Storelocator/etc/config.xml CHANGED
@@ -11,7 +11,7 @@
11
  <config>
12
  <modules>
13
  <Clarion_Storelocator>
14
- <version>0.1.0</version>
15
  </Clarion_Storelocator>
16
  </modules>
17
 
@@ -27,6 +27,9 @@
27
  <storelocator>
28
  <table>clarion_storelocator</table>
29
  </storelocator>
 
 
 
30
  </entities>
31
  </storelocator_resource>
32
  </models>
11
  <config>
12
  <modules>
13
  <Clarion_Storelocator>
14
+ <version>0.1.1</version>
15
  </Clarion_Storelocator>
16
  </modules>
17
 
27
  <storelocator>
28
  <table>clarion_storelocator</table>
29
  </storelocator>
30
+ <storelocator_store>
31
+ <table>clarion_storelocator_store</table>
32
+ </storelocator_store>
33
  </entities>
34
  </storelocator_resource>
35
  </models>
app/code/community/Clarion/Storelocator/sql/clarion_storelocator_setup/install-0.1.1.php ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Storelocator installation script
4
+ *
5
+ * @category Clarion
6
+ * @package Clarion_Storelocator
7
+ * @author Clarion Magento Team <pandurang.babar@clariontechnologies.co.in>
8
+ *
9
+ */
10
+ /**
11
+ * @var $installer Mage_Core_Model_Resource_Setup
12
+ */
13
+ $installer = $this;
14
+
15
+ /**
16
+ * Prepare database for install
17
+ */
18
+ $installer->startSetup();
19
+
20
+ /**
21
+ * Create table 'clarion_storelocator/storelocator'
22
+ */
23
+ $table = $installer->getConnection()
24
+ ->newTable($installer->getTable('clarion_storelocator/storelocator'))
25
+ ->addColumn('storelocator_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
26
+ 'identity' => true,
27
+ 'unsigned' => true,
28
+ 'nullable' => false,
29
+ 'primary' => true,
30
+ ), 'Storelocator Id')
31
+
32
+ ->addColumn('name', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
33
+ ), 'Store Name')
34
+
35
+ ->addColumn('status', Varien_Db_Ddl_Table::TYPE_TINYINT, null, array(
36
+ 'nullable' => false,
37
+ 'default' => '1',
38
+ ), 'Staus')
39
+
40
+ ->addColumn('street_address', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
41
+ 'nullable' => true,
42
+ 'default' => null,
43
+ ), 'Street Address')
44
+
45
+ ->addColumn('country', Varien_Db_Ddl_Table::TYPE_TEXT, 64, array(
46
+ 'nullable' => true,
47
+ 'default' => null,
48
+ ), 'Country')
49
+
50
+ ->addColumn('state', Varien_Db_Ddl_Table::TYPE_TEXT, 64, array(
51
+ 'nullable' => true,
52
+ 'default' => null,
53
+ ), 'State')
54
+
55
+ ->addColumn('city', Varien_Db_Ddl_Table::TYPE_TEXT, 64, array(
56
+ 'nullable' => true,
57
+ 'default' => null,
58
+ ), 'City')
59
+
60
+ ->addColumn('zipcode', Varien_Db_Ddl_Table::TYPE_TEXT, 64, array(
61
+ 'nullable' => true,
62
+ 'default' => null,
63
+ ), 'Zipcode')
64
+
65
+ ->addColumn('phone', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
66
+ 'nullable' => true,
67
+ 'default' => null,
68
+ ), 'Phone')
69
+
70
+ ->addColumn('fax', Varien_Db_Ddl_Table::TYPE_TEXT, 64, array(
71
+ 'nullable' => true,
72
+ 'default' => null,
73
+ ), 'Fax')
74
+
75
+ ->addColumn('url', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
76
+ 'nullable' => true,
77
+ 'default' => null,
78
+ ), 'Store Url')
79
+
80
+ ->addColumn('email', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
81
+ 'nullable' => true,
82
+ 'default' => null,
83
+ ), 'Email')
84
+
85
+ ->addColumn('store_logo', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
86
+ 'nullable' => true,
87
+ 'default' => null,
88
+ ), 'Store Logo')
89
+
90
+ ->addColumn('description', Varien_Db_Ddl_Table::TYPE_TEXT, '64K', array(
91
+ 'nullable' => true,
92
+ 'default' => null,
93
+ ), 'Description')
94
+
95
+ ->addColumn('trading_hours', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
96
+ 'nullable' => true,
97
+ 'default' => null,
98
+ ), 'Trading Hours')
99
+
100
+ ->addColumn('radius', Varien_Db_Ddl_Table::TYPE_TEXT, 64, array(
101
+ 'nullable' => true,
102
+ 'default' => null,
103
+ ), 'Radius')
104
+
105
+ ->addColumn('latitude', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
106
+ 'nullable' => true,
107
+ 'default' => null,
108
+ ), 'Latitude')
109
+
110
+ ->addColumn('longitude', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
111
+ 'nullable' => true,
112
+ 'default' => null,
113
+ ), 'Longitude')
114
+
115
+ ->addColumn('zoom_level', Varien_Db_Ddl_Table::TYPE_TEXT, 64, array(
116
+ 'nullable' => true,
117
+ 'default' => null,
118
+ ), 'Zoom level')
119
+
120
+ ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
121
+ 'nullable' => true,
122
+ 'default' => null,
123
+ ), 'Creation Time')
124
+
125
+ ->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
126
+ 'nullable' => true,
127
+ 'default' => null,
128
+ ), 'Store Updated Date')
129
+
130
+ ->setComment('Clarion Storelocator Table');
131
+
132
+ $installer->getConnection()->createTable($table);
133
+
134
+ /**
135
+ * Create table 'clarion_storelocator/storelocator_store'
136
+ */
137
+
138
+ $table = $installer->getConnection()
139
+ ->newTable($installer->getTable('clarion_storelocator/storelocator_store'))
140
+ ->addColumn('storelocator_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
141
+ 'nullable' => false,
142
+ 'primary' => true,
143
+ ), 'Storelocator ID')
144
+ ->addColumn('store_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
145
+ 'unsigned' => true,
146
+ 'nullable' => false,
147
+ 'primary' => true,
148
+ ), 'Store ID')
149
+ ->addIndex($installer->getIdxName('clarion_storelocator/storelocator_store', array('store_id')),
150
+ array('store_id'))
151
+
152
+ ->addForeignKey($installer->getFkName('clarion_storelocator/storelocator_store', 'storelocator_id', 'clarion_storelocator/storelocator', 'storelocator_id'),
153
+ 'storelocator_id', $installer->getTable('clarion_storelocator/storelocator'), 'storelocator_id',
154
+ Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
155
+
156
+ ->addForeignKey($installer->getFkName('clarion_storelocator/storelocator_store', 'store_id', 'core/store', 'store_id'),
157
+ 'store_id', $installer->getTable('core/store'), 'store_id',
158
+ Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
159
+
160
+ ->setComment('Clarion Storelocator To Store Linkage Table');
161
+ $installer->getConnection()->createTable($table);
162
+
163
+ /**
164
+ * Prepare database after install
165
+ */
166
+ $installer->endSetup();
app/code/community/Clarion/Storelocator/sql/clarion_storelocator_setup/upgrade-0.1.0-0.1.1.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Storelocator installation script
4
+ *
5
+ * @category Clarion
6
+ * @package Clarion_Storelocator
7
+ * @author Clarion Magento Team <pandurang.babar@clariontechnologies.co.in>
8
+ *
9
+ */
10
+ /** @var $installer Mage_Core_Model_Resource_Setup */
11
+ $installer = $this;
12
+ $installer->startSetup();
13
+
14
+ //Change field store_id to storelocator_id
15
+ $installer->getConnection()->changeColumn($installer->getTable('clarion_storelocator/storelocator'), 'store_id', 'storelocator_id', array(
16
+ 'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
17
+ 'identity' => true,
18
+ 'unsigned' => true,
19
+ 'nullable' => false,
20
+ 'primary' => true,
21
+ 'comment' => 'Storelocator Id'
22
+ ));
23
+
24
+ /**
25
+ * Create table 'clarion_storelocator/storelocator_store'
26
+ */
27
+
28
+ $table = $installer->getConnection()
29
+ ->newTable($installer->getTable('clarion_storelocator/storelocator_store'))
30
+ ->addColumn('storelocator_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
31
+ 'nullable' => false,
32
+ 'primary' => true,
33
+ ), 'Storelocator ID')
34
+ ->addColumn('store_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
35
+ 'unsigned' => true,
36
+ 'nullable' => false,
37
+ 'primary' => true,
38
+ ), 'Store ID')
39
+ ->addIndex($installer->getIdxName('clarion_storelocator/storelocator_store', array('store_id')),
40
+ array('store_id'))
41
+
42
+ ->addForeignKey($installer->getFkName('clarion_storelocator/storelocator_store', 'storelocator_id', 'clarion_storelocator/storelocator', 'storelocator_id'),
43
+ 'storelocator_id', $installer->getTable('clarion_storelocator/storelocator'), 'storelocator_id',
44
+ Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
45
+
46
+ ->addForeignKey($installer->getFkName('clarion_storelocator/storelocator_store', 'store_id', 'core/store', 'store_id'),
47
+ 'store_id', $installer->getTable('core/store'), 'store_id',
48
+ Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
49
+
50
+ ->setComment('Clarion Storelocator To Store Linkage Table');
51
+ $installer->getConnection()->createTable($table);
52
+
53
+ $installer->endSetup();
media/clarion_storelocator/cache/400/demo2.png ADDED
Binary file
media/clarion_storelocator/cache/400/demo4.png ADDED
Binary file
media/clarion_storelocator/cache/400/demo5.png ADDED
Binary file
media/clarion_storelocator/cache/400/red3.jpeg ADDED
Binary file
media/clarion_storelocator/demo1.png DELETED
Binary file
media/clarion_storelocator/demo5.png DELETED
Binary file
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Clarion_Storelocator</name>
4
- <version>1.0.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Store Locator With Google Map</summary>
10
  <description>Store locator extension helps to manage multiple stores from admin panel. Customers can search nearest stores. Customers can view individual store details. Stores shown on the Google map.</description>
11
- <notes>First stable release 1.0.0</notes>
12
  <authors><author><name>Clarion Technologies</name><user>Clariontech</user><email>magento@clariontechnologies.co.in</email></author></authors>
13
- <date>2014-07-10</date>
14
- <time>07:30:47</time>
15
- <contents><target name="magecommunity"><dir name="Clarion"><dir name="Storelocator"><dir name="Block"><dir name="Adminhtml"><dir name="Storelocator"><dir name="Edit"><file name="Form.php" hash="6ae73ab1e08b67ece7ef0b8090fa58ac"/><dir name="Tab"><file name="Description.php" hash="6d7713c768072d32e669f43e82ed43b6"/><file name="Display.php" hash="98f53775cdfff51f1b18594d769fd5cc"/><file name="Form.php" hash="ab9dff23f35e17e2a46957adbddf497b"/><file name="Googlemap.PHP" hash="5f6a32c06b19e78b6a67a4f54e6c735f"/></dir><file name="Tabs.php" hash="ee6cf57f633fc54c41f2a0097b02292b"/></dir><file name="Edit.php" hash="99123b14b87648755c790cd4517778a4"/><file name="Grid.php" hash="0fc226f076bd0a966157d9bd8b35ccc9"/></dir><file name="Storelocator.php" hash="8408bd9a6cd03628fbeb189b5ea25796"/></dir><file name="List.php" hash="aea899ad2098df8193bf18fb7eb00a7f"/><file name="View.php" hash="851850836d6bb8e4228a6173dce2375d"/></dir><dir name="Helper"><file name="Admin.php" hash="c3b93859c4e926afd7dfa1931b805040"/><file name="Data.php" hash="5ddcdaf83c7c3e34ddafdcbd9fd61d47"/><file name="Image.php" hash="f57436a272c1bd566239a52ea7429c5a"/></dir><dir name="Model"><file name="Enabledisable.php" hash="9a4274b006e955c1da42253260ec3fa3"/><dir name="Resource"><file name="Setup.php" hash="d626686cd920168f17d332b1edd3860d"/><dir name="Storelocator"><file name="Collection.php" hash="a3369d973ebed6c82cf5c7e46da7b485"/></dir><file name="Storelocator.php" hash="44158f03768473e415a060d60ccefab3"/></dir><file name="Storelocator.php" hash="2339ba82ce2082ea53f0b956c21ac8b0"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ManagestorelocatorController.php" hash="9352766c15d65212e7b6e9a38ba0803b"/></dir><file name="IndexController.php" hash="03c5faa977d65241b1d853deab5beff9"/></dir><dir name="data"><dir name="clarion_storelocator_setup"><file name="data-install-0.1.0.php" hash="c1a712b8a0832f53afd0a9de4289ef61"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="cdc622c940dc5be38dbc0ac0f4692827"/><file name="config.xml" hash="8d93985cdeaba92f959d41798c574917"/><file name="system.xml" hash="b22b364f771a8d79762e468f438c040b"/></dir><dir name="sql"><dir name="clarion_storelocator_setup"><file name="install-0.1.0.php" hash="837a059b999021a4fca8714dae95ed7c"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="clarion_storelocator.xml" hash="ed85f66f43d0abed92fbc8e6a4752e7a"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="clarion_storelocator.xml" hash="657e24dc7c3ea71c9cb5241611f1c43f"/></dir><dir name="template"><dir name="clarion"><dir name="storelocator"><file name="list.phtml" hash="a321d7338a3317883487d55a825dd60b"/><file name="view.phtml" hash="5e216c02a4ecde43d2548572e60e6e47"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Clarion_Storelocator.xml" hash="64d157a8f5d3806f9294495058042a8b"/></dir></target><target name="magemedia"><dir name="clarion_storelocator"><file name="demo1.png" hash="36d5e5281767ac6ed3ed4373945a00a1"/><file name="demo2.png" hash="1e691b78821ad95c4fd12f2e66990f93"/><file name="demo3.png" hash="e821fde1f20f200dea31e9e9e39cddd7"/><file name="demo4.png" hash="1f90c8d847fd50d9062ac6fda4d9104d"/><file name="demo5.png" hash="098844050ba3cec618963253a3956c90"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="clarion_storelocator.css" hash="e012deb8f48fff3d466aeff420097d7b"/></dir><dir name="js"><dir name="clarion_storelocator"><file name="storelocator.js" hash="cd71dbe51c5b86e8ab0f94a00660c3ce"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Clarion_Storelocator</name>
4
+ <version>1.0.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Store Locator With Google Map</summary>
10
  <description>Store locator extension helps to manage multiple stores from admin panel. Customers can search nearest stores. Customers can view individual store details. Stores shown on the Google map.</description>
11
+ <notes>Added multiple store views functionality.</notes>
12
  <authors><author><name>Clarion Technologies</name><user>Clariontech</user><email>magento@clariontechnologies.co.in</email></author></authors>
13
+ <date>2014-07-21</date>
14
+ <time>07:00:02</time>
15
+ <contents><target name="magecommunity"><dir name="Clarion"><dir name="Storelocator"><dir name="Block"><dir name="Adminhtml"><dir name="Storelocator"><dir name="Edit"><file name="Form.php" hash="6ae73ab1e08b67ece7ef0b8090fa58ac"/><dir name="Tab"><file name="Description.php" hash="6d7713c768072d32e669f43e82ed43b6"/><file name="Display.php" hash="98f53775cdfff51f1b18594d769fd5cc"/><file name="Form.php" hash="ddb9c96ffdb1848badee1ac396a6028d"/><file name="Googlemap.PHP" hash="5f6a32c06b19e78b6a67a4f54e6c735f"/></dir><file name="Tabs.php" hash="ee6cf57f633fc54c41f2a0097b02292b"/></dir><file name="Edit.php" hash="b84a1b2280b0c7d765b93daac5a0ec54"/><file name="Grid.php" hash="1b71cce9ee18ccb4980f7aeef91fc150"/></dir><file name="Storelocator.php" hash="8408bd9a6cd03628fbeb189b5ea25796"/></dir><file name="List.php" hash="30e86853e0fa4efe921bf015ba47be38"/><file name="View.php" hash="851850836d6bb8e4228a6173dce2375d"/></dir><dir name="Helper"><file name="Admin.php" hash="c3b93859c4e926afd7dfa1931b805040"/><file name="Data.php" hash="5ddcdaf83c7c3e34ddafdcbd9fd61d47"/><file name="Image.php" hash="f57436a272c1bd566239a52ea7429c5a"/></dir><dir name="Model"><file name="Enabledisable.php" hash="9a4274b006e955c1da42253260ec3fa3"/><dir name="Resource"><file name="Setup.php" hash="d626686cd920168f17d332b1edd3860d"/><dir name="Storelocator"><file name="Collection.php" hash="b4b795d05336b1f017768e56794dae62"/></dir><file name="Storelocator.php" hash="3657638c7dafc174f0197add770d6b8a"/></dir><file name="Storelocator.php" hash="fe10791b42d03149f8e3f32160d4e522"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ManagestorelocatorController.php" hash="f7984c1764fbb2c06e249a71ca44af8a"/></dir><file name="IndexController.php" hash="598df2ba06adbb249bac3b997e380194"/></dir><dir name="data"><dir name="clarion_storelocator_setup"><file name="data-install-0.1.0.php" hash="c1a712b8a0832f53afd0a9de4289ef61"/><file name="data-install-0.1.1.php" hash="7f1b72e3001764fb8d51882a50fdc9c9"/><file name="data-upgrade-0.1.0-0.1.1.php" hash="2f61434eeff7a8031db63fd8f62bbc34"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="cdc622c940dc5be38dbc0ac0f4692827"/><file name="config.xml" hash="b81aadab59c1a7d19fba90489a1eb589"/><file name="system.xml" hash="b22b364f771a8d79762e468f438c040b"/></dir><dir name="sql"><dir name="clarion_storelocator_setup"><file name="install-0.1.0.php" hash="837a059b999021a4fca8714dae95ed7c"/><file name="install-0.1.1.php" hash="806bb2bf8db848b1e17f0b32cd269d65"/><file name="upgrade-0.1.0-0.1.1.php" hash="10d75aaa89d7c7db9369fc37f2147eae"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="clarion_storelocator.xml" hash="ed85f66f43d0abed92fbc8e6a4752e7a"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="clarion_storelocator.xml" hash="657e24dc7c3ea71c9cb5241611f1c43f"/></dir><dir name="template"><dir name="clarion"><dir name="storelocator"><file name="list.phtml" hash="a321d7338a3317883487d55a825dd60b"/><file name="view.phtml" hash="5e216c02a4ecde43d2548572e60e6e47"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Clarion_Storelocator.xml" hash="64d157a8f5d3806f9294495058042a8b"/></dir></target><target name="magemedia"><dir name="clarion_storelocator"><dir name="cache"><dir name="400"><file name="demo2.png" hash="b267c5fb7a839b31015d8172c11b4c71"/><file name="demo4.png" hash="45247c98e898b992e22131422f5f6b02"/><file name="demo5.png" hash="a4a73084252f19bb3c033d07b9298957"/><file name="red3.jpeg" hash="ad747ba8acdf66bf640242912ad52c82"/></dir></dir><file name="demo2.png" hash="1e691b78821ad95c4fd12f2e66990f93"/><file name="demo3.png" hash="e821fde1f20f200dea31e9e9e39cddd7"/><file name="demo4.png" hash="1f90c8d847fd50d9062ac6fda4d9104d"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="clarion_storelocator.css" hash="e012deb8f48fff3d466aeff420097d7b"/></dir><dir name="js"><dir name="clarion_storelocator"><file name="storelocator.js" hash="cd71dbe51c5b86e8ab0f94a00660c3ce"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>