Internal overhaul of Cart/Checkout and other minor fixes

This commit is contained in:
Deon George
2013-12-02 15:16:28 +11:00
parent f8a5b153cf
commit 06b87c5135
26 changed files with 256 additions and 228 deletions

View File

@@ -18,11 +18,12 @@ class Checkout_Plugin_Paypal_Cart extends Checkout_Plugin_Paypal {
public function before(Cart $co) {
$output = '';
$output .= Form::open(sprintf('https://%s/cgi-bin/webscr',$this->test_mode ? $this->url_test : $this->url_prod),array('method'=>'POST'));
$output .= View::factory('checkout/plugin/paypal/before')
->set('checkout',$this->co)
->set('cart',$co);
$output .= Form::open(sprintf('https://%s/cgi-bin/webscr',$this->test_mode ? $this->url_test : $this->url_prod),array('method'=>'POST'));
$output .= Form::hidden('cmd','_cart');
$output .= Form::hidden('business',$this->test_mode ? 'deon_1260578114_biz@graytech.net.au' : 'deon@graytech.net.au');
$output .= Form::hidden('bn','Graytech_BuyNow_WPS_AU');
@@ -46,7 +47,6 @@ class Checkout_Plugin_Paypal_Cart extends Checkout_Plugin_Paypal {
$output .= Form::hidden('item_name_'.$c,'Paypal Fee');
$output .= Form::hidden('amount_'.$c,$this->co->fee($co->total()));
$output .= Form::submit('submit','Pay Now');
$output .= Form::close();
return $output;

View File

@@ -0,0 +1,16 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides Admin for Checkout management
*
* @package Checkout
* @category Controllers/Admin
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Controller_Admin_Checkout extends Controller_Checkout {
protected $secure_actions = array(
);
}
?>

View File

@@ -28,13 +28,8 @@ class Controller_Checkout extends Controller_TemplateDefault {
$co = ORM::factory('Checkout',$cid);
Block::add(array(
'title'=>'Checkout',
'body'=>$co->plugin()->before(Cart::instance()),
));
// Suppress our right hand tab
$this->template->right = ' ';
Block::factory()
->body($co->plugin()->before(Cart::instance()));
}
public function action_after() {
@@ -71,6 +66,7 @@ class Controller_Checkout extends Controller_TemplateDefault {
$cno->status = 1;
$cno->data = Request::current()->post();
$cno->save();
} else {
$cno->where('id','=',$test_id)->find();
}

View File

@@ -1,3 +0,0 @@
<tr>
<td class="icon"><label for="payment_<?php echo $payment->id; ?>"><?php echo FORM::radio('payment',$payment->id,0,array('id'=>'payment_'.$payment->id)); ?> <?php echo HTML::image($payment->graphic_url,array('alt'=>'')); ?> <?php echo $payment->name; ?></label></td>
</tr>

View File

@@ -1,32 +1,30 @@
<p>Paypal will be used to pay for the following items:</p>
</br>
<?php
echo Table::display(
$cart->contents(),
NULL,
array(
'item()->q'=>array('label'=>'Quantity'),
'item()->i'=>array('label'=>'Item'),
'item()->t'=>array('label'=>'Total','class'=>'right'),
),
array(
'type'=>'list',
)
);
?>
</br>
<p>Please Note: Paypal charges a fee to receive payments, and that fee will be added to your payment.</p>
<table class="list-box-left">
<tr class="list-data">
<th>Cart Total</th>
<td class="right"><?php echo $t=$cart->total(TRUE); ?></td>
</tr>
<tr class="list-data">
<th>Payment Fee</th>
<td class="right"><?php echo Currency::display($f=$checkout->fee($t)); ?></td>
</tr>
<tr class="list-data">
<th>Total</th>
<td class="right"><?php echo Currency::display($t+$f); ?></td>
</tr>
</table>
<?php echo View::factory('cart/view')->set('o',$cart); ?>
<div class="span4">
<fieldset>
<legend>Payment by Paypal</legend>
<p>Please Note: Paypal charges a fee to receive payments, and that fee will be added to your payment.</p>
<div class="dl-horizontal">
<dt>Cart Total</dt>
<dd><?php echo $t=$cart->total(TRUE); ?></dd>
<dt>Payment Fee</dt>
<dd><?php echo Currency::display($f=$checkout->fee($t)); ?></dd>
<dt>Total</dt>
<dd><?php echo Currency::display($t+$f); ?></dd>
</div>
</fieldset>
<div class="row">&nbsp;</div>
<div class="row">
<div class="offset1">
<button type="submit" class="btn btn-primary">Pay Now</button>
<a href="cart/empty" class="btn">Clear</a>
</div>
</div>
</div> <!-- /span -->
<div class="row">&nbsp;</div>