1 | <?php |
||
36 | class ProductLinkObserver extends AbstractProductImportObserver |
||
37 | { |
||
38 | |||
39 | /** |
||
40 | * The artefact type. |
||
41 | * |
||
42 | * @var string |
||
43 | */ |
||
44 | const ARTEFACT_TYPE = 'links'; |
||
45 | |||
46 | /** |
||
47 | * The mapping with the link type codes => column names. |
||
48 | * |
||
49 | * @var array |
||
50 | */ |
||
51 | protected $linkTypeCodeToColumnsMapping = array( |
||
52 | LinkTypeCodes::RELATION => array(ColumnKeys::RELATED_SKUS, ColumnKeys::RELATED_POSITION), |
||
53 | LinkTypeCodes::UP_SELL => array(ColumnKeys::UPSELL_SKUS, ColumnKeys::UPSELL_POSITION), |
||
54 | LinkTypeCodes::CROSS_SELL => array(ColumnKeys::CROSSSELL_SKUS, ColumnKeys::CROSSSELL_POSITION) |
||
55 | ); |
||
56 | |||
57 | /** |
||
58 | * Process the observer's business logic. |
||
59 | * |
||
60 | * @return array The processed row |
||
61 | */ |
||
62 | protected function process() |
||
76 | |||
77 | /** |
||
78 | * Prepare's and return's the artefacts for the passed link type. |
||
79 | * |
||
80 | * @param string $linkTypeCode The link type code to prepare the artefacts for |
||
81 | * @param array $columns The column names that contains the data (SKU + position) |
||
82 | * |
||
83 | * @return array The link artefacts assembled from the passed row |
||
84 | */ |
||
85 | protected function prepareArtefacts($linkTypeCode, array $columns) |
||
122 | |||
123 | /** |
||
124 | * Return's the link type code => colums mapping. |
||
125 | * |
||
126 | * @return array The mapping with the link type codes => colums |
||
127 | */ |
||
128 | protected function getLinkTypeCodeToColumnsMapping() |
||
132 | |||
133 | /** |
||
134 | * Add the passed product type artefacts to the product with the |
||
135 | * last entity ID. |
||
136 | * |
||
137 | * @param array $artefacts The product type artefacts |
||
138 | * |
||
139 | * @return void |
||
140 | * @uses \TechDivision\Import\Product\Media\Subjects\MediaSubject::getLastEntityId() |
||
141 | */ |
||
142 | protected function addArtefacts(array $artefacts) |
||
146 | } |
||
147 |