Ejemplo n.º 1
0
 /**
  * @param StoreFrontBundle\Struct\Product\Price $price
  * @return array
  */
 public function convertPriceStruct(StoreFrontBundle\Struct\Product\Price $price)
 {
     $data = array('valFrom' => $price->getFrom(), 'valTo' => $price->getTo(), 'from' => $price->getFrom(), 'to' => $price->getTo(), 'price' => $price->getCalculatedPrice(), 'pseudoprice' => $price->getCalculatedPseudoPrice(), 'referenceprice' => $price->getCalculatedReferencePrice());
     $data['attributes'] = $price->getAttributes();
     return $data;
 }
 /**
  * Calculates the product unit reference price for the passed
  * product price.
  *
  * @param Struct\Product\Price $price
  * @return float
  */
 private function calculateReferencePrice(Struct\Product\Price $price)
 {
     $value = $price->getCalculatedPrice() / $price->getUnit()->getPurchaseUnit() * $price->getUnit()->getReferenceUnit();
     return round($value, 3);
 }