function getAmount($value, $currency_code, $currency_value, $convert = false) { if (version_compare($this->_k2version, '2.6.7', 'lt')) { return K2StoreUtilities::number($value, array('thousands' => '', 'num_decimals' => '2', 'decimal' => '.')); } else { include_once JPATH_ADMINISTRATOR . '/components/com_k2store/library/base.php'; $currencyObject = K2StoreFactory::getCurrencyObject(); $amount = $currencyObject->format($value, $currency_code, $currency_value, false); return $amount; } }
?> </td> <td align="center"> <?php if ($row->bemail) { echo $row->bemail; } else { echo $row->user_email; } ?> </td> <td align="center"> <?php echo K2StoreUtilities::number($row->orderpayment_amount, $row->currency_code, $row->currency_value); ?> </td> <td align="center"> <?php echo JText::_($row->orderpayment_type); ?> </td> <!-- <td align="center"> <?php echo JText::_($row->transaction_status); ?> </td> --> <td align="center">
function display($cachable = false, $urlparams = array()) { //initialist system objects $app = JFactory::getApplication(); $session = JFactory::getSession(); K2StoreUtilities::cleanCache(); $params = JComponentHelper::getParams('com_k2store'); $view = $this->getView('mycart', 'html'); $view->set('_view', 'mycart'); //get post vars $post = $app->input->getArray($_POST); $model = $this->getModel('Mycart'); $checkout_model = $this->getModel('checkout'); $store = K2StoreHelperCart::getStoreAddress(); if (K2StoreHelperCart::hasProducts()) { $items = $model->getDataNew(); } else { $items = array(); } //coupon $post_coupon = $app->input->getString('coupon', ''); //first time applying? then set coupon to session if (isset($post_coupon) && !empty($post_coupon)) { try { if ($this->validateCoupon()) { $session->set('coupon', $post_coupon, 'k2store'); $msg = JText::_('K2STORE_COUPON_APPLIED_SUCCESSFULLY'); } } catch (Exception $e) { $msg = $e->getMessage(); } $this->setRedirect(JRoute::_("index.php?option=com_k2store&view=mycart"), $msg); } if ($post_coupon) { $view->assign('coupon', $post_coupon); } elseif ($session->has('coupon', 'k2store')) { $view->assign('coupon', $session->get('coupon', '', 'k2store')); } else { $view->assign('coupon', ''); } //shipping tax calculator //get countries $db = JFactory::getDbo(); $db->setQuery($db->getQuery(true)->select('country_id, country_name')->from('#__k2store_countries')->where('state=1')); $countries = $db->loadObjectList(); $country_id = $app->input->getInt('country_id'); if (isset($country_id)) { $session->set('billing_country_id', $country_id, 'k2store'); $session->set('shipping_country_id', $country_id, 'k2store'); } elseif ($session->has('shipping_country_id', 'k2store')) { $country_id = $session->get('shipping_country_id', '', 'k2store'); } else { $country_id = $store->country_id; } $countryList = JHtml::_('select.genericlist', $countries, 'country_id', $attribs = null, $optKey = 'country_id', $optText = 'country_name', $country_id, $idtag = 'cart_country', $translate = false); $zone_id = $app->input->getInt('zone_id'); if (isset($zone_id)) { $session->set('billing_zone_id', $zone_id, 'k2store'); $session->set('shipping_zone_id', $zone_id, 'k2store'); } elseif ($session->has('shipping_zone_id', 'k2store')) { $zone_id = $session->get('shipping_zone_id', '', 'k2store'); } else { $zone_id = $store->zone_id; } $postcode = $app->input->getString('postcode'); if (isset($postcode)) { $session->set('shipping_postcode', $postcode, 'k2store'); } elseif ($session->has('shipping_postcode', 'k2store')) { $postcode = $session->get('shipping_postcode', '', 'k2store'); } else { $postcode = $store->store_zip; } $view->assign('countryList', $countryList); $view->assign('country_id', $country_id); $view->assign('zone_id', $zone_id); $view->assign('postcode', $postcode); //assign a single selected method if it had been selected if ($session->has('shipping_values', 'k2store')) { //get exisitng values $shipping_values = $session->get('shipping_values', array(), 'k2store'); $rates = $checkout_model->getShippingRates(); $session->set('shipping_methods', $rates, 'k2store'); if (count($rates) < 1) { $session->set('shipping_method', array(), 'k2store'); } $is_same = false; foreach ($rates as $rate) { if ($shipping_values['shipping_name'] == $rate['name']) { $shipping_values['shipping_price'] = isset($rate['price']) ? $rate['price'] : 0; $shipping_values['shipping_extra'] = isset($rate['extra']) ? $rate['extra'] : 0; $shipping_values['shipping_code'] = isset($rate['code']) ? $rate['code'] : ''; $shipping_values['shipping_name'] = isset($rate['name']) ? $rate['name'] : ''; $shipping_values['shipping_tax'] = isset($rate['tax']) ? $rate['tax'] : 0; $shipping_values['shipping_plugin'] = isset($rate['element']) ? $rate['element'] : ''; $session->set('shipping_method', $shipping_values['shipping_plugin'], 'k2store'); $session->set('shipping_values', $shipping_values, 'k2store'); $is_same = true; } } if ($is_same === false) { //sometimes the previously selected method may not apply. In those cases, we will have remove the selected shipping. $session->set('shipping_values', array(), 'k2store'); } $view->assign('shipping_values', $session->get('shipping_values', array(), 'k2store')); } else { $view->assign('shipping_values', array()); } //do we have shipping methods if ($session->has('shipping_methods', 'k2store')) { $view->assign('shipping_methods', $session->get('shipping_methods', array(), 'k2store')); } //assign a single selected method if it had been selected if ($session->has('shipping_method', 'k2store')) { $view->assign('shipping_method', $session->get('shipping_method', array(), 'k2store')); } else { $view->assign('shipping_method', array()); } $cartobject = $model->checkItems($items, $params->get('show_tax_total')); $totals = $model->getTotals(); JPluginHelper::importPlugin('k2store'); $results = $app->triggerEvent('onK2StoreAfterDisplayCart', array($items)); $view->assign('onK2StoreAfterDisplayCart', trim(implode("\n", $results))); $view->assign('cartobj', $cartobject); $view->assign('totals', $totals); $view->assign('model', $model); $view->assign('params', $params); if (isset($post['return'])) { $view->assign('return', $post['return']); } $view->set('_doTask', true); $view->set('hidemenu', true); $view->setModel($model, true); $view->setLayout('default'); $view->display(); }