Skip to content

Commit

Permalink
More work on extension/other/recurring getReport() method
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCartpenter committed Jun 18, 2024
1 parent c92ac1b commit 8cc534e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
18 changes: 6 additions & 12 deletions upload/admin/controller/extension/other/recurring.php
Original file line number Diff line number Diff line change
Expand Up @@ -568,9 +568,6 @@ public function getReport(): ?\Action {
// Recurring
$this->load->model('extension/other/recurring');

// Products
$this->load->model('catalog/product');

$frequencies = [
'day' => $this->language->get('text_day'),
'week' => $this->language->get('text_week'),
Expand Down Expand Up @@ -614,27 +611,24 @@ public function getReport(): ?\Action {
$store_name = html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8');
}

// Products
$product_info = $this->model_catalog_product->getProduct($result['product_id']);

if ($product_info) {
$product_name = html_entity_decode($product_info['name'], ENT_QUOTES, 'UTF-8');
if ($result['product_name']) {
$name = html_entity_decode($result['product_name'], ENT_QUOTES, 'UTF-8');
} else {
$product_name = '';
$name = html_entity_decode($result['recurring_name'], ENT_QUOTES, 'UTF-8');
}

// Recurring
$recurring = '';

if ($result['recurring_duration']) {
$recurring .= sprintf($this->language->get('text_payment_description'), $this->currency->format($this->tax->calculate($result['recurring_price'] * $result['product_quantity'], $product_info['tax_class_id'], $this->config->get('config_tax')), $this->config->get('config_currency')), $result['recurring_cycle'], $frequencies[$result['recurring_frequency']], $result['recurring_duration']);
$recurring .= sprintf($this->language->get('text_payment_description'), $this->currency->format($result['recurring_price'] * $result['product_quantity'], $this->config->get('config_tax')), $result['recurring_cycle'], $frequencies[$result['recurring_frequency']], $result['recurring_duration']);
} else {
$recurring .= sprintf($this->language->get('text_payment_cancel'), $this->currency->format($this->tax->calculate($result['recurring_price'] * $result['product_quantity'], $product_info['tax_class_id'], $this->config->get('config_tax')), $this->config->get('config_currency')), $result['recurring_cycle'], $frequencies[$result['recurring_frequency']], $result['recurring_duration']);
$recurring .= sprintf($this->language->get('text_payment_cancel'), $this->currency->format($result['recurring_price'] * $result['product_quantity'], $this->config->get('config_tax')), $result['recurring_cycle'], $frequencies[$result['recurring_frequency']], $result['recurring_duration']);
}

// Only pull unique order recurring
$data['recurrings'][] = [
'product_name' => $product_name,
'name' => $name,
'store_name' => $store_name,
'recurring' => $recurring
];
Expand Down
4 changes: 2 additions & 2 deletions upload/admin/language/en-gb/extension/other/db_schema.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
// Heading
$_['heading_title'] = 'Database Schema (developers)';
$_['heading_title'] = 'Database Schema - Developers';

// Text
$_['text_extension'] = 'Extensions';
Expand All @@ -10,7 +10,7 @@
$_['text_parent'] = 'Parent Table';
$_['text_child'] = 'Table Relationships';
$_['text_index'] = 'Index';
$_['text_unverified'] = 'Extensions or Unverified';
$_['text_unverified'] = 'Extensions (unsupported)';

// Column
$_['column_table'] = 'Table';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</thead>
<tbody>
<tr>
<td style="width: 33%;">{{ recurring.product_name }}</td>
<td style="width: 33%;">{{ recurring.name }}</td>
<td style="width: 33%;">
<address>
<strong>{{ recurring.store_name }}</strong>
Expand Down

0 comments on commit 8cc534e

Please sign in to comment.