forked from magento-hackathon/MultiStock
/
Stock.php
66 lines (62 loc) · 1.66 KB
/
Stock.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
/**
* This file is part of a FireGento e.V. module.
*
* This FireGento e.V. module is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This script is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* PHP version 5
*
* @category FireGento
* @package FireGento_MultiStock
* @author FireGento Team <team@firegento.com>
* @copyright 2014 FireGento Team (http://www.firegento.com)
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
*/
/**
* Helper Class
*
* @category FireGento
* @package FireGento_MultiStock
* @author FireGento Team <team@firegento.com>
*/
class FireGento_MultiStock_Model_Stock extends Mage_CatalogInventory_Model_Stock
{
/**
* Get the id.
*
* @return null|int
*/
public function getId()
{
return $this->getData('stock_id');
}
/**
* Get the name.
*
* @return mixed
*/
public function getName()
{
return $this->getData('stock_name');
}
/**
* Delete a stock.
*
* @return $this|Mage_Core_Model_Abstract
*/
public function delete()
{
if (intval($this->getId()) == self::DEFAULT_STOCK_ID) {
Mage::logException(new Exception('default or unknown stock can\'t be deleted'));
} else {
parent::delete();
}
return $this;
}
}