Как показать информацию о заказе на странице успеха проверки в Opencart 2x

Я пытаюсь показать детали заказа для успешных заказов на странице успеха, но не могу этого сделать. Другой ответ здесь предлагает изменить success.php и success.tpl, но он не работает на Opencart 2.

Что я пробовал?

каталог / контроллер / контроль / Success.php

и добавили новые строки в следующий код:

public function index() { $this->data['order_id'] = 0; // <-- NEW LINE $this->data['total'] = 0; // <-- NEW LINE if (isset($this->session->data['order_id'])) { $this->data['order_id'] = $this->session->data['order_id']; // <-- NEW LINE $this->data['total'] = $this->cart->getTotal(); // <-- NEW LINE $this->cart->clear(); unset($this->session->data['shipping_method']); unset($this->session->data['shipping_methods']); unset($this->session->data['payment_method']); unset($this->session->data['payment_methods']); unset($this->session->data['guest']); unset($this->session->data['comment']); unset($this->session->data['order_id']); unset($this->session->data['coupon']); unset($this->session->data['reward']); unset($this->session->data['voucher']); unset($this->session->data['vouchers']); } $this->language->load('checkout/success'); 

Теперь добавлен следующий код в success.tpl

 <?php if($order_id) { ?> <script type="text/javascript"> // Some code here arr.push([ "create_order", {order_id: '<?php echo $order_id; ?>', sum: '<?php echo $total; ?>'} ]); 

Но на странице успеха ничего не отображается. Вышеприведенный код предназначен для отображения идентификатора заказа и общего количества, но я хочу показать все детали заказа, включая имя, адрес, продукты, общее количество, доставку и т. Д. Так же, как в счете-фактуре заказа.

Любая помощь будет оценена. спасибо

То, что я делал в версиях до 2.0, состояло в том, чтобы фактически установить новую переменную в сеанс для идентификатора заказа, поскольку я обнаружил, что $this->session->data['order_id'] не был согласованным, а иногда к тому времени не был $this->session->data['order_id'] пользователь достиг ControllerCheckoutSuccess .

Если вы хотите использовать этот подход, отредактируйте файл catalog/model/checkout/order.php . На или около строки 302 (в методе addOrderHistory) вы увидите, где скрипт проверяет идентификаторы статуса заказа, чтобы определить, должен ли он выполнить заказ.

Внутри этого оператора установите новую переменную сеанса по вашему выбору на переданный идентификатор заказа, возможно, $this->session->data['customer_order_id'] = $order_id

Теперь у вас есть переменная сеанса, которая, как вы знаете, будет оставаться последовательной, так как вы ее создали самостоятельно, и OpenCart не будет с ней связываться.

Если вы обнаружите, что идентификатор порядка сеанса IS остается согласованным в 2.1>, тогда не беспокойтесь об этом, просто продолжайте использовать переменную идентификатора заказа по умолчанию, встроенную.

Следующим шагом будет выбор того, как вы хотите загружать данные своего счета через PHP или Ajax. Я бы не рекомендовал использовать Ajax, так как это можно было бы манипулировать с помощью инструментов разработчика браузера и может раскрывать информацию другого пользователя. Используя PHP и сеанс, вы устраняете этот риск, поскольку случайный хакер не будет иметь доступа к сеансу другого клиента.

НЕОБХОДИМ ДЛЯ ВАШИХ ВАРИАНТОВ НИЖЕ:

Открыть catalog/controller/checkout/success.php

Сразу после загрузки языкового файла в ваш индексный метод добавьте следующее:

 $order_id = false; // If NOT using the custom variable mentioned SKIP this if (isset($this->session->data['customer_order_id'])) { $order_id = $this->session->data['customer_order_id']; } 

Если вы используете испеченный идентификатор заказа данных сеанса, установите идентификатор заказа в этом выражении:

 if (isset($this->session->data['order_id'])) { $this->cart->clear(); $order_id = $this->session->data['order_id']; 

ОПЦИЯ 1:

Добавьте данные квитанции для проверки / успеха.

Найдите эту строку:

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

Должно быть вокруг линии 77-84 или около того.

Здесь вы будете загружать и форматировать всю информацию о квитанции.

Открыть catalog/controller/account/order.php

В строке 108 вы найдете info метод.

Вот где начинается забава: P

Скопируйте всю соответствующую информацию из этого метода в ваш контрольный контроллер успеха сразу после $data['button_continue'] = $this->language->get('button_continue'); линия, упомянутая выше.

Вам нужно пройти эту линию за строкой и настроить ее, потому что помните, что она предназначена для входа в систему клиентов, поэтому вам не нужны ссылки для возврата или переупорядочения и т. Д.

Затем вы захотите создать новый шаблон, потому что шаблон common/success является общим и используется повсеместно.

Копировать catalog/view/theme/(your theme)/template/common/success.tpl

to: catalog/view/theme/(your theme)/template/checkout/success.tpl

Открыть catalog/view/theme/default/template/account/order_info.tpl

Таблицы, которые вам нужно добавить к шаблону успеха, начинаются в строке 28 и расширяются до строки 139. Если вы используете другую тему, вам нужно будет решить эту проблему самостоятельно.

Не забудьте изменить путь к вашему шаблону в checkout/success контроллере checkout/success в новом файле tout.

ЗАМЕТКА:

Важно помнить, что все это СЛЕДУЕТ делать в пакете модификации и НЕ в ваших основных файлах, но я не знаю вашей ситуации, так что вам решать.

ВАРИАНТ 2:

Создайте свой собственный модуль.

По-моему, построив для этой системы с версии 1.4, это лучший вариант.

Создайте новый контроллер в модулях, назовем его ControllerModuleReceipt :

 <?php /** * Controller class for displaying a receipt on checkout success. */ class ControllerModuleReceipt extends Controller { /** * Replicates the ControllerAccountOrder::info * method for displaying order info in our * ControllerCheckoutSuccess::index method * * @param int $order_id our order id * @return mixed receipt view */ public function index($setting) { $this->load->language('account/order'); $this->load->model('account/order'); if (empty($setting['order_id'])) { return; } $order_id = $setting['order_id']; $order_info = $this->model_account_order->getOrder($order_id); if ($order_info) { $data['text_order_detail'] = $this->language->get('text_order_detail'); $data['text_invoice_no'] = $this->language->get('text_invoice_no'); $data['text_order_id'] = $this->language->get('text_order_id'); $data['text_date_added'] = $this->language->get('text_date_added'); $data['text_shipping_method'] = $this->language->get('text_shipping_method'); $data['text_shipping_address'] = $this->language->get('text_shipping_address'); $data['text_payment_method'] = $this->language->get('text_payment_method'); $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['column_name'] = $this->language->get('column_name'); $data['column_model'] = $this->language->get('column_model'); $data['column_quantity'] = $this->language->get('column_quantity'); $data['column_price'] = $this->language->get('column_price'); $data['column_total'] = $this->language->get('column_total'); $data['column_action'] = $this->language->get('column_action'); $data['column_date_added'] = $this->language->get('column_date_added'); $data['column_status'] = $this->language->get('column_status'); $data['column_comment'] = $this->language->get('column_comment'); $data['invoice_no'] = ''; if ($order_info['invoice_no']) { $data['invoice_no'] = $order_info['invoice_prefix'] . $order_info['invoice_no']; } $data['order_id'] = $order_id; $data['date_added'] = date($this->language->get('date_format_short'), strtotime($order_info['date_added'])); $format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}'; if ($order_info['payment_address_format']) { $format = $order_info['payment_address_format']; } $find = array( '{firstname}', '{lastname}', '{company}', '{address_1}', '{address_2}', '{city}', '{postcode}', '{zone}', '{zone_code}', '{country}' ); $replace = array( 'firstname' => $order_info['payment_firstname'], 'lastname' => $order_info['payment_lastname'], 'company' => $order_info['payment_company'], 'address_1' => $order_info['payment_address_1'], 'address_2' => $order_info['payment_address_2'], 'city' => $order_info['payment_city'], 'postcode' => $order_info['payment_postcode'], 'zone' => $order_info['payment_zone'], 'zone_code' => $order_info['payment_zone_code'], 'country' => $order_info['payment_country'] ); $data['payment_address'] = str_replace(array("\r\n", "\r", "\n"), '<br />', preg_replace(array("/\s\s+/", "/\r\r+/", "/\n\n+/"), '<br />', trim(str_replace($find, $replace, $format)))); $data['payment_method'] = $order_info['payment_method']; $format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}'; if ($order_info['shipping_address_format']) { $format = $order_info['shipping_address_format']; } $find = array( '{firstname}', '{lastname}', '{company}', '{address_1}', '{address_2}', '{city}', '{postcode}', '{zone}', '{zone_code}', '{country}' ); $replace = array( 'firstname' => $order_info['shipping_firstname'], 'lastname' => $order_info['shipping_lastname'], 'company' => $order_info['shipping_company'], 'address_1' => $order_info['shipping_address_1'], 'address_2' => $order_info['shipping_address_2'], 'city' => $order_info['shipping_city'], 'postcode' => $order_info['shipping_postcode'], 'zone' => $order_info['shipping_zone'], 'zone_code' => $order_info['shipping_zone_code'], 'country' => $order_info['shipping_country'] ); $data['shipping_address'] = str_replace(array("\r\n", "\r", "\n"), '<br />', preg_replace(array("/\s\s+/", "/\r\r+/", "/\n\n+/"), '<br />', trim(str_replace($find, $replace, $format)))); $data['shipping_method'] = $order_info['shipping_method']; $this->load->model('catalog/product'); $this->load->model('tool/upload'); // Products $data['products'] = array(); $products = $this->model_account_order->getOrderProducts($this->request->get['order_id']); foreach ($products as $product) { $option_data = array(); $options = $this->model_account_order->getOrderOptions($this->request->get['order_id'], $product['order_product_id']); foreach ($options as $option) { $value = false; if ($option['type'] == 'file') { $upload_info = $this->model_tool_upload->getUploadByCode($option['value']); if ($upload_info) { $value = $upload_info['name']; } } if (! $value) { $value = $option['value']; } $option_data[] = array( 'name' => $option['name'], 'value' => (utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value) ); } $product_info = $this->model_catalog_product->getProduct($product['product_id']); $data['products'][] = array( 'name' => $product['name'], 'model' => $product['model'], 'option' => $option_data, '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']), 'total' => $this->currency->format($product['total'] + ($this->config->get('config_tax') ? ($product['tax'] * $product['quantity']) : 0), $order_info['currency_code'], $order_info['currency_value']) ); } // Voucher $data['vouchers'] = array(); $vouchers = $this->model_account_order->getOrderVouchers($this->request->get['order_id']); foreach ($vouchers as $voucher) { $data['vouchers'][] = array( 'description' => $voucher['description'], 'amount' => $this->currency->format($voucher['amount'], $order_info['currency_code'], $order_info['currency_value']) ); } // Totals $data['totals'] = array(); $totals = $this->model_account_order->getOrderTotals($this->request->get['order_id']); foreach ($totals as $total) { $data['totals'][] = array( 'title' => $total['title'], 'text' => $this->currency->format($total['value'], $order_info['currency_code'], $order_info['currency_value']), ); } $data['comment'] = nl2br($order_info['comment']); if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/receipt.tpl')) { return $this->load->view($this->config->get('config_template') . '/template/module/receipt.tpl', $data); } else { return $this->load->view('default/template/module/receipt.tpl', $data); } } } } 

ШАБЛОН:

Затем создадим шаблон в catalog/views/theme/default/module/receipt.tpl

 <table class="table table-bordered table-hover"> <thead> <tr> <td class="text-left" colspan="2"><?= $text_order_detail; ?></td> </tr> </thead> <tbody> <tr> <td class="text-left" style="width: 50%;"><?php if ($invoice_no): ?> <b><?= $text_invoice_no; ?></b> <?= $invoice_no; ?><br /> <?php endif; ?> <b><?= $text_order_id; ?></b> #<?= $order_id; ?><br /> <b><?= $text_date_added; ?></b> <?= $date_added; ?></td> <td class="text-left"><?php if ($payment_method): ?> <b><?= $text_payment_method; ?></b> <?= $payment_method; ?><br /> <?php endif; ?> <?php if ($shipping_method): ?> <b><?= $text_shipping_method; ?></b> <?= $shipping_method; ?> <?php endif; ?></td> </tr> </tbody> </table> <table class="table table-bordered table-hover"> <thead> <tr> <td class="text-left" style="width: 50%;"><?= $text_payment_address; ?></td> <?php if ($shipping_address): ?> <td class="text-left"><?= $text_shipping_address; ?></td> <?php endif; ?> </tr> </thead> <tbody> <tr> <td class="text-left"><?= $payment_address; ?></td> <?php if ($shipping_address): ?> <td class="text-left"><?= $shipping_address; ?></td> <?php endif; ?> </tr> </tbody> </table> <div class="table-responsive"> <table class="table table-bordered table-hover"> <thead> <tr> <td class="text-left"><?= $column_name; ?></td> <td class="text-left"><?= $column_model; ?></td> <td class="text-right"><?= $column_quantity; ?></td> <td class="text-right"><?= $column_price; ?></td> <td class="text-right"><?= $column_total; ?></td> <?php if ($products): ?> <td style="width: 20px;"></td> <?php endif; ?> </tr> </thead> <tbody> <?php foreach ($products as $product): ?> <tr> <td class="text-left"><?= $product['name']; ?> <?php foreach ($product['option'] as $option): ?> <br /> &nbsp;<small> - <?= $option['name']; ?>: <?= $option['value']; ?></small> <?php endforeach; ?></td> <td class="text-left"><?= $product['model']; ?></td> <td class="text-right"><?= $product['quantity']; ?></td> <td class="text-right"><?= $product['price']; ?></td> <td class="text-right"><?= $product['total']; ?></td> <td class="text-right" style="white-space: nowrap;"><?php if ($product['reorder']): ?> <a href="<?= $product['reorder']; ?>" data-toggle="tooltip" title="<?= $button_reorder; ?>" class="btn btn-primary"><i class="fa fa-shopping-cart"></i></a> <?php endif; ?> <a href="<?= $product['return']; ?>" data-toggle="tooltip" title="<?= $button_return; ?>" class="btn btn-danger"><i class="fa fa-reply"></i></a></td> </tr> <?php endforeach; ?> <?php foreach ($vouchers as $voucher): ?> <tr> <td class="text-left"><?= $voucher['description']; ?></td> <td class="text-left"></td> <td class="text-right">1</td> <td class="text-right"><?= $voucher['amount']; ?></td> <td class="text-right"><?= $voucher['amount']; ?></td> <?php if ($products): ?> <td></td> <?php endif; ?> </tr> <?php endforeach; ?> </tbody> <tfoot> <?php foreach ($totals as $total): ?> <tr> <td colspan="3"></td> <td class="text-right"><b><?= $total['title']; ?></b></td> <td class="text-right"><?= $total['text']; ?></td> <?php if ($products): ?> <td></td> <?php endif; ?> </tr> <?php endforeach; ?> </tfoot> </table> </div> <?php if ($comment): ?> <table class="table table-bordered table-hover"> <thead> <tr> <td class="text-left"><?= $text_comment; ?></td> </tr> </thead> <tbody> <tr> <td class="text-left"><?= $comment; ?></td> </tr> </tbody> </table> <?php endif; ?> 

Еще раз, если вы используете свою собственную тему, вам нужно будет ее отрегулировать.

ДОБАВИТЬ МОДУЛЬ ДЛЯ ПРОВЕРКИ УСПЕХА

Вернемся к контроллеру успеха проверки, мы должны добавить модуль.

Найти $data['content_bottom'] = $this->load->controller('common/content_bottom');

После этой строки добавьте следующее:

 $data['receipt'] = false; if ($order_id) { $data['receipt'] = $this->load->controller('module/receipt', array('order_id' => $order_id)); } 

ДОБАВИТЬ В ШАБЛОН УСПЕХА

Открыть catalog/view/theme/default/common/success.tpl

После <?php echo $text_message; ?> <?php echo $text_message; ?> добавить:

 <?php if ($receipt): ?> <?= $receipt; ?> <?php endif; ?> 

И это должно быть так. Еще раз лучше добавить изменения в основные файлы с помощью модификации, но, создав свой собственный модуль, намного проще добавить модификацию, а тем более справиться.

Я не тестировал код выше, но он должен работать или иметь минимальные ошибки. Не стесняйтесь публиковать какие-либо ошибки, и я буду рад помочь их исправить.

Удивительный код, который работает пост Винса !

Но я нашел некоторые ошибки и уведомления PHP, а таблица продуктов не отображалась, поэтому я сделал некоторые изменения в коде, и теперь он работает на 100%.

Я использовал OPTION 2 и Opencart 2.2 для тестов.

Вот код:

Receipit.php в CONTROLLER / MODULE

 <?php /** * Controller class for displaying a receipt on checkout success. */ class ControllerModuleReceipt extends Controller { /** * Replicates the ControllerAccountOrder::info * method for displaying order info in our * ControllerCheckoutSuccess::index method * * @param int $order_id our order id * @return mixed receipt view */ public function index($setting) { $this->load->language('account/order'); $this->load->model('account/order'); if (empty($setting['order_id'])) { return; } $order_id = $setting['order_id']; $order_info = $this->model_account_order->getOrder($order_id); if ($order_info) { $data['text_order_detail'] = $this->language->get('text_order_detail'); $data['text_invoice_no'] = $this->language->get('text_invoice_no'); $data['text_order_id'] = $this->language->get('text_order_id'); $data['text_date_added'] = $this->language->get('text_date_added'); $data['text_shipping_method'] = $this->language->get('text_shipping_method'); $data['text_shipping_address'] = $this->language->get('text_shipping_address'); $data['text_payment_method'] = $this->language->get('text_payment_method'); $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['column_name'] = $this->language->get('column_name'); $data['column_model'] = $this->language->get('column_model'); $data['column_quantity'] = $this->language->get('column_quantity'); $data['column_price'] = $this->language->get('column_price'); $data['column_total'] = $this->language->get('column_total'); $data['column_action'] = $this->language->get('column_action'); $data['column_date_added'] = $this->language->get('column_date_added'); $data['column_status'] = $this->language->get('column_status'); $data['column_comment'] = $this->language->get('column_comment'); $data['invoice_no'] = ''; if ($order_info['invoice_no']) { $data['invoice_no'] = $order_info['invoice_prefix'] . $order_info['invoice_no']; } $data['order_id'] = $order_id; $data['date_added'] = date($this->language->get('date_format_short'), strtotime($order_info['date_added'])); $format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}'; if ($order_info['payment_address_format']) { $format = $order_info['payment_address_format']; } $find = array( '{firstname}', '{lastname}', '{company}', '{address_1}', '{address_2}', '{city}', '{postcode}', '{zone}', '{zone_code}', '{country}' ); $replace = array( 'firstname' => $order_info['payment_firstname'], 'lastname' => $order_info['payment_lastname'], 'company' => $order_info['payment_company'], 'address_1' => $order_info['payment_address_1'], 'address_2' => $order_info['payment_address_2'], 'city' => $order_info['payment_city'], 'postcode' => $order_info['payment_postcode'], 'zone' => $order_info['payment_zone'], 'zone_code' => $order_info['payment_zone_code'], 'country' => $order_info['payment_country'] ); $data['payment_address'] = str_replace(array("\r\n", "\r", "\n"), '<br />', preg_replace(array("/\s\s+/", "/\r\r+/", "/\n\n+/"), '<br />', trim(str_replace($find, $replace, $format)))); $data['payment_method'] = $order_info['payment_method']; $format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}'; if ($order_info['shipping_address_format']) { $format = $order_info['shipping_address_format']; } $find = array( '{firstname}', '{lastname}', '{company}', '{address_1}', '{address_2}', '{city}', '{postcode}', '{zone}', '{zone_code}', '{country}' ); $replace = array( 'firstname' => $order_info['shipping_firstname'], 'lastname' => $order_info['shipping_lastname'], 'company' => $order_info['shipping_company'], 'address_1' => $order_info['shipping_address_1'], 'address_2' => $order_info['shipping_address_2'], 'city' => $order_info['shipping_city'], 'postcode' => $order_info['shipping_postcode'], 'zone' => $order_info['shipping_zone'], 'zone_code' => $order_info['shipping_zone_code'], 'country' => $order_info['shipping_country'] ); $data['shipping_address'] = str_replace(array("\r\n", "\r", "\n"), '<br />', preg_replace(array("/\s\s+/", "/\r\r+/", "/\n\n+/"), '<br />', trim(str_replace($find, $replace, $format)))); $data['shipping_method'] = $order_info['shipping_method']; $this->load->model('catalog/product'); $this->load->model('tool/upload'); // Products $data['products'] = array(); $products = $this->model_account_order->getOrderProducts($order_id); foreach ($products as $product) { $option_data = array(); $options = $this->model_account_order->getOrderOptions($order_id, $product['order_product_id']); foreach ($options as $option) { $value = false; if ($option['type'] == 'file') { $upload_info = $this->model_tool_upload->getUploadByCode($option['value']); if ($upload_info) { $value = $upload_info['name']; } } if (! $value) { $value = $option['value']; } $option_data[] = array( 'name' => $option['name'], 'value' => (utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value) ); } $product_info = $this->model_catalog_product->getProduct($product['product_id']); $data['products'][] = array( 'name' => $product['name'], 'model' => $product['model'], 'option' => $option_data, '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']), 'total' => $this->currency->format($product['total'] + ($this->config->get('config_tax') ? ($product['tax'] * $product['quantity']) : 0), $order_info['currency_code'], $order_info['currency_value']) ); } // Voucher $data['vouchers'] = array(); $vouchers = $this->model_account_order->getOrderVouchers($order_id); foreach ($vouchers as $voucher) { $data['vouchers'][] = array( 'description' => $voucher['description'], 'amount' => $this->currency->format($voucher['amount'], $order_info['currency_code'], $order_info['currency_value']) ); } // Totals $data['totals'] = array(); $totals = $this->model_account_order->getOrderTotals($order_id); foreach ($totals as $total) { $data['totals'][] = array( 'title' => $total['title'], 'text' => $this->currency->format($total['value'], $order_info['currency_code'], $order_info['currency_value']), ); } $data['comment'] = nl2br($order_info['comment']); if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/receipt.tpl')) { return $this->load->view($this->config->get('config_template') . '/template/module/receipt.tpl', $data); } else { return $this->load->view('/module/receipt.tpl', $data); } } } } 

Receipit.tpl в ШАБЛОНЫ / МОДУЛЬ

 <table class="table table-bordered table-hover"> <thead> <tr> <td class="text-left" colspan="2"><?= $text_order_detail; ?></td> </tr> </thead> <tbody> <tr> <td class="text-left" style="width: 50%;"><?php if ($invoice_no): ?> <b><?= $text_invoice_no; ?></b> <?= $invoice_no; ?><br /> <?php endif; ?> <b><?= $text_order_id; ?></b> #<?= $order_id; ?><br /> <b><?= $text_date_added; ?></b> <?= $date_added; ?></td> <td class="text-left"><?php if ($payment_method): ?> <b><?= $text_payment_method; ?></b> <?= $payment_method; ?><br /> <?php endif; ?> <?php if ($shipping_method): ?> <b><?= $text_shipping_method; ?></b> <?= $shipping_method; ?> <?php endif; ?></td> </tr> </tbody> </table> <table class="table table-bordered table-hover"> <thead> <tr> <td class="text-left" style="width: 50%;"><?= $text_payment_address; ?></td> <?php if ($shipping_address): ?> <td class="text-left"><?= $text_shipping_address; ?></td> <?php endif; ?> </tr> </thead> <tbody> <tr> <td class="text-left"><?= $payment_address; ?></td> <?php if ($shipping_address): ?> <td class="text-left"><?= $shipping_address; ?></td> <?php endif; ?> </tr> </tbody> </table> <div class="table-responsive"> <table class="table table-bordered table-hover"> <thead> <tr> <td class="text-left" style="display: table-cell"><?= $column_name; ?></td> <td class="text-left" style="display: none"><?= $column_model; ?></td> <td class="text-right" style="display: table-cell"><?= $column_quantity; ?></td> <td class="text-right" style="display: table-cell"><?= $column_price; ?></td> <td class="text-right" style="display: table-cell"><?= $column_total; ?></td> </tr> </thead> <tbody> <?php foreach ($products as $product): ?> <tr> <td class="text-left" style="display: table-cell"><?= $product['name']; ?> <?php foreach ($product['option'] as $option): ?> <br /> &nbsp;<small> - <?= $option['name']; ?>: <?= $option['value']; ?></small> <?php endforeach; ?></td> <td class="text-left" style="display: none"><?= $product['model']; ?></td> <td class="text-right" style="display: table-cell"><?= $product['quantity']; ?></td> <td class="text-right" style="display: table-cell"><?= $product['price']; ?></td> <td class="text-right" style="display: table-cell"><?= $product['total']; ?></td> </tr> <?php endforeach; ?> <?php foreach ($vouchers as $voucher): ?> <tr> <td class="text-left"><?= $voucher['description']; ?></td> <td class="text-left"></td> <td class="text-right">1</td> <td class="text-right"><?= $voucher['amount']; ?></td> <td class="text-right"><?= $voucher['amount']; ?></td> </tr> <?php endforeach; ?> </tbody> <tfoot> <?php foreach ($totals as $total): ?> <tr> <td colspan="2"></td> <td class="text-right"><b><?= $total['title']; ?></b></td> <td class="text-right"><?= $total['text']; ?></td> </tr> <?php endforeach; ?> </tfoot> </table> </div> <?php if ($comment): ?> <table class="table table-bordered table-hover"> <thead> <tr> <td class="text-left"><?= $text_comment; ?></td> </tr> </thead> <tbody> <tr> <td class="text-left"><?= $comment; ?></td> </tr> </tbody> </table> <?php endif; ?> 

ЗАМЕТКА

Прежде чем вводить коды в вашем магазине, протестируйте резервную копию, чтобы убедиться, что ваш магазин не будет поврежден.

Если у этого кода есть недостатки, пожалуйста, дайте мне знать здесь

Благодаря!