/
Storelocator.php
48 lines (45 loc) · 1.23 KB
/
Storelocator.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* Storelocation model
*
* @category Bluehorse
* @package Bluehorse_Storelocator
* @author Bluehorse Magento Team
*
*/
class Bluehorse_Storelocator_Model_Storelocator extends Mage_Core_Model_Abstract
{
/**
* Define resource model
*/
protected function _construct()
{
$this->_init('bluehorse_storelocator/storelocator');
}
/**
* Check if store exists based on its name
*
* @param $storeName store name
* @param $storelocatorId storelocator id
* @return boolean
*/
public function storeExists($storeName, $storelocatorId = null)
{
$result = $this->_getResource()->storeExists($storeName, $storelocatorId);
return (is_array($result) && count($result) > 0) ? true : false;
}
/**
* Upload store csv file and import data from it
*
* @throws Mage_Core_Exception
* @param Varien_Object $object
* @return Bluehorse_Storelocator_Model_Storelocator
*/
public function uploadAndImport($object)
{
$resultObj = $this->_getResource()->uploadAndImport($object);
if($resultObj){
return $resultObj;
}
}
}