first commit

This commit is contained in:
Konstantin
2026-05-30 09:27:58 +03:00
commit de0344d218
2371 changed files with 661486 additions and 0 deletions
@@ -0,0 +1,242 @@
<?php
class ModelExtensionTotalCoupon extends Model {
public function getCoupon($code) {
$status = true;
$coupon_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "coupon` WHERE code = '" . $this->db->escape($code) . "' AND ((date_start = '0000-00-00' OR date_start < NOW()) AND (date_end = '0000-00-00' OR date_end > NOW())) AND status = '1'");
if ($coupon_query->num_rows) {
if ($coupon_query->row['total'] > $this->cart->getSubTotal()) {
$status = false;
}
$coupon_total = $this->getTotalCouponHistoriesByCoupon($code);
if ($coupon_query->row['uses_total'] > 0 && ($coupon_total >= $coupon_query->row['uses_total'])) {
$status = false;
}
if ($coupon_query->row['logged'] && !$this->customer->getId()) {
$status = false;
}
if ($this->customer->getId()) {
$customer_total = $this->getTotalCouponHistoriesByCustomerId($code, $this->customer->getId());
if ($coupon_query->row['uses_customer'] > 0 && ($customer_total >= $coupon_query->row['uses_customer'])) {
$status = false;
}
}
// Products
$coupon_product_data = array();
$coupon_product_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "coupon_product` WHERE coupon_id = '" . (int)$coupon_query->row['coupon_id'] . "'");
foreach ($coupon_product_query->rows as $product) {
$coupon_product_data[] = $product['product_id'];
}
// Categories
$coupon_category_data = array();
$coupon_category_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "coupon_category` cc LEFT JOIN `" . DB_PREFIX . "category_path` cp ON (cc.category_id = cp.path_id) WHERE cc.coupon_id = '" . (int)$coupon_query->row['coupon_id'] . "'");
foreach ($coupon_category_query->rows as $category) {
$coupon_category_data[] = $category['category_id'];
}
$product_data = array();
if ($coupon_product_data || $coupon_category_data) {
foreach ($this->cart->getProducts() as $product) {
if (in_array($product['product_id'], $coupon_product_data)) {
$product_data[] = $product['product_id'];
continue;
}
foreach ($coupon_category_data as $category_id) {
$coupon_category_query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "product_to_category` WHERE `product_id` = '" . (int)$product['product_id'] . "' AND category_id = '" . (int)$category_id . "'");
if ($coupon_category_query->row['total']) {
$product_data[] = $product['product_id'];
continue;
}
}
}
if (!$product_data) {
$status = false;
}
}
} else {
$status = false;
}
if ($status) {
return array(
'coupon_id' => $coupon_query->row['coupon_id'],
'code' => $coupon_query->row['code'],
'name' => $coupon_query->row['name'],
'type' => $coupon_query->row['type'],
'discount' => $coupon_query->row['discount'],
'shipping' => $coupon_query->row['shipping'],
'total' => $coupon_query->row['total'],
'product' => $product_data,
'date_start' => $coupon_query->row['date_start'],
'date_end' => $coupon_query->row['date_end'],
'uses_total' => $coupon_query->row['uses_total'],
'uses_customer' => $coupon_query->row['uses_customer'],
'status' => $coupon_query->row['status'],
'date_added' => $coupon_query->row['date_added']
);
}
}
public function getTotal($total) {
if (isset($this->session->data['coupon'])) {
$this->load->language('extension/total/coupon', 'coupon');
$coupon_info = $this->getCoupon($this->session->data['coupon']);
if ($coupon_info) {
$discount_total = 0;
if (!$coupon_info['product']) {
$sub_total = $this->cart->getSubTotal();
} else {
$sub_total = 0;
foreach ($this->cart->getProducts() as $product) {
if (in_array($product['product_id'], $coupon_info['product'])) {
$sub_total += $product['total'];
}
}
}
if ($coupon_info['type'] == 'F') {
$coupon_info['discount'] = min($coupon_info['discount'], $sub_total);
}
foreach ($this->cart->getProducts() as $product) {
$discount = 0;
if (!$coupon_info['product']) {
$status = true;
} else {
$status = in_array($product['product_id'], $coupon_info['product']);
}
if ($status) {
if ($coupon_info['type'] == 'F') {
$discount = $coupon_info['discount'] * ($product['total'] / $sub_total);
} elseif ($coupon_info['type'] == 'P') {
$discount = $product['total'] / 100 * $coupon_info['discount'];
}
if ($product['tax_class_id']) {
$tax_rates = $this->tax->getRates($product['total'] - ($product['total'] - $discount), $product['tax_class_id']);
foreach ($tax_rates as $tax_rate) {
if ($tax_rate['type'] == 'P') {
$total['taxes'][$tax_rate['tax_rate_id']] -= $tax_rate['amount'];
}
}
}
}
$discount_total += $discount;
}
if ($coupon_info['shipping'] && isset($this->session->data['shipping_method'])) {
if (!empty($this->session->data['shipping_method']['tax_class_id'])) {
$tax_rates = $this->tax->getRates($this->session->data['shipping_method']['cost'], $this->session->data['shipping_method']['tax_class_id']);
foreach ($tax_rates as $tax_rate) {
if ($tax_rate['type'] == 'P') {
$total['taxes'][$tax_rate['tax_rate_id']] -= $tax_rate['amount'];
}
}
}
$discount_total += $this->session->data['shipping_method']['cost'];
}
// If discount greater than total
if ($discount_total > $total['total']) {
$discount_total = $total['total'];
}
if ($discount_total > 0) {
$total['totals'][] = array(
'code' => 'coupon',
'title' => sprintf($this->language->get('coupon')->get('text_coupon'), $this->session->data['coupon']),
'value' => -$discount_total,
'sort_order' => $this->config->get('total_coupon_sort_order')
);
$total['total'] -= $discount_total;
}
}
}
}
public function confirm($order_info, $order_total) {
$code = '';
$start = strpos($order_total['title'], '(') + 1;
$end = strrpos($order_total['title'], ')');
if ($start && $end) {
$code = substr($order_total['title'], $start, $end - $start);
}
if ($code) {
$status = true;
$coupon_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "coupon` WHERE code = '" . $this->db->escape($code) . "' AND status = '1'");
if ($coupon_query->num_rows) {
$coupon_total = $this->getTotalCouponHistoriesByCoupon($code);
if ($coupon_query->row['uses_total'] > 0 && ($coupon_total >= $coupon_query->row['uses_total'])) {
$status = false;
}
if ($order_info['customer_id']) {
$customer_total = $this->getTotalCouponHistoriesByCustomerId($code, $order_info['customer_id']);
if ($coupon_query->row['uses_customer'] > 0 && ($customer_total >= $coupon_query->row['uses_customer'])) {
$status = false;
}
}
} else {
$status = false;
}
if ($status) {
$this->db->query("INSERT INTO `" . DB_PREFIX . "coupon_history` SET coupon_id = '" . (int)$coupon_query->row['coupon_id'] . "', order_id = '" . (int)$order_info['order_id'] . "', customer_id = '" . (int)$order_info['customer_id'] . "', amount = '" . (float)$order_total['value'] . "', date_added = NOW()");
} else {
return $this->config->get('config_fraud_status_id');
}
}
}
public function unconfirm($order_id) {
$this->db->query("DELETE FROM `" . DB_PREFIX . "coupon_history` WHERE order_id = '" . (int)$order_id . "'");
}
public function getTotalCouponHistoriesByCoupon($coupon) {
$query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "coupon_history` ch LEFT JOIN `" . DB_PREFIX . "coupon` c ON (ch.coupon_id = c.coupon_id) WHERE c.code = '" . $this->db->escape($coupon) . "'");
return $query->row['total'];
}
public function getTotalCouponHistoriesByCustomerId($coupon, $customer_id) {
$query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "coupon_history` ch LEFT JOIN `" . DB_PREFIX . "coupon` c ON (ch.coupon_id = c.coupon_id) WHERE c.code = '" . $this->db->escape($coupon) . "' AND ch.customer_id = '" . (int)$customer_id . "'");
return $query->row['total'];
}
}
@@ -0,0 +1,35 @@
<?php
class ModelExtensionTotalCredit extends Model {
public function getTotal($total) {
$this->load->language('extension/total/credit');
$balance = $this->customer->getBalance();
if ((float)$balance) {
$credit = min($balance, $total['total']);
if ((float)$credit > 0) {
$total['totals'][] = array(
'code' => 'credit',
'title' => $this->language->get('text_credit'),
'value' => -$credit,
'sort_order' => $this->config->get('total_credit_sort_order')
);
$total['total'] -= $credit;
}
}
}
public function confirm($order_info, $order_total) {
$this->load->language('extension/total/credit');
if ($order_info['customer_id']) {
$this->db->query("INSERT INTO " . DB_PREFIX . "customer_transaction SET customer_id = '" . (int)$order_info['customer_id'] . "', order_id = '" . (int)$order_info['order_id'] . "', description = '" . $this->db->escape(sprintf($this->language->get('text_order_id'), (int)$order_info['order_id'])) . "', amount = '" . (float)$order_total['value'] . "', date_added = NOW()");
}
}
public function unconfirm($order_id) {
$this->db->query("DELETE FROM " . DB_PREFIX . "customer_transaction WHERE order_id = '" . (int)$order_id . "'");
}
}
@@ -0,0 +1,29 @@
<?php
class ModelExtensionTotalHandling extends Model {
public function getTotal($total) {
if (($this->cart->getSubTotal() > $this->config->get('total_handling_total')) && ($this->cart->getSubTotal() > 0) && ($this->cart->hasDownload() == false) && $this->cart->hasShipping() == true) {
$this->load->language('extension/total/handling');
$total['totals'][] = array(
'code' => 'handling',
'title' => $this->language->get('text_handling'),
'value' => $this->config->get('total_handling_fee'),
'sort_order' => $this->config->get('total_handling_sort_order')
);
if ($this->config->get('total_handling_tax_class_id')) {
$tax_rates = $this->tax->getRates($this->config->get('total_handling_fee'), $this->config->get('total_handling_tax_class_id'));
foreach ($tax_rates as $tax_rate) {
if (!isset($total['taxes'][$tax_rate['tax_rate_id']])) {
$total['taxes'][$tax_rate['tax_rate_id']] = $tax_rate['amount'];
} else {
$total['taxes'][$tax_rate['tax_rate_id']] += $tax_rate['amount'];
}
}
}
$total['total'] += $this->config->get('total_handling_fee');
}
}
}
@@ -0,0 +1,52 @@
<?php
class ModelExtensionTotalLightshopsets extends Model {
public function getTotal($total) {
$this->load->language('extension/total/lightshopsets');
$this->load->model('extension/module/lightshop');
$setids = array();
if (isset($this->session->data['lightshopsetid']) && $this->session->data['lightshopsetid']) {
$setids = $this->session->data['lightshopsetid'];
}
$cartProducts = array();
foreach ($this->cart->getProducts() as $product) {
$cartProducts[$product['product_id']]['quantity'] = $product['quantity'];
$cartProducts[$product['product_id']]['price'] = $product['price'];
}
foreach ($setids as $setid) {
$lightshopsets = $this->model_extension_module_lightshop->getSetDiscount($total,$setid,$cartProducts);
if (!empty($this->session->data['vouchers'])) {
foreach ($this->session->data['vouchers'] as $voucher) {
$lightshopsets += $voucher['amount'];
}
}
if ($lightshopsets['discount']) {
$setInfo = $this->model_extension_module_lightshop->getSetInfo($setid);
$total['totals'][] = array(
'code' => 'lightshopsets',
'title' => $this->language->get('text_lightshopsets').' - '.$setInfo['title'],
'value' => -$lightshopsets['discount'],
'sort_order' => $this->config->get('total_lightshopsets_sort_order')
);
$total['total'] -= $lightshopsets['discount'];
$cartProducts = $lightshopsets['cartproducts'];
}
}
}
}
@@ -0,0 +1,29 @@
<?php
class ModelExtensionTotalLowOrderFee extends Model {
public function getTotal($total) {
if ($this->cart->getSubTotal() && ($this->cart->getSubTotal() < $this->config->get('total_low_order_fee_total'))) {
$this->load->language('extension/total/low_order_fee');
$total['totals'][] = array(
'code' => 'low_order_fee',
'title' => $this->language->get('text_low_order_fee'),
'value' => $this->config->get('total_low_order_fee_fee'),
'sort_order' => $this->config->get('total_low_order_fee_sort_order')
);
if ($this->config->get('total_low_order_fee_tax_class_id')) {
$tax_rates = $this->tax->getRates($this->config->get('total_low_order_fee_fee'), $this->config->get('total_low_order_fee_tax_class_id'));
foreach ($tax_rates as $tax_rate) {
if (!isset($total['taxes'][$tax_rate['tax_rate_id']])) {
$total['taxes'][$tax_rate['tax_rate_id']] = $tax_rate['amount'];
} else {
$total['taxes'][$tax_rate['tax_rate_id']] += $tax_rate['amount'];
}
}
}
$total['total'] += $this->config->get('total_low_order_fee_fee');
}
}
}
@@ -0,0 +1,78 @@
<?php
class ModelExtensionTotalReward extends Model {
public function getTotal($total) {
if (isset($this->session->data['reward'])) {
$this->load->language('extension/total/reward', 'reward');
$points = $this->customer->getRewardPoints();
if ($this->session->data['reward'] <= $points) {
$discount_total = 0;
$points_total = 0;
foreach ($this->cart->getProducts() as $product) {
if ($product['points']) {
$points_total += $product['points'];
}
}
$points = min($points, $points_total);
foreach ($this->cart->getProducts() as $product) {
$discount = 0;
if ($product['points']) {
$discount = $product['total'] * ($this->session->data['reward'] / $points_total);
if ($product['tax_class_id']) {
$tax_rates = $this->tax->getRates($product['total'] - ($product['total'] - $discount), $product['tax_class_id']);
foreach ($tax_rates as $tax_rate) {
if ($tax_rate['type'] == 'P') {
$total['taxes'][$tax_rate['tax_rate_id']] -= $tax_rate['amount'];
}
}
}
}
$discount_total += $discount;
}
$total['totals'][] = array(
'code' => 'reward',
'title' => sprintf($this->language->get('reward')->get('text_reward'), $this->session->data['reward']),
'value' => -$discount_total,
'sort_order' => $this->config->get('total_reward_sort_order')
);
$total['total'] -= $discount_total;
}
}
}
public function confirm($order_info, $order_total) {
$this->load->language('extension/total/reward');
$points = 0;
$start = strpos($order_total['title'], '(') + 1;
$end = strrpos($order_total['title'], ')');
if ($start && $end) {
$points = substr($order_total['title'], $start, $end - $start);
}
$this->load->model('account/customer');
if ($this->model_account_customer->getRewardTotal($order_info['customer_id']) >= $points) {
$this->db->query("INSERT INTO " . DB_PREFIX . "customer_reward SET customer_id = '" . (int)$order_info['customer_id'] . "', order_id = '" . (int)$order_info['order_id'] . "', description = '" . $this->db->escape(sprintf($this->language->get('text_order_id'), (int)$order_info['order_id'])) . "', points = '" . (float)-$points . "', date_added = NOW()");
} else {
return $this->config->get('config_fraud_status_id');
}
}
public function unconfirm($order_id) {
$this->db->query("DELETE FROM " . DB_PREFIX . "customer_reward WHERE order_id = '" . (int)$order_id . "' AND points < 0");
}
}
@@ -0,0 +1,27 @@
<?php
class ModelExtensionTotalShipping extends Model {
public function getTotal($total) {
if ($this->cart->hasShipping() && isset($this->session->data['shipping_method'])) {
$total['totals'][] = array(
'code' => 'shipping',
'title' => $this->session->data['shipping_method']['title'],
'value' => $this->session->data['shipping_method']['cost'],
'sort_order' => $this->config->get('total_shipping_sort_order')
);
if ($this->session->data['shipping_method']['tax_class_id']) {
$tax_rates = $this->tax->getRates($this->session->data['shipping_method']['cost'], $this->session->data['shipping_method']['tax_class_id']);
foreach ($tax_rates as $tax_rate) {
if (!isset($total['taxes'][$tax_rate['tax_rate_id']])) {
$total['taxes'][$tax_rate['tax_rate_id']] = $tax_rate['amount'];
} else {
$total['taxes'][$tax_rate['tax_rate_id']] += $tax_rate['amount'];
}
}
}
$total['total'] += $this->session->data['shipping_method']['cost'];
}
}
}
@@ -0,0 +1,23 @@
<?php
class ModelExtensionTotalSubTotal extends Model {
public function getTotal($total) {
$this->load->language('extension/total/sub_total');
$sub_total = $this->cart->getSubTotal();
if (!empty($this->session->data['vouchers'])) {
foreach ($this->session->data['vouchers'] as $voucher) {
$sub_total += $voucher['amount'];
}
}
$total['totals'][] = array(
'code' => 'sub_total',
'title' => $this->language->get('text_sub_total'),
'value' => $sub_total,
'sort_order' => $this->config->get('total_sub_total_sort_order')
);
$total['total'] += $sub_total;
}
}
@@ -0,0 +1,17 @@
<?php
class ModelExtensionTotalTax extends Model {
public function getTotal($total) {
foreach ($total['taxes'] as $key => $value) {
if ($value > 0) {
$total['totals'][] = array(
'code' => 'tax',
'title' => $this->tax->getRateName($key),
'value' => $value,
'sort_order' => $this->config->get('total_tax_sort_order')
);
$total['total'] += $value;
}
}
}
}
@@ -0,0 +1,13 @@
<?php
class ModelExtensionTotalTotal extends Model {
public function getTotal($total) {
$this->load->language('extension/total/total');
$total['totals'][] = array(
'code' => 'total',
'title' => $this->language->get('text_total'),
'value' => max(0, $total['total']),
'sort_order' => $this->config->get('total_total_sort_order')
);
}
}
@@ -0,0 +1,124 @@
<?php
class ModelExtensionTotalVoucher extends Model {
public function addVoucher($order_id, $data) {
$this->db->query("INSERT INTO " . DB_PREFIX . "voucher SET order_id = '" . (int)$order_id . "', code = '" . $this->db->escape($data['code']) . "', from_name = '" . $this->db->escape($data['from_name']) . "', from_email = '" . $this->db->escape($data['from_email']) . "', to_name = '" . $this->db->escape($data['to_name']) . "', to_email = '" . $this->db->escape($data['to_email']) . "', voucher_theme_id = '" . (int)$data['voucher_theme_id'] . "', message = '" . $this->db->escape($data['message']) . "', amount = '" . (float)$data['amount'] . "', status = '1', date_added = NOW()");
return $this->db->getLastId();
}
public function disableVoucher($order_id) {
$this->db->query("UPDATE " . DB_PREFIX . "voucher SET status = '0' WHERE order_id = '" . (int)$order_id . "'");
}
public function getVoucher($code) {
$status = true;
$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.code = '" . $this->db->escape($code) . "' AND vtd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND v.status = '1'");
if ($voucher_query->num_rows) {
if ($voucher_query->row['order_id']) {
$implode = array();
foreach ($this->config->get('config_complete_status') as $order_status_id) {
$implode[] = "'" . (int)$order_status_id . "'";
}
$order_query = $this->db->query("SELECT order_id FROM `" . DB_PREFIX . "order` WHERE order_id = '" . (int)$voucher_query->row['order_id'] . "' AND order_status_id IN(" . implode(",", $implode) . ")");
if (!$order_query->num_rows) {
$status = false;
}
$order_voucher_query = $this->db->query("SELECT order_voucher_id FROM `" . DB_PREFIX . "order_voucher` WHERE order_id = '" . (int)$voucher_query->row['order_id'] . "' AND voucher_id = '" . (int)$voucher_query->row['voucher_id'] . "'");
if (!$order_voucher_query->num_rows) {
$status = false;
}
}
$voucher_history_query = $this->db->query("SELECT SUM(amount) AS total FROM `" . DB_PREFIX . "voucher_history` vh WHERE vh.voucher_id = '" . (int)$voucher_query->row['voucher_id'] . "' GROUP BY vh.voucher_id");
if ($voucher_history_query->num_rows) {
$amount = $voucher_query->row['amount'] + $voucher_history_query->row['total'];
} else {
$amount = $voucher_query->row['amount'];
}
if ($amount <= 0) {
$status = false;
}
} else {
$status = false;
}
if ($status) {
return array(
'voucher_id' => $voucher_query->row['voucher_id'],
'code' => $voucher_query->row['code'],
'from_name' => $voucher_query->row['from_name'],
'from_email' => $voucher_query->row['from_email'],
'to_name' => $voucher_query->row['to_name'],
'to_email' => $voucher_query->row['to_email'],
'voucher_theme_id' => $voucher_query->row['voucher_theme_id'],
'theme' => $voucher_query->row['theme'],
'message' => $voucher_query->row['message'],
'image' => $voucher_query->row['image'],
'amount' => $amount,
'status' => $voucher_query->row['status'],
'date_added' => $voucher_query->row['date_added']
);
}
}
public function getTotal($total) {
if (isset($this->session->data['voucher'])) {
$this->load->language('extension/total/voucher', 'voucher');
$voucher_info = $this->getVoucher($this->session->data['voucher']);
if ($voucher_info) {
$amount = min($voucher_info['amount'], $total['total']);
if ($amount > 0) {
$total['totals'][] = array(
'code' => 'voucher',
'title' => sprintf($this->language->get('voucher')->get('text_voucher'), $this->session->data['voucher']),
'value' => -$amount,
'sort_order' => $this->config->get('total_voucher_sort_order')
);
$total['total'] -= $amount;
} else {
unset($this->session->data['voucher']);
}
} else {
unset($this->session->data['voucher']);
}
}
}
public function confirm($order_info, $order_total) {
$code = '';
$start = strpos($order_total['title'], '(') + 1;
$end = strrpos($order_total['title'], ')');
if ($start && $end) {
$code = substr($order_total['title'], $start, $end - $start);
}
if ($code) {
$voucher_info = $this->getVoucher($code);
if ($voucher_info) {
$this->db->query("INSERT INTO `" . DB_PREFIX . "voucher_history` SET voucher_id = '" . (int)$voucher_info['voucher_id'] . "', order_id = '" . (int)$order_info['order_id'] . "', amount = '" . (float)$order_total['value'] . "', date_added = NOW()");
} else {
return $this->config->get('config_fraud_status_id');
}
}
}
public function unconfirm($order_id) {
$this->db->query("DELETE FROM `" . DB_PREFIX . "voucher_history` WHERE order_id = '" . (int)$order_id . "'");
}
}
@@ -0,0 +1,48 @@
<?php
class ModelExtensionTotalVoucherTheme extends Model {
public function getVoucherTheme($voucher_theme_id) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "voucher_theme vt LEFT JOIN " . DB_PREFIX . "voucher_theme_description vtd ON (vt.voucher_theme_id = vtd.voucher_theme_id) WHERE vt.voucher_theme_id = '" . (int)$voucher_theme_id . "' AND vtd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
return $query->row;
}
public function getVoucherThemes($data = array()) {
if ($data) {
$sql = "SELECT * FROM " . DB_PREFIX . "voucher_theme vt LEFT JOIN " . DB_PREFIX . "voucher_theme_description vtd ON (vt.voucher_theme_id = vtd.voucher_theme_id) WHERE vtd.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY vtd.name";
if (isset($data['order']) && ($data['order'] == 'DESC')) {
$sql .= " DESC";
} else {
$sql .= " ASC";
}
if (isset($data['start']) || isset($data['limit'])) {
if ($data['start'] < 0) {
$data['start'] = 0;
}
if ($data['limit'] < 1) {
$data['limit'] = 20;
}
$sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
}
$query = $this->db->query($sql);
return $query->rows;
} else {
$voucher_theme_data = $this->cache->get('voucher_theme.' . (int)$this->config->get('config_language_id'));
if (!$voucher_theme_data) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "voucher_theme vt LEFT JOIN " . DB_PREFIX . "voucher_theme_description vtd ON (vt.voucher_theme_id = vtd.voucher_theme_id) WHERE vtd.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY vtd.name");
$voucher_theme_data = $query->rows;
$this->cache->set('voucher_theme.' . (int)$this->config->get('config_language_id'), $voucher_theme_data);
}
return $voucher_theme_data;
}
}
}