public function findallAction() { $option = $this->getCurrentOptionValue(); $currency = Core_Model_Language::getCurrentCurrency(); $data = array("currency_symbol" => Core_Model_Language::getCurrentCurrency()->getSymbol(), "page_title" => $option->getTabbarName(), "format" => $currency->toCurrency(1, array("locale" => $currency->getLocale()))); $this->_sendHtml($data); }
public function createRecurring($token) { $params = array(); $lines = $this->_order->getLines(); $at_least_one_item_is_recurring = false; foreach ($lines as $k => $item) { if ($item->getIsRecurrent() == "1") { $k = 0; $unit_price_excl_tax = round($item->getPriceExclTax(), 2); $unit_price = round($unit_price_excl_tax * (1 + $this->_order->getTaxRate() / 100), 2); // prix TTC $tax_item = round($unit_price - $unit_price_excl_tax, 2); $params['DESC'] = $item->getName(); $params['TAXAMT'] = !empty($params['TAXAMT']) ? $params['TAXAMT'] + $tax_item * $item->getQty() : $tax_item * $item->getQty(); $params['AMT'] = round($item->getTotalPriceExclTax(), 2); $params["L_PAYMENTREQUEST_0_ITEMCATEGORY{$k}"] = 'Physical'; $params["L_PAYMENTREQUEST_0_NAME{$k}"] = $item->getName(); $params["L_PAYMENTREQUEST_0_QTY{$k}"] = $item->getQty(); $params["L_PAYMENTREQUEST_0_TAXAMT{$k}"] = $tax_item; $params["L_PAYMENTREQUEST_0_AMT{$k}"] = round($item->getTotalPriceExclTax(), 2); $at_least_one_item_is_recurring = true; } } if (!empty($params)) { $frequency = $this->_order->getSubscription()->getPaymentFrequency(); $date = $this->getNextPaymentDue($frequency); $params = array_merge($params, array('TOKEN' => $token, 'CURRENCYCODE' => Core_Model_Language::getCurrentCurrency()->getShortName(), 'PROFILESTARTDATE' => $date, 'BILLINGPERIOD' => $this->getPeriod($frequency), 'BILLINGFREQUENCY' => 1, 'EMAIL' => $this->_order->getAdminEmail())); $response = $this->request(self::CREATE_RECURRING_PAYMENTS_PROFILE, $params); if ($response) { return true; } } return !$at_least_one_item_is_recurring; }
public function formatPrice($price, $currency = null) { $price = preg_replace(array('/(,)/', '/[^0-9.]/'), array('.', ''), $price); if ($currency) { $currency = new Zend_Currency($currency); } else { $currency = Core_Model_Language::getCurrentCurrency(); } return $currency->toCurrency($price); }