uawdijnntqw1x1x1
IP : 18.118.252.232
Hostname : ns1.eurodns.top
Kernel : Linux ns1.eurodns.top 4.18.0-553.5.1.lve.1.el7h.x86_64 #1 SMP Fri Jun 14 14:24:52 UTC 2024 x86_64
Disable Function : mail,sendmail,exec,passthru,shell_exec,system,popen,curl_multi_exec,show_source,eval,open_base
OS : Linux
PATH:
/
home
/
sudancam
/
public_html
/
0d544
/
..
/
..
/
.trash
/
css.1
/
..
/
catalog.1
/
controller
/
product
/
compare.php
/
/
<?php namespace Opencart\Catalog\Controller\Product; class Compare extends \Opencart\System\Engine\Controller { public function index(): void { $this->load->language('product/compare'); $this->load->model('catalog/product'); $this->load->model('tool/image'); if (!isset($this->session->data['compare'])) { $this->session->data['compare'] = []; } if (isset($this->request->get['remove'])) { $key = array_search($this->request->get['remove'], $this->session->data['compare']); if ($key !== false) { unset($this->session->data['compare'][$key]); $this->session->data['success'] = $this->language->get('text_remove'); } $this->response->redirect($this->url->link('product/compare', 'language=' . $this->config->get('config_language'))); } $this->document->setTitle($this->language->get('heading_title')); $data['breadcrumbs'] = []; $data['breadcrumbs'][] = [ 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home', 'language=' . $this->config->get('config_language')) ]; $data['breadcrumbs'][] = [ 'text' => $this->language->get('heading_title'), 'href' => $this->url->link('product/compare', 'language=' . $this->config->get('config_language')) ]; $data['add_to_cart'] = $this->url->link('checkout/cart|add', 'language=' . $this->config->get('config_language')); $data['cart'] = $this->url->link('common/cart|info', 'language=' . $this->config->get('config_language')); if (isset($this->session->data['success'])) { $data['success'] = $this->session->data['success']; unset($this->session->data['success']); } else { $data['success'] = ''; } $data['products'] = []; $data['attribute_groups'] = []; foreach ($this->session->data['compare'] as $key => $product_id) { $product_info = $this->model_catalog_product->getProduct($product_id); if ($product_info) { if (is_file(DIR_IMAGE . html_entity_decode($product_info['image'], ENT_QUOTES, 'UTF-8'))) { $image = $this->model_tool_image->resize(html_entity_decode($product_info['image'], ENT_QUOTES, 'UTF-8'), $this->config->get('config_image_compare_width'), $this->config->get('config_image_compare_height')); } else { $image = false; } if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) { $price = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); } else { $price = false; } if ((float)$product_info['special']) { $special = $this->currency->format($this->tax->calculate($product_info['special'], $product_info['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); } else { $special = false; } if ($product_info['quantity'] <= 0) { $availability = $product_info['stock_status']; } elseif ($this->config->get('config_stock_display')) { $availability = $product_info['quantity']; } else { $availability = $this->language->get('text_instock'); } $attribute_data = []; $attribute_groups = $this->model_catalog_product->getAttributes($product_id); foreach ($attribute_groups as $attribute_group) { foreach ($attribute_group['attribute'] as $attribute) { $attribute_data[$attribute['attribute_id']] = $attribute['text']; } } $data['products'][$product_id] = [ 'product_id' => $product_info['product_id'], 'name' => $product_info['name'], 'thumb' => $image, 'price' => $price, 'special' => $special, 'description' => utf8_substr(strip_tags(html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8')), 0, 200) . '..', 'model' => $product_info['model'], 'manufacturer' => $product_info['manufacturer'], 'availability' => $availability, 'minimum' => $product_info['minimum'] > 0 ? $product_info['minimum'] : 1, 'rating' => (int)$product_info['rating'], 'reviews' => sprintf($this->language->get('text_reviews'), (int)$product_info['reviews']), 'weight' => $this->weight->format($product_info['weight'], $product_info['weight_class_id'], $this->language->get('decimal_point'), $this->language->get('thousand_point')), 'length' => $this->length->format($product_info['length'], $product_info['length_class_id'], $this->language->get('decimal_point'), $this->language->get('thousand_point')), 'width' => $this->length->format($product_info['width'], $product_info['length_class_id'], $this->language->get('decimal_point'), $this->language->get('thousand_point')), 'height' => $this->length->format($product_info['height'], $product_info['length_class_id'], $this->language->get('decimal_point'), $this->language->get('thousand_point')), 'attribute' => $attribute_data, 'href' => $this->url->link('product/product', 'language=' . $this->config->get('config_language') . '&product_id=' . $product_id), 'remove' => $this->url->link('product/compare', 'language=' . $this->config->get('config_language') . '&remove=' . $product_id) ]; foreach ($attribute_groups as $attribute_group) { $data['attribute_groups'][$attribute_group['attribute_group_id']]['name'] = $attribute_group['name']; foreach ($attribute_group['attribute'] as $attribute) { $data['attribute_groups'][$attribute_group['attribute_group_id']]['attribute'][$attribute['attribute_id']]['name'] = $attribute['name']; } } } else { unset($this->session->data['compare'][$key]); } } $data['continue'] = $this->url->link('common/home', 'language=' . $this->config->get('config_language')); $data['column_left'] = $this->load->controller('common/column_left'); $data['column_right'] = $this->load->controller('common/column_right'); $data['content_top'] = $this->load->controller('common/content_top'); $data['content_bottom'] = $this->load->controller('common/content_bottom'); $data['footer'] = $this->load->controller('common/footer'); $data['header'] = $this->load->controller('common/header'); $this->response->setOutput($this->load->view('product/compare', $data)); } public function add(): void { $this->load->language('product/compare'); $json = []; if (!isset($this->session->data['compare'])) { $this->session->data['compare'] = []; } if (isset($this->request->post['product_id'])) { $product_id = $this->request->post['product_id']; } else { $product_id = 0; } $this->load->model('catalog/product'); $product_info = $this->model_catalog_product->getProduct($product_id); if (!$product_info) { $json['error'] = $this->language->get('error_product'); } if (!$json) { // If already in array remove the product_id so it will be added to the back of the array $key = array_search($this->request->post['product_id'], $this->session->data['compare']); if ($key !== false) { unset($this->session->data['compare'][$key]); } // If greater than 4 products then remove the first one if (count($this->session->data['compare']) >= 4) { array_shift($this->session->data['compare']); } $this->session->data['compare'][] = $this->request->post['product_id']; $json['success'] = sprintf($this->language->get('text_success'), $this->url->link('product/product', 'language=' . $this->config->get('config_language') . '&product_id=' . $this->request->post['product_id']), $product_info['name'], $this->url->link('product/compare', 'language=' . $this->config->get('config_language'))); $json['total'] = sprintf($this->language->get('text_compare'), (isset($this->session->data['compare']) ? count($this->session->data['compare']) : 0)); } $this->response->addHeader('Content-Type: application/json'); $this->response->setOutput(json_encode($json)); } }
/home/sudancam/public_html/0d544/../../.trash/css.1/../catalog.1/controller/product/compare.php