catalog/controller/extension/total/voucher.php
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
class ControllerExtensionTotalVoucher extends Controller {
public function index() {
if ($this->config->get('total_voucher_status')) {
$this->load->language('extension/total/voucher');
if (isset($this->session->data['voucher'])) {
$data['voucher'] = $this->session->data['voucher'];
} else {
$data['voucher'] = '';
}
return $this->load->view('extension/total/voucher', $data);
}
}
public function voucher() {
$this->load->language('extension/total/voucher');
$json = array();
$this->load->model('extension/total/voucher');
if (isset($this->request->post['voucher'])) {
$voucher = $this->request->post['voucher'];
} else {
$voucher = '';
}
$voucher_info = $this->model_extension_total_voucher->getVoucher($voucher);
if (empty($this->request->post['voucher'])) {
$json['error'] = $this->language->get('error_empty');
} elseif ($voucher_info) {
$this->session->data['voucher'] = $this->request->post['voucher'];
$this->session->data['success'] = $this->language->get('text_success');
$json['redirect'] = $this->url->link('checkout/cart');
} else {
$json['error'] = $this->language->get('error_voucher');
}
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($json));
}
public function send($route, $args, $output) {
$this->load->model('checkout/order');
$order_info = $this->model_checkout_order->getOrder($args[0]);
// If order status in the complete range create any vouchers that where in the order need to be made available.
if (in_array($order_info['order_status_id'], $this->config->get('config_complete_status'))) {
$voucher_query = $this->db->query("SELECT *, vtd.name AS theme FROM `" . DB_PREFIX . "voucher` v LEFT JOIN " . DB_PREFIX . "voucher_theme vt ON (v.voucher_theme_id = vt.voucher_theme_id) LEFT JOIN " . DB_PREFIX . "voucher_theme_description vtd ON (vt.voucher_theme_id = vtd.voucher_theme_id) WHERE v.order_id = '" . (int)$order_info['order_id'] . "' AND vtd.language_id = '" . (int)$order_info['language_id'] . "'");
if ($voucher_query->num_rows) {
// Send out any gift voucher mails
$language = new Language($order_info['language_code']);
$language->load($order_info['language_code']);
后面还有 43 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
