Skip to content

Commit

Permalink
more recurring work
Browse files Browse the repository at this point in the history
  • Loading branch information
danielkerr committed Feb 7, 2016
1 parent dd40377 commit 421eb41
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 53 deletions.
1 change: 1 addition & 0 deletions upload/catalog/controller/account/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ public function info() {
$data['text_payment_address'] = $this->language->get('text_payment_address');
$data['text_history'] = $this->language->get('text_history');
$data['text_comment'] = $this->language->get('text_comment');
$data['text_no_results'] = $this->language->get('text_no_results');

$data['column_name'] = $this->language->get('column_name');
$data['column_model'] = $this->language->get('column_model');
Expand Down
41 changes: 23 additions & 18 deletions upload/catalog/controller/account/recurring.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function index() {

$data['recurrings'][] = array(
'order_recurring_id' => $result['order_recurring_id'],
'product' => $result['product'],
'product' => $result['product_name'],
'status' => $status,
'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
'view' => $this->url->link('account/recurring/info', 'order_recurring_id=' . $result['order_recurring_id'], true),
Expand Down Expand Up @@ -152,38 +152,39 @@ public function info() {

$data['text_recurring_detail'] = $this->language->get('text_recurring_detail');
$data['text_order_recurring_id'] = $this->language->get('text_order_recurring_id');
$data['text_order_id'] = $this->language->get('text_order_id');
$data['text_date_added'] = $this->language->get('text_date_added');
$data['text_payment_method'] = $this->language->get('text_payment_method');
$data['text_status'] = $this->language->get('text_status');
$data['text_reference'] = $this->language->get('text_reference');
$data['text_payment_method'] = $this->language->get('text_payment_method');
$data['text_order_id'] = $this->language->get('text_order_id');
$data['text_product'] = $this->language->get('text_product');

$data['text_quantity'] = $this->language->get('text_quantity');
$data['text_description'] = $this->language->get('text_description');
$data['text_reference'] = $this->language->get('text_reference');
$data['text_transaction'] = $this->language->get('text_transaction');
$data['text_recurring_description'] = $this->language->get('text_recurring_description');

$data['text_no_results'] = $this->language->get('text_no_results');


$data['column_date_added'] = $this->language->get('column_date_added');
$data['column_type'] = $this->language->get('column_type');
$data['column_amount'] = $this->language->get('column_amount');

$data['order_recurring_id'] = $this->request->get['order_recurring_id'];
$data['order_id'] = $recurring_info['order_id'];
$data['recurring_description'] = $recurring_info['recurring_description'];
$data['recurring_status'] = $recurring_info['recurring_status'];
$data['date_added'] = date($this->language->get('date_format_short'), strtotime($recurring_info['date_added']));

if ($recurring_info['status']) {
$data['status'] = $this->language->get('text_status_' . $recurring_info['status']);
} else {
$data['status'] = '';
}

$data['payment_method'] = $recurring_info['payment_method'];

$data['order_id'] = $recurring_info['order_id'];
$data['product_name'] = $recurring_info['product_name'];
$data['quantity'] = $recurring_info['quantity'];
$data['date_added'] = date($this->language->get('date_format_short'), strtotime($recurring_info['date_added']));
$data['product_quantity'] = $recurring_info['product_quantity'];

$data['recurring_description'] = $recurring_info['recurring_description'];
$data['reference'] = $recurring_info['reference'];

$data['product'] = $this->url->link('product/product', 'product_id=' . $recurring['product_id'], true);
$data['order'] = $this->url->link('account/order/info', 'order_id=' . $recurring['order_id'], true);

// Transactions
$data['transactions'] = array();

Expand All @@ -193,11 +194,15 @@ public function info() {
$data['transactions'][] = array(
'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
'type' => $result['type'],
'amount' => $this->currency->format($result['amount'], $recurring_info['currency'])
'amount' => $this->currency->format($result['amount'], $recurring_info['currency'])
);
}

//$data['buttons'] = $this->load->controller('payment/' . $recurring['payment_code'] . '/recurringButtons');
$data['product'] = $this->url->link('product/product', 'product_id=' . $recurring_info['product_id'], true);
$data['order'] = $this->url->link('account/order/info', 'order_id=' . $recurring_info['order_id'], true);

$data['button'] = $this->load->controller('payment/' . $recurring_info['payment_code'] . '/recurringButtons');

$data['column_left'] = $this->load->controller('common/column_left');
$data['column_right'] = $this->load->controller('common/column_right');
$data['content_top'] = $this->load->controller('common/content_top');
Expand Down
2 changes: 1 addition & 1 deletion upload/catalog/controller/payment/pp_express.php
Original file line number Diff line number Diff line change
Expand Up @@ -1981,7 +1981,7 @@ protected function validateReward() {
public function recurringButtons() {
$this->load->language('payment/pp_express');

$recurring = $this->model_account_recurring->getProfile($this->request->get['recurring_id']);
$recurring = $this->model_account_recurring->getProfile($this->request->get['order_recurring_id']);

$data['buttons'] = array();

Expand Down
44 changes: 37 additions & 7 deletions upload/catalog/language/en-gb/account/recurring.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,20 @@

// Text
$_['text_account'] = 'Account';
$_['text_recurring'] = 'Recurring Payment Information';
$_['text_recurring_detail'] = 'Recurring Payment Details';
$_['text_order_recurring_id'] = 'Recurring ID:';
$_['text_date_added'] = 'Date Added:';
$_['text_status'] = 'Status:';
$_['text_payment_method'] = 'Payment method:';


$_['text_order_id'] = 'Order ID: ';
$_['text_product'] = 'Product: ';

$_['text_quantity'] = 'Quantity: ';

$_['text_recurring'] = 'Recurring Payment Information';




Expand All @@ -20,12 +27,11 @@
$_['text_transaction'] = 'Transactions';


$_['text_order_recurring_id'] = 'Recurring ID: ';
$_['text_payment_method'] = 'Payment method: ';
$_['text_date_added'] = 'Date Added';
$_['text_recurring_description'] = 'Description';
$_['text_status'] = 'Status:';
$_['text_reference'] = 'Reference:';



$_['text_description'] = 'Description';
$_['text_reference'] = 'Reference';


$_['text_empty'] = 'No recurring payments found!';
Expand Down Expand Up @@ -79,6 +85,30 @@
8 => $this->language->get('text_transaction_outstanding_failed'),
9 => $this->language->get('text_transaction_expired'),
);
private $recurring_status = array(
0 => 'Inactive',
1 => 'Active',
2 => 'Suspended',
3 => 'Cancelled',
4 => 'Expired / Complete'
);
private $transaction_type = array(
0 => 'Created',
1 => 'Payment',
2 => 'Outstanding payment',
3 => 'Payment skipped',
4 => 'Payment failed',
5 => 'Cancelled',
6 => 'Suspended',
7 => 'Suspended from failed payment',
8 => 'Outstanding payment failed',
9 => 'Expired'
);
*/


Expand Down
1 change: 1 addition & 0 deletions upload/catalog/language/en-gb/en-gb.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
$_['text_all_zones'] = 'All Zones';
$_['text_pagination'] = 'Showing %d to %d of %d (%d Pages)';
$_['text_loading'] = 'Loading...';
$_['text_no_results'] = 'No results!';

// Buttons
$_['button_address_add'] = 'Add Address';
Expand Down
21 changes: 0 additions & 21 deletions upload/catalog/model/account/recurring.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,5 @@
<?php
class ModelAccountRecurring extends Model {
private $recurring_status = array(
0 => 'Inactive',
1 => 'Active',
2 => 'Suspended',
3 => 'Cancelled',
4 => 'Expired / Complete'
);

private $transaction_type = array(
0 => 'Created',
1 => 'Payment',
2 => 'Outstanding payment',
3 => 'Payment skipped',
4 => 'Payment failed',
5 => 'Cancelled',
6 => 'Suspended',
7 => 'Suspended from failed payment',
8 => 'Outstanding payment failed',
9 => 'Expired'
);

public function getOrderRecurring($order_recurring_id) {
$query = $this->db->query("SELECT `or`.*,`o`.`payment_method`,`o`.`payment_code`,`o`.`currency_code` FROM `" . DB_PREFIX . "order_recurring` `or` LEFT JOIN `" . DB_PREFIX . "order` `o` ON `or`.`order_id` = `o`.`order_id` WHERE `or`.`order_recurring_id` = '" . (int)$order_recurring_id . "' AND `o`.`customer_id` = '" . (int)$this->customer->getId() . "'");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,19 @@
</tr>
</thead>
<tbody>
<?php if ($histories) { ?>
<?php foreach ($histories as $history) { ?>
<tr>
<td class="text-left"><?php echo $history['date_added']; ?></td>
<td class="text-left"><?php echo $history['status']; ?></td>
<td class="text-left"><?php echo $history['comment']; ?></td>
</tr>
<?php } ?>
<?php } else { ?>
<tr>
<td colspan="3" class="text-center"><?php echo $text_no_results; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,23 @@
</thead>
<tbody>
<tr>
<td class="text-left" style="width: 50%; vertical-align: top;"><p><b><?php echo $text_order_recurring_id; ?></b> #<?php echo $order_recurring_id; ?></p>
<td class="text-left" style="width: 50%; vertical-align: top;"><b><?php echo $text_order_recurring_id; ?></b> #<?php echo $order_recurring_id; ?><br />
<p><b><?php echo $text_date_added; ?></b> <?php echo $date_added; ?></p>
<p><b><?php echo $text_status; ?></b> <?php echo $recurring_status; ?></p>
<p><b><?php echo $text_status; ?></b> <?php echo $status; ?></p>
<p><b><?php echo $text_payment_method; ?></b> <?php echo $payment_method; ?></p></td>
<td class="left" style="width: 50%; vertical-align: top;"><p><b><?php echo $text_product; ?></b><a href="<?php echo $recurring['product']; ?>"><?php echo $product_name; ?></a></p>
<p><b><?php echo $text_quantity; ?></b> <?php echo $quantity; ?></p>
<p><b><?php echo $text_order_id; ?></b> <a href="<?php echo $recurring['order']; ?>">#<?php echo $order_id; ?></a></p></td>
<td class="left" style="width: 50%; vertical-align: top;">
<p><b><?php echo $text_order_id; ?></b> <a href="<?php echo $order; ?>">#<?php echo $order_id; ?></a></p>

<p><b><?php echo $text_product; ?></b><a href="<?php echo $product; ?>"><?php echo $product_name; ?></a></p>
<p><b><?php echo $text_quantity; ?></b> <?php echo $product_quantity; ?></p>
</td>
</tr>
</tbody>
</table>
<table class="table table-bordered table-hover">
<thead>
<tr>
<td class="text-left"><?php echo $text_recurring_description; ?></td>
<td class="text-left"><?php echo $text_description; ?></td>
<td class="text-left"><?php echo $text_reference; ?></td>
</tr>
</thead>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
</body>
</html>

0 comments on commit 421eb41

Please sign in to comment.