Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

wAsOne

Newbie
  
  • Posts

    2
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

wAsOne's Achievements

Newbie

Newbie (1/14)

  • First Post
  • Week One Done
  • One Month Later
  • One Year In
  • Conversation Starter

Recent Badges

0

Reputation

  1. Добавлял в библиотеку, ибо делал по этому примеру: также подобных переменных в контроллере нет, там немного иная система, но подобный массив имеется(снизу): $data['products'] = array(); $products = $this->cart->getProducts(); foreach ($products as $product) { $product_total = 0; foreach ($products as $product_2) { if ($product_2['product_id'] == $product['product_id']) { $product_total += $product_2['quantity']; } } if ($product['minimum'] > $product_total) { $data['error_warning'] = sprintf($this->language->get('error_minimum'), $product['name'], $product['minimum']); } if ($product['image']) { $image = $this->model_tool_image->resize($product['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_cart_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_cart_height')); } else { $image = ''; } $option_data = array(); foreach ($product['option'] as $option) { if ($option['type'] != 'file') { $value = $option['value']; } else { $upload_info = $this->model_tool_upload->getUploadByCode($option['value']); if ($upload_info) { $value = $upload_info['name']; } else { $value = ''; } } $option_data[] = array( 'name' => $option['name'], 'value' => (utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value) ); } // Display prices if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) { $unit_price = $this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax')); $price = $this->currency->format($unit_price, $this->session->data['currency']); $total = $this->currency->format($unit_price * $product['quantity'], $this->session->data['currency']); } else { $price = false; $total = false; } $recurring = ''; if ($product['recurring']) { $frequencies = array( 'day' => $this->language->get('text_day'), 'week' => $this->language->get('text_week'), 'semi_month' => $this->language->get('text_semi_month'), 'month' => $this->language->get('text_month'), 'year' => $this->language->get('text_year') ); if ($product['recurring']['trial']) { $recurring = sprintf($this->language->get('text_trial_description'), $this->currency->format($this->tax->calculate($product['recurring']['trial_price'] * $product['quantity'], $product['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']), $product['recurring']['trial_cycle'], $frequencies[$product['recurring']['trial_frequency']], $product['recurring']['trial_duration']) . ' '; } if ($product['recurring']['duration']) { $recurring .= sprintf($this->language->get('text_payment_description'), $this->currency->format($this->tax->calculate($product['recurring']['price'] * $product['quantity'], $product['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']), $product['recurring']['cycle'], $frequencies[$product['recurring']['frequency']], $product['recurring']['duration']); } else { $recurring .= sprintf($this->language->get('text_payment_cancel'), $this->currency->format($this->tax->calculate($product['recurring']['price'] * $product['quantity'], $product['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']), $product['recurring']['cycle'], $frequencies[$product['recurring']['frequency']], $product['recurring']['duration']); } } $data['products'][] = array( 'cart_id' => $product['cart_id'], 'thumb' => $image, 'name' => $product['name'], 'model' => $product['model'], 'option' => $option_data, 'recurring' => $recurring, 'quantity' => $product['quantity'], 'stock' => $product['stock'] ? true : !(!$this->config->get('config_stock_checkout') || $this->config->get('config_stock_warning')), 'reward' => ($product['reward'] ? sprintf($this->language->get('text_points'), $product['reward']) : ''), 'price' => $price, 'total' => $total, 'href' => $this->url->link('product/product', 'product_id=' . $product['product_id']) ); } При замене на: 'name' => $product_query->row['pd.name'], Выходит из корзины и выкидывает на страницу товара, где при попытке зайти в корзину с товаром выводит ошибку:
  2. Добрый день! Возникла проблема с Opencart 3.0.2.0 Задача такая: Надо вывести название категории товаров, которые находятся в корзине. У меня получилось вывести название категорий, но оно заменяет название товара. Что я делал для этого: 1) Нашел файл \system\library\cart.php Там нашел строку $product_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.date_available <= NOW() AND p.status = '1'"); и заменил на строку $product_query = $this->db->query("SELECT *, cd.name as category_name FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category ptc ON (ptc.product_id=p.product_id) LEFT JOIN " . DB_PREFIX . "category_description cd ON (cd.category_id=ptc.category_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.date_available <= NOW() AND p.status = '1'"); 2) Далее в том же файле я нашел массив $product_data[] = array(... и добавил в него строчку 'category_id' => $product_query->row['category_id'], 3) Выводить пытался так: {% if product.category_id %} {# {% for catlist in catname %} #} <li>{{ product.category_id }}</li> {# {% endfor %} #} {% endif %} Также пытался всячески менять этот вывод, но ничего не выводит. 4) Название категории начало после всех добавлений выводится вместо названия товара, который я вывожу так {% for product in products %} <span> <a href="{{ product.href }}" class="cart-name">{{ product.name }}</a> </span> {% endfor %}
×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.