Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

reallik

Новичок
  
  • Posts

    9
  • Joined

  • Last visited

1 Follower

Recent Profile Visitors

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

reallik's Achievements

Rookie

Rookie (2/14)

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

Recent Badges

0

Reputation

  1. Все полулилось.Только картинки не перелеиют к корзине, как икое реализовать.Как я понимаю нужно добавить скрипт, но какой и куда?
  2. Пыиюсь добавить кнопки "купить" в обещём списке, но ничего не выходит. У меня почему-то файлы сильно отличаются от файлов home.php и home.tpl от этих https://opencart-forum.ru/go.php?http://opencart.studio-vk.com/catalog/controller/common/home.php.txt https://opencart-forum.ru/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 модуль+" Но ничего не вышло, полулилось, что он тупо вывел код. Можно ли как-то этот модуль дорилиить или перегделать другой модуль, например "Последние товары" или "Хиты продаж". Укажите куда копать.
×
×
  • 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.