Conditions | 4 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
37 | public function buildProperty(TransformEvent $event): void |
||
38 | { |
||
39 | $product = $event->getObject(); |
||
40 | |||
41 | if (!$product instanceof ProductInterface) { |
||
42 | return; |
||
43 | } |
||
44 | |||
45 | $document = $event->getDocument(); |
||
46 | |||
47 | /** @var ProductVariantInterface $productVariant */ |
||
48 | foreach ($product->getVariants() as $productVariant) { |
||
49 | foreach($productVariant->getChannelPricings() as $channelPricing) { |
||
50 | $propertyName = $this->priceProperty . '_' . strtolower($channelPricing->getChannelCode()); |
||
51 | |||
52 | $document->set($propertyName, $channelPricing->getPrice()); |
||
53 | } |
||
57 |