Example #1
0
	function generateConfirmCart($payment_method) {
		$array = array();
		$cart = oseMscPublic::getCart();
		// begin to count tax
		$country = JRequest::getCmd('bill_country', null);
		$state = JRequest::getCmd('bill_state', 'all');
		$taxParams = oseMscPublic::getTax($country, $state);
		$cart = oseMscPublic::getCart();
		$cart->updateTaxParams('country', $country);
		$cart->updateTaxParams('state', $state);
		$cart->updateTaxParams('rate', $taxParams['rate']);
		$cart->updateTaxParams('file_control', $taxParams['file_control']);
		$cart->updateTaxParams('has_file_control', $taxParams['has_file_control']);
		$cart->updateTaxParams('vat_number', $taxParams['vat_number']);
		$cart->refreshSubTotal();
		// end
		$items = $cart->get('items');
		$subtotal = oseMscPublic::getSubtotal();
		$total = $cart->get('total');
		$discount = $cart->get('discount');
		$msc = oseRegistry::call('msc');
		// begin to draw the confirm box
		$draw = new oseMscListDraw();
		$payment = oseRegistry::call('payment');
		$osePaymentCurrency = oseMscPublic::getSelectedCurrency();
		$paymentView = $payment->getInstance('View');
		$keys = array_keys($items);
		$payment_mode = $cart->getParams('payment_mode');
		if (strtolower($payment_mode) == "paypal_cc") {
			$payment_mode = JText::_("Credit Card");
		}
		$paymentPre = ($payment_mode == 'm') ? 'Manual Re-Billing ' : 'Automatic Re-Billing ';
		$tHtml = '<table width="100%"><th width="76%" class="first">Item</th><th width="10%">Length</th><th width="10%" class="last">Price</th>';
		foreach ($items as $item) {
			$msc_id = oseObject::getValue($item, 'entry_id');
			$msc_option = oseObject::getValue($item, 'msc_option');
			if ($payment_mode == 'm') {
				$rows = array();
				$rows['title'] = $draw->drawFirstTitle(oseObject::getValue($item, 'title'), oseObject::getValue($item, 'leaf'));
				$rows['recurrence'] = oseObject::getValue($item, 'standard_recurrence');
				$rows['price'] = oseObject::getValue($item, 'standard_price');
				$tHtml .= '<tr><td>' . implode('</td><td>', $rows) . '</td></tr>';
			}
		}
		$tHtml .= '</table>';
		$array['items'] = '<div id="osecart-items">' . $tHtml . '</div>';
		$array['payment_preference'] = '<div id="ose-confirm-preference">Payment Preference: ' . $paymentPre . '</div>';
		$gwInfo = oseRegistry::call('payment')->getInstance('GateWay')->getGWInfo($payment_method);
		if (!empty($gwInfo) && $gwInfo->is_cc) {
			$array['payment_method'] = '<div id="ose-confirm-method">Payment Method: Credit Card</div>';
			;
		} else {
			$array['payment_method'] = '<div id="ose-confirm-method">Payment Method: ' . ucfirst($payment_method) . '</div>';
		}
		$array['subtotal'] = '<div id="osetotalcosts"><div class="items">Subtotal: ' . $osePaymentCurrency . ' ' . $subtotal . '</div>';
		$array['discount'] = '<div class="items">Discount: ' . $osePaymentCurrency . ' ' . $discount . '</div>';
		$array['tax'] = '<div class="items">Tax: ' . $osePaymentCurrency . ' ' . $cart->getTaxParams('amount', '0.00') . '</div>';
		$array['total'] = '<div class="items" id ="osegradntotal">Grand Total: ' . $osePaymentCurrency . ' ' . $total . '</div></div>';
		if (is_array($array)) {
			$array = implode("\r\n", $array);
		}
		$divSelectedRow = $draw->drawDiv('ose-selected-row');
		$html = sprintf($divSelectedRow, "\r\n" . $array . "\r\n");
		return $html;
	}
Example #2
0
	function generateConfirmCart($payment_method) {
		$array = array();
		$cart = oseMscPublic::getCart();
		$items = $cart->get('items');
		$subtotal = oseMscPublic::getSubtotal();
		$total = $cart->get('total');
		$discount = $cart->get('discount');
		$msc = oseRegistry::call('msc');
		$draw = new oseMscListDraw();
		$payment = oseRegistry::call('payment');
		$osePaymentCurrency = oseMscPublic::getSelectedCurrency();
		$paymentView = $payment->getInstance('View');
		$keys = array_keys($items);
		$payment_mode = $cart->getParams('payment_mode');
		$paymentPre = ($payment_mode == 'm') ? 'Manual Re-Billing ' : 'Automatic Re-Billing ';
		$tHtml = '<table width="100%"><th width="76%" class="first">Item</th><th width="10%">Length</th><th width="10%" class="last">Price</th>';
		foreach ($items as $item) {
			$msc_id = oseObject::getValue($item, 'entry_id');
			$msc_option = oseObject::getValue($item, 'msc_option');
			if ($payment_mode == 'm') {
				$rows = array();
				$rows['title'] = $draw->drawFirstTitle(oseObject::getValue($item, 'title'), oseObject::getValue($item, 'leaf'));
				$rows['recurrence'] = oseObject::getValue($item, 'standard_recurrence');
				$rows['price'] = oseObject::getValue($item, 'standard_price');
				$tHtml .= '<tr><td>' . implode('</td><td>', $rows) . '</td></tr>';
			}
		}
		$tHtml .= '</table>';
		$array['items'] = '<div id="osecart-items">' . $tHtml . '</div>';
		$array['subtotal'] = '<div id="osetotalcosts"><div class="items">Subtotal: ' . $osePaymentCurrency . ' ' . $subtotal . '</div>';
		$array['discount'] = '<div class="items">Discount: ' . $osePaymentCurrency . ' ' . $discount . '</div>';
		$array['total'] = '<div class="items" id ="osegradntotal">Grand Total: ' . $osePaymentCurrency . ' ' . $total . '</div></div>';
		$array['payment_preference'] = '<div id="ose-confirm-preference">Payment Preference: ' . $paymentPre . '</div>';
		if ($payment_method == 'authorize' || $payment_method == 'paypal_cc' || $payment_method == 'eway') {
			$array['payment_method'] = '<div id="ose-confirm-method">Payment Method: Credit Card</div>';
			;
		} else {
			$array['payment_method'] = '<div id="ose-confirm-method">Payment Method: ' . ucfirst($payment_method) . '</div>';
		}
		if (is_array($array)) {
			$array = implode("\r\n", $array);
		}
		$divSelectedRow = $draw->drawDiv('ose-selected-row');
		$html = sprintf($divSelectedRow, "\r\n" . $array . "\r\n");
		return $html;
	}