Skip to content

Commit

Permalink
https://github.com/opencart/opencart/issues/11458
Browse files Browse the repository at this point in the history
  • Loading branch information
danielkerr committed Jan 21, 2023
1 parent cfce5ab commit 2da089f
Show file tree
Hide file tree
Showing 6 changed files with 138 additions and 124 deletions.
6 changes: 4 additions & 2 deletions upload/admin/controller/sale/order.php
Expand Up @@ -677,13 +677,14 @@ public function info(): void {
}
}

$subscription_id = 0;
$description = '';

$subscription_info = $this->model_sale_subscription->getSubscriptionByOrderProductId($order_id, $product['order_product_id']);

print_r($subscription_info);

if ($subscription_info) {
$subscription_id = $subscription_info['subscription_id'];

$trial_price = $this->currency->format($subscription_info['trial_price'], $this->config->get('config_currency'));
$trial_cycle = $subscription_info['trial_cycle'];
$trial_frequency = $this->language->get('text_' . $subscription_info['trial_frequency']);
Expand Down Expand Up @@ -711,6 +712,7 @@ public function info(): void {
'name' => $product['name'],
'model' => $product['model'],
'option' => $option_data,
'subscription_id' => $subscription_id,
'subscription' => $description,
'quantity' => $product['quantity'],
'price' => $this->currency->format($product['price'] + ($this->config->get('config_tax') ? $product['tax'] : 0), $order_info['currency_code'], $order_info['currency_value']),
Expand Down
4 changes: 3 additions & 1 deletion upload/admin/controller/sale/subscription.php
Expand Up @@ -351,6 +351,8 @@ public function info(): void {

$this->document->setTitle($this->language->get('heading_title'));

$data['text_form'] = !$subscription_id ? $this->language->get('text_add') : sprintf($this->language->get('text_edit'), $subscription_id);

$url = '';

if (isset($this->request->get['filter_subscription_id'])) {
Expand Down Expand Up @@ -462,7 +464,7 @@ public function info(): void {

$this->load->model('customer/customer');

$data['payment_methods'] = $this->model_customer_customer->getPaymentMethods($order_info['customer_id']);
$data['payment_methods'] = $this->model_customer_customer->getPaymentMethods($data['customer_id']);

if (!empty($subscription_info)) {
$data['customer_payment_id'] = $subscription_info['customer_payment_id'];
Expand Down
239 changes: 124 additions & 115 deletions upload/admin/language/en-gb/sale/order.php
@@ -1,127 +1,136 @@
<?php
// Heading
$_['heading_title'] = 'Orders';
$_['heading_title'] = 'Orders';

// Text
$_['text_success'] = 'Success: You have modified orders!';
$_['text_list'] = 'Order List';
$_['text_add'] = 'Add Order';
$_['text_edit'] = 'Order (#%s)';
$_['text_filter'] = 'Filter';
$_['text_store'] = 'Store';
$_['text_date_added'] = 'Date Added';
$_['text_customer'] = 'Customer';
$_['text_cart_add'] = 'Add Item';
$_['text_product_add'] = 'Add Product';
$_['text_voucher_add'] = 'Add Voucher';
$_['text_points'] = 'Points';
$_['text_reward'] = 'Reward Points';
$_['text_reward_add'] = 'Success: Reward points added!';
$_['text_reward_remove'] = 'Success: Reward points removed!';
$_['text_affiliate'] = 'Affiliate';
$_['text_commission'] = 'Commission';
$_['text_commission_add'] = 'Success: Commission added!';
$_['text_commission_remove'] = 'Success: Commission removed!';
$_['text_restock'] = 'Success: Products have been restocked!';
$_['text_upload'] = 'Your file was successfully uploaded!';
$_['text_subscription'] = 'Subscription';
$_['text_more'] = 'More..';
$_['text_less'] = 'Less..';
$_['text_payment_address'] = 'Payment Address';
$_['text_payment_method'] = 'Payment Method';
$_['text_shipping_address'] = 'Shipping Address';
$_['text_shipping_method'] = 'Shipping Method';
$_['text_comment'] = 'Comment';
$_['text_history'] = 'History';
$_['text_history_add'] = 'Add History';
$_['text_browser'] = 'Browser';
$_['text_ip'] = 'IP Address';
$_['text_forwarded_ip'] = 'Forwarded IP';
$_['text_user_agent'] = 'User Agent';
$_['text_accept_language'] = 'Accept Language';
$_['text_order_id'] = 'Order ID';
$_['text_website'] = 'Web Site';
$_['text_invoice'] = 'Invoice';
$_['text_invoice_no'] = 'Invoice No.';
$_['text_shipping'] = 'Dispatch Note';
$_['text_store_address'] = 'Store Address';
$_['text_store_telephone'] = 'Store Telephone';
$_['text_store_email'] = 'Store E-Mail';
$_['text_customer_email'] = 'Customer E-Mail';
$_['text_missing'] = 'Missing Orders';
$_['text_default'] = 'Default';
$_['text_picklist'] = 'Dispatch Note';
$_['text_success'] = 'Success: You have modified orders!';
$_['text_list'] = 'Order List';
$_['text_add'] = 'Add Order';
$_['text_edit'] = 'Order (#%s)';
$_['text_filter'] = 'Filter';
$_['text_store'] = 'Store';
$_['text_date_added'] = 'Date Added';
$_['text_customer'] = 'Customer';
$_['text_cart_add'] = 'Add Item';
$_['text_product_add'] = 'Add Product';
$_['text_voucher_add'] = 'Add Voucher';
$_['text_points'] = 'Points';
$_['text_reward'] = 'Reward Points';
$_['text_reward_add'] = 'Success: Reward points added!';
$_['text_reward_remove'] = 'Success: Reward points removed!';
$_['text_affiliate'] = 'Affiliate';
$_['text_commission'] = 'Commission';
$_['text_commission_add'] = 'Success: Commission added!';
$_['text_commission_remove'] = 'Success: Commission removed!';
$_['text_restock'] = 'Success: Products have been restocked!';
$_['text_upload'] = 'Your file was successfully uploaded!';
$_['text_subscription'] = 'Subscription';
$_['text_subscription_trial'] = '%s every %d %s(s) for %d payment(s) then ';
$_['text_subscription_duration'] = '%s every %d %s(s) for %d payment(s)';
$_['text_subscription_cancel'] = '%s every %d %s(s) until canceled';
$_['text_day'] = 'day';
$_['text_week'] = 'week';
$_['text_semi_month'] = 'half-month';
$_['text_month'] = 'month';
$_['text_year'] = 'year';
$_['text_more'] = 'More..';
$_['text_less'] = 'Less..';
$_['text_payment_address'] = 'Payment Address';
$_['text_payment_method'] = 'Payment Method';
$_['text_shipping_address'] = 'Shipping Address';
$_['text_shipping_method'] = 'Shipping Method';
$_['text_comment'] = 'Comment';
$_['text_history'] = 'History';
$_['text_history_add'] = 'Add History';
$_['text_browser'] = 'Browser';
$_['text_ip'] = 'IP Address';
$_['text_forwarded_ip'] = 'Forwarded IP';
$_['text_user_agent'] = 'User Agent';
$_['text_accept_language'] = 'Accept Language';
$_['text_order_id'] = 'Order ID';
$_['text_website'] = 'Web Site';
$_['text_invoice'] = 'Invoice';
$_['text_invoice_no'] = 'Invoice No.';
$_['text_shipping'] = 'Dispatch Note';
$_['text_store_address'] = 'Store Address';
$_['text_store_telephone'] = 'Store Telephone';
$_['text_store_email'] = 'Store E-Mail';
$_['text_customer_email'] = 'Customer E-Mail';
$_['text_customer_telephone'] = 'Customer Telephone';
$_['text_missing'] = 'Missing Orders';
$_['text_default'] = 'Default';
$_['text_picklist'] = 'Dispatch Note';

// Column
$_['column_order_id'] = 'Order ID';
$_['column_customer'] = 'Customer';
$_['column_store'] = 'Store';
$_['column_status'] = 'Status';
$_['column_date_added'] = 'Date Added';
$_['column_date_modified'] = 'Date Modified';
$_['column_total'] = 'Total';
$_['column_product'] = 'Product';
$_['column_model'] = 'Model';
$_['column_quantity'] = 'Quantity';
$_['column_price'] = 'Unit Price';
$_['column_comment'] = 'Comment';
$_['column_notify'] = 'Customer Notified';
$_['column_location'] = 'Location';
$_['column_reference'] = 'Reference';
$_['column_weight'] = 'Product Weight';
$_['column_action'] = 'Action';
$_['column_order_id'] = 'Order ID';
$_['column_customer'] = 'Customer';
$_['column_store'] = 'Store';
$_['column_status'] = 'Status';
$_['column_date_added'] = 'Date Added';
$_['column_date_modified'] = 'Date Modified';
$_['column_total'] = 'Total';
$_['column_product'] = 'Product';
$_['column_model'] = 'Model';
$_['column_quantity'] = 'Quantity';
$_['column_price'] = 'Unit Price';
$_['column_comment'] = 'Comment';
$_['column_notify'] = 'Customer Notified';
$_['column_location'] = 'Location';
$_['column_reference'] = 'Reference';
$_['column_weight'] = 'Product Weight';
$_['column_action'] = 'Action';

// Entry
$_['entry_store'] = 'Store';
$_['entry_customer'] = 'Customer';
$_['entry_customer_group'] = 'Customer Group';
$_['entry_firstname'] = 'First Name';
$_['entry_lastname'] = 'Last Name';
$_['entry_email'] = 'E-Mail';
$_['entry_telephone'] = 'Telephone';
$_['entry_address'] = 'Choose Address';
$_['entry_company'] = 'Company';
$_['entry_address_1'] = 'Address 1';
$_['entry_address_2'] = 'Address 2';
$_['entry_city'] = 'City';
$_['entry_postcode'] = 'Postcode';
$_['entry_country'] = 'Country';
$_['entry_zone'] = 'Region / State';
$_['entry_product'] = 'Choose Product';
$_['entry_option'] = 'Choose Option(s)';
$_['entry_subscription'] = 'Choose Subscription';
$_['entry_quantity'] = 'Quantity';
$_['entry_to_name'] = 'Recipient\'s Name';
$_['entry_to_email'] = 'Recipient\'s E-mail';
$_['entry_from_name'] = 'Sender\'s Name';
$_['entry_from_email'] = 'Sender\'s E-mail';
$_['entry_theme'] = 'Gift Certificate Theme';
$_['entry_message'] = 'Message';
$_['entry_amount'] = 'Amount';
$_['entry_order_status'] = 'Order Status';
$_['entry_notify'] = 'Notify Customer';
$_['entry_override'] = 'Override';
$_['entry_comment'] = 'Comment';
$_['entry_language'] = 'Language';
$_['entry_currency'] = 'Currency';
$_['entry_coupon'] = 'Coupon';
$_['entry_voucher'] = 'Voucher';
$_['entry_reward'] = 'Use Reward Points';
$_['entry_shipping_method'] = 'Shipping Method';
$_['entry_payment_method'] = 'Payment Method';
$_['entry_order_id'] = 'Order ID';
$_['entry_total'] = 'Total';
$_['entry_date_from'] = 'Date From';
$_['entry_date_to'] = 'Date To';
$_['entry_store'] = 'Store';
$_['entry_customer'] = 'Customer';
$_['entry_customer_group'] = 'Customer Group';
$_['entry_firstname'] = 'First Name';
$_['entry_lastname'] = 'Last Name';
$_['entry_email'] = 'E-Mail';
$_['entry_telephone'] = 'Telephone';
$_['entry_address'] = 'Choose Address';
$_['entry_company'] = 'Company';
$_['entry_address_1'] = 'Address 1';
$_['entry_address_2'] = 'Address 2';
$_['entry_city'] = 'City';
$_['entry_postcode'] = 'Postcode';
$_['entry_country'] = 'Country';
$_['entry_zone'] = 'Region / State';
$_['entry_product'] = 'Choose Product';
$_['entry_option'] = 'Choose Option(s)';
$_['entry_subscription'] = 'Choose Subscription';
$_['entry_quantity'] = 'Quantity';
$_['entry_to_name'] = 'Recipient\'s Name';
$_['entry_to_email'] = 'Recipient\'s E-mail';
$_['entry_from_name'] = 'Sender\'s Name';
$_['entry_from_email'] = 'Sender\'s E-mail';
$_['entry_theme'] = 'Gift Certificate Theme';
$_['entry_message'] = 'Message';
$_['entry_amount'] = 'Amount';
$_['entry_order_status'] = 'Order Status';
$_['entry_notify'] = 'Notify Customer';
$_['entry_override'] = 'Override';
$_['entry_comment'] = 'Comment';
$_['entry_language'] = 'Language';
$_['entry_currency'] = 'Currency';
$_['entry_coupon'] = 'Coupon';
$_['entry_voucher'] = 'Voucher';
$_['entry_reward'] = 'Use Reward Points';
$_['entry_shipping_method'] = 'Shipping Method';
$_['entry_payment_method'] = 'Payment Method';
$_['entry_order_id'] = 'Order ID';
$_['entry_total'] = 'Total';
$_['entry_date_from'] = 'Date From';
$_['entry_date_to'] = 'Date To';

// Help
$_['help_override'] = 'If the customers order is being blocked from changing the order status due to an anti-fraud extension enable override.';
$_['help_override'] = 'If the customers order is being blocked from changing the order status due to an anti-fraud extension enable override.';

// Error
$_['error_warning'] = 'Warning: Please check the form carefully for errors!';
$_['error_permission'] = 'Warning: You do not have permission to modify orders!';
$_['error_invoice_no'] = 'Warning: Invoice No. has already been created!';
$_['error_order'] = 'Warning: Order does not exist!';
$_['error_affiliate'] = 'Warning: Affiliate does not exist!';
$_['error_reward_add'] = 'Warning: Reward points for this order has already been added!';
$_['error_commission_add'] = 'Warning: Affiliate commission for this order has already been added!';
$_['error_warning'] = 'Warning: Please check the form carefully for errors!';
$_['error_permission'] = 'Warning: You do not have permission to modify orders!';
$_['error_invoice_no'] = 'Warning: Invoice No. has already been created!';
$_['error_order'] = 'Warning: Order does not exist!';
$_['error_affiliate'] = 'Warning: Affiliate does not exist!';
$_['error_reward_add'] = 'Warning: Reward points for this order has already been added!';
$_['error_commission_add'] = 'Warning: Affiliate commission for this order has already been added!';
3 changes: 2 additions & 1 deletion upload/admin/language/en-gb/sale/subscription.php
Expand Up @@ -5,8 +5,9 @@
// Text
$_['text_success'] = 'Success: You have modified subscriptions!';
$_['text_list'] = 'Subscription List';
$_['text_add'] = 'Add Subscription';
$_['text_edit'] = 'Subscription (#%s)';
$_['text_filter'] = 'Filter';
$_['text_subscription'] = 'Subscription Details';
$_['text_subscription_id'] = 'Subscription ID';
$_['text_order_id'] = 'Order ID';
$_['text_customer'] = 'Customer';
Expand Down
8 changes: 4 additions & 4 deletions upload/admin/view/template/sale/order_info.twig
Expand Up @@ -84,12 +84,12 @@

{% if order_product.reward %}
<br/>
<small> - {{ text_points }} {{ order_product.reward }}</small>
<small> - {{ text_points }}: {{ order_product.reward }}</small>
{% endif %}

{% if order_product.subscription %}
<br/>
<small> - {{ text_subscription }}: {{ order_product.subscription }}</small>
<small> - {{ text_subscription }}: <a href="index.php?route=sale/subscription.info&user_token={{ user_token }}&subscription_id={{ order_product.subscription_id }}" target="_blank">{{ order_product.subscription }}</a></small>
{% endif %}

</td>
Expand Down Expand Up @@ -2660,12 +2660,12 @@ $('#button-refresh').on('click', function () {
if (product['reward']) {
html += '<br/>';
html += ' - <small>{{ text_points }} ' + product['reward'] + '</small>';
html += ' - <small>{{ text_points }}: ' + product['reward'] + '</small>';
}
if (product['subscription']) {
html += '<br/>';
html += ' - <small>{{ text_subscription }} ' + product['subscription'] + '</small>';
html += ' - <small>{{ text_subscription }}: <a href="index.php?route=sale/subscription.info&user_token={{ user_token }}&subscription_id={{ order_product.subscription_id }}" target="_blank">' + product['subscription'] + '</small>';
}
html += ' </td>';
Expand Down
2 changes: 1 addition & 1 deletion upload/admin/view/template/sale/subscription_info.twig
Expand Up @@ -13,7 +13,7 @@
</div>
<div class="container-fluid">
<div class="card mb-3">
<div class="card-header">{{ text_subscription }}</div>
<div class="card-header"><i class="fa-solid fa-info-circle"></i> {{ text_form }}</div>
<div class="card-body">

<form id="form-subscription">
Expand Down

0 comments on commit 2da089f

Please sign in to comment.