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

poster2010

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

    4
  • З нами

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

poster2010's Achievements

Newbie

Newbie (1/14)

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

Recent Badges

0

Репутація

  1. ВОТ ПРИМЕР Если кому нужно пишите ICQ 64ДваТри94701 опенкарт 2.0 ocStore © 2009-2011 All Rights Reserved. Version 0.2.0
  2. Версия Version 0.2.0 catalog/controller/product/latest.php <?php class ControllerProductLatest extends Controller { public function index() { $this->language->load('product/latest'); $this->document->title = $this->language->get('heading_title'); $this->document->breadcrumbs = array(); $this->document->breadcrumbs[] = array( 'href' => HTTP_SERVER . 'index.php?route=common/home', 'text' => $this->language->get('text_home'), 'separator' => FALSE ); $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['page'])) { $url .= '&page=' . $this->request->get['page']; } $this->document->breadcrumbs[] = array( 'href' => HTTP_SERVER . 'index.php?route=product/special' . $url, 'text' => $this->language->get('heading_title'), 'separator' => $this->language->get('text_separator') ); $this->data['heading_title'] = $this->language->get('heading_title'); $this->data['text_sort'] = $this->language->get('text_sort'); if (isset($this->request->get['page'])) { $page = $this->request->get['page']; } else { $page = 1; } if (isset($this->request->get['sort'])) { $sort = $this->request->get['sort']; } else { $sort = 'p.sort_order'; } if (isset($this->request->get['order'])) { $order = $this->request->get['order']; } else { $order = 'ASC'; } $this->load->model('catalog/product'); $product_total = $this->model_catalog_product->getTotalAllProduct(); if ($product_total) { $url = ''; $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['products'] = array(); $results = $this->model_catalog_product->getProductsLatest(($page - 1) * $this->config->get('config_catalog_limit'), $this->config->get('config_catalog_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; } $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']; } $year = preg_replace('|([0-9]{4})-[0-9]{2}-[0-9]{2}.*|si', '\\1', $result['date_added']); $month = preg_replace('|[0-9]{4}-([0-9]{2})-[0-9]{2}.*|si', '\\1', $result['date_added']); $days = preg_replace('|[0-9]{4}-([0-9]{2})-[0-9]{2}.*|si', '\\1', $result['date_added']); $date = mktime(0, 0, 0, $month, $days, $year); $day_of_week = array('Âîñêðåñåíüå', 'Ïîíåäåëüíèê', 'Âòîðíèê', 'Ñðåäà', '×åòâåðã', 'Ïÿòíèöà', 'Ñóááîòà'); $month_of_year = array('', 'ßíâàðÿ', 'Ôåâðàëÿ', 'Ìàðòà', 'Àïðåëÿ', 'Ìàÿ', 'Èþíÿ', 'Èþëÿ', 'Àâãóñòà', 'Ñåíòÿáðÿ', 'Îêòÿáðÿ', 'Íîÿáðÿ', 'Äåêàáðÿ'); $tmp = $this->model_catalog_product->getProductSpecial($result['product_id']); if (strlen($tmp)>5){$tmp = explode('.',$tmp);$s = '';$i = strlen($tmp[0]);$f = 0;while ($i != 0){$i--;if ($f==3) { $f=0; $s = $tmp[0][$i].','.$s; }else $s = $tmp[0][$i].$s;$f++;}$tmp = $s.'.'.$tmp[1][0].$tmp[1][1].' ð.';} $this->data['products'][] = array( 'name' => $result['name'], 'model' => $result['model'], 'rating' => $rating, 'stars' => sprintf($this->language->get('text_stars'), $rating), 'thumb' => $this->model_tool_image->resize($image, $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height')), 'price' => $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax'))), 'options' => $options, 'special' => $tmp,//$this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax'))), 'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/product' . $url . '&product_id=' . $result['product_id']), 'add' => $add, 'description' => html_entity_decode($result['description']), 'data' => $day_of_week[date("w",$date)] . ', ' . intval($days) . ' ' . $month_of_year[intval($month)] . ' ' . $year . ' ãîäà.' ); } 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; } $url = ''; if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } $this->data['sorts'] = array(); $this->data['sorts'][] = array( 'text' => $this->language->get('text_default'), 'value' => 'p.sort_order-ASC', 'href' => HTTP_SERVER . 'index.php?route=product/special' . $url . '&sort=p.sort_order&order=ASC' ); $this->data['sorts'][] = array( 'text' => $this->language->get('text_name_asc'), 'value' => 'pd.name-ASC', 'href' => HTTP_SERVER . 'index.php?route=product/special' . $url . '&sort=pd.name&order=ASC' ); $this->data['sorts'][] = array( 'text' => $this->language->get('text_name_desc'), 'value' => 'pd.name-DESC', 'href' => HTTP_SERVER . 'index.php?route=product/special' . $url . '&sort=pd.name&order=DESC' ); $this->data['sorts'][] = array( 'text' => $this->language->get('text_price_asc'), 'value' => 'special-ASC', 'href' => HTTP_SERVER . 'index.php?route=product/special' . $url . '&sort=special&order=ASC' ); $this->data['sorts'][] = array( 'text' => $this->language->get('text_price_desc'), 'value' => 'special-DESC', 'href' => HTTP_SERVER . 'index.php?route=product/special' . $url . '&sort=special&order=DESC' ); if ($this->config->get('config_review')) { $this->data['sorts'][] = array( 'text' => $this->language->get('text_rating_desc'), 'value' => 'rating-DESC', 'href' => HTTP_SERVER . 'index.php?route=product/special' . $url . '&sort=rating&order=DESC' ); $this->data['sorts'][] = array( 'text' => $this->language->get('text_rating_asc'), 'value' => 'rating-ASC', 'href' => HTTP_SERVER . 'index.php?route=product/special' . $url . '&sort=rating&order=ASC' ); } $this->data['sorts'][] = array( 'text' => $this->language->get('text_model_asc'), 'value' => 'p.model-ASC', 'href' => HTTP_SERVER . 'index.php?route=product/special' . $url . '&sort=p.model&order=ASC' ); $this->data['sorts'][] = array( 'text' => $this->language->get('text_model_desc'), 'value' => 'p.model-DESC', 'href' => HTTP_SERVER . 'index.php?route=product/special' . $url . '&sort=p.model&order=DESC' ); $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']; } $pagination = new Pagination(); $pagination->total = $product_total; $pagination->page = $page; $pagination->limit = $this->config->get('config_catalog_limit'); $pagination->text = $this->language->get('text_pagination'); $pagination->url = HTTP_SERVER . 'index.php?route=product/special' . $url . '&page={page}'; $this->data['pagination'] = $pagination->render(); $this->data['sort'] = $sort; $this->data['order'] = $order; if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/latest.tpl')) { $this->template = $this->config->get('config_template') . '/template/product/latest.tpl'; } else { $this->template = 'default/template/product/latest.tpl'; } $this->children = array( 'common/column_right', 'common/column_left', 'common/footer', 'common/header' ); $this->response->setOutput($this->render(TRUE), $this->config->get('config_compression')); } else { $this->data['text_error'] = $this->language->get('text_empty'); $this->data['button_continue'] = $this->language->get('button_continue'); $this->data['continue'] = HTTP_SERVER . 'index.php?route=common/home'; if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/error/not_found.tpl')) { $this->template = $this->config->get('config_template') . '/template/error/not_found.tpl'; } else { $this->template = 'default/template/error/not_found.tpl'; } $this->children = array( 'common/column_right', 'common/column_left', 'common/footer', 'common/header' ); $this->response->setOutput($this->render(TRUE), $this->config->get('config_compression')); } } } ?> www/catalog/model/catalog/product.php Добавить public function getTotalAllProduct() { $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "product WHERE status = 1"); if (isset($query->row['total'])) { return $query->row['total']; } else { return 0; } } public function getProductsLatest($start = 0, $limit = 20) { $customer_group_id = $this->config->get('config_customer_group_id'); $sql = "SELECT *, pd.name AS name, p.image, m.name AS manufacturer, ss.name AS stock, (SELECT AVG(r.rating) FROM " . DB_PREFIX . "review r WHERE p.product_id = r.product_id GROUP BY r.product_id) AS rating FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "stock_status ss ON (p.stock_status_id = ss.stock_status_id) WHERE p.status = '1' AND p.date_available <= NOW() AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY p.date_added"; $sql .= " DESC"; if ($start < 0) { $start = 0; } $sql .= " LIMIT " . (int)$start . "," . (int)$limit; $query = $this->db->query($sql); return $query->rows; }
  3. Нужен модуль последние товары но не на главной. Где взять или может у кого то есть решения? Буду благодарен.

×
×
  • Створити...

Important Information

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