Post by hilmikeltin » Wed Feb 13, 2019 1:07 pm

to make an export xml using google_sitemap in Opencart 3,0

copied all google_sitemap files as new_sitemap, change all google variables as new in new_sitemap files. change the htaccess suitable to new_sitemap. clear the cache after edited.

RewriteRule ^sitemap.xml$ index.php?route=extension/feed/new_sitemap [L]
RewriteRule ^new_sitemap.xml$ index.php?route=extension/feed/new_sitemap [L]
but did not work. i could not install extension. It is seen in admin but gives an error. I can not see the error also. what i am missing?

New member

Posts

Joined
Thu Nov 23, 2017 6:17 am

Post by JNeuhoff » Wed Feb 13, 2019 9:37 pm

hilmikeltin wrote:
Wed Feb 13, 2019 1:07 pm
to make an export xml using google_sitemap in Opencart 3,0

copied all google_sitemap files as new_sitemap, change all google variables as new in new_sitemap files. change the htaccess suitable to new_sitemap. clear the cache after edited.

RewriteRule ^sitemap.xml$ index.php?route=extension/feed/new_sitemap [L]
RewriteRule ^new_sitemap.xml$ index.php?route=extension/feed/new_sitemap [L]
but did not work. i could not install extension. It is seen in admin but gives an error. I can not see the error also. what i am missing?
Not enough details, and even those provided are somewhat conflicting, such as "in admin but gives an error. I can not see the error ", doesn't make sense to me.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member
Online

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by hilmikeltin » Thu Feb 14, 2019 5:07 am

<?php
class ControllerExtensionFeedxmlSitemap extends Controller {
private $error = array();

public function index() {
$this->load->language('extension/feed/new_sitemap');

$this->document->setTitle($this->language->get('heading_title'));

$this->load->model('setting/setting');

if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
$this->model_setting_setting->editSetting('feed_new_sitemap', $this->request->post);

$this->session->data['success'] = $this->language->get('text_success');

$this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=feed', true));
}

if (isset($this->error['warning'])) {
$data['error_warning'] = $this->error['warning'];
} else {
$data['error_warning'] = '';
}

$data['breadcrumbs'] = array();

$data['breadcrumbs'][] = array(
'text' => $this->language->get('text_home'),
'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
);

$data['breadcrumbs'][] = array(
'text' => $this->language->get('text_extension'),
'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=feed', true)
);

$data['breadcrumbs'][] = array(
'text' => $this->language->get('heading_title'),
'href' => $this->url->link('extension/feed/new_sitemap', 'user_token=' . $this->session->data['user_token'], true)
);

$data['action'] = $this->url->link('extension/feed/new_sitemap', 'user_token=' . $this->session->data['user_token'], true);

$data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=feed', true);

if (isset($this->request->post['feed_new_sitemap_status'])) {
$data['feed_new_sitemap_status'] = $this->request->post['feed_new_sitemap_status'];
} else {
$data['feed_new_sitemap_status'] = $this->config->get('feed_new_sitemap_status');
}

$data['data_feed'] = HTTP_CATALOG . 'index.php?route=extension/feed/new_sitemap';

$data['header'] = $this->load->controller('common/header');
$data['column_left'] = $this->load->controller('common/column_left');
$data['footer'] = $this->load->controller('common/footer');

$this->response->setOutput($this->load->view('extension/feed/new_sitemap', $data));
}

protected function validate() {
if (!$this->user->hasPermission('modify', 'extension/feed/new_sitemap')) {
$this->error['warning'] = $this->language->get('error_permission');
}

return !$this->error;
}
}

New member

Posts

Joined
Thu Nov 23, 2017 6:17 am

Post by hilmikeltin » Thu Feb 14, 2019 5:08 am

<?php
class ControllerExtensionFeedxmlSitemap extends Controller {
public function index() {
if ($this->config->get('feed_new_sitemap_status')) {
$output = '<?xml version="1.0" encoding="UTF-8"?>';
// $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';

$this->load->model('catalog/product');
$this->load->model('tool/image');

$products = $this->model_catalog_product->getProducts();

foreach ($products as $product) {
if ($product['image']) {
$output .= '<url>';
$output .= ' <loc>' . $this->url->link('product/product', 'product_id=' . $product['product_id']) . '</loc>';
$output .= ' <changefreq>weekly</changefreq>';
$output .= ' <lastmod>' . date('Y-m-d\TH:i:sP', strtotime($product['date_modified'])) . '</lastmod>';
$output .= ' <priority>1.0</priority>';
$output .= ' <image:image>';
$output .= ' <image:loc>' . $this->model_tool_image->resize($product['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_popup_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_popup_height')) . '</image:loc>';
$output .= ' <image:caption>' . $product['name'] . '</image:caption>';
$output .= ' <image:title>' . $product['name'] . '</image:title>';
$output .= ' </image:image>';
$output .= '</url>';
}
}

$this->load->model('catalog/category');

$output .= $this->getCategories(0);

$this->load->model('catalog/manufacturer');

$manufacturers = $this->model_catalog_manufacturer->getManufacturers();

foreach ($manufacturers as $manufacturer) {
$output .= '<url>';
$output .= ' <loc>' . $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $manufacturer['manufacturer_id']) . '</loc>';
$output .= ' <changefreq>weekly</changefreq>';
$output .= ' <priority>0.7</priority>';
$output .= '</url>';

$products = $this->model_catalog_product->getProducts(array('filter_manufacturer_id' => $manufacturer['manufacturer_id']));

foreach ($products as $product) {
$output .= '<url>';
$output .= ' <loc>' . $this->url->link('product/product', 'manufacturer_id=' . $manufacturer['manufacturer_id'] . '&product_id=' . $product['product_id']) . '</loc>';
$output .= ' <changefreq>weekly</changefreq>';
$output .= ' <priority>1.0</priority>';
$output .= '</url>';
}
}

$this->load->model('catalog/information');

$informations = $this->model_catalog_information->getInformations();

foreach ($informations as $information) {
$output .= '<url>';
$output .= ' <loc>' . $this->url->link('information/information', 'information_id=' . $information['information_id']) . '</loc>';
$output .= ' <changefreq>weekly</changefreq>';
$output .= ' <priority>0.5</priority>';
$output .= '</url>';
}

$output .= '</urlset>';

$this->response->addHeader('Content-Type: application/xml');
$this->response->setOutput($output);
}
}

protected function getCategories($parent_id, $current_path = '') {
$output = '';

$results = $this->model_catalog_category->getCategories($parent_id);

foreach ($results as $result) {
if (!$current_path) {
$new_path = $result['category_id'];
} else {
$new_path = $current_path . '_' . $result['category_id'];
}

$output .= '<url>';
$output .= ' <loc>' . $this->url->link('product/category', 'path=' . $new_path) . '</loc>';
$output .= ' <changefreq>weekly</changefreq>';
$output .= ' <priority>0.7</priority>';
$output .= '</url>';

$products = $this->model_catalog_product->getProducts(array('filter_category_id' => $result['category_id']));

foreach ($products as $product) {
$output .= '<url>';
$output .= ' <loc>' . $this->url->link('product/product', 'path=' . $new_path . '&product_id=' . $product['product_id']) . '</loc>';
$output .= ' <changefreq>weekly</changefreq>';
$output .= ' <priority>1.0</priority>';
$output .= '</url>';
}

$output .= $this->getCategories($result['category_id'], $new_path);
}

return $output;
}
}

New member

Posts

Joined
Thu Nov 23, 2017 6:17 am

Post by hilmikeltin » Thu Feb 14, 2019 5:11 am

first admin, second catalog new_product.php. i can not load the module gives HTTP ERROR 500. cleared cache, coded utf-8 without bom. change the functions name , againist to conflict with google_sitemap. searched the function and some variables under public_html. i could not find any. i do not understand why?

New member

Posts

Joined
Thu Nov 23, 2017 6:17 am
Who is online

Users browsing this forum: No registered users and 183 guests