Перейти до вмісту
Пошук в
  • Детальніше...
Шукати результати, які ...
Шукати результати в ...

reallik

Новачок
  
  • Публікації

    9
  • З нами

  • Відвідування

1 подписчик

Відвідувачі профілю

Блок відвідувачів профілю відключений і не буде доступний широкому іншим користувачам

reallik's Achievements

Rookie

Rookie (2/14)

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

Recent Badges

0

Репутація

  1. Все получилось.Только картинки не перелетают к корзине, как такое реализовать.Как я понимаю нужно добавить скрипт, но какой и куда?
  2. Пытаюсь добавить кнопки "купить" в общем списке, но ничего не выходит. У меня почему-то файлы сильно отличаются от файлов home.php и home.tpl от этих https://opencartforum.com/go.php?http://opencart.studio-vk.com/catalog/controller/common/home.php.txt https://opencartforum.com/go.php?http://opencart.studio-vk.com/catalog/view/theme/default/template/common/home.tpl.txt Я правильно понимаю, что изменяю, только 2 файла home.tpl и home.php ? Если просто пытаюсь заменить свои файлы на файлы из ссылок приведенных выше, то главная страница перестает работать.. Мои home.tpl <?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?><div id="content"> <?php if ($welcome) { ?> <div class="top"> <div class="left"></div> <div class="right"></div> <div class="center"> <h1><?php echo $heading_title; ?></h1> </div> </div> <div class="middle"> <div><?php echo $welcome; ?></div> </div> <div class="bottom"> <div class="left"></div> <div class="right"></div> <div class="center"></div> </div> <?php } ?> <?php foreach ($modules as $module) { ?> <?php echo ${$module['code']}; ?> <?php } ?></div><?php echo $footer; ?> и home.php <?php class ControllerCommonHome extends Controller { public function index() { $this->language->load('common/home'); $this->document->title = $this->config->get('config_title'); $this->document->description = $this->config->get('config_meta_description'); $this->data['heading_title'] = sprintf($this->language->get('heading_title'), $this->config->get('config_name')); $this->load->model('setting/store'); if (!$this->config->get('config_store_id')) { $this->data['welcome'] = html_entity_decode($this->config->get('config_description_' . $this->config->get('config_language_id')), ENT_QUOTES, 'UTF-8'); } else { $store_info = $this->model_setting_store->getStore($this->config->get('config_store_id')); if ($store_info) { $this->data['welcome'] = html_entity_decode($store_info['description'], ENT_QUOTES, 'UTF-8'); } else { $this->data['welcome'] = ''; } } if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/home.tpl')) { $this->template = $this->config->get('config_template') . '/template/common/home.tpl'; } else { $this->template = 'default/template/common/home.tpl'; } $this->children = array( 'common/column_right', 'common/column_left', 'common/footer', 'common/header' ); $this->load->model('checkout/extension'); $module_data = $this->model_checkout_extension->getExtensionsByPosition('module', 'home'); $this->data['modules'] = $module_data; foreach ($module_data as $result) { $this->children[] = 'module/' . $result['code']; } $this->response->setOutput($this->render(TRUE), $this->config->get('config_compression')); }}?> Объясните для самых "умных" как реализовать.
  3. А можно решение данной задачи сделать более элегантной, чтоб не вносить много изменей в код.В новой версии опенкарта почти везде появилась кнопочк "плюс" - добавление в корзину, можно как нибудь изменить ее код,например взяв код из страницы самого продукта, где кнопка "добавить в корзину", работающая на Аяксе, чтоб и эта кнопка "плюс" заменилась на кнопку "добавить в корзину" и работала по тому же принципу, как и на странице определенного товара.А то и так уже много изменений внес в код своего магазина и уже начал забывать где и что изменил, поэтому хотелось изменений с минимальными усилиями.
  4. Это не баг. Я часа три в css и header.tpl копался. А оказывается это ползунок у браузера справа прятался, поэтому сайт и смещался.
  5. ocStore v0.1.4Шаблон стандартный, магазин дефолтный.Хостинг sweb, а также в Денвере на локальной машине.В любом браузере.Баг в стандартном шаблоне, т.е. при переходе с главной на любую другую страницу(например корзину), сайт смещается вправо на 10-15 пикселов. Это происходит, когда на главной странице высота второго блока больше соседних блоков, а на другой странице (например корзины) высота второго блока меньше соседних блоков.Как можно поправить данную ситуацию?
  6. Огромное спасибо. Теперь не нужны танцы с бубном, установил модуль и готово. Можно его, даже выложить в расширения.Там только в одном языковом файле надо кодировку сменить с ANSI на UTF8 при сохранении, а то кракозябры вышли.
  7. Куда именно в catalog/controller/module/htmlmodule.php <?php class ControllerModuleMyModule extends Controller { private $_name = 'mymodule'; protected function index() { $this->language->load('module/' . $this->_name); $this->data['heading_title'] = $this->language->get('heading_title'); $this->load->model('localisation/language'); $languages = $this->model_localisation_language->getLanguages(); foreach ($languages as $language) { if (isset($this->request->post['mymodule_code' . $language['language_id']])) { $this->data['mymodule_code' . $language['language_id']] = $this->request->post['mymodule_code' . $language['language_id']]; } else { $this->data['mymodule_code' . $language['language_id']] = $this->config->get('mymodule_code' . $language['language_id']); } } $this->data['code'] = html_entity_decode($this->config->get('mymodule_code' . $this->config->get('config_language_id'))); foreach ($languages as $language) { if (isset($this->request->post['mymodule_title' . $language['language_id']])) { $this->data['mymodule_title' . $language['language_id']] = $this->request->post['mymodule_title' . $language['language_id']]; } else { $this->data['mymodule_title' . $language['language_id']] = $this->config->get('mymodule_title' . $language['language_id']); } } $this->data['title'] = $this->config->get($this->_name . '_title' . $this->config->get('config_language_id')); $this->data['header'] = $this->config->get( $this->_name . '_header'); $this->data['oformlenie'] = $this->config->get( $this->_name . '_oformlenie'); $this->id = $this->_name; $tmpl = '/template/module/' . $this->_name . '.tpl'; $tmplhome = '/template/module/' . $this->_name . '_home.tpl'; if( !$this->data['title'] ) { //если мы ничего не ввели в заголовок, то $this->data['title'] = $this->data['heading_title']; // $title присвается название модуля } if( !$this->data['header'] ) { //если заголовок выключен, то $this->data['title'] = ''; // $title пустая. } if ($this->config->get('mymodule_position') == 'home') { if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . $tmplhome)) { $this->template = $this->config->get('config_template') . $tmplhome; } else { $this->template = 'default' . $tmplhome; } } else { if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . $tmpl)) { $this->template = $this->config->get('config_template') . $tmpl; } else { $this->template = 'default' . $tmpl; } } $this->render(); }}?> Вставлять это: $this->load->model('catalog/category'); $this->data['categories'] = array(); $results = $this->model_catalog_category->getCategories(0); foreach ($results as $result) { if ($result['image']) { $image = $result['image']; } else { $image = 'no_image.jpg'; } $this->data['categories'][] = array( 'name' => $result['name'], 'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $result['category_id']), 'thumb' => $this->model_tool_image->resize($image, $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height')) ); } Может какие еще переменные менять? А то пытался просто вставить по разному, выходит ошибка. Еще же есть admin/controller/module/htmlmodule.php , тут надо что-то менять? Полазил на Opencart.com и нашел http://www.opencart.com/index.php?route ... order=DESC такой модуль Category Product Home Может его легче приспособить? Но он выдает только определенные категории, а все не выдает. Вот код его модулей catalogcontrollermodulecategoryproducthome.php <?php class ControllerModulecategoryproducthome extends Controller { protected $category_id = 0; protected $path = array(); protected function index() { $this->language->load('module/categoryproducthome'); $this->data['heading_title'] = $this->language->get('heading_title'); $this->load->model('catalog/product'); $this->load->model('catalog/review'); $this->load->model('tool/seo_url'); $this->load->model('tool/image'); $this->data['button_add_to_cart'] = $this->language->get('button_add_to_cart'); $this->data['heading_title']=$this->config->get('categoryproducthome_heading'); $this->data['products'] = array(); $results = $this->model_catalog_product->getProductsByCategoryId($this->config->get('categoryproducthome_category'),'p.sort_order', 'ASC', 0, $this->config->get('categoryproducthome_limit')); foreach ($results as $result) { if ($result['image']) { $image = $result['image']; } else { $image = 'no_image.jpg'; } if ($this->config->get('config_review')) { $rating = $this->model_catalog_review->getAverageRating($result['product_id']); } else { $rating = false; } $special = FALSE; $discount = $this->model_catalog_product->getProductDiscount($result['product_id']); if ($discount) { $price = $this->currency->format($this->tax->calculate($discount, $result['tax_class_id'], $this->config->get('config_tax'))); } else { $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax'))); $special = $this->model_catalog_product->getProductSpecial($result['product_id']); if ($special) { $special = $this->currency->format($this->tax->calculate($special, $result['tax_class_id'], $this->config->get('config_tax'))); } } $options = $this->model_catalog_product->getProductOptions($result['product_id']); if ($options) { $add = $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/product&product_id=' . $result['product_id']); } else { $add = HTTPS_SERVER . 'index.php?route=checkout/cart&product_id=' . $result['product_id']; } $this->data['products'][] = array( 'product_id' => $result['product_id'], 'name' => $result['name'], 'model' => $result['model'], 'rating' => $rating, 'stars' => sprintf($this->language->get('text_stars'), $rating), 'price' => $price, 'options' => $options, 'special' => $special, 'image' => $this->model_tool_image->resize($image, 38, 38), 'thumb' => $this->model_tool_image->resize($image, $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height')), 'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/product&product_id=' . $result['product_id']), 'add' => $add ); } if (!$this->config->get('config_customer_price')) { $this->data['display_price'] = TRUE; } elseif ($this->customer->isLogged()) { $this->data['display_price'] = TRUE; } else { $this->data['display_price'] = FALSE; } //$this->data['categoryproducthome'] = $this->getProducts($this->config->get('categoryproducthome_category'),$this->config->get('categoryproducthome_limit')); $this->id = 'categoryproducthome'; if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/categoryproducthome.tpl')) { $this->template = $this->config->get('config_template') . '/template/module/categoryproducthome.tpl'; } else { $this->template = 'default/template/module/categoryproducthome.tpl'; } $this->render(); } protected function getProducts($category_id, $limit=20) { $categoryproducthome = array(); $category_id = array_shift($this->path); $results = $this->model_catalog_product->getProductsByCategoryId($category_id); $i=0; foreach ($results as $result) { if (!$current_path) { $new_path = $result['category_id']; } else { $new_path = $current_path . '_' . $result['category_id']; } if ($result['image']) { $image = $result['image']; } else { $image = 'no_image.jpg'; } if ($this->category_id == $result['category_id']) { $categoryproducthome[$i]['href'] = $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $new_path); } else { $categoryproducthome[$i]['href'] = $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $new_path); } $categoryproducthome[$i]['thumb'] = $this->model_tool_image->resize($image, $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height')); $categoryproducthome[$i]['name'] = $result['name']; $i++; } return $categoryproducthome; } }?> И второй admincontrollermodulecategoryproducthome.php <?phpclass ControllerModulecategoryproducthome extends Controller { private $error = array(); public function index() { $this->load->language('module/categoryproducthome'); $this->document->title = $this->language->get('heading_title'); $this->load->model('setting/setting'); $this->load->model('catalog/category'); if (($this->request->server['REQUEST_METHOD'] == 'POST') && ($this->validate())) { $this->model_setting_setting->editSetting('categoryproducthome', $this->request->post); $this->session->data['success'] = $this->language->get('text_success'); $this->redirect(HTTPS_SERVER . 'index.php?route=extension/module&token=' . $this->session->data['token']); } $this->data['heading_title'] = $this->language->get('heading_title'); $this->data['text_enabled'] = $this->language->get('text_enabled'); $this->data['text_disabled'] = $this->language->get('text_disabled'); $this->data['text_left'] = $this->language->get('text_left'); $this->data['text_right'] = $this->language->get('text_right'); $this->data['entry_position'] = $this->language->get('entry_position'); $this->data['entry_category'] = $this->language->get('entry_category'); $this->data['entry_status'] = $this->language->get('entry_status'); $this->data['entry_limit'] = $this->language->get('entry_limit'); $this->data['entry_headingtitle'] = $this->language->get('entry_headingtitle'); $this->data['entry_sort_order'] = $this->language->get('entry_sort_order'); $this->data['button_save'] = $this->language->get('button_save'); $this->data['button_cancel'] = $this->language->get('button_cancel'); $results = $this->model_catalog_category->getCategories(0); foreach ($results as $result) { $this->data['categories'][] = array( 'category_id' => $result['category_id'], 'name' => $result['name'] ); } if (isset($this->error['warning'])) { $this->data['error_warning'] = $this->error['warning']; } else { $this->data['error_warning'] = ''; } $this->document->breadcrumbs = array(); $this->document->breadcrumbs[] = array( 'href' => HTTPS_SERVER . 'index.php?route=common/home&token=' . $this->session->data['token'], 'text' => $this->language->get('text_home'), 'separator' => FALSE ); $this->document->breadcrumbs[] = array( 'href' => HTTPS_SERVER . 'index.php?route=extension/module&token=' . $this->session->data['token'], 'text' => $this->language->get('text_module'), 'separator' => ' :: ' ); $this->document->breadcrumbs[] = array( 'href' => HTTPS_SERVER . 'index.php?route=module/categoryproducthome&token=' . $this->session->data['token'], 'text' => $this->language->get('heading_title'), 'separator' => ' :: ' ); $this->data['action'] = HTTPS_SERVER . 'index.php?route=module/categoryproducthome&token=' . $this->session->data['token']; $this->data['cancel'] = HTTPS_SERVER . 'index.php?route=extension/module&token=' . $this->session->data['token']; if (isset($this->request->post['categoryproducthome_position'])) { $this->data['categoryproducthome_position'] = $this->request->post['categoryproducthome_position']; } else { $this->data['categoryproducthome_position'] = $this->config->get('categoryproducthome_position'); } if (isset($this->request->post['categoryproducthome_category'])) { $this->data['categoryproducthome_category'] = $this->request->post['categoryproducthome_category']; } else { $this->data['categoryproducthome_category'] = $this->config->get('categoryproducthome_category'); } if (isset($this->request->post['categoryproducthome_heading'])) { $this->data['categoryproducthome_heading'] = $this->request->post['categoryproducthome_heading']; } else { $this->data['categoryproducthome_heading'] = $this->config->get('categoryproducthome_heading'); } if (isset($this->request->post['categoryproducthome_limit'])) { $this->data['categoryproducthome_limit'] = $this->request->post['categoryproducthome_limit']; } else { $this->data['categoryproducthome_limit'] = $this->config->get('categoryproducthome_limit'); } if (isset($this->request->post['categoryproducthome_status'])) { $this->data['categoryproducthome_status'] = $this->request->post['categoryproducthome_status']; } else { $this->data['categoryproducthome_status'] = $this->config->get('categoryproducthome_status'); } if (isset($this->request->post['categoryproducthome_sort_order'])) { $this->data['categoryproducthome_sort_order'] = $this->request->post['categoryproducthome_sort_order']; } else { $this->data['categoryproducthome_sort_order'] = $this->config->get('categoryproducthome_sort_order'); } $this->template = 'module/categoryproducthome.tpl'; $this->children = array( 'common/header', 'common/footer' ); $this->response->setOutput($this->render(TRUE), $this->config->get('config_compression')); } private function validate() { if (!$this->user->hasPermission('modify', 'module/categoryproducthome')) { $this->error['warning'] = $this->language->get('error_permission'); } if (!$this->error) { return TRUE; } else { return FALSE; } }}?> Как я понимаю, тут будет легче это реализовать.
  8. Возникла мысль. Когда выводим категории товаров на главной, то не можем добавлять другие модули на главной в центре. А можно как нибудь выводить категории на главной, через этот модуль "HTML модуль+" <!-- m -->https://myopencart.com/extension/info/12.html<!-- m --> Я поставил этот модуль, изменил файл в ../catalog/controller/common/home.php $this->load->model('catalog/category'); $this->data['categories'] = array(); $results = $this->model_catalog_category->getCategories(0); foreach ($results as $result) { if ($result['image']) { $image = $result['image']; } else { $image = 'no_image.jpg'; } $this->data['categories'][] = array( 'name' => $result['name'], 'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $result['category_id']), 'thumb' => $this->model_tool_image->resize($image, $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height')) ); } И попытался вывести вот это <?php if ($categories) { ?> <table class="list"> <?php for ($i = 0; $i < sizeof($categories); $i = $i + 4) { ?> <tr> <?php for ($j = $i; $j < ($i + 4); $j++) { ?> <td width="25%"><?php if (isset($categories[$j])) { ?> <a href="<?php echo $categories[$j]['href']; ?>"><img src="<?php echo $categories[$j]['thumb']; ?>" title="<?php echo $categories[$j]['name']; ?>" alt="<?php echo $categories[$j]['name']; ?>" style="margin-bottom: 3px;" /></a> <a href="<?php echo $categories[$j]['href']; ?>"><?php echo $categories[$j]['name']; ?></a> <?php } ?></td> <?php } ?> </tr> <?php } ?> </table> <?php } ?> Через модуль "HTML модуль+" Но ничего не вышло, получилось, что он тупо вывел код. Можно ли как-то этот модуль доработать или переделать другой модуль, например "Последние товары" или "Хиты продаж". Укажите куда копать.
×
×
  • Створити...

Important Information

На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність.