/** * Returns price based on the base price and all related price influencer * * @return string */ public function getNetPrice() { $basePrice = $this->product->getBasePrice(); $newPrice = $basePrice; $priceInfluencer = \Abra\Cadabra\Service\PriceInfluencerService::collectPriceInfluencerFromArticle($this); /** @var \Abra\Cadabra\Domain\Model\PriceInfluencer\PriceInfluencerInterface $influencer */ foreach ($priceInfluencer as $influencer) { $newPrice = $influencer->calculatePrice($newPrice); } return $this->numberFormat($newPrice); }
/** * Extracts attribute identifiers from product * * @return void */ protected function extractAttributes() { $attributes = $this->product->getAttributes(); $attributeArray = array(); /** @var \Abra\Cadabra\Domain\Model\Attribute\AbstractAttribute $attribute */ foreach ($attributes as $attribute) { $attributeArray[$attribute->getUid()] = array(); /** @var \Abra\Cadabra\Domain\Model\Attribute\AttributeValue $value */ foreach ($attribute->getValues() as $value) { $attributeArray[$attribute->getUid()][] = $value->getUid(); } asort($attributeArray[$attribute->getUid()]); } ksort($attributeArray); $this->attributes = $attributeArray; }