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

Добавление товаров в карту сайта (html)


samoylia

Recommended Posts

Здравствуйте. Нашел вот эту тему, в которой есть решение для Opencart 1.4.x. как добавить товары в карту сайта (та что html). Подскажите, пожалуйста, как можно реализовать такое на ocStore 1.5.4.1.? Заранее благодарен.

Надіслати
Поділитися на інших сайтах


  • 2 weeks later...

Тоже интересует этот вопрос. Хотелось бы в нее залить и ссылки на статьи/новости. Как сие реализовать? Может модуль есть? Перешерстил Гугл, этот сайт с дополнениями, ничего не наше. Уже наверняка делали это, то на 1.5.4.1 не нахожу. В коде мало что понимаю (файл sitemap.php)? но подозреваю, что идет обращение к базе только по этом куску.

 $this->data['categories'] = array();

$categories_1 = $this->model_catalog_category->getCategories(0);

foreach ($categories_1 as $category_1) {
$level_2_data = array();

$categories_2 = $this->model_catalog_category->getCategories($category_1['category_id']);

foreach ($categories_2 as $category_2) {
$level_3_data = array();

$categories_3 = $this->model_catalog_category->getCategories($category_2['category_id']);

foreach ($categories_3 as $category_3) {
$level_3_data[] = array(
'name' => $category_3['name'],
'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'] . '_' . $category_2['category_id'] . '_' . $category_3['category_id'])
);
}

$level_2_data[] = array(
'name' => $category_2['name'],
'children' => $level_3_data,
'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'] . '_' . $category_2['category_id'])
);
}

$this->data['categories'][] = array(
'name' => $category_1['name'],
'children' => $level_2_data,
'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'])
);
}

 Т.е. по продуктам видимо что-то похожее нужно. А потом еще sitemap.tpl нужно подправить. Может кто подскажет как реализовать? 

Надіслати
Поділитися на інших сайтах


  • 1 month later...

сделал так кому интересно на ошибки не проверял мне главное нужно было что бы товары вывелись

/catalog/view/theme/default/template/information/sitemap.tpl

 

в то место где хотите выводить товары вставить
 

<?php if ($products) { ?>
	<ul>
    <?php foreach ($products as $product) { ?>
    <li>
     <a href="<?php echo $product['href']; ?>"  title="<?php echo $product['name_title']; ?>"><?php echo $product['name']; ?></a>
	</li>
    <?php } ?>
	</ul>
   <?php } ?>

/catalog/controller/information/sitemap.php

 

добавить после 

$this->data['categories'][] = array(
'name' => $category_1['name'],
'children' => $level_2_data,
'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'])
);
}

это

	$this->data['products'] = array();
			
			$product_total = $this->model_catalog_product->getTotalProducts($data); 
			
			$results = $this->model_catalog_product->getProducts($data);
			
			foreach ($results as $result) {
				$this->data['products'][] = array(
					'product_id'  => $result['product_id'],
					'name'        => $result['name'],
					'href'        => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'])
				);
			}
Надіслати
Поділитися на інших сайтах


Ошибка

Notice: Undefined variable: data in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 77Warning: http_build_query() [function.http-build-query]: Parameter 1 expected to be Array or Object. Incorrect value given in /home/r/rusukrnet/new/public_html/catalog/model/catalog/product.php on line 458Notice: Undefined variable: data in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 79Warning: http_build_query() [function.http-build-query]: Parameter 1 expected to be Array or Object. Incorrect value given in /home/r/rusukrnet/new/public_html/catalog/model/catalog/product.php on line 73Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85Notice: Undefined index: path in /home/r/rusukrnet/new/public_html/catalog/controller/information/sitemap.php on line 85

 

Может в модель еще чего-то прописать нужно?

Надіслати
Поділитися на інших сайтах


  • 8 months later...
  • 1 year later...

Всем привет. Работаю над одним проектом, поставлена такая же задача.

Поправил этот код, все работает на Opencart 1.5.5.1.1

 

/catalog/view/theme/default/template/information/sitemap.tpl

в то место где хотите выводить товары вставить

<?php if ($products) { ?>
	<ul>
    <?php foreach ($products as $product) { ?>
    <li>
     <a href="<?php echo $product['href']; ?>"  title="<?php echo $product['name_title']; ?>"><?php echo $product['name']; ?></a>
	</li>
    <?php } ?>
	</ul>
   <?php } ?>

/catalog/controller/information/sitemap.php

добавить после 

$this->data['categories'][] = array(
'name' => $category_1['name'],
'children' => $level_2_data,
'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'])
);
}

ентот

$this->data['products'] = array();
			$product_total = $this->model_catalog_product->getTotalProducts(); 
			$results = $this->model_catalog_product->getProducts();
			foreach ($results as $result) {
				$this->data['products'][] = array(
					'product_id'  => $result['product_id'],
					'name'        => $result['name'],
					'href'        => $this->url->link('product/product', '&product_id=' . $result['product_id'])
				);
			}

Работает без ошибок.

Красивее будет если под каждой категорией выводились бы ее товары.

Буду искать такое решение 

Надіслати
Поділитися на інших сайтах


  • 8 months later...

Все зависит от количества товаров

а сделать можно что угодно

 

1000 товаров - уже не имеет смысла в html  карте

 

А если у вас товаров до сотни двух то можно

Надіслати
Поділитися на інших сайтах

  • 1 month later...

1000 товаров - уже не имеет смысла в html карте

 

В теории можно усложнить карту, сделать авторазбивку на страницы, и вывести ссылки для каждой из них на главной. Html карта нужная карта, благодаря ей все страницы сайта доступны в пределах трех кликов! Но сейчас хотябы просто добится того чтоб выводились товары на одной странице(

Змінено користувачем 20strannik08
Надіслати
Поділитися на інших сайтах


  • 3 weeks later...
В 15.02.2016 в 01:00, morro сказал:

Всем привет. Работаю над одним проектом, поставлена такая же задача.

Поправил этот код, все работает на Opencart 1.5.5.1.1

 

/catalog/view/theme/default/template/information/sitemap.tpl

в то место где хотите выводить товары вставить


<?php if ($products) { ?>
	<ul>
    <?php foreach ($products as $product) { ?>
    <li>
     <a href="<?php echo $product['href']; ?>"  title="<?php echo $product['name_title']; ?>"><?php echo $product['name']; ?></a>
	</li>
    <?php } ?>
	</ul>
   <?php } ?>

/catalog/controller/information/sitemap.php

добавить после 


$this->data['categories'][] = array(
'name' => $category_1['name'],
'children' => $level_2_data,
'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'])
);
}

ентот


$this->data['products'] = array();
			$product_total = $this->model_catalog_product->getTotalProducts(); 
			$results = $this->model_catalog_product->getProducts();
			foreach ($results as $result) {
				$this->data['products'][] = array(
					'product_id'  => $result['product_id'],
					'name'        => $result['name'],
					'href'        => $this->url->link('product/product', '&product_id=' . $result['product_id'])
				);
			}

Работает без ошибок.

Красивее будет если под каждой категорией выводились бы ее товары.

Буду искать такое решение 

Здравствуй morro, нашел ли ты решение, чтоб под каждой категорией выводились бы ее товары

Надіслати
Поділитися на інших сайтах

  • 5 months later...

Створіть аккаунт або увійдіть для коментування

Ви повинні бути користувачем, щоб залишити коментар

Створити обліковий запис

Зареєструйтеся для отримання облікового запису. Це просто!

Зареєструвати аккаунт

Вхід

Уже зареєстровані? Увійдіть тут.

Вхід зараз
  • Зараз на сторінці   0 користувачів

    • Ні користувачів, які переглядиють цю сторінку

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

Important Information

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