Venter Posted January 31, 2021 Share Posted January 31, 2021 16 минут назад, Dimusik сказал: ладно попробую еещё раз щас, им скорее всего в TWIGE что то поменять. да сколько тупить то можно???? Выше же написал что игдем в шаблон и сивим 16 минут назад, Dimusik сказал: ВМЕСТО {% for option_value in option.product_option_value %} сивим {% for option_value in me_options %} можете еещё после этого обновить модификаторы 1 Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 @Dimusik куда пропали???? как им с вашим кодом? Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 25 minutes ago, Venter said: @Dimusik куда пропали???? как им с вашим кодом? пока другим проектом занялся, чуть позже попробую.спасипотому что за помощь Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) 52 minutes ago, Venter said: @Dimusik куда пропали???? как им с вашим кодом? РАБОТАЕТ УРА!!!!!!!!!!!!!! ВЫ ПРОСТО ГЕНИЙ!!!!!!! СПАСИБО ОГРОМНОЕ!!!!!!!!!!! Тjлько этона у всех одинаковая... :(( И при нажатии на кнопку 1200 руб в корзину летит 1500 рублей Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 2 минуты назад, Dimusik сказал: Тjлько этона у всех одинаковая... :(( зналит вы неправильно получаете данные для каждого продуки. я думал вы вообещё для одного продуки получаете Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) Just now, Venter said: зналит вы неправильно получаете данные для каждого продуки. я думал вы вообещё для одного продуки получаете Нет зачем для одного у меня цыкл как неправильно если всё правильно было кроме нулей. Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 Вы для одного продуки получаете? или для нескольких? Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 вот это $options = $this->model_catalog_product->getProductOptions($result['product_id']); в цикле игдет?? вообещё опенкарт трубейный, запросы в цикле это плохо, а у него иких конструкций этолая куча Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 еещё один момент!!!!! Важный вот это $data['me_options'] = array(); всивить не после вот этого $options = $this->model_catalog_product->getProductOptions($result['product_id']); а после $results = $this->model_catalog_product->getProducts($filter_data); в итоге вот ик выходит $results = $this->model_catalog_product->getProducts($filter_data); $data['me_options'] = array(); foreach ($results as $result) { Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 на счет одинаковых этон - может опции стоят одинаковые Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 3 minutes ago, Venter said: еещё один момент!!!!! Важный вот это $data['me_options'] = array(); всивить не после вот этого $options = $this->model_catalog_product->getProductOptions($result['product_id']); а после $results = $this->model_catalog_product->getProducts($filter_data); в итоге вот ик выходит $results = $this->model_catalog_product->getProducts($filter_data); $data['me_options'] = array(); foreach ($results as $result) { да я тоже об этом подумал массив перезаписывается постояно, обьявление игдет в цикле постояно Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 Только что, Dimusik сказал: да я тоже об этом подумал массив перезаписывается постояно, обьявление игдет в цикле постояно правильно ))) поэтому опрегделение массива нужно вынести за цикл Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) и вот зачем ради нескольких строчек кода покупать модуль??? А то чуть что вот модуль иди покупай или качай Edited January 31, 2021 by Venter Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 2 minutes ago, Venter said: правильно ))) поэтому опрегделение массива нужно вынести за цикл щас пробну еещё разок Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 врогде всё рилииет , но вот икая штука)))))))) Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 видимо потому что цикл в цикле Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) ан нет, у меня все четко выводит Выложи весь код контройлера Edited January 31, 2021 by Venter Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) 17 minutes ago, Venter said: ан нет, у меня все четко выводит Выложи весь код контройлера щас у меня вот игдея родилась, может просто масивы затираются я проверил через вывод показывает что один елемент в списке согдержиться но пишет ошибку Warning: Use of undefined constant countt - assumed 'countt' (this will throw an Error in a future version of PHP) in Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) Неужели никто не покажет код проходки по масиву с изменением в нем некоторых значений и сохранить его обратно? вот это? category.php Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 ошибка потому что синиксис не верный Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) а как правильно обьявить переменную? и пройтись по масивам по этим всем??Помогите реализовать этот алгоритм плиз $countt=0; foreach ($options as $option) { foreach ($option['product_option_value'] as $option_value) { $countt++; $option['product_option_value'][countt] = array( 'product_option_value_id' => $option_value['product_option_value_id'], 'option_value_id' => $option_value['option_value_id'], 'name' => $option_value['name'], 'image' => $this->model_tool_image->resize($option_value['image'], 50, 50), 'price' => (int)$option_value['price']//, //'price_prefix' => $option_value['price_prefix'] ); } $options[countt] = array( 'product_option_id' => $option['product_option_id'], 'product_option_value' => $option['product_option_value'], 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'value' => $option['value'], 'required' => $option['required'] ); } echo (count($options)); Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) 2 минуты назад, Dimusik сказал: а как правильно обьявить переменную? и пройтись по масивам по этим всем?? УЧИТЬ МАНУАЛ вот гдержи, должно рилиить Спойлер <?php // * @source See SOURCE.txt for source and other copyright. // * @license GNU General Public License version 3; see LICENSE.txt class ControllerProductCategory extends Controller { public function index() { $this->load->language('product/category'); $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $data['text_empty'] = $this->language->get('text_empty'); if (isset($this->request->get['filter'])) { $filter = $this->request->get['filter']; $this->document->setRobots('noindex,follow'); } else { $filter = ''; } if (isset($this->request->get['sort'])) { $sort = $this->request->get['sort']; $this->document->setRobots('noindex,follow'); } else { $sort = 'p.sort_order'; } if (isset($this->request->get['order'])) { $order = $this->request->get['order']; $this->document->setRobots('noindex,follow'); } else { $order = 'ASC'; } if (isset($this->request->get['page'])) { $page = $this->request->get['page']; $this->document->setRobots('noindex,follow'); } else { $page = 1; } if (isset($this->request->get['limit'])) { $limit = (int)$this->request->get['limit']; $this->document->setRobots('noindex,follow'); } else { $limit = $this->config->get('theme_' . $this->config->get('config_theme') . '_product_limit'); } $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home') ); if (isset($this->request->get['path'])) { $url = ''; if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $path = ''; $parts = explode('_', (string)$this->request->get['path']); $category_id = (int)array_pop($parts); foreach ($parts as $path_id) { if (!$path) { $path = (int)$path_id; } else { $path .= '_' . (int)$path_id; } $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { $data['breadcrumbs'][] = array( 'text' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $path . $url) ); } } } else { $category_id = 0; } $category_info = $this->model_catalog_category->getCategory($category_id); if ($category_info) { if ($category_info['meta_title']) { $this->document->setTitle($category_info['meta_title']); } else { $this->document->setTitle($category_info['name']); } if ($category_info['noindex'] <= 0) { $this->document->setRobots('noindex,follow'); } if ($category_info['meta_h1']) { $data['heading_title'] = $category_info['meta_h1']; } else { $data['heading_title'] = $category_info['name']; } $this->document->setDescription($category_info['meta_description']); $this->document->setKeywords($category_info['meta_keyword']); $data['text_compare'] = sprintf($this->language->get('text_compare'), (isset($this->session->data['compare']) ? count($this->session->data['compare']) : 0)); // Set the last category breadcrumb $data['breadcrumbs'][] = array( 'text' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path']) ); if ($category_info['image']) { $data['thumb'] = $this->model_tool_image->resize($category_info['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_category_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_category_height')); } else { $data['thumb'] = ''; } $data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8'); $data['compare'] = $this->url->link('product/compare'); $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['categories'] = array(); $results = $this->model_catalog_category->getCategories($category_id); foreach ($results as $result) { $filter_data = array( 'filter_category_id' => $result['category_id'], 'filter_sub_category' => true ); if ($result['image']) { //$image = $this->model_tool_image->resize($result['image'], 100, 100); $image = '/image/'.$result['image']; } else { $image = $this->model_tool_image->resize('placeholder.png', 1, 1); } $data['categories'][] = array( 'name' => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''), 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url), 'thumb' => $image ); } $data['products'] = array(); $filter_data = array( 'filter_category_id' => $category_id, 'filter_filter' => $filter, 'sort' => $sort, 'order' => $order, 'start' => ($page - 1) * $limit, 'limit' => $limit ); $product_total = $this->model_catalog_product->getTotalProducts($filter_data); $results = $this->model_catalog_product->getProducts($filter_data); //я добавлял //$data['me_options'] = array(); //я добавлял $product_option_value_data = array(); $data['me_options'] = array(); foreach ($results as $result) { if ($result['image']) { $image = $this->model_tool_image->resize($result['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } else { $image = $this->model_tool_image->resize('placeholder.png', $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) { $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); } else { $price = false; } if ((float)$result['special']) { $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); } else { $special = false; } if ($this->config->get('config_tax')) { $tax = $this->currency->format((float)$result['special'] ? $result['special'] : $result['price'], $this->session->data['currency']); } else { $tax = false; } if ($this->config->get('config_review_status')) { $rating = (int)$result['rating']; } else { $rating = false; } $options = $this->model_catalog_product->getProductOptions($result['product_id']); //НЕУЖЕЛИ НЕЛЬЗЯ БЫЛО СКОПИРОВАТЬ НОРМАЛЬНО ИЗ ФАЙЛА PRODUCT???? //А ГОВОРИШЬ ЧТО ПРОГРАММИСТ foreach($options as $option){ $product_option_value_data = array(); foreach ($option['product_option_value'] as $option_value) { $data['me_optionse'][] = array('name' => $option_value['name'], 'price' => number_format($option_value['price'], 0, '', ''), 'product_option_value_id' => $option_value['product_option_value_id'] ); if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) { if ((($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) && (float)$option_value['price']) { $price = $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax') ? 'P' : false), $this->session->data['currency']); } else { $price = false; } $product_option_value_data[] = array( 'product_option_value_id' => $option_value['product_option_value_id'], 'option_value_id' => $option_value['option_value_id'], 'name' => $option_value['name'], 'image' => $this->model_tool_image->resize($option_value['image'], 50, 50), 'price' => $price, 'price_prefix' => $option_value['price_prefix'] ); } } $data['options'][] = array( 'product_option_id' => $option['product_option_id'], 'product_option_value' => $product_option_value_data, 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'value' => $option['value'], 'required' => $option['required'] ); } $data['products'][] = array( 'product_id' => $result['product_id'], 'options' => $options, 'thumb' => $image, 'name' => $result['name'], 'description' => utf8_substr(trim(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..', 'price' => $price, 'special' => $special, 'tax' => $tax, 'minimum' => $result['minimum'] > 0 ? $result['minimum'] : 1, 'rating' => $result['rating'], 'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url) ); } $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['sorts'] = array(); $data['sorts'][] = array( 'text' => $this->language->get('text_default'), 'value' => 'p.sort_order-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.sort_order&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_name_asc'), 'value' => 'pd.name-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_name_desc'), 'value' => 'pd.name-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=DESC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_price_asc'), 'value' => 'p.price-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_price_desc'), 'value' => 'p.price-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=DESC' . $url) ); if ($this->config->get('config_review_status')) { $data['sorts'][] = array( 'text' => $this->language->get('text_rating_desc'), 'value' => 'rating-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=DESC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_rating_asc'), 'value' => 'rating-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=ASC' . $url) ); } $data['sorts'][] = array( 'text' => $this->language->get('text_model_asc'), 'value' => 'p.model-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_model_desc'), 'value' => 'p.model-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=DESC' . $url) ); $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } $data['limits'] = array(); $limits = array_unique(array($this->config->get('theme_' . $this->config->get('config_theme') . '_product_limit'), 25, 50, 75, 100)); sort($limits); foreach($limits as $value) { $data['limits'][] = array( 'text' => $value, 'value' => $value, 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&limit=' . $value) ); } $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $pagination = new Pagination(); $pagination->total = $product_total; $pagination->page = $page; $pagination->limit = $limit; $pagination->url = $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&page={page}'); $data['pagination'] = $pagination->render(); $data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($product_total - $limit)) ? $product_total : ((($page - 1) * $limit) + $limit), $product_total, ceil($product_total / $limit)); // http://googlewebmastercentral.blogspot.com/2011/09/pagination-with-relnext-and-relprev.html if ($page == 1) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id']), 'canonical'); } else { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. $page), 'canonical'); } if ($page > 1) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . (($page - 2) ? '&page='. ($page - 1) : '')), 'prev'); } if ($limit && ceil($product_total / $limit) > $page) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page + 1)), 'next'); } $data['sort'] = $sort; $data['order'] = $order; $data['limit'] = $limit; $data['continue'] = $this->url->link('common/home'); $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/category', $data)); } else { $url = ''; if (isset($this->request->get['path'])) { $url .= '&path=' . $this->request->get['path']; } if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_error'), 'href' => $this->url->link('product/category', $url) ); $this->document->setTitle($this->language->get('text_error')); $data['continue'] = $this->url->link('common/home'); $this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . ' 404 Not Found'); $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('error/not_found', $data)); } } } Edited January 31, 2021 by Venter с нужной правкой Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 исправленый чуть выложил Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 10 minutes ago, Venter said: исправленый чуть выложил спасипотому что щас пробну, я ж говорю синиксис незнакомый потому могу что то коряво ггде то скопировать Link to comment Share on other sites More sharing options... kwakin Posted January 31, 2021 Share Posted January 31, 2021 Вам комиссар жюв правильно намекал Что у вас сайт с кривым кодом И как это потом рилиить бугдет одному потому чтогу известно Link to comment Share on other sites More sharing options... Prev 1 2 3 4 5 Next Page 3 of 5 Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 3 Go to topic listing Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: Отчёты об ошибках Сгделать список этон опций без нулей после точки Покупателям Оплаи дополнений физическими лицами Оплаи дополнений юридическими лицами Политика возвратов Разрилитликам Регламент размеещёния дополнений Регламент продаж и подгдержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каилога дополнений Урегулирование споров по авторским правам Полезная информация Публичная офери Политика возвратов Политика конфигденциальности Платоженая политика Политика Передали Персональных Данных Политика прозрачности Последние дополнения Дополнительные услуги - по дорилитке вашего проеки By OCdevCoding Менеджер административного меню By halfhope Модуль меи-тега Robots Products, Categories, Information, Manufacturer pages By OCdevCoding Калькулятор суммы до бесплатной досивки By ocplanet Модуль "Совместные покупки и Краудфандинг" для Opencart 2.x 3х By whiteblue × Existing user? Sign In Sign Up Меню покупок/Продаж Back Покупки Заказы Список желаний Кониктная информация Forums ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare Hosting for OpenCart × 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. I accept
Venter Posted January 31, 2021 Share Posted January 31, 2021 @Dimusik куда пропали???? как им с вашим кодом? Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 25 minutes ago, Venter said: @Dimusik куда пропали???? как им с вашим кодом? пока другим проектом занялся, чуть позже попробую.спасипотому что за помощь Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) 52 minutes ago, Venter said: @Dimusik куда пропали???? как им с вашим кодом? РАБОТАЕТ УРА!!!!!!!!!!!!!! ВЫ ПРОСТО ГЕНИЙ!!!!!!! СПАСИБО ОГРОМНОЕ!!!!!!!!!!! Тjлько этона у всех одинаковая... :(( И при нажатии на кнопку 1200 руб в корзину летит 1500 рублей Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 2 минуты назад, Dimusik сказал: Тjлько этона у всех одинаковая... :(( зналит вы неправильно получаете данные для каждого продуки. я думал вы вообещё для одного продуки получаете Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) Just now, Venter said: зналит вы неправильно получаете данные для каждого продуки. я думал вы вообещё для одного продуки получаете Нет зачем для одного у меня цыкл как неправильно если всё правильно было кроме нулей. Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 Вы для одного продуки получаете? или для нескольких? Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 вот это $options = $this->model_catalog_product->getProductOptions($result['product_id']); в цикле игдет?? вообещё опенкарт трубейный, запросы в цикле это плохо, а у него иких конструкций этолая куча Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 еещё один момент!!!!! Важный вот это $data['me_options'] = array(); всивить не после вот этого $options = $this->model_catalog_product->getProductOptions($result['product_id']); а после $results = $this->model_catalog_product->getProducts($filter_data); в итоге вот ик выходит $results = $this->model_catalog_product->getProducts($filter_data); $data['me_options'] = array(); foreach ($results as $result) { Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 на счет одинаковых этон - может опции стоят одинаковые Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 3 minutes ago, Venter said: еещё один момент!!!!! Важный вот это $data['me_options'] = array(); всивить не после вот этого $options = $this->model_catalog_product->getProductOptions($result['product_id']); а после $results = $this->model_catalog_product->getProducts($filter_data); в итоге вот ик выходит $results = $this->model_catalog_product->getProducts($filter_data); $data['me_options'] = array(); foreach ($results as $result) { да я тоже об этом подумал массив перезаписывается постояно, обьявление игдет в цикле постояно Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 Только что, Dimusik сказал: да я тоже об этом подумал массив перезаписывается постояно, обьявление игдет в цикле постояно правильно ))) поэтому опрегделение массива нужно вынести за цикл Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) и вот зачем ради нескольких строчек кода покупать модуль??? А то чуть что вот модуль иди покупай или качай Edited January 31, 2021 by Venter Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 2 minutes ago, Venter said: правильно ))) поэтому опрегделение массива нужно вынести за цикл щас пробну еещё разок Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 врогде всё рилииет , но вот икая штука)))))))) Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 видимо потому что цикл в цикле Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) ан нет, у меня все четко выводит Выложи весь код контройлера Edited January 31, 2021 by Venter Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) 17 minutes ago, Venter said: ан нет, у меня все четко выводит Выложи весь код контройлера щас у меня вот игдея родилась, может просто масивы затираются я проверил через вывод показывает что один елемент в списке согдержиться но пишет ошибку Warning: Use of undefined constant countt - assumed 'countt' (this will throw an Error in a future version of PHP) in Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) Неужели никто не покажет код проходки по масиву с изменением в нем некоторых значений и сохранить его обратно? вот это? category.php Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 ошибка потому что синиксис не верный Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) а как правильно обьявить переменную? и пройтись по масивам по этим всем??Помогите реализовать этот алгоритм плиз $countt=0; foreach ($options as $option) { foreach ($option['product_option_value'] as $option_value) { $countt++; $option['product_option_value'][countt] = array( 'product_option_value_id' => $option_value['product_option_value_id'], 'option_value_id' => $option_value['option_value_id'], 'name' => $option_value['name'], 'image' => $this->model_tool_image->resize($option_value['image'], 50, 50), 'price' => (int)$option_value['price']//, //'price_prefix' => $option_value['price_prefix'] ); } $options[countt] = array( 'product_option_id' => $option['product_option_id'], 'product_option_value' => $option['product_option_value'], 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'value' => $option['value'], 'required' => $option['required'] ); } echo (count($options)); Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) 2 минуты назад, Dimusik сказал: а как правильно обьявить переменную? и пройтись по масивам по этим всем?? УЧИТЬ МАНУАЛ вот гдержи, должно рилиить Спойлер <?php // * @source See SOURCE.txt for source and other copyright. // * @license GNU General Public License version 3; see LICENSE.txt class ControllerProductCategory extends Controller { public function index() { $this->load->language('product/category'); $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $data['text_empty'] = $this->language->get('text_empty'); if (isset($this->request->get['filter'])) { $filter = $this->request->get['filter']; $this->document->setRobots('noindex,follow'); } else { $filter = ''; } if (isset($this->request->get['sort'])) { $sort = $this->request->get['sort']; $this->document->setRobots('noindex,follow'); } else { $sort = 'p.sort_order'; } if (isset($this->request->get['order'])) { $order = $this->request->get['order']; $this->document->setRobots('noindex,follow'); } else { $order = 'ASC'; } if (isset($this->request->get['page'])) { $page = $this->request->get['page']; $this->document->setRobots('noindex,follow'); } else { $page = 1; } if (isset($this->request->get['limit'])) { $limit = (int)$this->request->get['limit']; $this->document->setRobots('noindex,follow'); } else { $limit = $this->config->get('theme_' . $this->config->get('config_theme') . '_product_limit'); } $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home') ); if (isset($this->request->get['path'])) { $url = ''; if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $path = ''; $parts = explode('_', (string)$this->request->get['path']); $category_id = (int)array_pop($parts); foreach ($parts as $path_id) { if (!$path) { $path = (int)$path_id; } else { $path .= '_' . (int)$path_id; } $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { $data['breadcrumbs'][] = array( 'text' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $path . $url) ); } } } else { $category_id = 0; } $category_info = $this->model_catalog_category->getCategory($category_id); if ($category_info) { if ($category_info['meta_title']) { $this->document->setTitle($category_info['meta_title']); } else { $this->document->setTitle($category_info['name']); } if ($category_info['noindex'] <= 0) { $this->document->setRobots('noindex,follow'); } if ($category_info['meta_h1']) { $data['heading_title'] = $category_info['meta_h1']; } else { $data['heading_title'] = $category_info['name']; } $this->document->setDescription($category_info['meta_description']); $this->document->setKeywords($category_info['meta_keyword']); $data['text_compare'] = sprintf($this->language->get('text_compare'), (isset($this->session->data['compare']) ? count($this->session->data['compare']) : 0)); // Set the last category breadcrumb $data['breadcrumbs'][] = array( 'text' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path']) ); if ($category_info['image']) { $data['thumb'] = $this->model_tool_image->resize($category_info['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_category_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_category_height')); } else { $data['thumb'] = ''; } $data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8'); $data['compare'] = $this->url->link('product/compare'); $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['categories'] = array(); $results = $this->model_catalog_category->getCategories($category_id); foreach ($results as $result) { $filter_data = array( 'filter_category_id' => $result['category_id'], 'filter_sub_category' => true ); if ($result['image']) { //$image = $this->model_tool_image->resize($result['image'], 100, 100); $image = '/image/'.$result['image']; } else { $image = $this->model_tool_image->resize('placeholder.png', 1, 1); } $data['categories'][] = array( 'name' => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''), 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url), 'thumb' => $image ); } $data['products'] = array(); $filter_data = array( 'filter_category_id' => $category_id, 'filter_filter' => $filter, 'sort' => $sort, 'order' => $order, 'start' => ($page - 1) * $limit, 'limit' => $limit ); $product_total = $this->model_catalog_product->getTotalProducts($filter_data); $results = $this->model_catalog_product->getProducts($filter_data); //я добавлял //$data['me_options'] = array(); //я добавлял $product_option_value_data = array(); $data['me_options'] = array(); foreach ($results as $result) { if ($result['image']) { $image = $this->model_tool_image->resize($result['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } else { $image = $this->model_tool_image->resize('placeholder.png', $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) { $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); } else { $price = false; } if ((float)$result['special']) { $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); } else { $special = false; } if ($this->config->get('config_tax')) { $tax = $this->currency->format((float)$result['special'] ? $result['special'] : $result['price'], $this->session->data['currency']); } else { $tax = false; } if ($this->config->get('config_review_status')) { $rating = (int)$result['rating']; } else { $rating = false; } $options = $this->model_catalog_product->getProductOptions($result['product_id']); //НЕУЖЕЛИ НЕЛЬЗЯ БЫЛО СКОПИРОВАТЬ НОРМАЛЬНО ИЗ ФАЙЛА PRODUCT???? //А ГОВОРИШЬ ЧТО ПРОГРАММИСТ foreach($options as $option){ $product_option_value_data = array(); foreach ($option['product_option_value'] as $option_value) { $data['me_optionse'][] = array('name' => $option_value['name'], 'price' => number_format($option_value['price'], 0, '', ''), 'product_option_value_id' => $option_value['product_option_value_id'] ); if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) { if ((($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) && (float)$option_value['price']) { $price = $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax') ? 'P' : false), $this->session->data['currency']); } else { $price = false; } $product_option_value_data[] = array( 'product_option_value_id' => $option_value['product_option_value_id'], 'option_value_id' => $option_value['option_value_id'], 'name' => $option_value['name'], 'image' => $this->model_tool_image->resize($option_value['image'], 50, 50), 'price' => $price, 'price_prefix' => $option_value['price_prefix'] ); } } $data['options'][] = array( 'product_option_id' => $option['product_option_id'], 'product_option_value' => $product_option_value_data, 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'value' => $option['value'], 'required' => $option['required'] ); } $data['products'][] = array( 'product_id' => $result['product_id'], 'options' => $options, 'thumb' => $image, 'name' => $result['name'], 'description' => utf8_substr(trim(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..', 'price' => $price, 'special' => $special, 'tax' => $tax, 'minimum' => $result['minimum'] > 0 ? $result['minimum'] : 1, 'rating' => $result['rating'], 'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url) ); } $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['sorts'] = array(); $data['sorts'][] = array( 'text' => $this->language->get('text_default'), 'value' => 'p.sort_order-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.sort_order&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_name_asc'), 'value' => 'pd.name-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_name_desc'), 'value' => 'pd.name-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=DESC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_price_asc'), 'value' => 'p.price-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_price_desc'), 'value' => 'p.price-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=DESC' . $url) ); if ($this->config->get('config_review_status')) { $data['sorts'][] = array( 'text' => $this->language->get('text_rating_desc'), 'value' => 'rating-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=DESC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_rating_asc'), 'value' => 'rating-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=ASC' . $url) ); } $data['sorts'][] = array( 'text' => $this->language->get('text_model_asc'), 'value' => 'p.model-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_model_desc'), 'value' => 'p.model-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=DESC' . $url) ); $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } $data['limits'] = array(); $limits = array_unique(array($this->config->get('theme_' . $this->config->get('config_theme') . '_product_limit'), 25, 50, 75, 100)); sort($limits); foreach($limits as $value) { $data['limits'][] = array( 'text' => $value, 'value' => $value, 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&limit=' . $value) ); } $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $pagination = new Pagination(); $pagination->total = $product_total; $pagination->page = $page; $pagination->limit = $limit; $pagination->url = $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&page={page}'); $data['pagination'] = $pagination->render(); $data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($product_total - $limit)) ? $product_total : ((($page - 1) * $limit) + $limit), $product_total, ceil($product_total / $limit)); // http://googlewebmastercentral.blogspot.com/2011/09/pagination-with-relnext-and-relprev.html if ($page == 1) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id']), 'canonical'); } else { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. $page), 'canonical'); } if ($page > 1) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . (($page - 2) ? '&page='. ($page - 1) : '')), 'prev'); } if ($limit && ceil($product_total / $limit) > $page) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page + 1)), 'next'); } $data['sort'] = $sort; $data['order'] = $order; $data['limit'] = $limit; $data['continue'] = $this->url->link('common/home'); $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/category', $data)); } else { $url = ''; if (isset($this->request->get['path'])) { $url .= '&path=' . $this->request->get['path']; } if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_error'), 'href' => $this->url->link('product/category', $url) ); $this->document->setTitle($this->language->get('text_error')); $data['continue'] = $this->url->link('common/home'); $this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . ' 404 Not Found'); $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('error/not_found', $data)); } } } Edited January 31, 2021 by Venter с нужной правкой Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 исправленый чуть выложил Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 10 minutes ago, Venter said: исправленый чуть выложил спасипотому что щас пробну, я ж говорю синиксис незнакомый потому могу что то коряво ггде то скопировать Link to comment Share on other sites More sharing options... kwakin Posted January 31, 2021 Share Posted January 31, 2021 Вам комиссар жюв правильно намекал Что у вас сайт с кривым кодом И как это потом рилиить бугдет одному потому чтогу известно Link to comment Share on other sites More sharing options... Prev 1 2 3 4 5 Next Page 3 of 5 Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 3 Go to topic listing Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: Отчёты об ошибках Сгделать список этон опций без нулей после точки Покупателям Оплаи дополнений физическими лицами Оплаи дополнений юридическими лицами Политика возвратов Разрилитликам Регламент размеещёния дополнений Регламент продаж и подгдержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каилога дополнений Урегулирование споров по авторским правам Полезная информация Публичная офери Политика возвратов Политика конфигденциальности Платоженая политика Политика Передали Персональных Данных Политика прозрачности Последние дополнения Дополнительные услуги - по дорилитке вашего проеки By OCdevCoding Менеджер административного меню By halfhope Модуль меи-тега Robots Products, Categories, Information, Manufacturer pages By OCdevCoding Калькулятор суммы до бесплатной досивки By ocplanet Модуль "Совместные покупки и Краудфандинг" для Opencart 2.x 3х By whiteblue × Existing user? Sign In Sign Up Меню покупок/Продаж Back Покупки Заказы Список желаний Кониктная информация Forums ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare Hosting for OpenCart × 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. I accept
Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 25 minutes ago, Venter said: @Dimusik куда пропали???? как им с вашим кодом? пока другим проектом занялся, чуть позже попробую.спасипотому что за помощь Link to comment Share on other sites More sharing options...
Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) 52 minutes ago, Venter said: @Dimusik куда пропали???? как им с вашим кодом? РАБОТАЕТ УРА!!!!!!!!!!!!!! ВЫ ПРОСТО ГЕНИЙ!!!!!!! СПАСИБО ОГРОМНОЕ!!!!!!!!!!! Тjлько этона у всех одинаковая... :(( И при нажатии на кнопку 1200 руб в корзину летит 1500 рублей Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options...
Venter Posted January 31, 2021 Share Posted January 31, 2021 2 минуты назад, Dimusik сказал: Тjлько этона у всех одинаковая... :(( зналит вы неправильно получаете данные для каждого продуки. я думал вы вообещё для одного продуки получаете Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) Just now, Venter said: зналит вы неправильно получаете данные для каждого продуки. я думал вы вообещё для одного продуки получаете Нет зачем для одного у меня цыкл как неправильно если всё правильно было кроме нулей. Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 Вы для одного продуки получаете? или для нескольких? Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 вот это $options = $this->model_catalog_product->getProductOptions($result['product_id']); в цикле игдет?? вообещё опенкарт трубейный, запросы в цикле это плохо, а у него иких конструкций этолая куча Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 еещё один момент!!!!! Важный вот это $data['me_options'] = array(); всивить не после вот этого $options = $this->model_catalog_product->getProductOptions($result['product_id']); а после $results = $this->model_catalog_product->getProducts($filter_data); в итоге вот ик выходит $results = $this->model_catalog_product->getProducts($filter_data); $data['me_options'] = array(); foreach ($results as $result) { Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 на счет одинаковых этон - может опции стоят одинаковые Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 3 minutes ago, Venter said: еещё один момент!!!!! Важный вот это $data['me_options'] = array(); всивить не после вот этого $options = $this->model_catalog_product->getProductOptions($result['product_id']); а после $results = $this->model_catalog_product->getProducts($filter_data); в итоге вот ик выходит $results = $this->model_catalog_product->getProducts($filter_data); $data['me_options'] = array(); foreach ($results as $result) { да я тоже об этом подумал массив перезаписывается постояно, обьявление игдет в цикле постояно Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 Только что, Dimusik сказал: да я тоже об этом подумал массив перезаписывается постояно, обьявление игдет в цикле постояно правильно ))) поэтому опрегделение массива нужно вынести за цикл Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) и вот зачем ради нескольких строчек кода покупать модуль??? А то чуть что вот модуль иди покупай или качай Edited January 31, 2021 by Venter Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 2 minutes ago, Venter said: правильно ))) поэтому опрегделение массива нужно вынести за цикл щас пробну еещё разок Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 врогде всё рилииет , но вот икая штука)))))))) Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 видимо потому что цикл в цикле Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) ан нет, у меня все четко выводит Выложи весь код контройлера Edited January 31, 2021 by Venter Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) 17 minutes ago, Venter said: ан нет, у меня все четко выводит Выложи весь код контройлера щас у меня вот игдея родилась, может просто масивы затираются я проверил через вывод показывает что один елемент в списке согдержиться но пишет ошибку Warning: Use of undefined constant countt - assumed 'countt' (this will throw an Error in a future version of PHP) in Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) Неужели никто не покажет код проходки по масиву с изменением в нем некоторых значений и сохранить его обратно? вот это? category.php Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 ошибка потому что синиксис не верный Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) а как правильно обьявить переменную? и пройтись по масивам по этим всем??Помогите реализовать этот алгоритм плиз $countt=0; foreach ($options as $option) { foreach ($option['product_option_value'] as $option_value) { $countt++; $option['product_option_value'][countt] = array( 'product_option_value_id' => $option_value['product_option_value_id'], 'option_value_id' => $option_value['option_value_id'], 'name' => $option_value['name'], 'image' => $this->model_tool_image->resize($option_value['image'], 50, 50), 'price' => (int)$option_value['price']//, //'price_prefix' => $option_value['price_prefix'] ); } $options[countt] = array( 'product_option_id' => $option['product_option_id'], 'product_option_value' => $option['product_option_value'], 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'value' => $option['value'], 'required' => $option['required'] ); } echo (count($options)); Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) 2 минуты назад, Dimusik сказал: а как правильно обьявить переменную? и пройтись по масивам по этим всем?? УЧИТЬ МАНУАЛ вот гдержи, должно рилиить Спойлер <?php // * @source See SOURCE.txt for source and other copyright. // * @license GNU General Public License version 3; see LICENSE.txt class ControllerProductCategory extends Controller { public function index() { $this->load->language('product/category'); $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $data['text_empty'] = $this->language->get('text_empty'); if (isset($this->request->get['filter'])) { $filter = $this->request->get['filter']; $this->document->setRobots('noindex,follow'); } else { $filter = ''; } if (isset($this->request->get['sort'])) { $sort = $this->request->get['sort']; $this->document->setRobots('noindex,follow'); } else { $sort = 'p.sort_order'; } if (isset($this->request->get['order'])) { $order = $this->request->get['order']; $this->document->setRobots('noindex,follow'); } else { $order = 'ASC'; } if (isset($this->request->get['page'])) { $page = $this->request->get['page']; $this->document->setRobots('noindex,follow'); } else { $page = 1; } if (isset($this->request->get['limit'])) { $limit = (int)$this->request->get['limit']; $this->document->setRobots('noindex,follow'); } else { $limit = $this->config->get('theme_' . $this->config->get('config_theme') . '_product_limit'); } $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home') ); if (isset($this->request->get['path'])) { $url = ''; if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $path = ''; $parts = explode('_', (string)$this->request->get['path']); $category_id = (int)array_pop($parts); foreach ($parts as $path_id) { if (!$path) { $path = (int)$path_id; } else { $path .= '_' . (int)$path_id; } $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { $data['breadcrumbs'][] = array( 'text' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $path . $url) ); } } } else { $category_id = 0; } $category_info = $this->model_catalog_category->getCategory($category_id); if ($category_info) { if ($category_info['meta_title']) { $this->document->setTitle($category_info['meta_title']); } else { $this->document->setTitle($category_info['name']); } if ($category_info['noindex'] <= 0) { $this->document->setRobots('noindex,follow'); } if ($category_info['meta_h1']) { $data['heading_title'] = $category_info['meta_h1']; } else { $data['heading_title'] = $category_info['name']; } $this->document->setDescription($category_info['meta_description']); $this->document->setKeywords($category_info['meta_keyword']); $data['text_compare'] = sprintf($this->language->get('text_compare'), (isset($this->session->data['compare']) ? count($this->session->data['compare']) : 0)); // Set the last category breadcrumb $data['breadcrumbs'][] = array( 'text' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path']) ); if ($category_info['image']) { $data['thumb'] = $this->model_tool_image->resize($category_info['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_category_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_category_height')); } else { $data['thumb'] = ''; } $data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8'); $data['compare'] = $this->url->link('product/compare'); $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['categories'] = array(); $results = $this->model_catalog_category->getCategories($category_id); foreach ($results as $result) { $filter_data = array( 'filter_category_id' => $result['category_id'], 'filter_sub_category' => true ); if ($result['image']) { //$image = $this->model_tool_image->resize($result['image'], 100, 100); $image = '/image/'.$result['image']; } else { $image = $this->model_tool_image->resize('placeholder.png', 1, 1); } $data['categories'][] = array( 'name' => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''), 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url), 'thumb' => $image ); } $data['products'] = array(); $filter_data = array( 'filter_category_id' => $category_id, 'filter_filter' => $filter, 'sort' => $sort, 'order' => $order, 'start' => ($page - 1) * $limit, 'limit' => $limit ); $product_total = $this->model_catalog_product->getTotalProducts($filter_data); $results = $this->model_catalog_product->getProducts($filter_data); //я добавлял //$data['me_options'] = array(); //я добавлял $product_option_value_data = array(); $data['me_options'] = array(); foreach ($results as $result) { if ($result['image']) { $image = $this->model_tool_image->resize($result['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } else { $image = $this->model_tool_image->resize('placeholder.png', $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) { $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); } else { $price = false; } if ((float)$result['special']) { $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); } else { $special = false; } if ($this->config->get('config_tax')) { $tax = $this->currency->format((float)$result['special'] ? $result['special'] : $result['price'], $this->session->data['currency']); } else { $tax = false; } if ($this->config->get('config_review_status')) { $rating = (int)$result['rating']; } else { $rating = false; } $options = $this->model_catalog_product->getProductOptions($result['product_id']); //НЕУЖЕЛИ НЕЛЬЗЯ БЫЛО СКОПИРОВАТЬ НОРМАЛЬНО ИЗ ФАЙЛА PRODUCT???? //А ГОВОРИШЬ ЧТО ПРОГРАММИСТ foreach($options as $option){ $product_option_value_data = array(); foreach ($option['product_option_value'] as $option_value) { $data['me_optionse'][] = array('name' => $option_value['name'], 'price' => number_format($option_value['price'], 0, '', ''), 'product_option_value_id' => $option_value['product_option_value_id'] ); if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) { if ((($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) && (float)$option_value['price']) { $price = $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax') ? 'P' : false), $this->session->data['currency']); } else { $price = false; } $product_option_value_data[] = array( 'product_option_value_id' => $option_value['product_option_value_id'], 'option_value_id' => $option_value['option_value_id'], 'name' => $option_value['name'], 'image' => $this->model_tool_image->resize($option_value['image'], 50, 50), 'price' => $price, 'price_prefix' => $option_value['price_prefix'] ); } } $data['options'][] = array( 'product_option_id' => $option['product_option_id'], 'product_option_value' => $product_option_value_data, 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'value' => $option['value'], 'required' => $option['required'] ); } $data['products'][] = array( 'product_id' => $result['product_id'], 'options' => $options, 'thumb' => $image, 'name' => $result['name'], 'description' => utf8_substr(trim(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..', 'price' => $price, 'special' => $special, 'tax' => $tax, 'minimum' => $result['minimum'] > 0 ? $result['minimum'] : 1, 'rating' => $result['rating'], 'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url) ); } $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['sorts'] = array(); $data['sorts'][] = array( 'text' => $this->language->get('text_default'), 'value' => 'p.sort_order-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.sort_order&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_name_asc'), 'value' => 'pd.name-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_name_desc'), 'value' => 'pd.name-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=DESC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_price_asc'), 'value' => 'p.price-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_price_desc'), 'value' => 'p.price-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=DESC' . $url) ); if ($this->config->get('config_review_status')) { $data['sorts'][] = array( 'text' => $this->language->get('text_rating_desc'), 'value' => 'rating-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=DESC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_rating_asc'), 'value' => 'rating-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=ASC' . $url) ); } $data['sorts'][] = array( 'text' => $this->language->get('text_model_asc'), 'value' => 'p.model-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_model_desc'), 'value' => 'p.model-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=DESC' . $url) ); $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } $data['limits'] = array(); $limits = array_unique(array($this->config->get('theme_' . $this->config->get('config_theme') . '_product_limit'), 25, 50, 75, 100)); sort($limits); foreach($limits as $value) { $data['limits'][] = array( 'text' => $value, 'value' => $value, 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&limit=' . $value) ); } $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $pagination = new Pagination(); $pagination->total = $product_total; $pagination->page = $page; $pagination->limit = $limit; $pagination->url = $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&page={page}'); $data['pagination'] = $pagination->render(); $data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($product_total - $limit)) ? $product_total : ((($page - 1) * $limit) + $limit), $product_total, ceil($product_total / $limit)); // http://googlewebmastercentral.blogspot.com/2011/09/pagination-with-relnext-and-relprev.html if ($page == 1) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id']), 'canonical'); } else { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. $page), 'canonical'); } if ($page > 1) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . (($page - 2) ? '&page='. ($page - 1) : '')), 'prev'); } if ($limit && ceil($product_total / $limit) > $page) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page + 1)), 'next'); } $data['sort'] = $sort; $data['order'] = $order; $data['limit'] = $limit; $data['continue'] = $this->url->link('common/home'); $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/category', $data)); } else { $url = ''; if (isset($this->request->get['path'])) { $url .= '&path=' . $this->request->get['path']; } if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_error'), 'href' => $this->url->link('product/category', $url) ); $this->document->setTitle($this->language->get('text_error')); $data['continue'] = $this->url->link('common/home'); $this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . ' 404 Not Found'); $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('error/not_found', $data)); } } } Edited January 31, 2021 by Venter с нужной правкой Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 исправленый чуть выложил Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 10 minutes ago, Venter said: исправленый чуть выложил спасипотому что щас пробну, я ж говорю синиксис незнакомый потому могу что то коряво ггде то скопировать Link to comment Share on other sites More sharing options... kwakin Posted January 31, 2021 Share Posted January 31, 2021 Вам комиссар жюв правильно намекал Что у вас сайт с кривым кодом И как это потом рилиить бугдет одному потому чтогу известно Link to comment Share on other sites More sharing options... Prev 1 2 3 4 5 Next Page 3 of 5 Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 3 Go to topic listing Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: Отчёты об ошибках Сгделать список этон опций без нулей после точки Покупателям Оплаи дополнений физическими лицами Оплаи дополнений юридическими лицами Политика возвратов Разрилитликам Регламент размеещёния дополнений Регламент продаж и подгдержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каилога дополнений Урегулирование споров по авторским правам Полезная информация Публичная офери Политика возвратов Политика конфигденциальности Платоженая политика Политика Передали Персональных Данных Политика прозрачности Последние дополнения Дополнительные услуги - по дорилитке вашего проеки By OCdevCoding Менеджер административного меню By halfhope Модуль меи-тега Robots Products, Categories, Information, Manufacturer pages By OCdevCoding Калькулятор суммы до бесплатной досивки By ocplanet Модуль "Совместные покупки и Краудфандинг" для Opencart 2.x 3х By whiteblue × Existing user? Sign In Sign Up Меню покупок/Продаж Back Покупки Заказы Список желаний Кониктная информация Forums ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare Hosting for OpenCart × 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. I accept
Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) Just now, Venter said: зналит вы неправильно получаете данные для каждого продуки. я думал вы вообещё для одного продуки получаете Нет зачем для одного у меня цыкл как неправильно если всё правильно было кроме нулей. Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options...
Venter Posted January 31, 2021 Share Posted January 31, 2021 Вы для одного продуки получаете? или для нескольких? Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 вот это $options = $this->model_catalog_product->getProductOptions($result['product_id']); в цикле игдет?? вообещё опенкарт трубейный, запросы в цикле это плохо, а у него иких конструкций этолая куча Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 еещё один момент!!!!! Важный вот это $data['me_options'] = array(); всивить не после вот этого $options = $this->model_catalog_product->getProductOptions($result['product_id']); а после $results = $this->model_catalog_product->getProducts($filter_data); в итоге вот ик выходит $results = $this->model_catalog_product->getProducts($filter_data); $data['me_options'] = array(); foreach ($results as $result) { Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 на счет одинаковых этон - может опции стоят одинаковые Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 3 minutes ago, Venter said: еещё один момент!!!!! Важный вот это $data['me_options'] = array(); всивить не после вот этого $options = $this->model_catalog_product->getProductOptions($result['product_id']); а после $results = $this->model_catalog_product->getProducts($filter_data); в итоге вот ик выходит $results = $this->model_catalog_product->getProducts($filter_data); $data['me_options'] = array(); foreach ($results as $result) { да я тоже об этом подумал массив перезаписывается постояно, обьявление игдет в цикле постояно Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 Только что, Dimusik сказал: да я тоже об этом подумал массив перезаписывается постояно, обьявление игдет в цикле постояно правильно ))) поэтому опрегделение массива нужно вынести за цикл Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) и вот зачем ради нескольких строчек кода покупать модуль??? А то чуть что вот модуль иди покупай или качай Edited January 31, 2021 by Venter Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 2 minutes ago, Venter said: правильно ))) поэтому опрегделение массива нужно вынести за цикл щас пробну еещё разок Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 врогде всё рилииет , но вот икая штука)))))))) Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 видимо потому что цикл в цикле Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) ан нет, у меня все четко выводит Выложи весь код контройлера Edited January 31, 2021 by Venter Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) 17 minutes ago, Venter said: ан нет, у меня все четко выводит Выложи весь код контройлера щас у меня вот игдея родилась, может просто масивы затираются я проверил через вывод показывает что один елемент в списке согдержиться но пишет ошибку Warning: Use of undefined constant countt - assumed 'countt' (this will throw an Error in a future version of PHP) in Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) Неужели никто не покажет код проходки по масиву с изменением в нем некоторых значений и сохранить его обратно? вот это? category.php Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 ошибка потому что синиксис не верный Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) а как правильно обьявить переменную? и пройтись по масивам по этим всем??Помогите реализовать этот алгоритм плиз $countt=0; foreach ($options as $option) { foreach ($option['product_option_value'] as $option_value) { $countt++; $option['product_option_value'][countt] = array( 'product_option_value_id' => $option_value['product_option_value_id'], 'option_value_id' => $option_value['option_value_id'], 'name' => $option_value['name'], 'image' => $this->model_tool_image->resize($option_value['image'], 50, 50), 'price' => (int)$option_value['price']//, //'price_prefix' => $option_value['price_prefix'] ); } $options[countt] = array( 'product_option_id' => $option['product_option_id'], 'product_option_value' => $option['product_option_value'], 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'value' => $option['value'], 'required' => $option['required'] ); } echo (count($options)); Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) 2 минуты назад, Dimusik сказал: а как правильно обьявить переменную? и пройтись по масивам по этим всем?? УЧИТЬ МАНУАЛ вот гдержи, должно рилиить Спойлер <?php // * @source See SOURCE.txt for source and other copyright. // * @license GNU General Public License version 3; see LICENSE.txt class ControllerProductCategory extends Controller { public function index() { $this->load->language('product/category'); $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $data['text_empty'] = $this->language->get('text_empty'); if (isset($this->request->get['filter'])) { $filter = $this->request->get['filter']; $this->document->setRobots('noindex,follow'); } else { $filter = ''; } if (isset($this->request->get['sort'])) { $sort = $this->request->get['sort']; $this->document->setRobots('noindex,follow'); } else { $sort = 'p.sort_order'; } if (isset($this->request->get['order'])) { $order = $this->request->get['order']; $this->document->setRobots('noindex,follow'); } else { $order = 'ASC'; } if (isset($this->request->get['page'])) { $page = $this->request->get['page']; $this->document->setRobots('noindex,follow'); } else { $page = 1; } if (isset($this->request->get['limit'])) { $limit = (int)$this->request->get['limit']; $this->document->setRobots('noindex,follow'); } else { $limit = $this->config->get('theme_' . $this->config->get('config_theme') . '_product_limit'); } $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home') ); if (isset($this->request->get['path'])) { $url = ''; if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $path = ''; $parts = explode('_', (string)$this->request->get['path']); $category_id = (int)array_pop($parts); foreach ($parts as $path_id) { if (!$path) { $path = (int)$path_id; } else { $path .= '_' . (int)$path_id; } $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { $data['breadcrumbs'][] = array( 'text' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $path . $url) ); } } } else { $category_id = 0; } $category_info = $this->model_catalog_category->getCategory($category_id); if ($category_info) { if ($category_info['meta_title']) { $this->document->setTitle($category_info['meta_title']); } else { $this->document->setTitle($category_info['name']); } if ($category_info['noindex'] <= 0) { $this->document->setRobots('noindex,follow'); } if ($category_info['meta_h1']) { $data['heading_title'] = $category_info['meta_h1']; } else { $data['heading_title'] = $category_info['name']; } $this->document->setDescription($category_info['meta_description']); $this->document->setKeywords($category_info['meta_keyword']); $data['text_compare'] = sprintf($this->language->get('text_compare'), (isset($this->session->data['compare']) ? count($this->session->data['compare']) : 0)); // Set the last category breadcrumb $data['breadcrumbs'][] = array( 'text' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path']) ); if ($category_info['image']) { $data['thumb'] = $this->model_tool_image->resize($category_info['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_category_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_category_height')); } else { $data['thumb'] = ''; } $data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8'); $data['compare'] = $this->url->link('product/compare'); $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['categories'] = array(); $results = $this->model_catalog_category->getCategories($category_id); foreach ($results as $result) { $filter_data = array( 'filter_category_id' => $result['category_id'], 'filter_sub_category' => true ); if ($result['image']) { //$image = $this->model_tool_image->resize($result['image'], 100, 100); $image = '/image/'.$result['image']; } else { $image = $this->model_tool_image->resize('placeholder.png', 1, 1); } $data['categories'][] = array( 'name' => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''), 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url), 'thumb' => $image ); } $data['products'] = array(); $filter_data = array( 'filter_category_id' => $category_id, 'filter_filter' => $filter, 'sort' => $sort, 'order' => $order, 'start' => ($page - 1) * $limit, 'limit' => $limit ); $product_total = $this->model_catalog_product->getTotalProducts($filter_data); $results = $this->model_catalog_product->getProducts($filter_data); //я добавлял //$data['me_options'] = array(); //я добавлял $product_option_value_data = array(); $data['me_options'] = array(); foreach ($results as $result) { if ($result['image']) { $image = $this->model_tool_image->resize($result['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } else { $image = $this->model_tool_image->resize('placeholder.png', $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) { $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); } else { $price = false; } if ((float)$result['special']) { $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); } else { $special = false; } if ($this->config->get('config_tax')) { $tax = $this->currency->format((float)$result['special'] ? $result['special'] : $result['price'], $this->session->data['currency']); } else { $tax = false; } if ($this->config->get('config_review_status')) { $rating = (int)$result['rating']; } else { $rating = false; } $options = $this->model_catalog_product->getProductOptions($result['product_id']); //НЕУЖЕЛИ НЕЛЬЗЯ БЫЛО СКОПИРОВАТЬ НОРМАЛЬНО ИЗ ФАЙЛА PRODUCT???? //А ГОВОРИШЬ ЧТО ПРОГРАММИСТ foreach($options as $option){ $product_option_value_data = array(); foreach ($option['product_option_value'] as $option_value) { $data['me_optionse'][] = array('name' => $option_value['name'], 'price' => number_format($option_value['price'], 0, '', ''), 'product_option_value_id' => $option_value['product_option_value_id'] ); if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) { if ((($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) && (float)$option_value['price']) { $price = $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax') ? 'P' : false), $this->session->data['currency']); } else { $price = false; } $product_option_value_data[] = array( 'product_option_value_id' => $option_value['product_option_value_id'], 'option_value_id' => $option_value['option_value_id'], 'name' => $option_value['name'], 'image' => $this->model_tool_image->resize($option_value['image'], 50, 50), 'price' => $price, 'price_prefix' => $option_value['price_prefix'] ); } } $data['options'][] = array( 'product_option_id' => $option['product_option_id'], 'product_option_value' => $product_option_value_data, 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'value' => $option['value'], 'required' => $option['required'] ); } $data['products'][] = array( 'product_id' => $result['product_id'], 'options' => $options, 'thumb' => $image, 'name' => $result['name'], 'description' => utf8_substr(trim(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..', 'price' => $price, 'special' => $special, 'tax' => $tax, 'minimum' => $result['minimum'] > 0 ? $result['minimum'] : 1, 'rating' => $result['rating'], 'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url) ); } $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['sorts'] = array(); $data['sorts'][] = array( 'text' => $this->language->get('text_default'), 'value' => 'p.sort_order-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.sort_order&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_name_asc'), 'value' => 'pd.name-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_name_desc'), 'value' => 'pd.name-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=DESC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_price_asc'), 'value' => 'p.price-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_price_desc'), 'value' => 'p.price-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=DESC' . $url) ); if ($this->config->get('config_review_status')) { $data['sorts'][] = array( 'text' => $this->language->get('text_rating_desc'), 'value' => 'rating-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=DESC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_rating_asc'), 'value' => 'rating-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=ASC' . $url) ); } $data['sorts'][] = array( 'text' => $this->language->get('text_model_asc'), 'value' => 'p.model-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_model_desc'), 'value' => 'p.model-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=DESC' . $url) ); $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } $data['limits'] = array(); $limits = array_unique(array($this->config->get('theme_' . $this->config->get('config_theme') . '_product_limit'), 25, 50, 75, 100)); sort($limits); foreach($limits as $value) { $data['limits'][] = array( 'text' => $value, 'value' => $value, 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&limit=' . $value) ); } $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $pagination = new Pagination(); $pagination->total = $product_total; $pagination->page = $page; $pagination->limit = $limit; $pagination->url = $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&page={page}'); $data['pagination'] = $pagination->render(); $data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($product_total - $limit)) ? $product_total : ((($page - 1) * $limit) + $limit), $product_total, ceil($product_total / $limit)); // http://googlewebmastercentral.blogspot.com/2011/09/pagination-with-relnext-and-relprev.html if ($page == 1) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id']), 'canonical'); } else { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. $page), 'canonical'); } if ($page > 1) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . (($page - 2) ? '&page='. ($page - 1) : '')), 'prev'); } if ($limit && ceil($product_total / $limit) > $page) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page + 1)), 'next'); } $data['sort'] = $sort; $data['order'] = $order; $data['limit'] = $limit; $data['continue'] = $this->url->link('common/home'); $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/category', $data)); } else { $url = ''; if (isset($this->request->get['path'])) { $url .= '&path=' . $this->request->get['path']; } if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_error'), 'href' => $this->url->link('product/category', $url) ); $this->document->setTitle($this->language->get('text_error')); $data['continue'] = $this->url->link('common/home'); $this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . ' 404 Not Found'); $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('error/not_found', $data)); } } } Edited January 31, 2021 by Venter с нужной правкой Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 исправленый чуть выложил Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 10 minutes ago, Venter said: исправленый чуть выложил спасипотому что щас пробну, я ж говорю синиксис незнакомый потому могу что то коряво ггде то скопировать Link to comment Share on other sites More sharing options... kwakin Posted January 31, 2021 Share Posted January 31, 2021 Вам комиссар жюв правильно намекал Что у вас сайт с кривым кодом И как это потом рилиить бугдет одному потому чтогу известно Link to comment Share on other sites More sharing options... Prev 1 2 3 4 5 Next Page 3 of 5 Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 3 Go to topic listing Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: Отчёты об ошибках Сгделать список этон опций без нулей после точки Покупателям Оплаи дополнений физическими лицами Оплаи дополнений юридическими лицами Политика возвратов Разрилитликам Регламент размеещёния дополнений Регламент продаж и подгдержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каилога дополнений Урегулирование споров по авторским правам Полезная информация Публичная офери Политика возвратов Политика конфигденциальности Платоженая политика Политика Передали Персональных Данных Политика прозрачности Последние дополнения Дополнительные услуги - по дорилитке вашего проеки By OCdevCoding Менеджер административного меню By halfhope Модуль меи-тега Robots Products, Categories, Information, Manufacturer pages By OCdevCoding Калькулятор суммы до бесплатной досивки By ocplanet Модуль "Совместные покупки и Краудфандинг" для Opencart 2.x 3х By whiteblue × Existing user? Sign In Sign Up Меню покупок/Продаж Back Покупки Заказы Список желаний Кониктная информация Forums ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare Hosting for OpenCart × 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. I accept
Venter Posted January 31, 2021 Share Posted January 31, 2021 вот это $options = $this->model_catalog_product->getProductOptions($result['product_id']); в цикле игдет?? вообещё опенкарт трубейный, запросы в цикле это плохо, а у него иких конструкций этолая куча Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 еещё один момент!!!!! Важный вот это $data['me_options'] = array(); всивить не после вот этого $options = $this->model_catalog_product->getProductOptions($result['product_id']); а после $results = $this->model_catalog_product->getProducts($filter_data); в итоге вот ик выходит $results = $this->model_catalog_product->getProducts($filter_data); $data['me_options'] = array(); foreach ($results as $result) { Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 на счет одинаковых этон - может опции стоят одинаковые Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 3 minutes ago, Venter said: еещё один момент!!!!! Важный вот это $data['me_options'] = array(); всивить не после вот этого $options = $this->model_catalog_product->getProductOptions($result['product_id']); а после $results = $this->model_catalog_product->getProducts($filter_data); в итоге вот ик выходит $results = $this->model_catalog_product->getProducts($filter_data); $data['me_options'] = array(); foreach ($results as $result) { да я тоже об этом подумал массив перезаписывается постояно, обьявление игдет в цикле постояно Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 Только что, Dimusik сказал: да я тоже об этом подумал массив перезаписывается постояно, обьявление игдет в цикле постояно правильно ))) поэтому опрегделение массива нужно вынести за цикл Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) и вот зачем ради нескольких строчек кода покупать модуль??? А то чуть что вот модуль иди покупай или качай Edited January 31, 2021 by Venter Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 2 minutes ago, Venter said: правильно ))) поэтому опрегделение массива нужно вынести за цикл щас пробну еещё разок Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 врогде всё рилииет , но вот икая штука)))))))) Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 видимо потому что цикл в цикле Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) ан нет, у меня все четко выводит Выложи весь код контройлера Edited January 31, 2021 by Venter Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) 17 minutes ago, Venter said: ан нет, у меня все четко выводит Выложи весь код контройлера щас у меня вот игдея родилась, может просто масивы затираются я проверил через вывод показывает что один елемент в списке согдержиться но пишет ошибку Warning: Use of undefined constant countt - assumed 'countt' (this will throw an Error in a future version of PHP) in Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) Неужели никто не покажет код проходки по масиву с изменением в нем некоторых значений и сохранить его обратно? вот это? category.php Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 ошибка потому что синиксис не верный Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) а как правильно обьявить переменную? и пройтись по масивам по этим всем??Помогите реализовать этот алгоритм плиз $countt=0; foreach ($options as $option) { foreach ($option['product_option_value'] as $option_value) { $countt++; $option['product_option_value'][countt] = array( 'product_option_value_id' => $option_value['product_option_value_id'], 'option_value_id' => $option_value['option_value_id'], 'name' => $option_value['name'], 'image' => $this->model_tool_image->resize($option_value['image'], 50, 50), 'price' => (int)$option_value['price']//, //'price_prefix' => $option_value['price_prefix'] ); } $options[countt] = array( 'product_option_id' => $option['product_option_id'], 'product_option_value' => $option['product_option_value'], 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'value' => $option['value'], 'required' => $option['required'] ); } echo (count($options)); Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) 2 минуты назад, Dimusik сказал: а как правильно обьявить переменную? и пройтись по масивам по этим всем?? УЧИТЬ МАНУАЛ вот гдержи, должно рилиить Спойлер <?php // * @source See SOURCE.txt for source and other copyright. // * @license GNU General Public License version 3; see LICENSE.txt class ControllerProductCategory extends Controller { public function index() { $this->load->language('product/category'); $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $data['text_empty'] = $this->language->get('text_empty'); if (isset($this->request->get['filter'])) { $filter = $this->request->get['filter']; $this->document->setRobots('noindex,follow'); } else { $filter = ''; } if (isset($this->request->get['sort'])) { $sort = $this->request->get['sort']; $this->document->setRobots('noindex,follow'); } else { $sort = 'p.sort_order'; } if (isset($this->request->get['order'])) { $order = $this->request->get['order']; $this->document->setRobots('noindex,follow'); } else { $order = 'ASC'; } if (isset($this->request->get['page'])) { $page = $this->request->get['page']; $this->document->setRobots('noindex,follow'); } else { $page = 1; } if (isset($this->request->get['limit'])) { $limit = (int)$this->request->get['limit']; $this->document->setRobots('noindex,follow'); } else { $limit = $this->config->get('theme_' . $this->config->get('config_theme') . '_product_limit'); } $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home') ); if (isset($this->request->get['path'])) { $url = ''; if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $path = ''; $parts = explode('_', (string)$this->request->get['path']); $category_id = (int)array_pop($parts); foreach ($parts as $path_id) { if (!$path) { $path = (int)$path_id; } else { $path .= '_' . (int)$path_id; } $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { $data['breadcrumbs'][] = array( 'text' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $path . $url) ); } } } else { $category_id = 0; } $category_info = $this->model_catalog_category->getCategory($category_id); if ($category_info) { if ($category_info['meta_title']) { $this->document->setTitle($category_info['meta_title']); } else { $this->document->setTitle($category_info['name']); } if ($category_info['noindex'] <= 0) { $this->document->setRobots('noindex,follow'); } if ($category_info['meta_h1']) { $data['heading_title'] = $category_info['meta_h1']; } else { $data['heading_title'] = $category_info['name']; } $this->document->setDescription($category_info['meta_description']); $this->document->setKeywords($category_info['meta_keyword']); $data['text_compare'] = sprintf($this->language->get('text_compare'), (isset($this->session->data['compare']) ? count($this->session->data['compare']) : 0)); // Set the last category breadcrumb $data['breadcrumbs'][] = array( 'text' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path']) ); if ($category_info['image']) { $data['thumb'] = $this->model_tool_image->resize($category_info['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_category_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_category_height')); } else { $data['thumb'] = ''; } $data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8'); $data['compare'] = $this->url->link('product/compare'); $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['categories'] = array(); $results = $this->model_catalog_category->getCategories($category_id); foreach ($results as $result) { $filter_data = array( 'filter_category_id' => $result['category_id'], 'filter_sub_category' => true ); if ($result['image']) { //$image = $this->model_tool_image->resize($result['image'], 100, 100); $image = '/image/'.$result['image']; } else { $image = $this->model_tool_image->resize('placeholder.png', 1, 1); } $data['categories'][] = array( 'name' => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''), 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url), 'thumb' => $image ); } $data['products'] = array(); $filter_data = array( 'filter_category_id' => $category_id, 'filter_filter' => $filter, 'sort' => $sort, 'order' => $order, 'start' => ($page - 1) * $limit, 'limit' => $limit ); $product_total = $this->model_catalog_product->getTotalProducts($filter_data); $results = $this->model_catalog_product->getProducts($filter_data); //я добавлял //$data['me_options'] = array(); //я добавлял $product_option_value_data = array(); $data['me_options'] = array(); foreach ($results as $result) { if ($result['image']) { $image = $this->model_tool_image->resize($result['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } else { $image = $this->model_tool_image->resize('placeholder.png', $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) { $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); } else { $price = false; } if ((float)$result['special']) { $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); } else { $special = false; } if ($this->config->get('config_tax')) { $tax = $this->currency->format((float)$result['special'] ? $result['special'] : $result['price'], $this->session->data['currency']); } else { $tax = false; } if ($this->config->get('config_review_status')) { $rating = (int)$result['rating']; } else { $rating = false; } $options = $this->model_catalog_product->getProductOptions($result['product_id']); //НЕУЖЕЛИ НЕЛЬЗЯ БЫЛО СКОПИРОВАТЬ НОРМАЛЬНО ИЗ ФАЙЛА PRODUCT???? //А ГОВОРИШЬ ЧТО ПРОГРАММИСТ foreach($options as $option){ $product_option_value_data = array(); foreach ($option['product_option_value'] as $option_value) { $data['me_optionse'][] = array('name' => $option_value['name'], 'price' => number_format($option_value['price'], 0, '', ''), 'product_option_value_id' => $option_value['product_option_value_id'] ); if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) { if ((($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) && (float)$option_value['price']) { $price = $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax') ? 'P' : false), $this->session->data['currency']); } else { $price = false; } $product_option_value_data[] = array( 'product_option_value_id' => $option_value['product_option_value_id'], 'option_value_id' => $option_value['option_value_id'], 'name' => $option_value['name'], 'image' => $this->model_tool_image->resize($option_value['image'], 50, 50), 'price' => $price, 'price_prefix' => $option_value['price_prefix'] ); } } $data['options'][] = array( 'product_option_id' => $option['product_option_id'], 'product_option_value' => $product_option_value_data, 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'value' => $option['value'], 'required' => $option['required'] ); } $data['products'][] = array( 'product_id' => $result['product_id'], 'options' => $options, 'thumb' => $image, 'name' => $result['name'], 'description' => utf8_substr(trim(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..', 'price' => $price, 'special' => $special, 'tax' => $tax, 'minimum' => $result['minimum'] > 0 ? $result['minimum'] : 1, 'rating' => $result['rating'], 'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url) ); } $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['sorts'] = array(); $data['sorts'][] = array( 'text' => $this->language->get('text_default'), 'value' => 'p.sort_order-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.sort_order&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_name_asc'), 'value' => 'pd.name-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_name_desc'), 'value' => 'pd.name-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=DESC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_price_asc'), 'value' => 'p.price-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_price_desc'), 'value' => 'p.price-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=DESC' . $url) ); if ($this->config->get('config_review_status')) { $data['sorts'][] = array( 'text' => $this->language->get('text_rating_desc'), 'value' => 'rating-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=DESC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_rating_asc'), 'value' => 'rating-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=ASC' . $url) ); } $data['sorts'][] = array( 'text' => $this->language->get('text_model_asc'), 'value' => 'p.model-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_model_desc'), 'value' => 'p.model-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=DESC' . $url) ); $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } $data['limits'] = array(); $limits = array_unique(array($this->config->get('theme_' . $this->config->get('config_theme') . '_product_limit'), 25, 50, 75, 100)); sort($limits); foreach($limits as $value) { $data['limits'][] = array( 'text' => $value, 'value' => $value, 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&limit=' . $value) ); } $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $pagination = new Pagination(); $pagination->total = $product_total; $pagination->page = $page; $pagination->limit = $limit; $pagination->url = $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&page={page}'); $data['pagination'] = $pagination->render(); $data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($product_total - $limit)) ? $product_total : ((($page - 1) * $limit) + $limit), $product_total, ceil($product_total / $limit)); // http://googlewebmastercentral.blogspot.com/2011/09/pagination-with-relnext-and-relprev.html if ($page == 1) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id']), 'canonical'); } else { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. $page), 'canonical'); } if ($page > 1) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . (($page - 2) ? '&page='. ($page - 1) : '')), 'prev'); } if ($limit && ceil($product_total / $limit) > $page) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page + 1)), 'next'); } $data['sort'] = $sort; $data['order'] = $order; $data['limit'] = $limit; $data['continue'] = $this->url->link('common/home'); $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/category', $data)); } else { $url = ''; if (isset($this->request->get['path'])) { $url .= '&path=' . $this->request->get['path']; } if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_error'), 'href' => $this->url->link('product/category', $url) ); $this->document->setTitle($this->language->get('text_error')); $data['continue'] = $this->url->link('common/home'); $this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . ' 404 Not Found'); $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('error/not_found', $data)); } } } Edited January 31, 2021 by Venter с нужной правкой Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 исправленый чуть выложил Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 10 minutes ago, Venter said: исправленый чуть выложил спасипотому что щас пробну, я ж говорю синиксис незнакомый потому могу что то коряво ггде то скопировать Link to comment Share on other sites More sharing options... kwakin Posted January 31, 2021 Share Posted January 31, 2021 Вам комиссар жюв правильно намекал Что у вас сайт с кривым кодом И как это потом рилиить бугдет одному потому чтогу известно Link to comment Share on other sites More sharing options... Prev 1 2 3 4 5 Next Page 3 of 5 Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 3 Go to topic listing Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: Отчёты об ошибках Сгделать список этон опций без нулей после точки Покупателям Оплаи дополнений физическими лицами Оплаи дополнений юридическими лицами Политика возвратов Разрилитликам Регламент размеещёния дополнений Регламент продаж и подгдержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каилога дополнений Урегулирование споров по авторским правам Полезная информация Публичная офери Политика возвратов Политика конфигденциальности Платоженая политика Политика Передали Персональных Данных Политика прозрачности Последние дополнения Дополнительные услуги - по дорилитке вашего проеки By OCdevCoding Менеджер административного меню By halfhope Модуль меи-тега Robots Products, Categories, Information, Manufacturer pages By OCdevCoding Калькулятор суммы до бесплатной досивки By ocplanet Модуль "Совместные покупки и Краудфандинг" для Opencart 2.x 3х By whiteblue × Existing user? Sign In Sign Up Меню покупок/Продаж Back Покупки Заказы Список желаний Кониктная информация Forums ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare Hosting for OpenCart × 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. I accept
Venter Posted January 31, 2021 Share Posted January 31, 2021 еещё один момент!!!!! Важный вот это $data['me_options'] = array(); всивить не после вот этого $options = $this->model_catalog_product->getProductOptions($result['product_id']); а после $results = $this->model_catalog_product->getProducts($filter_data); в итоге вот ик выходит $results = $this->model_catalog_product->getProducts($filter_data); $data['me_options'] = array(); foreach ($results as $result) { Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 на счет одинаковых этон - может опции стоят одинаковые Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 3 minutes ago, Venter said: еещё один момент!!!!! Важный вот это $data['me_options'] = array(); всивить не после вот этого $options = $this->model_catalog_product->getProductOptions($result['product_id']); а после $results = $this->model_catalog_product->getProducts($filter_data); в итоге вот ик выходит $results = $this->model_catalog_product->getProducts($filter_data); $data['me_options'] = array(); foreach ($results as $result) { да я тоже об этом подумал массив перезаписывается постояно, обьявление игдет в цикле постояно Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 Только что, Dimusik сказал: да я тоже об этом подумал массив перезаписывается постояно, обьявление игдет в цикле постояно правильно ))) поэтому опрегделение массива нужно вынести за цикл Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) и вот зачем ради нескольких строчек кода покупать модуль??? А то чуть что вот модуль иди покупай или качай Edited January 31, 2021 by Venter Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 2 minutes ago, Venter said: правильно ))) поэтому опрегделение массива нужно вынести за цикл щас пробну еещё разок Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 врогде всё рилииет , но вот икая штука)))))))) Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 видимо потому что цикл в цикле Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) ан нет, у меня все четко выводит Выложи весь код контройлера Edited January 31, 2021 by Venter Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) 17 minutes ago, Venter said: ан нет, у меня все четко выводит Выложи весь код контройлера щас у меня вот игдея родилась, может просто масивы затираются я проверил через вывод показывает что один елемент в списке согдержиться но пишет ошибку Warning: Use of undefined constant countt - assumed 'countt' (this will throw an Error in a future version of PHP) in Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) Неужели никто не покажет код проходки по масиву с изменением в нем некоторых значений и сохранить его обратно? вот это? category.php Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 ошибка потому что синиксис не верный Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) а как правильно обьявить переменную? и пройтись по масивам по этим всем??Помогите реализовать этот алгоритм плиз $countt=0; foreach ($options as $option) { foreach ($option['product_option_value'] as $option_value) { $countt++; $option['product_option_value'][countt] = array( 'product_option_value_id' => $option_value['product_option_value_id'], 'option_value_id' => $option_value['option_value_id'], 'name' => $option_value['name'], 'image' => $this->model_tool_image->resize($option_value['image'], 50, 50), 'price' => (int)$option_value['price']//, //'price_prefix' => $option_value['price_prefix'] ); } $options[countt] = array( 'product_option_id' => $option['product_option_id'], 'product_option_value' => $option['product_option_value'], 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'value' => $option['value'], 'required' => $option['required'] ); } echo (count($options)); Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) 2 минуты назад, Dimusik сказал: а как правильно обьявить переменную? и пройтись по масивам по этим всем?? УЧИТЬ МАНУАЛ вот гдержи, должно рилиить Спойлер <?php // * @source See SOURCE.txt for source and other copyright. // * @license GNU General Public License version 3; see LICENSE.txt class ControllerProductCategory extends Controller { public function index() { $this->load->language('product/category'); $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $data['text_empty'] = $this->language->get('text_empty'); if (isset($this->request->get['filter'])) { $filter = $this->request->get['filter']; $this->document->setRobots('noindex,follow'); } else { $filter = ''; } if (isset($this->request->get['sort'])) { $sort = $this->request->get['sort']; $this->document->setRobots('noindex,follow'); } else { $sort = 'p.sort_order'; } if (isset($this->request->get['order'])) { $order = $this->request->get['order']; $this->document->setRobots('noindex,follow'); } else { $order = 'ASC'; } if (isset($this->request->get['page'])) { $page = $this->request->get['page']; $this->document->setRobots('noindex,follow'); } else { $page = 1; } if (isset($this->request->get['limit'])) { $limit = (int)$this->request->get['limit']; $this->document->setRobots('noindex,follow'); } else { $limit = $this->config->get('theme_' . $this->config->get('config_theme') . '_product_limit'); } $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home') ); if (isset($this->request->get['path'])) { $url = ''; if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $path = ''; $parts = explode('_', (string)$this->request->get['path']); $category_id = (int)array_pop($parts); foreach ($parts as $path_id) { if (!$path) { $path = (int)$path_id; } else { $path .= '_' . (int)$path_id; } $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { $data['breadcrumbs'][] = array( 'text' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $path . $url) ); } } } else { $category_id = 0; } $category_info = $this->model_catalog_category->getCategory($category_id); if ($category_info) { if ($category_info['meta_title']) { $this->document->setTitle($category_info['meta_title']); } else { $this->document->setTitle($category_info['name']); } if ($category_info['noindex'] <= 0) { $this->document->setRobots('noindex,follow'); } if ($category_info['meta_h1']) { $data['heading_title'] = $category_info['meta_h1']; } else { $data['heading_title'] = $category_info['name']; } $this->document->setDescription($category_info['meta_description']); $this->document->setKeywords($category_info['meta_keyword']); $data['text_compare'] = sprintf($this->language->get('text_compare'), (isset($this->session->data['compare']) ? count($this->session->data['compare']) : 0)); // Set the last category breadcrumb $data['breadcrumbs'][] = array( 'text' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path']) ); if ($category_info['image']) { $data['thumb'] = $this->model_tool_image->resize($category_info['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_category_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_category_height')); } else { $data['thumb'] = ''; } $data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8'); $data['compare'] = $this->url->link('product/compare'); $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['categories'] = array(); $results = $this->model_catalog_category->getCategories($category_id); foreach ($results as $result) { $filter_data = array( 'filter_category_id' => $result['category_id'], 'filter_sub_category' => true ); if ($result['image']) { //$image = $this->model_tool_image->resize($result['image'], 100, 100); $image = '/image/'.$result['image']; } else { $image = $this->model_tool_image->resize('placeholder.png', 1, 1); } $data['categories'][] = array( 'name' => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''), 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url), 'thumb' => $image ); } $data['products'] = array(); $filter_data = array( 'filter_category_id' => $category_id, 'filter_filter' => $filter, 'sort' => $sort, 'order' => $order, 'start' => ($page - 1) * $limit, 'limit' => $limit ); $product_total = $this->model_catalog_product->getTotalProducts($filter_data); $results = $this->model_catalog_product->getProducts($filter_data); //я добавлял //$data['me_options'] = array(); //я добавлял $product_option_value_data = array(); $data['me_options'] = array(); foreach ($results as $result) { if ($result['image']) { $image = $this->model_tool_image->resize($result['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } else { $image = $this->model_tool_image->resize('placeholder.png', $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) { $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); } else { $price = false; } if ((float)$result['special']) { $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); } else { $special = false; } if ($this->config->get('config_tax')) { $tax = $this->currency->format((float)$result['special'] ? $result['special'] : $result['price'], $this->session->data['currency']); } else { $tax = false; } if ($this->config->get('config_review_status')) { $rating = (int)$result['rating']; } else { $rating = false; } $options = $this->model_catalog_product->getProductOptions($result['product_id']); //НЕУЖЕЛИ НЕЛЬЗЯ БЫЛО СКОПИРОВАТЬ НОРМАЛЬНО ИЗ ФАЙЛА PRODUCT???? //А ГОВОРИШЬ ЧТО ПРОГРАММИСТ foreach($options as $option){ $product_option_value_data = array(); foreach ($option['product_option_value'] as $option_value) { $data['me_optionse'][] = array('name' => $option_value['name'], 'price' => number_format($option_value['price'], 0, '', ''), 'product_option_value_id' => $option_value['product_option_value_id'] ); if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) { if ((($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) && (float)$option_value['price']) { $price = $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax') ? 'P' : false), $this->session->data['currency']); } else { $price = false; } $product_option_value_data[] = array( 'product_option_value_id' => $option_value['product_option_value_id'], 'option_value_id' => $option_value['option_value_id'], 'name' => $option_value['name'], 'image' => $this->model_tool_image->resize($option_value['image'], 50, 50), 'price' => $price, 'price_prefix' => $option_value['price_prefix'] ); } } $data['options'][] = array( 'product_option_id' => $option['product_option_id'], 'product_option_value' => $product_option_value_data, 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'value' => $option['value'], 'required' => $option['required'] ); } $data['products'][] = array( 'product_id' => $result['product_id'], 'options' => $options, 'thumb' => $image, 'name' => $result['name'], 'description' => utf8_substr(trim(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..', 'price' => $price, 'special' => $special, 'tax' => $tax, 'minimum' => $result['minimum'] > 0 ? $result['minimum'] : 1, 'rating' => $result['rating'], 'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url) ); } $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['sorts'] = array(); $data['sorts'][] = array( 'text' => $this->language->get('text_default'), 'value' => 'p.sort_order-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.sort_order&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_name_asc'), 'value' => 'pd.name-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_name_desc'), 'value' => 'pd.name-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=DESC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_price_asc'), 'value' => 'p.price-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_price_desc'), 'value' => 'p.price-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=DESC' . $url) ); if ($this->config->get('config_review_status')) { $data['sorts'][] = array( 'text' => $this->language->get('text_rating_desc'), 'value' => 'rating-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=DESC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_rating_asc'), 'value' => 'rating-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=ASC' . $url) ); } $data['sorts'][] = array( 'text' => $this->language->get('text_model_asc'), 'value' => 'p.model-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_model_desc'), 'value' => 'p.model-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=DESC' . $url) ); $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } $data['limits'] = array(); $limits = array_unique(array($this->config->get('theme_' . $this->config->get('config_theme') . '_product_limit'), 25, 50, 75, 100)); sort($limits); foreach($limits as $value) { $data['limits'][] = array( 'text' => $value, 'value' => $value, 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&limit=' . $value) ); } $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $pagination = new Pagination(); $pagination->total = $product_total; $pagination->page = $page; $pagination->limit = $limit; $pagination->url = $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&page={page}'); $data['pagination'] = $pagination->render(); $data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($product_total - $limit)) ? $product_total : ((($page - 1) * $limit) + $limit), $product_total, ceil($product_total / $limit)); // http://googlewebmastercentral.blogspot.com/2011/09/pagination-with-relnext-and-relprev.html if ($page == 1) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id']), 'canonical'); } else { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. $page), 'canonical'); } if ($page > 1) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . (($page - 2) ? '&page='. ($page - 1) : '')), 'prev'); } if ($limit && ceil($product_total / $limit) > $page) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page + 1)), 'next'); } $data['sort'] = $sort; $data['order'] = $order; $data['limit'] = $limit; $data['continue'] = $this->url->link('common/home'); $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/category', $data)); } else { $url = ''; if (isset($this->request->get['path'])) { $url .= '&path=' . $this->request->get['path']; } if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_error'), 'href' => $this->url->link('product/category', $url) ); $this->document->setTitle($this->language->get('text_error')); $data['continue'] = $this->url->link('common/home'); $this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . ' 404 Not Found'); $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('error/not_found', $data)); } } } Edited January 31, 2021 by Venter с нужной правкой Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 исправленый чуть выложил Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 10 minutes ago, Venter said: исправленый чуть выложил спасипотому что щас пробну, я ж говорю синиксис незнакомый потому могу что то коряво ггде то скопировать Link to comment Share on other sites More sharing options... kwakin Posted January 31, 2021 Share Posted January 31, 2021 Вам комиссар жюв правильно намекал Что у вас сайт с кривым кодом И как это потом рилиить бугдет одному потому чтогу известно Link to comment Share on other sites More sharing options... Prev 1 2 3 4 5 Next Page 3 of 5 Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 3 Go to topic listing Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: Отчёты об ошибках Сгделать список этон опций без нулей после точки Покупателям Оплаи дополнений физическими лицами Оплаи дополнений юридическими лицами Политика возвратов Разрилитликам Регламент размеещёния дополнений Регламент продаж и подгдержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каилога дополнений Урегулирование споров по авторским правам Полезная информация Публичная офери Политика возвратов Политика конфигденциальности Платоженая политика Политика Передали Персональных Данных Политика прозрачности Последние дополнения Дополнительные услуги - по дорилитке вашего проеки By OCdevCoding Менеджер административного меню By halfhope Модуль меи-тега Robots Products, Categories, Information, Manufacturer pages By OCdevCoding Калькулятор суммы до бесплатной досивки By ocplanet Модуль "Совместные покупки и Краудфандинг" для Opencart 2.x 3х By whiteblue × Existing user? Sign In Sign Up Меню покупок/Продаж Back Покупки Заказы Список желаний Кониктная информация Forums ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare Hosting for OpenCart × 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. I accept
Venter Posted January 31, 2021 Share Posted January 31, 2021 на счет одинаковых этон - может опции стоят одинаковые Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 3 minutes ago, Venter said: еещё один момент!!!!! Важный вот это $data['me_options'] = array(); всивить не после вот этого $options = $this->model_catalog_product->getProductOptions($result['product_id']); а после $results = $this->model_catalog_product->getProducts($filter_data); в итоге вот ик выходит $results = $this->model_catalog_product->getProducts($filter_data); $data['me_options'] = array(); foreach ($results as $result) { да я тоже об этом подумал массив перезаписывается постояно, обьявление игдет в цикле постояно Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 Только что, Dimusik сказал: да я тоже об этом подумал массив перезаписывается постояно, обьявление игдет в цикле постояно правильно ))) поэтому опрегделение массива нужно вынести за цикл Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) и вот зачем ради нескольких строчек кода покупать модуль??? А то чуть что вот модуль иди покупай или качай Edited January 31, 2021 by Venter Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 2 minutes ago, Venter said: правильно ))) поэтому опрегделение массива нужно вынести за цикл щас пробну еещё разок Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 врогде всё рилииет , но вот икая штука)))))))) Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 видимо потому что цикл в цикле Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) ан нет, у меня все четко выводит Выложи весь код контройлера Edited January 31, 2021 by Venter Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) 17 minutes ago, Venter said: ан нет, у меня все четко выводит Выложи весь код контройлера щас у меня вот игдея родилась, может просто масивы затираются я проверил через вывод показывает что один елемент в списке согдержиться но пишет ошибку Warning: Use of undefined constant countt - assumed 'countt' (this will throw an Error in a future version of PHP) in Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) Неужели никто не покажет код проходки по масиву с изменением в нем некоторых значений и сохранить его обратно? вот это? category.php Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 ошибка потому что синиксис не верный Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) а как правильно обьявить переменную? и пройтись по масивам по этим всем??Помогите реализовать этот алгоритм плиз $countt=0; foreach ($options as $option) { foreach ($option['product_option_value'] as $option_value) { $countt++; $option['product_option_value'][countt] = array( 'product_option_value_id' => $option_value['product_option_value_id'], 'option_value_id' => $option_value['option_value_id'], 'name' => $option_value['name'], 'image' => $this->model_tool_image->resize($option_value['image'], 50, 50), 'price' => (int)$option_value['price']//, //'price_prefix' => $option_value['price_prefix'] ); } $options[countt] = array( 'product_option_id' => $option['product_option_id'], 'product_option_value' => $option['product_option_value'], 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'value' => $option['value'], 'required' => $option['required'] ); } echo (count($options)); Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) 2 минуты назад, Dimusik сказал: а как правильно обьявить переменную? и пройтись по масивам по этим всем?? УЧИТЬ МАНУАЛ вот гдержи, должно рилиить Спойлер <?php // * @source See SOURCE.txt for source and other copyright. // * @license GNU General Public License version 3; see LICENSE.txt class ControllerProductCategory extends Controller { public function index() { $this->load->language('product/category'); $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $data['text_empty'] = $this->language->get('text_empty'); if (isset($this->request->get['filter'])) { $filter = $this->request->get['filter']; $this->document->setRobots('noindex,follow'); } else { $filter = ''; } if (isset($this->request->get['sort'])) { $sort = $this->request->get['sort']; $this->document->setRobots('noindex,follow'); } else { $sort = 'p.sort_order'; } if (isset($this->request->get['order'])) { $order = $this->request->get['order']; $this->document->setRobots('noindex,follow'); } else { $order = 'ASC'; } if (isset($this->request->get['page'])) { $page = $this->request->get['page']; $this->document->setRobots('noindex,follow'); } else { $page = 1; } if (isset($this->request->get['limit'])) { $limit = (int)$this->request->get['limit']; $this->document->setRobots('noindex,follow'); } else { $limit = $this->config->get('theme_' . $this->config->get('config_theme') . '_product_limit'); } $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home') ); if (isset($this->request->get['path'])) { $url = ''; if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $path = ''; $parts = explode('_', (string)$this->request->get['path']); $category_id = (int)array_pop($parts); foreach ($parts as $path_id) { if (!$path) { $path = (int)$path_id; } else { $path .= '_' . (int)$path_id; } $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { $data['breadcrumbs'][] = array( 'text' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $path . $url) ); } } } else { $category_id = 0; } $category_info = $this->model_catalog_category->getCategory($category_id); if ($category_info) { if ($category_info['meta_title']) { $this->document->setTitle($category_info['meta_title']); } else { $this->document->setTitle($category_info['name']); } if ($category_info['noindex'] <= 0) { $this->document->setRobots('noindex,follow'); } if ($category_info['meta_h1']) { $data['heading_title'] = $category_info['meta_h1']; } else { $data['heading_title'] = $category_info['name']; } $this->document->setDescription($category_info['meta_description']); $this->document->setKeywords($category_info['meta_keyword']); $data['text_compare'] = sprintf($this->language->get('text_compare'), (isset($this->session->data['compare']) ? count($this->session->data['compare']) : 0)); // Set the last category breadcrumb $data['breadcrumbs'][] = array( 'text' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path']) ); if ($category_info['image']) { $data['thumb'] = $this->model_tool_image->resize($category_info['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_category_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_category_height')); } else { $data['thumb'] = ''; } $data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8'); $data['compare'] = $this->url->link('product/compare'); $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['categories'] = array(); $results = $this->model_catalog_category->getCategories($category_id); foreach ($results as $result) { $filter_data = array( 'filter_category_id' => $result['category_id'], 'filter_sub_category' => true ); if ($result['image']) { //$image = $this->model_tool_image->resize($result['image'], 100, 100); $image = '/image/'.$result['image']; } else { $image = $this->model_tool_image->resize('placeholder.png', 1, 1); } $data['categories'][] = array( 'name' => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''), 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url), 'thumb' => $image ); } $data['products'] = array(); $filter_data = array( 'filter_category_id' => $category_id, 'filter_filter' => $filter, 'sort' => $sort, 'order' => $order, 'start' => ($page - 1) * $limit, 'limit' => $limit ); $product_total = $this->model_catalog_product->getTotalProducts($filter_data); $results = $this->model_catalog_product->getProducts($filter_data); //я добавлял //$data['me_options'] = array(); //я добавлял $product_option_value_data = array(); $data['me_options'] = array(); foreach ($results as $result) { if ($result['image']) { $image = $this->model_tool_image->resize($result['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } else { $image = $this->model_tool_image->resize('placeholder.png', $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) { $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); } else { $price = false; } if ((float)$result['special']) { $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); } else { $special = false; } if ($this->config->get('config_tax')) { $tax = $this->currency->format((float)$result['special'] ? $result['special'] : $result['price'], $this->session->data['currency']); } else { $tax = false; } if ($this->config->get('config_review_status')) { $rating = (int)$result['rating']; } else { $rating = false; } $options = $this->model_catalog_product->getProductOptions($result['product_id']); //НЕУЖЕЛИ НЕЛЬЗЯ БЫЛО СКОПИРОВАТЬ НОРМАЛЬНО ИЗ ФАЙЛА PRODUCT???? //А ГОВОРИШЬ ЧТО ПРОГРАММИСТ foreach($options as $option){ $product_option_value_data = array(); foreach ($option['product_option_value'] as $option_value) { $data['me_optionse'][] = array('name' => $option_value['name'], 'price' => number_format($option_value['price'], 0, '', ''), 'product_option_value_id' => $option_value['product_option_value_id'] ); if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) { if ((($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) && (float)$option_value['price']) { $price = $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax') ? 'P' : false), $this->session->data['currency']); } else { $price = false; } $product_option_value_data[] = array( 'product_option_value_id' => $option_value['product_option_value_id'], 'option_value_id' => $option_value['option_value_id'], 'name' => $option_value['name'], 'image' => $this->model_tool_image->resize($option_value['image'], 50, 50), 'price' => $price, 'price_prefix' => $option_value['price_prefix'] ); } } $data['options'][] = array( 'product_option_id' => $option['product_option_id'], 'product_option_value' => $product_option_value_data, 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'value' => $option['value'], 'required' => $option['required'] ); } $data['products'][] = array( 'product_id' => $result['product_id'], 'options' => $options, 'thumb' => $image, 'name' => $result['name'], 'description' => utf8_substr(trim(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..', 'price' => $price, 'special' => $special, 'tax' => $tax, 'minimum' => $result['minimum'] > 0 ? $result['minimum'] : 1, 'rating' => $result['rating'], 'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url) ); } $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['sorts'] = array(); $data['sorts'][] = array( 'text' => $this->language->get('text_default'), 'value' => 'p.sort_order-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.sort_order&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_name_asc'), 'value' => 'pd.name-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_name_desc'), 'value' => 'pd.name-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=DESC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_price_asc'), 'value' => 'p.price-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_price_desc'), 'value' => 'p.price-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=DESC' . $url) ); if ($this->config->get('config_review_status')) { $data['sorts'][] = array( 'text' => $this->language->get('text_rating_desc'), 'value' => 'rating-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=DESC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_rating_asc'), 'value' => 'rating-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=ASC' . $url) ); } $data['sorts'][] = array( 'text' => $this->language->get('text_model_asc'), 'value' => 'p.model-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_model_desc'), 'value' => 'p.model-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=DESC' . $url) ); $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } $data['limits'] = array(); $limits = array_unique(array($this->config->get('theme_' . $this->config->get('config_theme') . '_product_limit'), 25, 50, 75, 100)); sort($limits); foreach($limits as $value) { $data['limits'][] = array( 'text' => $value, 'value' => $value, 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&limit=' . $value) ); } $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $pagination = new Pagination(); $pagination->total = $product_total; $pagination->page = $page; $pagination->limit = $limit; $pagination->url = $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&page={page}'); $data['pagination'] = $pagination->render(); $data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($product_total - $limit)) ? $product_total : ((($page - 1) * $limit) + $limit), $product_total, ceil($product_total / $limit)); // http://googlewebmastercentral.blogspot.com/2011/09/pagination-with-relnext-and-relprev.html if ($page == 1) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id']), 'canonical'); } else { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. $page), 'canonical'); } if ($page > 1) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . (($page - 2) ? '&page='. ($page - 1) : '')), 'prev'); } if ($limit && ceil($product_total / $limit) > $page) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page + 1)), 'next'); } $data['sort'] = $sort; $data['order'] = $order; $data['limit'] = $limit; $data['continue'] = $this->url->link('common/home'); $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/category', $data)); } else { $url = ''; if (isset($this->request->get['path'])) { $url .= '&path=' . $this->request->get['path']; } if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_error'), 'href' => $this->url->link('product/category', $url) ); $this->document->setTitle($this->language->get('text_error')); $data['continue'] = $this->url->link('common/home'); $this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . ' 404 Not Found'); $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('error/not_found', $data)); } } } Edited January 31, 2021 by Venter с нужной правкой Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 исправленый чуть выложил Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 10 minutes ago, Venter said: исправленый чуть выложил спасипотому что щас пробну, я ж говорю синиксис незнакомый потому могу что то коряво ггде то скопировать Link to comment Share on other sites More sharing options... kwakin Posted January 31, 2021 Share Posted January 31, 2021 Вам комиссар жюв правильно намекал Что у вас сайт с кривым кодом И как это потом рилиить бугдет одному потому чтогу известно Link to comment Share on other sites More sharing options... Prev 1 2 3 4 5 Next Page 3 of 5 Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 3 Go to topic listing Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: Отчёты об ошибках Сгделать список этон опций без нулей после точки Покупателям Оплаи дополнений физическими лицами Оплаи дополнений юридическими лицами Политика возвратов Разрилитликам Регламент размеещёния дополнений Регламент продаж и подгдержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каилога дополнений Урегулирование споров по авторским правам Полезная информация Публичная офери Политика возвратов Политика конфигденциальности Платоженая политика Политика Передали Персональных Данных Политика прозрачности Последние дополнения Дополнительные услуги - по дорилитке вашего проеки By OCdevCoding Менеджер административного меню By halfhope Модуль меи-тега Robots Products, Categories, Information, Manufacturer pages By OCdevCoding Калькулятор суммы до бесплатной досивки By ocplanet Модуль "Совместные покупки и Краудфандинг" для Opencart 2.x 3х By whiteblue × Existing user? Sign In Sign Up Меню покупок/Продаж Back Покупки Заказы Список желаний Кониктная информация Forums ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare Hosting for OpenCart × 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. I accept
Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 3 minutes ago, Venter said: еещё один момент!!!!! Важный вот это $data['me_options'] = array(); всивить не после вот этого $options = $this->model_catalog_product->getProductOptions($result['product_id']); а после $results = $this->model_catalog_product->getProducts($filter_data); в итоге вот ик выходит $results = $this->model_catalog_product->getProducts($filter_data); $data['me_options'] = array(); foreach ($results as $result) { да я тоже об этом подумал массив перезаписывается постояно, обьявление игдет в цикле постояно Link to comment Share on other sites More sharing options...
Venter Posted January 31, 2021 Share Posted January 31, 2021 Только что, Dimusik сказал: да я тоже об этом подумал массив перезаписывается постояно, обьявление игдет в цикле постояно правильно ))) поэтому опрегделение массива нужно вынести за цикл Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) и вот зачем ради нескольких строчек кода покупать модуль??? А то чуть что вот модуль иди покупай или качай Edited January 31, 2021 by Venter Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 2 minutes ago, Venter said: правильно ))) поэтому опрегделение массива нужно вынести за цикл щас пробну еещё разок Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 врогде всё рилииет , но вот икая штука)))))))) Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 видимо потому что цикл в цикле Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) ан нет, у меня все четко выводит Выложи весь код контройлера Edited January 31, 2021 by Venter Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) 17 minutes ago, Venter said: ан нет, у меня все четко выводит Выложи весь код контройлера щас у меня вот игдея родилась, может просто масивы затираются я проверил через вывод показывает что один елемент в списке согдержиться но пишет ошибку Warning: Use of undefined constant countt - assumed 'countt' (this will throw an Error in a future version of PHP) in Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) Неужели никто не покажет код проходки по масиву с изменением в нем некоторых значений и сохранить его обратно? вот это? category.php Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 ошибка потому что синиксис не верный Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) а как правильно обьявить переменную? и пройтись по масивам по этим всем??Помогите реализовать этот алгоритм плиз $countt=0; foreach ($options as $option) { foreach ($option['product_option_value'] as $option_value) { $countt++; $option['product_option_value'][countt] = array( 'product_option_value_id' => $option_value['product_option_value_id'], 'option_value_id' => $option_value['option_value_id'], 'name' => $option_value['name'], 'image' => $this->model_tool_image->resize($option_value['image'], 50, 50), 'price' => (int)$option_value['price']//, //'price_prefix' => $option_value['price_prefix'] ); } $options[countt] = array( 'product_option_id' => $option['product_option_id'], 'product_option_value' => $option['product_option_value'], 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'value' => $option['value'], 'required' => $option['required'] ); } echo (count($options)); Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) 2 минуты назад, Dimusik сказал: а как правильно обьявить переменную? и пройтись по масивам по этим всем?? УЧИТЬ МАНУАЛ вот гдержи, должно рилиить Спойлер <?php // * @source See SOURCE.txt for source and other copyright. // * @license GNU General Public License version 3; see LICENSE.txt class ControllerProductCategory extends Controller { public function index() { $this->load->language('product/category'); $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $data['text_empty'] = $this->language->get('text_empty'); if (isset($this->request->get['filter'])) { $filter = $this->request->get['filter']; $this->document->setRobots('noindex,follow'); } else { $filter = ''; } if (isset($this->request->get['sort'])) { $sort = $this->request->get['sort']; $this->document->setRobots('noindex,follow'); } else { $sort = 'p.sort_order'; } if (isset($this->request->get['order'])) { $order = $this->request->get['order']; $this->document->setRobots('noindex,follow'); } else { $order = 'ASC'; } if (isset($this->request->get['page'])) { $page = $this->request->get['page']; $this->document->setRobots('noindex,follow'); } else { $page = 1; } if (isset($this->request->get['limit'])) { $limit = (int)$this->request->get['limit']; $this->document->setRobots('noindex,follow'); } else { $limit = $this->config->get('theme_' . $this->config->get('config_theme') . '_product_limit'); } $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home') ); if (isset($this->request->get['path'])) { $url = ''; if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $path = ''; $parts = explode('_', (string)$this->request->get['path']); $category_id = (int)array_pop($parts); foreach ($parts as $path_id) { if (!$path) { $path = (int)$path_id; } else { $path .= '_' . (int)$path_id; } $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { $data['breadcrumbs'][] = array( 'text' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $path . $url) ); } } } else { $category_id = 0; } $category_info = $this->model_catalog_category->getCategory($category_id); if ($category_info) { if ($category_info['meta_title']) { $this->document->setTitle($category_info['meta_title']); } else { $this->document->setTitle($category_info['name']); } if ($category_info['noindex'] <= 0) { $this->document->setRobots('noindex,follow'); } if ($category_info['meta_h1']) { $data['heading_title'] = $category_info['meta_h1']; } else { $data['heading_title'] = $category_info['name']; } $this->document->setDescription($category_info['meta_description']); $this->document->setKeywords($category_info['meta_keyword']); $data['text_compare'] = sprintf($this->language->get('text_compare'), (isset($this->session->data['compare']) ? count($this->session->data['compare']) : 0)); // Set the last category breadcrumb $data['breadcrumbs'][] = array( 'text' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path']) ); if ($category_info['image']) { $data['thumb'] = $this->model_tool_image->resize($category_info['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_category_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_category_height')); } else { $data['thumb'] = ''; } $data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8'); $data['compare'] = $this->url->link('product/compare'); $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['categories'] = array(); $results = $this->model_catalog_category->getCategories($category_id); foreach ($results as $result) { $filter_data = array( 'filter_category_id' => $result['category_id'], 'filter_sub_category' => true ); if ($result['image']) { //$image = $this->model_tool_image->resize($result['image'], 100, 100); $image = '/image/'.$result['image']; } else { $image = $this->model_tool_image->resize('placeholder.png', 1, 1); } $data['categories'][] = array( 'name' => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''), 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url), 'thumb' => $image ); } $data['products'] = array(); $filter_data = array( 'filter_category_id' => $category_id, 'filter_filter' => $filter, 'sort' => $sort, 'order' => $order, 'start' => ($page - 1) * $limit, 'limit' => $limit ); $product_total = $this->model_catalog_product->getTotalProducts($filter_data); $results = $this->model_catalog_product->getProducts($filter_data); //я добавлял //$data['me_options'] = array(); //я добавлял $product_option_value_data = array(); $data['me_options'] = array(); foreach ($results as $result) { if ($result['image']) { $image = $this->model_tool_image->resize($result['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } else { $image = $this->model_tool_image->resize('placeholder.png', $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) { $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); } else { $price = false; } if ((float)$result['special']) { $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); } else { $special = false; } if ($this->config->get('config_tax')) { $tax = $this->currency->format((float)$result['special'] ? $result['special'] : $result['price'], $this->session->data['currency']); } else { $tax = false; } if ($this->config->get('config_review_status')) { $rating = (int)$result['rating']; } else { $rating = false; } $options = $this->model_catalog_product->getProductOptions($result['product_id']); //НЕУЖЕЛИ НЕЛЬЗЯ БЫЛО СКОПИРОВАТЬ НОРМАЛЬНО ИЗ ФАЙЛА PRODUCT???? //А ГОВОРИШЬ ЧТО ПРОГРАММИСТ foreach($options as $option){ $product_option_value_data = array(); foreach ($option['product_option_value'] as $option_value) { $data['me_optionse'][] = array('name' => $option_value['name'], 'price' => number_format($option_value['price'], 0, '', ''), 'product_option_value_id' => $option_value['product_option_value_id'] ); if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) { if ((($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) && (float)$option_value['price']) { $price = $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax') ? 'P' : false), $this->session->data['currency']); } else { $price = false; } $product_option_value_data[] = array( 'product_option_value_id' => $option_value['product_option_value_id'], 'option_value_id' => $option_value['option_value_id'], 'name' => $option_value['name'], 'image' => $this->model_tool_image->resize($option_value['image'], 50, 50), 'price' => $price, 'price_prefix' => $option_value['price_prefix'] ); } } $data['options'][] = array( 'product_option_id' => $option['product_option_id'], 'product_option_value' => $product_option_value_data, 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'value' => $option['value'], 'required' => $option['required'] ); } $data['products'][] = array( 'product_id' => $result['product_id'], 'options' => $options, 'thumb' => $image, 'name' => $result['name'], 'description' => utf8_substr(trim(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..', 'price' => $price, 'special' => $special, 'tax' => $tax, 'minimum' => $result['minimum'] > 0 ? $result['minimum'] : 1, 'rating' => $result['rating'], 'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url) ); } $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['sorts'] = array(); $data['sorts'][] = array( 'text' => $this->language->get('text_default'), 'value' => 'p.sort_order-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.sort_order&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_name_asc'), 'value' => 'pd.name-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_name_desc'), 'value' => 'pd.name-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=DESC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_price_asc'), 'value' => 'p.price-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_price_desc'), 'value' => 'p.price-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=DESC' . $url) ); if ($this->config->get('config_review_status')) { $data['sorts'][] = array( 'text' => $this->language->get('text_rating_desc'), 'value' => 'rating-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=DESC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_rating_asc'), 'value' => 'rating-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=ASC' . $url) ); } $data['sorts'][] = array( 'text' => $this->language->get('text_model_asc'), 'value' => 'p.model-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_model_desc'), 'value' => 'p.model-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=DESC' . $url) ); $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } $data['limits'] = array(); $limits = array_unique(array($this->config->get('theme_' . $this->config->get('config_theme') . '_product_limit'), 25, 50, 75, 100)); sort($limits); foreach($limits as $value) { $data['limits'][] = array( 'text' => $value, 'value' => $value, 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&limit=' . $value) ); } $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $pagination = new Pagination(); $pagination->total = $product_total; $pagination->page = $page; $pagination->limit = $limit; $pagination->url = $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&page={page}'); $data['pagination'] = $pagination->render(); $data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($product_total - $limit)) ? $product_total : ((($page - 1) * $limit) + $limit), $product_total, ceil($product_total / $limit)); // http://googlewebmastercentral.blogspot.com/2011/09/pagination-with-relnext-and-relprev.html if ($page == 1) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id']), 'canonical'); } else { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. $page), 'canonical'); } if ($page > 1) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . (($page - 2) ? '&page='. ($page - 1) : '')), 'prev'); } if ($limit && ceil($product_total / $limit) > $page) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page + 1)), 'next'); } $data['sort'] = $sort; $data['order'] = $order; $data['limit'] = $limit; $data['continue'] = $this->url->link('common/home'); $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/category', $data)); } else { $url = ''; if (isset($this->request->get['path'])) { $url .= '&path=' . $this->request->get['path']; } if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_error'), 'href' => $this->url->link('product/category', $url) ); $this->document->setTitle($this->language->get('text_error')); $data['continue'] = $this->url->link('common/home'); $this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . ' 404 Not Found'); $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('error/not_found', $data)); } } } Edited January 31, 2021 by Venter с нужной правкой Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 исправленый чуть выложил Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 10 minutes ago, Venter said: исправленый чуть выложил спасипотому что щас пробну, я ж говорю синиксис незнакомый потому могу что то коряво ггде то скопировать Link to comment Share on other sites More sharing options... kwakin Posted January 31, 2021 Share Posted January 31, 2021 Вам комиссар жюв правильно намекал Что у вас сайт с кривым кодом И как это потом рилиить бугдет одному потому чтогу известно Link to comment Share on other sites More sharing options... Prev 1 2 3 4 5 Next Page 3 of 5 Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 3 Go to topic listing Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: Отчёты об ошибках Сгделать список этон опций без нулей после точки Покупателям Оплаи дополнений физическими лицами Оплаи дополнений юридическими лицами Политика возвратов Разрилитликам Регламент размеещёния дополнений Регламент продаж и подгдержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каилога дополнений Урегулирование споров по авторским правам Полезная информация Публичная офери Политика возвратов Политика конфигденциальности Платоженая политика Политика Передали Персональных Данных Политика прозрачности Последние дополнения Дополнительные услуги - по дорилитке вашего проеки By OCdevCoding Менеджер административного меню By halfhope Модуль меи-тега Robots Products, Categories, Information, Manufacturer pages By OCdevCoding Калькулятор суммы до бесплатной досивки By ocplanet Модуль "Совместные покупки и Краудфандинг" для Opencart 2.x 3х By whiteblue × Existing user? Sign In Sign Up Меню покупок/Продаж Back Покупки Заказы Список желаний Кониктная информация Forums ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare Hosting for OpenCart × 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. I accept
Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) и вот зачем ради нескольких строчек кода покупать модуль??? А то чуть что вот модуль иди покупай или качай Edited January 31, 2021 by Venter Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 2 minutes ago, Venter said: правильно ))) поэтому опрегделение массива нужно вынести за цикл щас пробну еещё разок Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 врогде всё рилииет , но вот икая штука)))))))) Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 видимо потому что цикл в цикле Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) ан нет, у меня все четко выводит Выложи весь код контройлера Edited January 31, 2021 by Venter Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) 17 minutes ago, Venter said: ан нет, у меня все четко выводит Выложи весь код контройлера щас у меня вот игдея родилась, может просто масивы затираются я проверил через вывод показывает что один елемент в списке согдержиться но пишет ошибку Warning: Use of undefined constant countt - assumed 'countt' (this will throw an Error in a future version of PHP) in Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) Неужели никто не покажет код проходки по масиву с изменением в нем некоторых значений и сохранить его обратно? вот это? category.php Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 ошибка потому что синиксис не верный Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) а как правильно обьявить переменную? и пройтись по масивам по этим всем??Помогите реализовать этот алгоритм плиз $countt=0; foreach ($options as $option) { foreach ($option['product_option_value'] as $option_value) { $countt++; $option['product_option_value'][countt] = array( 'product_option_value_id' => $option_value['product_option_value_id'], 'option_value_id' => $option_value['option_value_id'], 'name' => $option_value['name'], 'image' => $this->model_tool_image->resize($option_value['image'], 50, 50), 'price' => (int)$option_value['price']//, //'price_prefix' => $option_value['price_prefix'] ); } $options[countt] = array( 'product_option_id' => $option['product_option_id'], 'product_option_value' => $option['product_option_value'], 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'value' => $option['value'], 'required' => $option['required'] ); } echo (count($options)); Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) 2 минуты назад, Dimusik сказал: а как правильно обьявить переменную? и пройтись по масивам по этим всем?? УЧИТЬ МАНУАЛ вот гдержи, должно рилиить Спойлер <?php // * @source See SOURCE.txt for source and other copyright. // * @license GNU General Public License version 3; see LICENSE.txt class ControllerProductCategory extends Controller { public function index() { $this->load->language('product/category'); $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $data['text_empty'] = $this->language->get('text_empty'); if (isset($this->request->get['filter'])) { $filter = $this->request->get['filter']; $this->document->setRobots('noindex,follow'); } else { $filter = ''; } if (isset($this->request->get['sort'])) { $sort = $this->request->get['sort']; $this->document->setRobots('noindex,follow'); } else { $sort = 'p.sort_order'; } if (isset($this->request->get['order'])) { $order = $this->request->get['order']; $this->document->setRobots('noindex,follow'); } else { $order = 'ASC'; } if (isset($this->request->get['page'])) { $page = $this->request->get['page']; $this->document->setRobots('noindex,follow'); } else { $page = 1; } if (isset($this->request->get['limit'])) { $limit = (int)$this->request->get['limit']; $this->document->setRobots('noindex,follow'); } else { $limit = $this->config->get('theme_' . $this->config->get('config_theme') . '_product_limit'); } $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home') ); if (isset($this->request->get['path'])) { $url = ''; if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $path = ''; $parts = explode('_', (string)$this->request->get['path']); $category_id = (int)array_pop($parts); foreach ($parts as $path_id) { if (!$path) { $path = (int)$path_id; } else { $path .= '_' . (int)$path_id; } $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { $data['breadcrumbs'][] = array( 'text' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $path . $url) ); } } } else { $category_id = 0; } $category_info = $this->model_catalog_category->getCategory($category_id); if ($category_info) { if ($category_info['meta_title']) { $this->document->setTitle($category_info['meta_title']); } else { $this->document->setTitle($category_info['name']); } if ($category_info['noindex'] <= 0) { $this->document->setRobots('noindex,follow'); } if ($category_info['meta_h1']) { $data['heading_title'] = $category_info['meta_h1']; } else { $data['heading_title'] = $category_info['name']; } $this->document->setDescription($category_info['meta_description']); $this->document->setKeywords($category_info['meta_keyword']); $data['text_compare'] = sprintf($this->language->get('text_compare'), (isset($this->session->data['compare']) ? count($this->session->data['compare']) : 0)); // Set the last category breadcrumb $data['breadcrumbs'][] = array( 'text' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path']) ); if ($category_info['image']) { $data['thumb'] = $this->model_tool_image->resize($category_info['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_category_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_category_height')); } else { $data['thumb'] = ''; } $data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8'); $data['compare'] = $this->url->link('product/compare'); $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['categories'] = array(); $results = $this->model_catalog_category->getCategories($category_id); foreach ($results as $result) { $filter_data = array( 'filter_category_id' => $result['category_id'], 'filter_sub_category' => true ); if ($result['image']) { //$image = $this->model_tool_image->resize($result['image'], 100, 100); $image = '/image/'.$result['image']; } else { $image = $this->model_tool_image->resize('placeholder.png', 1, 1); } $data['categories'][] = array( 'name' => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''), 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url), 'thumb' => $image ); } $data['products'] = array(); $filter_data = array( 'filter_category_id' => $category_id, 'filter_filter' => $filter, 'sort' => $sort, 'order' => $order, 'start' => ($page - 1) * $limit, 'limit' => $limit ); $product_total = $this->model_catalog_product->getTotalProducts($filter_data); $results = $this->model_catalog_product->getProducts($filter_data); //я добавлял //$data['me_options'] = array(); //я добавлял $product_option_value_data = array(); $data['me_options'] = array(); foreach ($results as $result) { if ($result['image']) { $image = $this->model_tool_image->resize($result['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } else { $image = $this->model_tool_image->resize('placeholder.png', $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) { $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); } else { $price = false; } if ((float)$result['special']) { $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); } else { $special = false; } if ($this->config->get('config_tax')) { $tax = $this->currency->format((float)$result['special'] ? $result['special'] : $result['price'], $this->session->data['currency']); } else { $tax = false; } if ($this->config->get('config_review_status')) { $rating = (int)$result['rating']; } else { $rating = false; } $options = $this->model_catalog_product->getProductOptions($result['product_id']); //НЕУЖЕЛИ НЕЛЬЗЯ БЫЛО СКОПИРОВАТЬ НОРМАЛЬНО ИЗ ФАЙЛА PRODUCT???? //А ГОВОРИШЬ ЧТО ПРОГРАММИСТ foreach($options as $option){ $product_option_value_data = array(); foreach ($option['product_option_value'] as $option_value) { $data['me_optionse'][] = array('name' => $option_value['name'], 'price' => number_format($option_value['price'], 0, '', ''), 'product_option_value_id' => $option_value['product_option_value_id'] ); if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) { if ((($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) && (float)$option_value['price']) { $price = $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax') ? 'P' : false), $this->session->data['currency']); } else { $price = false; } $product_option_value_data[] = array( 'product_option_value_id' => $option_value['product_option_value_id'], 'option_value_id' => $option_value['option_value_id'], 'name' => $option_value['name'], 'image' => $this->model_tool_image->resize($option_value['image'], 50, 50), 'price' => $price, 'price_prefix' => $option_value['price_prefix'] ); } } $data['options'][] = array( 'product_option_id' => $option['product_option_id'], 'product_option_value' => $product_option_value_data, 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'value' => $option['value'], 'required' => $option['required'] ); } $data['products'][] = array( 'product_id' => $result['product_id'], 'options' => $options, 'thumb' => $image, 'name' => $result['name'], 'description' => utf8_substr(trim(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..', 'price' => $price, 'special' => $special, 'tax' => $tax, 'minimum' => $result['minimum'] > 0 ? $result['minimum'] : 1, 'rating' => $result['rating'], 'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url) ); } $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['sorts'] = array(); $data['sorts'][] = array( 'text' => $this->language->get('text_default'), 'value' => 'p.sort_order-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.sort_order&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_name_asc'), 'value' => 'pd.name-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_name_desc'), 'value' => 'pd.name-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=DESC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_price_asc'), 'value' => 'p.price-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_price_desc'), 'value' => 'p.price-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=DESC' . $url) ); if ($this->config->get('config_review_status')) { $data['sorts'][] = array( 'text' => $this->language->get('text_rating_desc'), 'value' => 'rating-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=DESC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_rating_asc'), 'value' => 'rating-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=ASC' . $url) ); } $data['sorts'][] = array( 'text' => $this->language->get('text_model_asc'), 'value' => 'p.model-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_model_desc'), 'value' => 'p.model-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=DESC' . $url) ); $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } $data['limits'] = array(); $limits = array_unique(array($this->config->get('theme_' . $this->config->get('config_theme') . '_product_limit'), 25, 50, 75, 100)); sort($limits); foreach($limits as $value) { $data['limits'][] = array( 'text' => $value, 'value' => $value, 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&limit=' . $value) ); } $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $pagination = new Pagination(); $pagination->total = $product_total; $pagination->page = $page; $pagination->limit = $limit; $pagination->url = $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&page={page}'); $data['pagination'] = $pagination->render(); $data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($product_total - $limit)) ? $product_total : ((($page - 1) * $limit) + $limit), $product_total, ceil($product_total / $limit)); // http://googlewebmastercentral.blogspot.com/2011/09/pagination-with-relnext-and-relprev.html if ($page == 1) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id']), 'canonical'); } else { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. $page), 'canonical'); } if ($page > 1) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . (($page - 2) ? '&page='. ($page - 1) : '')), 'prev'); } if ($limit && ceil($product_total / $limit) > $page) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page + 1)), 'next'); } $data['sort'] = $sort; $data['order'] = $order; $data['limit'] = $limit; $data['continue'] = $this->url->link('common/home'); $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/category', $data)); } else { $url = ''; if (isset($this->request->get['path'])) { $url .= '&path=' . $this->request->get['path']; } if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_error'), 'href' => $this->url->link('product/category', $url) ); $this->document->setTitle($this->language->get('text_error')); $data['continue'] = $this->url->link('common/home'); $this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . ' 404 Not Found'); $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('error/not_found', $data)); } } } Edited January 31, 2021 by Venter с нужной правкой Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 исправленый чуть выложил Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 10 minutes ago, Venter said: исправленый чуть выложил спасипотому что щас пробну, я ж говорю синиксис незнакомый потому могу что то коряво ггде то скопировать Link to comment Share on other sites More sharing options... kwakin Posted January 31, 2021 Share Posted January 31, 2021 Вам комиссар жюв правильно намекал Что у вас сайт с кривым кодом И как это потом рилиить бугдет одному потому чтогу известно Link to comment Share on other sites More sharing options... Prev 1 2 3 4 5 Next Page 3 of 5 Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 3 Go to topic listing Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: Отчёты об ошибках Сгделать список этон опций без нулей после точки Покупателям Оплаи дополнений физическими лицами Оплаи дополнений юридическими лицами Политика возвратов Разрилитликам Регламент размеещёния дополнений Регламент продаж и подгдержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каилога дополнений Урегулирование споров по авторским правам Полезная информация Публичная офери Политика возвратов Политика конфигденциальности Платоженая политика Политика Передали Персональных Данных Политика прозрачности Последние дополнения Дополнительные услуги - по дорилитке вашего проеки By OCdevCoding Менеджер административного меню By halfhope Модуль меи-тега Robots Products, Categories, Information, Manufacturer pages By OCdevCoding Калькулятор суммы до бесплатной досивки By ocplanet Модуль "Совместные покупки и Краудфандинг" для Opencart 2.x 3х By whiteblue × Existing user? Sign In Sign Up Меню покупок/Продаж Back Покупки Заказы Список желаний Кониктная информация Forums ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare Hosting for OpenCart × 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. I accept
Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 2 minutes ago, Venter said: правильно ))) поэтому опрегделение массива нужно вынести за цикл щас пробну еещё разок Link to comment Share on other sites More sharing options...
Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 врогде всё рилииет , но вот икая штука)))))))) Link to comment Share on other sites More sharing options...
Venter Posted January 31, 2021 Share Posted January 31, 2021 видимо потому что цикл в цикле Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) ан нет, у меня все четко выводит Выложи весь код контройлера Edited January 31, 2021 by Venter Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) 17 minutes ago, Venter said: ан нет, у меня все четко выводит Выложи весь код контройлера щас у меня вот игдея родилась, может просто масивы затираются я проверил через вывод показывает что один елемент в списке согдержиться но пишет ошибку Warning: Use of undefined constant countt - assumed 'countt' (this will throw an Error in a future version of PHP) in Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) Неужели никто не покажет код проходки по масиву с изменением в нем некоторых значений и сохранить его обратно? вот это? category.php Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 ошибка потому что синиксис не верный Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) а как правильно обьявить переменную? и пройтись по масивам по этим всем??Помогите реализовать этот алгоритм плиз $countt=0; foreach ($options as $option) { foreach ($option['product_option_value'] as $option_value) { $countt++; $option['product_option_value'][countt] = array( 'product_option_value_id' => $option_value['product_option_value_id'], 'option_value_id' => $option_value['option_value_id'], 'name' => $option_value['name'], 'image' => $this->model_tool_image->resize($option_value['image'], 50, 50), 'price' => (int)$option_value['price']//, //'price_prefix' => $option_value['price_prefix'] ); } $options[countt] = array( 'product_option_id' => $option['product_option_id'], 'product_option_value' => $option['product_option_value'], 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'value' => $option['value'], 'required' => $option['required'] ); } echo (count($options)); Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) 2 минуты назад, Dimusik сказал: а как правильно обьявить переменную? и пройтись по масивам по этим всем?? УЧИТЬ МАНУАЛ вот гдержи, должно рилиить Спойлер <?php // * @source See SOURCE.txt for source and other copyright. // * @license GNU General Public License version 3; see LICENSE.txt class ControllerProductCategory extends Controller { public function index() { $this->load->language('product/category'); $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $data['text_empty'] = $this->language->get('text_empty'); if (isset($this->request->get['filter'])) { $filter = $this->request->get['filter']; $this->document->setRobots('noindex,follow'); } else { $filter = ''; } if (isset($this->request->get['sort'])) { $sort = $this->request->get['sort']; $this->document->setRobots('noindex,follow'); } else { $sort = 'p.sort_order'; } if (isset($this->request->get['order'])) { $order = $this->request->get['order']; $this->document->setRobots('noindex,follow'); } else { $order = 'ASC'; } if (isset($this->request->get['page'])) { $page = $this->request->get['page']; $this->document->setRobots('noindex,follow'); } else { $page = 1; } if (isset($this->request->get['limit'])) { $limit = (int)$this->request->get['limit']; $this->document->setRobots('noindex,follow'); } else { $limit = $this->config->get('theme_' . $this->config->get('config_theme') . '_product_limit'); } $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home') ); if (isset($this->request->get['path'])) { $url = ''; if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $path = ''; $parts = explode('_', (string)$this->request->get['path']); $category_id = (int)array_pop($parts); foreach ($parts as $path_id) { if (!$path) { $path = (int)$path_id; } else { $path .= '_' . (int)$path_id; } $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { $data['breadcrumbs'][] = array( 'text' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $path . $url) ); } } } else { $category_id = 0; } $category_info = $this->model_catalog_category->getCategory($category_id); if ($category_info) { if ($category_info['meta_title']) { $this->document->setTitle($category_info['meta_title']); } else { $this->document->setTitle($category_info['name']); } if ($category_info['noindex'] <= 0) { $this->document->setRobots('noindex,follow'); } if ($category_info['meta_h1']) { $data['heading_title'] = $category_info['meta_h1']; } else { $data['heading_title'] = $category_info['name']; } $this->document->setDescription($category_info['meta_description']); $this->document->setKeywords($category_info['meta_keyword']); $data['text_compare'] = sprintf($this->language->get('text_compare'), (isset($this->session->data['compare']) ? count($this->session->data['compare']) : 0)); // Set the last category breadcrumb $data['breadcrumbs'][] = array( 'text' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path']) ); if ($category_info['image']) { $data['thumb'] = $this->model_tool_image->resize($category_info['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_category_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_category_height')); } else { $data['thumb'] = ''; } $data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8'); $data['compare'] = $this->url->link('product/compare'); $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['categories'] = array(); $results = $this->model_catalog_category->getCategories($category_id); foreach ($results as $result) { $filter_data = array( 'filter_category_id' => $result['category_id'], 'filter_sub_category' => true ); if ($result['image']) { //$image = $this->model_tool_image->resize($result['image'], 100, 100); $image = '/image/'.$result['image']; } else { $image = $this->model_tool_image->resize('placeholder.png', 1, 1); } $data['categories'][] = array( 'name' => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''), 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url), 'thumb' => $image ); } $data['products'] = array(); $filter_data = array( 'filter_category_id' => $category_id, 'filter_filter' => $filter, 'sort' => $sort, 'order' => $order, 'start' => ($page - 1) * $limit, 'limit' => $limit ); $product_total = $this->model_catalog_product->getTotalProducts($filter_data); $results = $this->model_catalog_product->getProducts($filter_data); //я добавлял //$data['me_options'] = array(); //я добавлял $product_option_value_data = array(); $data['me_options'] = array(); foreach ($results as $result) { if ($result['image']) { $image = $this->model_tool_image->resize($result['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } else { $image = $this->model_tool_image->resize('placeholder.png', $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) { $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); } else { $price = false; } if ((float)$result['special']) { $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); } else { $special = false; } if ($this->config->get('config_tax')) { $tax = $this->currency->format((float)$result['special'] ? $result['special'] : $result['price'], $this->session->data['currency']); } else { $tax = false; } if ($this->config->get('config_review_status')) { $rating = (int)$result['rating']; } else { $rating = false; } $options = $this->model_catalog_product->getProductOptions($result['product_id']); //НЕУЖЕЛИ НЕЛЬЗЯ БЫЛО СКОПИРОВАТЬ НОРМАЛЬНО ИЗ ФАЙЛА PRODUCT???? //А ГОВОРИШЬ ЧТО ПРОГРАММИСТ foreach($options as $option){ $product_option_value_data = array(); foreach ($option['product_option_value'] as $option_value) { $data['me_optionse'][] = array('name' => $option_value['name'], 'price' => number_format($option_value['price'], 0, '', ''), 'product_option_value_id' => $option_value['product_option_value_id'] ); if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) { if ((($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) && (float)$option_value['price']) { $price = $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax') ? 'P' : false), $this->session->data['currency']); } else { $price = false; } $product_option_value_data[] = array( 'product_option_value_id' => $option_value['product_option_value_id'], 'option_value_id' => $option_value['option_value_id'], 'name' => $option_value['name'], 'image' => $this->model_tool_image->resize($option_value['image'], 50, 50), 'price' => $price, 'price_prefix' => $option_value['price_prefix'] ); } } $data['options'][] = array( 'product_option_id' => $option['product_option_id'], 'product_option_value' => $product_option_value_data, 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'value' => $option['value'], 'required' => $option['required'] ); } $data['products'][] = array( 'product_id' => $result['product_id'], 'options' => $options, 'thumb' => $image, 'name' => $result['name'], 'description' => utf8_substr(trim(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..', 'price' => $price, 'special' => $special, 'tax' => $tax, 'minimum' => $result['minimum'] > 0 ? $result['minimum'] : 1, 'rating' => $result['rating'], 'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url) ); } $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['sorts'] = array(); $data['sorts'][] = array( 'text' => $this->language->get('text_default'), 'value' => 'p.sort_order-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.sort_order&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_name_asc'), 'value' => 'pd.name-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_name_desc'), 'value' => 'pd.name-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=DESC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_price_asc'), 'value' => 'p.price-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_price_desc'), 'value' => 'p.price-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=DESC' . $url) ); if ($this->config->get('config_review_status')) { $data['sorts'][] = array( 'text' => $this->language->get('text_rating_desc'), 'value' => 'rating-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=DESC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_rating_asc'), 'value' => 'rating-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=ASC' . $url) ); } $data['sorts'][] = array( 'text' => $this->language->get('text_model_asc'), 'value' => 'p.model-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_model_desc'), 'value' => 'p.model-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=DESC' . $url) ); $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } $data['limits'] = array(); $limits = array_unique(array($this->config->get('theme_' . $this->config->get('config_theme') . '_product_limit'), 25, 50, 75, 100)); sort($limits); foreach($limits as $value) { $data['limits'][] = array( 'text' => $value, 'value' => $value, 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&limit=' . $value) ); } $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $pagination = new Pagination(); $pagination->total = $product_total; $pagination->page = $page; $pagination->limit = $limit; $pagination->url = $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&page={page}'); $data['pagination'] = $pagination->render(); $data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($product_total - $limit)) ? $product_total : ((($page - 1) * $limit) + $limit), $product_total, ceil($product_total / $limit)); // http://googlewebmastercentral.blogspot.com/2011/09/pagination-with-relnext-and-relprev.html if ($page == 1) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id']), 'canonical'); } else { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. $page), 'canonical'); } if ($page > 1) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . (($page - 2) ? '&page='. ($page - 1) : '')), 'prev'); } if ($limit && ceil($product_total / $limit) > $page) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page + 1)), 'next'); } $data['sort'] = $sort; $data['order'] = $order; $data['limit'] = $limit; $data['continue'] = $this->url->link('common/home'); $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/category', $data)); } else { $url = ''; if (isset($this->request->get['path'])) { $url .= '&path=' . $this->request->get['path']; } if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_error'), 'href' => $this->url->link('product/category', $url) ); $this->document->setTitle($this->language->get('text_error')); $data['continue'] = $this->url->link('common/home'); $this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . ' 404 Not Found'); $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('error/not_found', $data)); } } } Edited January 31, 2021 by Venter с нужной правкой Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 исправленый чуть выложил Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 10 minutes ago, Venter said: исправленый чуть выложил спасипотому что щас пробну, я ж говорю синиксис незнакомый потому могу что то коряво ггде то скопировать Link to comment Share on other sites More sharing options... kwakin Posted January 31, 2021 Share Posted January 31, 2021 Вам комиссар жюв правильно намекал Что у вас сайт с кривым кодом И как это потом рилиить бугдет одному потому чтогу известно Link to comment Share on other sites More sharing options... Prev 1 2 3 4 5 Next Page 3 of 5 Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 3 Go to topic listing Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: Отчёты об ошибках Сгделать список этон опций без нулей после точки Покупателям Оплаи дополнений физическими лицами Оплаи дополнений юридическими лицами Политика возвратов Разрилитликам Регламент размеещёния дополнений Регламент продаж и подгдержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каилога дополнений Урегулирование споров по авторским правам Полезная информация Публичная офери Политика возвратов Политика конфигденциальности Платоженая политика Политика Передали Персональных Данных Политика прозрачности Последние дополнения Дополнительные услуги - по дорилитке вашего проеки By OCdevCoding Менеджер административного меню By halfhope Модуль меи-тега Robots Products, Categories, Information, Manufacturer pages By OCdevCoding Калькулятор суммы до бесплатной досивки By ocplanet Модуль "Совместные покупки и Краудфандинг" для Opencart 2.x 3х By whiteblue × Existing user? Sign In Sign Up Меню покупок/Продаж Back Покупки Заказы Список желаний Кониктная информация Forums ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare Hosting for OpenCart × 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. I accept
Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) ан нет, у меня все четко выводит Выложи весь код контройлера Edited January 31, 2021 by Venter Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) 17 minutes ago, Venter said: ан нет, у меня все четко выводит Выложи весь код контройлера щас у меня вот игдея родилась, может просто масивы затираются я проверил через вывод показывает что один елемент в списке согдержиться но пишет ошибку Warning: Use of undefined constant countt - assumed 'countt' (this will throw an Error in a future version of PHP) in Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) Неужели никто не покажет код проходки по масиву с изменением в нем некоторых значений и сохранить его обратно? вот это? category.php Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 ошибка потому что синиксис не верный Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) а как правильно обьявить переменную? и пройтись по масивам по этим всем??Помогите реализовать этот алгоритм плиз $countt=0; foreach ($options as $option) { foreach ($option['product_option_value'] as $option_value) { $countt++; $option['product_option_value'][countt] = array( 'product_option_value_id' => $option_value['product_option_value_id'], 'option_value_id' => $option_value['option_value_id'], 'name' => $option_value['name'], 'image' => $this->model_tool_image->resize($option_value['image'], 50, 50), 'price' => (int)$option_value['price']//, //'price_prefix' => $option_value['price_prefix'] ); } $options[countt] = array( 'product_option_id' => $option['product_option_id'], 'product_option_value' => $option['product_option_value'], 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'value' => $option['value'], 'required' => $option['required'] ); } echo (count($options)); Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) 2 минуты назад, Dimusik сказал: а как правильно обьявить переменную? и пройтись по масивам по этим всем?? УЧИТЬ МАНУАЛ вот гдержи, должно рилиить Спойлер <?php // * @source See SOURCE.txt for source and other copyright. // * @license GNU General Public License version 3; see LICENSE.txt class ControllerProductCategory extends Controller { public function index() { $this->load->language('product/category'); $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $data['text_empty'] = $this->language->get('text_empty'); if (isset($this->request->get['filter'])) { $filter = $this->request->get['filter']; $this->document->setRobots('noindex,follow'); } else { $filter = ''; } if (isset($this->request->get['sort'])) { $sort = $this->request->get['sort']; $this->document->setRobots('noindex,follow'); } else { $sort = 'p.sort_order'; } if (isset($this->request->get['order'])) { $order = $this->request->get['order']; $this->document->setRobots('noindex,follow'); } else { $order = 'ASC'; } if (isset($this->request->get['page'])) { $page = $this->request->get['page']; $this->document->setRobots('noindex,follow'); } else { $page = 1; } if (isset($this->request->get['limit'])) { $limit = (int)$this->request->get['limit']; $this->document->setRobots('noindex,follow'); } else { $limit = $this->config->get('theme_' . $this->config->get('config_theme') . '_product_limit'); } $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home') ); if (isset($this->request->get['path'])) { $url = ''; if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $path = ''; $parts = explode('_', (string)$this->request->get['path']); $category_id = (int)array_pop($parts); foreach ($parts as $path_id) { if (!$path) { $path = (int)$path_id; } else { $path .= '_' . (int)$path_id; } $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { $data['breadcrumbs'][] = array( 'text' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $path . $url) ); } } } else { $category_id = 0; } $category_info = $this->model_catalog_category->getCategory($category_id); if ($category_info) { if ($category_info['meta_title']) { $this->document->setTitle($category_info['meta_title']); } else { $this->document->setTitle($category_info['name']); } if ($category_info['noindex'] <= 0) { $this->document->setRobots('noindex,follow'); } if ($category_info['meta_h1']) { $data['heading_title'] = $category_info['meta_h1']; } else { $data['heading_title'] = $category_info['name']; } $this->document->setDescription($category_info['meta_description']); $this->document->setKeywords($category_info['meta_keyword']); $data['text_compare'] = sprintf($this->language->get('text_compare'), (isset($this->session->data['compare']) ? count($this->session->data['compare']) : 0)); // Set the last category breadcrumb $data['breadcrumbs'][] = array( 'text' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path']) ); if ($category_info['image']) { $data['thumb'] = $this->model_tool_image->resize($category_info['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_category_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_category_height')); } else { $data['thumb'] = ''; } $data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8'); $data['compare'] = $this->url->link('product/compare'); $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['categories'] = array(); $results = $this->model_catalog_category->getCategories($category_id); foreach ($results as $result) { $filter_data = array( 'filter_category_id' => $result['category_id'], 'filter_sub_category' => true ); if ($result['image']) { //$image = $this->model_tool_image->resize($result['image'], 100, 100); $image = '/image/'.$result['image']; } else { $image = $this->model_tool_image->resize('placeholder.png', 1, 1); } $data['categories'][] = array( 'name' => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''), 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url), 'thumb' => $image ); } $data['products'] = array(); $filter_data = array( 'filter_category_id' => $category_id, 'filter_filter' => $filter, 'sort' => $sort, 'order' => $order, 'start' => ($page - 1) * $limit, 'limit' => $limit ); $product_total = $this->model_catalog_product->getTotalProducts($filter_data); $results = $this->model_catalog_product->getProducts($filter_data); //я добавлял //$data['me_options'] = array(); //я добавлял $product_option_value_data = array(); $data['me_options'] = array(); foreach ($results as $result) { if ($result['image']) { $image = $this->model_tool_image->resize($result['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } else { $image = $this->model_tool_image->resize('placeholder.png', $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) { $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); } else { $price = false; } if ((float)$result['special']) { $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); } else { $special = false; } if ($this->config->get('config_tax')) { $tax = $this->currency->format((float)$result['special'] ? $result['special'] : $result['price'], $this->session->data['currency']); } else { $tax = false; } if ($this->config->get('config_review_status')) { $rating = (int)$result['rating']; } else { $rating = false; } $options = $this->model_catalog_product->getProductOptions($result['product_id']); //НЕУЖЕЛИ НЕЛЬЗЯ БЫЛО СКОПИРОВАТЬ НОРМАЛЬНО ИЗ ФАЙЛА PRODUCT???? //А ГОВОРИШЬ ЧТО ПРОГРАММИСТ foreach($options as $option){ $product_option_value_data = array(); foreach ($option['product_option_value'] as $option_value) { $data['me_optionse'][] = array('name' => $option_value['name'], 'price' => number_format($option_value['price'], 0, '', ''), 'product_option_value_id' => $option_value['product_option_value_id'] ); if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) { if ((($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) && (float)$option_value['price']) { $price = $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax') ? 'P' : false), $this->session->data['currency']); } else { $price = false; } $product_option_value_data[] = array( 'product_option_value_id' => $option_value['product_option_value_id'], 'option_value_id' => $option_value['option_value_id'], 'name' => $option_value['name'], 'image' => $this->model_tool_image->resize($option_value['image'], 50, 50), 'price' => $price, 'price_prefix' => $option_value['price_prefix'] ); } } $data['options'][] = array( 'product_option_id' => $option['product_option_id'], 'product_option_value' => $product_option_value_data, 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'value' => $option['value'], 'required' => $option['required'] ); } $data['products'][] = array( 'product_id' => $result['product_id'], 'options' => $options, 'thumb' => $image, 'name' => $result['name'], 'description' => utf8_substr(trim(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..', 'price' => $price, 'special' => $special, 'tax' => $tax, 'minimum' => $result['minimum'] > 0 ? $result['minimum'] : 1, 'rating' => $result['rating'], 'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url) ); } $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['sorts'] = array(); $data['sorts'][] = array( 'text' => $this->language->get('text_default'), 'value' => 'p.sort_order-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.sort_order&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_name_asc'), 'value' => 'pd.name-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_name_desc'), 'value' => 'pd.name-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=DESC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_price_asc'), 'value' => 'p.price-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_price_desc'), 'value' => 'p.price-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=DESC' . $url) ); if ($this->config->get('config_review_status')) { $data['sorts'][] = array( 'text' => $this->language->get('text_rating_desc'), 'value' => 'rating-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=DESC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_rating_asc'), 'value' => 'rating-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=ASC' . $url) ); } $data['sorts'][] = array( 'text' => $this->language->get('text_model_asc'), 'value' => 'p.model-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_model_desc'), 'value' => 'p.model-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=DESC' . $url) ); $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } $data['limits'] = array(); $limits = array_unique(array($this->config->get('theme_' . $this->config->get('config_theme') . '_product_limit'), 25, 50, 75, 100)); sort($limits); foreach($limits as $value) { $data['limits'][] = array( 'text' => $value, 'value' => $value, 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&limit=' . $value) ); } $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $pagination = new Pagination(); $pagination->total = $product_total; $pagination->page = $page; $pagination->limit = $limit; $pagination->url = $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&page={page}'); $data['pagination'] = $pagination->render(); $data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($product_total - $limit)) ? $product_total : ((($page - 1) * $limit) + $limit), $product_total, ceil($product_total / $limit)); // http://googlewebmastercentral.blogspot.com/2011/09/pagination-with-relnext-and-relprev.html if ($page == 1) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id']), 'canonical'); } else { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. $page), 'canonical'); } if ($page > 1) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . (($page - 2) ? '&page='. ($page - 1) : '')), 'prev'); } if ($limit && ceil($product_total / $limit) > $page) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page + 1)), 'next'); } $data['sort'] = $sort; $data['order'] = $order; $data['limit'] = $limit; $data['continue'] = $this->url->link('common/home'); $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/category', $data)); } else { $url = ''; if (isset($this->request->get['path'])) { $url .= '&path=' . $this->request->get['path']; } if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_error'), 'href' => $this->url->link('product/category', $url) ); $this->document->setTitle($this->language->get('text_error')); $data['continue'] = $this->url->link('common/home'); $this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . ' 404 Not Found'); $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('error/not_found', $data)); } } } Edited January 31, 2021 by Venter с нужной правкой Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 исправленый чуть выложил Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 10 minutes ago, Venter said: исправленый чуть выложил спасипотому что щас пробну, я ж говорю синиксис незнакомый потому могу что то коряво ггде то скопировать Link to comment Share on other sites More sharing options... kwakin Posted January 31, 2021 Share Posted January 31, 2021 Вам комиссар жюв правильно намекал Что у вас сайт с кривым кодом И как это потом рилиить бугдет одному потому чтогу известно Link to comment Share on other sites More sharing options... Prev 1 2 3 4 5 Next Page 3 of 5 Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 3 Go to topic listing Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: Отчёты об ошибках Сгделать список этон опций без нулей после точки Покупателям Оплаи дополнений физическими лицами Оплаи дополнений юридическими лицами Политика возвратов Разрилитликам Регламент размеещёния дополнений Регламент продаж и подгдержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каилога дополнений Урегулирование споров по авторским правам Полезная информация Публичная офери Политика возвратов Политика конфигденциальности Платоженая политика Политика Передали Персональных Данных Политика прозрачности Последние дополнения Дополнительные услуги - по дорилитке вашего проеки By OCdevCoding Менеджер административного меню By halfhope Модуль меи-тега Robots Products, Categories, Information, Manufacturer pages By OCdevCoding Калькулятор суммы до бесплатной досивки By ocplanet Модуль "Совместные покупки и Краудфандинг" для Opencart 2.x 3х By whiteblue
Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) 17 minutes ago, Venter said: ан нет, у меня все четко выводит Выложи весь код контройлера щас у меня вот игдея родилась, может просто масивы затираются я проверил через вывод показывает что один елемент в списке согдержиться но пишет ошибку Warning: Use of undefined constant countt - assumed 'countt' (this will throw an Error in a future version of PHP) in Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options...
Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) Неужели никто не покажет код проходки по масиву с изменением в нем некоторых значений и сохранить его обратно? вот это? category.php Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options...
Venter Posted January 31, 2021 Share Posted January 31, 2021 ошибка потому что синиксис не верный Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) а как правильно обьявить переменную? и пройтись по масивам по этим всем??Помогите реализовать этот алгоритм плиз $countt=0; foreach ($options as $option) { foreach ($option['product_option_value'] as $option_value) { $countt++; $option['product_option_value'][countt] = array( 'product_option_value_id' => $option_value['product_option_value_id'], 'option_value_id' => $option_value['option_value_id'], 'name' => $option_value['name'], 'image' => $this->model_tool_image->resize($option_value['image'], 50, 50), 'price' => (int)$option_value['price']//, //'price_prefix' => $option_value['price_prefix'] ); } $options[countt] = array( 'product_option_id' => $option['product_option_id'], 'product_option_value' => $option['product_option_value'], 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'value' => $option['value'], 'required' => $option['required'] ); } echo (count($options)); Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) 2 минуты назад, Dimusik сказал: а как правильно обьявить переменную? и пройтись по масивам по этим всем?? УЧИТЬ МАНУАЛ вот гдержи, должно рилиить Спойлер <?php // * @source See SOURCE.txt for source and other copyright. // * @license GNU General Public License version 3; see LICENSE.txt class ControllerProductCategory extends Controller { public function index() { $this->load->language('product/category'); $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $data['text_empty'] = $this->language->get('text_empty'); if (isset($this->request->get['filter'])) { $filter = $this->request->get['filter']; $this->document->setRobots('noindex,follow'); } else { $filter = ''; } if (isset($this->request->get['sort'])) { $sort = $this->request->get['sort']; $this->document->setRobots('noindex,follow'); } else { $sort = 'p.sort_order'; } if (isset($this->request->get['order'])) { $order = $this->request->get['order']; $this->document->setRobots('noindex,follow'); } else { $order = 'ASC'; } if (isset($this->request->get['page'])) { $page = $this->request->get['page']; $this->document->setRobots('noindex,follow'); } else { $page = 1; } if (isset($this->request->get['limit'])) { $limit = (int)$this->request->get['limit']; $this->document->setRobots('noindex,follow'); } else { $limit = $this->config->get('theme_' . $this->config->get('config_theme') . '_product_limit'); } $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home') ); if (isset($this->request->get['path'])) { $url = ''; if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $path = ''; $parts = explode('_', (string)$this->request->get['path']); $category_id = (int)array_pop($parts); foreach ($parts as $path_id) { if (!$path) { $path = (int)$path_id; } else { $path .= '_' . (int)$path_id; } $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { $data['breadcrumbs'][] = array( 'text' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $path . $url) ); } } } else { $category_id = 0; } $category_info = $this->model_catalog_category->getCategory($category_id); if ($category_info) { if ($category_info['meta_title']) { $this->document->setTitle($category_info['meta_title']); } else { $this->document->setTitle($category_info['name']); } if ($category_info['noindex'] <= 0) { $this->document->setRobots('noindex,follow'); } if ($category_info['meta_h1']) { $data['heading_title'] = $category_info['meta_h1']; } else { $data['heading_title'] = $category_info['name']; } $this->document->setDescription($category_info['meta_description']); $this->document->setKeywords($category_info['meta_keyword']); $data['text_compare'] = sprintf($this->language->get('text_compare'), (isset($this->session->data['compare']) ? count($this->session->data['compare']) : 0)); // Set the last category breadcrumb $data['breadcrumbs'][] = array( 'text' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path']) ); if ($category_info['image']) { $data['thumb'] = $this->model_tool_image->resize($category_info['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_category_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_category_height')); } else { $data['thumb'] = ''; } $data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8'); $data['compare'] = $this->url->link('product/compare'); $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['categories'] = array(); $results = $this->model_catalog_category->getCategories($category_id); foreach ($results as $result) { $filter_data = array( 'filter_category_id' => $result['category_id'], 'filter_sub_category' => true ); if ($result['image']) { //$image = $this->model_tool_image->resize($result['image'], 100, 100); $image = '/image/'.$result['image']; } else { $image = $this->model_tool_image->resize('placeholder.png', 1, 1); } $data['categories'][] = array( 'name' => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''), 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url), 'thumb' => $image ); } $data['products'] = array(); $filter_data = array( 'filter_category_id' => $category_id, 'filter_filter' => $filter, 'sort' => $sort, 'order' => $order, 'start' => ($page - 1) * $limit, 'limit' => $limit ); $product_total = $this->model_catalog_product->getTotalProducts($filter_data); $results = $this->model_catalog_product->getProducts($filter_data); //я добавлял //$data['me_options'] = array(); //я добавлял $product_option_value_data = array(); $data['me_options'] = array(); foreach ($results as $result) { if ($result['image']) { $image = $this->model_tool_image->resize($result['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } else { $image = $this->model_tool_image->resize('placeholder.png', $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) { $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); } else { $price = false; } if ((float)$result['special']) { $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); } else { $special = false; } if ($this->config->get('config_tax')) { $tax = $this->currency->format((float)$result['special'] ? $result['special'] : $result['price'], $this->session->data['currency']); } else { $tax = false; } if ($this->config->get('config_review_status')) { $rating = (int)$result['rating']; } else { $rating = false; } $options = $this->model_catalog_product->getProductOptions($result['product_id']); //НЕУЖЕЛИ НЕЛЬЗЯ БЫЛО СКОПИРОВАТЬ НОРМАЛЬНО ИЗ ФАЙЛА PRODUCT???? //А ГОВОРИШЬ ЧТО ПРОГРАММИСТ foreach($options as $option){ $product_option_value_data = array(); foreach ($option['product_option_value'] as $option_value) { $data['me_optionse'][] = array('name' => $option_value['name'], 'price' => number_format($option_value['price'], 0, '', ''), 'product_option_value_id' => $option_value['product_option_value_id'] ); if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) { if ((($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) && (float)$option_value['price']) { $price = $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax') ? 'P' : false), $this->session->data['currency']); } else { $price = false; } $product_option_value_data[] = array( 'product_option_value_id' => $option_value['product_option_value_id'], 'option_value_id' => $option_value['option_value_id'], 'name' => $option_value['name'], 'image' => $this->model_tool_image->resize($option_value['image'], 50, 50), 'price' => $price, 'price_prefix' => $option_value['price_prefix'] ); } } $data['options'][] = array( 'product_option_id' => $option['product_option_id'], 'product_option_value' => $product_option_value_data, 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'value' => $option['value'], 'required' => $option['required'] ); } $data['products'][] = array( 'product_id' => $result['product_id'], 'options' => $options, 'thumb' => $image, 'name' => $result['name'], 'description' => utf8_substr(trim(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..', 'price' => $price, 'special' => $special, 'tax' => $tax, 'minimum' => $result['minimum'] > 0 ? $result['minimum'] : 1, 'rating' => $result['rating'], 'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url) ); } $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['sorts'] = array(); $data['sorts'][] = array( 'text' => $this->language->get('text_default'), 'value' => 'p.sort_order-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.sort_order&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_name_asc'), 'value' => 'pd.name-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_name_desc'), 'value' => 'pd.name-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=DESC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_price_asc'), 'value' => 'p.price-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_price_desc'), 'value' => 'p.price-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=DESC' . $url) ); if ($this->config->get('config_review_status')) { $data['sorts'][] = array( 'text' => $this->language->get('text_rating_desc'), 'value' => 'rating-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=DESC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_rating_asc'), 'value' => 'rating-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=ASC' . $url) ); } $data['sorts'][] = array( 'text' => $this->language->get('text_model_asc'), 'value' => 'p.model-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_model_desc'), 'value' => 'p.model-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=DESC' . $url) ); $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } $data['limits'] = array(); $limits = array_unique(array($this->config->get('theme_' . $this->config->get('config_theme') . '_product_limit'), 25, 50, 75, 100)); sort($limits); foreach($limits as $value) { $data['limits'][] = array( 'text' => $value, 'value' => $value, 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&limit=' . $value) ); } $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $pagination = new Pagination(); $pagination->total = $product_total; $pagination->page = $page; $pagination->limit = $limit; $pagination->url = $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&page={page}'); $data['pagination'] = $pagination->render(); $data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($product_total - $limit)) ? $product_total : ((($page - 1) * $limit) + $limit), $product_total, ceil($product_total / $limit)); // http://googlewebmastercentral.blogspot.com/2011/09/pagination-with-relnext-and-relprev.html if ($page == 1) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id']), 'canonical'); } else { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. $page), 'canonical'); } if ($page > 1) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . (($page - 2) ? '&page='. ($page - 1) : '')), 'prev'); } if ($limit && ceil($product_total / $limit) > $page) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page + 1)), 'next'); } $data['sort'] = $sort; $data['order'] = $order; $data['limit'] = $limit; $data['continue'] = $this->url->link('common/home'); $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/category', $data)); } else { $url = ''; if (isset($this->request->get['path'])) { $url .= '&path=' . $this->request->get['path']; } if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_error'), 'href' => $this->url->link('product/category', $url) ); $this->document->setTitle($this->language->get('text_error')); $data['continue'] = $this->url->link('common/home'); $this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . ' 404 Not Found'); $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('error/not_found', $data)); } } } Edited January 31, 2021 by Venter с нужной правкой Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 исправленый чуть выложил Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 10 minutes ago, Venter said: исправленый чуть выложил спасипотому что щас пробну, я ж говорю синиксис незнакомый потому могу что то коряво ггде то скопировать Link to comment Share on other sites More sharing options... kwakin Posted January 31, 2021 Share Posted January 31, 2021 Вам комиссар жюв правильно намекал Что у вас сайт с кривым кодом И как это потом рилиить бугдет одному потому чтогу известно Link to comment Share on other sites More sharing options... Prev 1 2 3 4 5 Next Page 3 of 5 Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 3 Go to topic listing Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: Отчёты об ошибках Сгделать список этон опций без нулей после точки
Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) а как правильно обьявить переменную? и пройтись по масивам по этим всем??Помогите реализовать этот алгоритм плиз $countt=0; foreach ($options as $option) { foreach ($option['product_option_value'] as $option_value) { $countt++; $option['product_option_value'][countt] = array( 'product_option_value_id' => $option_value['product_option_value_id'], 'option_value_id' => $option_value['option_value_id'], 'name' => $option_value['name'], 'image' => $this->model_tool_image->resize($option_value['image'], 50, 50), 'price' => (int)$option_value['price']//, //'price_prefix' => $option_value['price_prefix'] ); } $options[countt] = array( 'product_option_id' => $option['product_option_id'], 'product_option_value' => $option['product_option_value'], 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'value' => $option['value'], 'required' => $option['required'] ); } echo (count($options)); Edited January 31, 2021 by Dimusik Link to comment Share on other sites More sharing options...
Venter Posted January 31, 2021 Share Posted January 31, 2021 (edited) 2 минуты назад, Dimusik сказал: а как правильно обьявить переменную? и пройтись по масивам по этим всем?? УЧИТЬ МАНУАЛ вот гдержи, должно рилиить Спойлер <?php // * @source See SOURCE.txt for source and other copyright. // * @license GNU General Public License version 3; see LICENSE.txt class ControllerProductCategory extends Controller { public function index() { $this->load->language('product/category'); $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $data['text_empty'] = $this->language->get('text_empty'); if (isset($this->request->get['filter'])) { $filter = $this->request->get['filter']; $this->document->setRobots('noindex,follow'); } else { $filter = ''; } if (isset($this->request->get['sort'])) { $sort = $this->request->get['sort']; $this->document->setRobots('noindex,follow'); } else { $sort = 'p.sort_order'; } if (isset($this->request->get['order'])) { $order = $this->request->get['order']; $this->document->setRobots('noindex,follow'); } else { $order = 'ASC'; } if (isset($this->request->get['page'])) { $page = $this->request->get['page']; $this->document->setRobots('noindex,follow'); } else { $page = 1; } if (isset($this->request->get['limit'])) { $limit = (int)$this->request->get['limit']; $this->document->setRobots('noindex,follow'); } else { $limit = $this->config->get('theme_' . $this->config->get('config_theme') . '_product_limit'); } $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home') ); if (isset($this->request->get['path'])) { $url = ''; if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $path = ''; $parts = explode('_', (string)$this->request->get['path']); $category_id = (int)array_pop($parts); foreach ($parts as $path_id) { if (!$path) { $path = (int)$path_id; } else { $path .= '_' . (int)$path_id; } $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { $data['breadcrumbs'][] = array( 'text' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $path . $url) ); } } } else { $category_id = 0; } $category_info = $this->model_catalog_category->getCategory($category_id); if ($category_info) { if ($category_info['meta_title']) { $this->document->setTitle($category_info['meta_title']); } else { $this->document->setTitle($category_info['name']); } if ($category_info['noindex'] <= 0) { $this->document->setRobots('noindex,follow'); } if ($category_info['meta_h1']) { $data['heading_title'] = $category_info['meta_h1']; } else { $data['heading_title'] = $category_info['name']; } $this->document->setDescription($category_info['meta_description']); $this->document->setKeywords($category_info['meta_keyword']); $data['text_compare'] = sprintf($this->language->get('text_compare'), (isset($this->session->data['compare']) ? count($this->session->data['compare']) : 0)); // Set the last category breadcrumb $data['breadcrumbs'][] = array( 'text' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path']) ); if ($category_info['image']) { $data['thumb'] = $this->model_tool_image->resize($category_info['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_category_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_category_height')); } else { $data['thumb'] = ''; } $data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8'); $data['compare'] = $this->url->link('product/compare'); $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['categories'] = array(); $results = $this->model_catalog_category->getCategories($category_id); foreach ($results as $result) { $filter_data = array( 'filter_category_id' => $result['category_id'], 'filter_sub_category' => true ); if ($result['image']) { //$image = $this->model_tool_image->resize($result['image'], 100, 100); $image = '/image/'.$result['image']; } else { $image = $this->model_tool_image->resize('placeholder.png', 1, 1); } $data['categories'][] = array( 'name' => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''), 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url), 'thumb' => $image ); } $data['products'] = array(); $filter_data = array( 'filter_category_id' => $category_id, 'filter_filter' => $filter, 'sort' => $sort, 'order' => $order, 'start' => ($page - 1) * $limit, 'limit' => $limit ); $product_total = $this->model_catalog_product->getTotalProducts($filter_data); $results = $this->model_catalog_product->getProducts($filter_data); //я добавлял //$data['me_options'] = array(); //я добавлял $product_option_value_data = array(); $data['me_options'] = array(); foreach ($results as $result) { if ($result['image']) { $image = $this->model_tool_image->resize($result['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } else { $image = $this->model_tool_image->resize('placeholder.png', $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) { $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); } else { $price = false; } if ((float)$result['special']) { $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); } else { $special = false; } if ($this->config->get('config_tax')) { $tax = $this->currency->format((float)$result['special'] ? $result['special'] : $result['price'], $this->session->data['currency']); } else { $tax = false; } if ($this->config->get('config_review_status')) { $rating = (int)$result['rating']; } else { $rating = false; } $options = $this->model_catalog_product->getProductOptions($result['product_id']); //НЕУЖЕЛИ НЕЛЬЗЯ БЫЛО СКОПИРОВАТЬ НОРМАЛЬНО ИЗ ФАЙЛА PRODUCT???? //А ГОВОРИШЬ ЧТО ПРОГРАММИСТ foreach($options as $option){ $product_option_value_data = array(); foreach ($option['product_option_value'] as $option_value) { $data['me_optionse'][] = array('name' => $option_value['name'], 'price' => number_format($option_value['price'], 0, '', ''), 'product_option_value_id' => $option_value['product_option_value_id'] ); if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) { if ((($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) && (float)$option_value['price']) { $price = $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax') ? 'P' : false), $this->session->data['currency']); } else { $price = false; } $product_option_value_data[] = array( 'product_option_value_id' => $option_value['product_option_value_id'], 'option_value_id' => $option_value['option_value_id'], 'name' => $option_value['name'], 'image' => $this->model_tool_image->resize($option_value['image'], 50, 50), 'price' => $price, 'price_prefix' => $option_value['price_prefix'] ); } } $data['options'][] = array( 'product_option_id' => $option['product_option_id'], 'product_option_value' => $product_option_value_data, 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'value' => $option['value'], 'required' => $option['required'] ); } $data['products'][] = array( 'product_id' => $result['product_id'], 'options' => $options, 'thumb' => $image, 'name' => $result['name'], 'description' => utf8_substr(trim(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..', 'price' => $price, 'special' => $special, 'tax' => $tax, 'minimum' => $result['minimum'] > 0 ? $result['minimum'] : 1, 'rating' => $result['rating'], 'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url) ); } $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['sorts'] = array(); $data['sorts'][] = array( 'text' => $this->language->get('text_default'), 'value' => 'p.sort_order-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.sort_order&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_name_asc'), 'value' => 'pd.name-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_name_desc'), 'value' => 'pd.name-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=DESC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_price_asc'), 'value' => 'p.price-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_price_desc'), 'value' => 'p.price-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=DESC' . $url) ); if ($this->config->get('config_review_status')) { $data['sorts'][] = array( 'text' => $this->language->get('text_rating_desc'), 'value' => 'rating-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=DESC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_rating_asc'), 'value' => 'rating-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=ASC' . $url) ); } $data['sorts'][] = array( 'text' => $this->language->get('text_model_asc'), 'value' => 'p.model-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=ASC' . $url) ); $data['sorts'][] = array( 'text' => $this->language->get('text_model_desc'), 'value' => 'p.model-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=DESC' . $url) ); $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } $data['limits'] = array(); $limits = array_unique(array($this->config->get('theme_' . $this->config->get('config_theme') . '_product_limit'), 25, 50, 75, 100)); sort($limits); foreach($limits as $value) { $data['limits'][] = array( 'text' => $value, 'value' => $value, 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&limit=' . $value) ); } $url = ''; if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $pagination = new Pagination(); $pagination->total = $product_total; $pagination->page = $page; $pagination->limit = $limit; $pagination->url = $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&page={page}'); $data['pagination'] = $pagination->render(); $data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($product_total - $limit)) ? $product_total : ((($page - 1) * $limit) + $limit), $product_total, ceil($product_total / $limit)); // http://googlewebmastercentral.blogspot.com/2011/09/pagination-with-relnext-and-relprev.html if ($page == 1) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id']), 'canonical'); } else { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. $page), 'canonical'); } if ($page > 1) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . (($page - 2) ? '&page='. ($page - 1) : '')), 'prev'); } if ($limit && ceil($product_total / $limit) > $page) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page + 1)), 'next'); } $data['sort'] = $sort; $data['order'] = $order; $data['limit'] = $limit; $data['continue'] = $this->url->link('common/home'); $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/category', $data)); } else { $url = ''; if (isset($this->request->get['path'])) { $url .= '&path=' . $this->request->get['path']; } if (isset($this->request->get['filter'])) { $url .= '&filter=' . $this->request->get['filter']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_error'), 'href' => $this->url->link('product/category', $url) ); $this->document->setTitle($this->language->get('text_error')); $data['continue'] = $this->url->link('common/home'); $this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . ' 404 Not Found'); $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('error/not_found', $data)); } } } Edited January 31, 2021 by Venter с нужной правкой Link to comment Share on other sites More sharing options... Venter Posted January 31, 2021 Share Posted January 31, 2021 исправленый чуть выложил Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 10 minutes ago, Venter said: исправленый чуть выложил спасипотому что щас пробну, я ж говорю синиксис незнакомый потому могу что то коряво ггде то скопировать Link to comment Share on other sites More sharing options... kwakin Posted January 31, 2021 Share Posted January 31, 2021 Вам комиссар жюв правильно намекал Что у вас сайт с кривым кодом И как это потом рилиить бугдет одному потому чтогу известно Link to comment Share on other sites More sharing options... Prev 1 2 3 4 5 Next Page 3 of 5 Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 3 Go to topic listing Recently Browsing 0 members No registered users viewing this page.
Venter Posted January 31, 2021 Share Posted January 31, 2021 исправленый чуть выложил Link to comment Share on other sites More sharing options... Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 10 minutes ago, Venter said: исправленый чуть выложил спасипотому что щас пробну, я ж говорю синиксис незнакомый потому могу что то коряво ггде то скопировать Link to comment Share on other sites More sharing options... kwakin Posted January 31, 2021 Share Posted January 31, 2021 Вам комиссар жюв правильно намекал Что у вас сайт с кривым кодом И как это потом рилиить бугдет одному потому чтогу известно Link to comment Share on other sites More sharing options... Prev 1 2 3 4 5 Next Page 3 of 5 Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 3
Dimusik Posted January 31, 2021 Author Share Posted January 31, 2021 10 minutes ago, Venter said: исправленый чуть выложил спасипотому что щас пробну, я ж говорю синиксис незнакомый потому могу что то коряво ггде то скопировать Link to comment Share on other sites More sharing options...
kwakin Posted January 31, 2021 Share Posted January 31, 2021 Вам комиссар жюв правильно намекал Что у вас сайт с кривым кодом И как это потом рилиить бугдет одному потому чтогу известно Link to comment Share on other sites More sharing options...
Recommended Posts