1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* TechDivision\Import\Product\TierPrice\Observers\AbstractProductTierPriceObserver |
5
|
|
|
* |
6
|
|
|
* NOTICE OF LICENSE |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the Open Software License (OSL 3.0) |
9
|
|
|
* that is available through the world-wide-web at this URL: |
10
|
|
|
* http://opensource.org/licenses/osl-3.0.php |
11
|
|
|
* |
12
|
|
|
* PHP version 5 |
13
|
|
|
* |
14
|
|
|
* @author Tim Wagner <[email protected]> |
15
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
16
|
|
|
* @link https://github.com/techdivision/import-product-tier-price |
17
|
|
|
* @link https://www.techdivision.com |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
namespace TechDivision\Import\Product\TierPrice\Observers; |
21
|
|
|
|
22
|
|
|
use TechDivision\Import\Product\Observers\AbstractProductImportObserver; |
23
|
|
|
use TechDivision\Import\Product\TierPrice\Services\TierPriceProcessorInterface; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Observer for deleting tier prices from the database. |
27
|
|
|
* |
28
|
|
|
* @author Tim Wagner <[email protected]> |
29
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
30
|
|
|
* @link https://github.com/techdivision/import-product-tier-price |
31
|
|
|
* @link https://www.techdivision.com |
32
|
|
|
*/ |
33
|
|
|
abstract class AbstractProductTierPriceObserver extends AbstractProductImportObserver |
34
|
|
|
{ |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* The product tier price processor instance. |
38
|
|
|
* |
39
|
|
|
* @var \TechDivision\Import\Product\TierPrice\Services\TierPriceProcessorInterface |
40
|
|
|
*/ |
41
|
|
|
protected $tierPriceProcessor; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Initialize the observer with the passed product tier price processor instance. |
45
|
|
|
* |
46
|
|
|
* @param \TechDivision\Import\Product\TierPrice\Services\TierPriceProcessorInterface $tierPriceProcessor The processor instance |
47
|
|
|
*/ |
48
|
|
|
public function __construct(TierPriceProcessorInterface $tierPriceProcessor) |
49
|
|
|
{ |
50
|
|
|
$this->tierPriceProcessor = $tierPriceProcessor; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Returns the product tier price rewrite processor instance. |
55
|
|
|
* |
56
|
|
|
* @return \TechDivision\Import\Product\TierPrice\Services\TierPriceProcessorInterface The processor instance |
57
|
|
|
*/ |
58
|
|
|
protected function getTierPriceProcessor() |
59
|
|
|
{ |
60
|
|
|
return $this->tierPriceProcessor; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Returns the primary key member name for the actual Magento edition. |
65
|
|
|
* |
66
|
|
|
* @return string The primary key member name |
67
|
|
|
* @see \TechDivision\Import\Product\TierPrice\Services\TierPriceProcessorInterface::getPrimaryKeyMemberName() |
68
|
|
|
*/ |
69
|
|
|
protected function getPrimaryKeyMemberName() |
70
|
|
|
{ |
71
|
|
|
return $this->getTierPriceProcessor()->getPrimaryKeyMemberName(); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Set's the ID of the last PK used. |
76
|
|
|
* |
77
|
|
|
* @param string $pk The PK |
78
|
|
|
* |
79
|
|
|
* @return void |
80
|
|
|
*/ |
81
|
|
|
protected function setLastPk($pk) |
82
|
|
|
{ |
83
|
|
|
$this->getSubject()->setLastPk($pk); |
84
|
|
|
} |
85
|
|
|
} |
86
|
|
|
|