public function toArray($currencyID = null) { $array = parent::toArray(); $rs = ProductPrice::getRecurringProductPeriodPrices($this, $currencyID); $currencies = array(); if ($rs && $rs->size()) { $mapping = array(ProductPrice::TYPE_PERIOD_PRICE => 'ProductPrice_period', ProductPrice::TYPE_SETUP_PRICE => 'ProductPrice_setup'); while (false != ($item = $rs->shift())) { $itemArray = $item->toArray(); if ($itemArray['type'] == ProductPrice::TYPE_SETUP_PRICE || $itemArray['type'] == ProductPrice::TYPE_PERIOD_PRICE) { $array[$mapping[$itemArray['type']]][$itemArray['currencyID']] = $itemArray; if (array_key_exists($itemArray['currencyID'], $currencies) == false) { $currencies[$itemArray['currencyID']] = Currency::getInstanceByID($itemArray['currencyID']); } $array[$mapping[$itemArray['type']]]['formated_price'][$itemArray['currencyID']] = $currencies[$itemArray['currencyID']]->getFormattedPrice($itemArray['price']); } } } return $array; }