-
Публікації
57 -
З нами
-
Відвідування
Відвідувачі профілю
2 091 перегляд профілю
Freemanoid22's Achievements
-
Для потомков - решение: в /catalog/controller/account/wishlist.php меняем if ($product_info) { if (!in_array($this->request->post['product_id'], $this->session->data['compare'])) { 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', 'product_id=' . $this->request->post['product_id']), $product_info['name'], $this->url->link('product/compare')); $json['total'] = sprintf($this->language->get('text_compare'), (isset($this->session->data['compare']) ? count($this->session->data['compare']) : 0)); } на if ($product_info) { if (!in_array($this->request->post['product_id'], $this->session->data['compare'])) { if (count($this->session->data['compare']) >= 5) { //array_shift($this->session->data['compare']); } if (count($this->session->data['compare']) < 5) { $this->session->data['compare'][] = $this->request->post['product_id']; } } //$json['success'] = sprintf($this->language->get('text_success'), $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']), $product_info['name'], $this->url->link('product/compare')); if (count($this->session->data['compare']) >= 5) { $json['warning'] = 'В сравнении 5 из 5'; } else { $json['success'] = sprintf($this->language->get('text_success'), $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']), $product_info['name'], $this->url->link('product/compare')); } $json['total'] = sprintf($this->language->get('text_compare'), (isset($this->session->data['compare']) ? count($this->session->data['compare']) : 0)); } Открываем /catalog/view/javascript/common.js В var compare = { ищем if (json['success']) { $('#content').parent().before('<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">×</button></div>'); $('#compare-total').html(json['total']); $('html, body').animate({ scrollTop: 0 }, 'slow'); } и после вставляем if (json['warning']) { $('#content').parent().before('<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> ' + json['warning'] + ' <button type="button" class="close" data-dismiss="alert">×</button></div>'); $('#compare-total').html(json['total']); setTimeout(function () { $('.alert-success').fadeOut() }, 4000); }
-
Добрый день. Хотел сделать уведомление при достижении 5 товаров в сравнении, но 'success' возвращает пустое значение. Хотел бы понять почему так происходит. if ($product_info) { if (!in_array($this->request->post['product_id'], $this->session->data['compare'])) { if (count($this->session->data['compare']) >= 5) { $json['success'] = $this->language->get('text_compare_limit'); //возвращает unexpected end of json input $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)); die(); 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', 'product_id=' . $this->request->post['product_id']), $product_info['name'], $this->url->link('product/compare')); $json['total'] = sprintf($this->language->get('text_compare'), (isset($this->session->data['compare']) ? count($this->session->data['compare']) : 0)); }
-
А за модуль спасибо, в след раз воспользуюсь )
-
Вроде как остался 1 запрос поправить в базу, чем покупать. Либо делал поиск по id группы пользователей, но цифры не очень удобно показывать - глазу приятнее названия групп. Насколько я понимаю - нужно лишь указать таблицу по которой поиск идет, а не по умолчанию (т.е в одной строке подставить правильно наименование) Может кто ткнет в синтаксис, где посмотреть как он правильно пишется сокращенно.
-
Добрый вечер. Есть потребность фильтровать группы покупателей в списке заказов.Странно, но нигде информации кроме громозких модулей не нашел. В итоге переделал xml вывода invoce в группу покупателей, но фильтр не ищет по нужной таблице данные (знаний как подрубить другую таблицу не хватает). Переделал запрос который находит мне наименования группы покупателей <![CDATA[$sql = "SELECT o.order_id, CONCAT(o.firstname, ' ', o.lastname) AS customer, (SELECT os.name FROM " . DB_PREFIX . "order_status os WHERE os.order_status_id = o.order_status_id AND os.language_id = '" . (int)$this->config->get('config_language_id') . "') AS status, (SELECT os.name FROM " . DB_PREFIX . "customer_group_description os WHERE os.customer_group_id = o.customer_group_id AND os.language_id = '" . (int)$this->config->get('config_language_id') . "') AS customer_group_name, o.total, o.currency_code, o.currency_value, o.date_added, o.date_modified FROM `" . DB_PREFIX . "order` o";]]> А вот в поиске по данным не могу подключить нужную таблицу <operation error="log"> <search position="before" offset="2"><![CDATA[$sql .= " AND order_id = '" . (int)$data['filter_order_id'] . "'";]]></search> <add><![CDATA[if (!empty($data['customer_group_name'])) { $sql .= " AND customer_group_id = '" . (int)$data['name'] . "'"; }]]></add> </operation> Насколько понял именно тут идет поиск по таблице order (а в ней нету наименований, только id группы пользователей). admin_customer_group.xml
-
Есть Opencart 1.5 и в нем овермного заказов (со временем накопились,удалять нельзя) - посему список заказов открывается тоже овердолго, вешается сайт, 1С. Убрал все лишние запросы (оставил только 3 поля, но все равно долго открывается). Возможно есть решение? Из мыслей - ограничить кол-вом заказов (т.е не искать все, а только 10 последних в базе, дальше запросы обрывать). Если ограничить кол-вом, то как реализовать? Сам кусок кода вывода <?php if ($orders) { ?> <?php foreach ($orders as $order) { ?> <tr> <td style="text-align: center;"><?php if ($order['selected']) { ?> <input type="checkbox" name="selected[]" value="<?php echo $order['order_id']; ?>" checked="checked" /> <?php } else { ?> <input type="checkbox" name="selected[]" value="<?php echo $order['order_id']; ?>" /> <?php } ?></td> <td class="right"><?php echo $order['order_id']; ?></td> <td class="left"><?php echo $order['customer']; ?></td> <td class="left"><?php echo $order['status']; ?></td> <td class="right"><?php echo $order['total']; ?></td> <td class="left"><?php echo $order['date_added']; ?></td> <td class="left"><?php echo $order['date_modified']; ?></td> <td class="right"><?php foreach ($order['action'] as $action) { ?> [ <a href="<?php echo $action['href']; ?>"><?php echo $action['text']; ?></a> ] <?php } ?></td> </tr> <?php } ?> <?php } else { ?> <tr> <td class="center" colspan="8"><?php echo $text_no_results; ?></td> </tr> <?php } ?>