Hi guys/girls,
I am in need of help to create a review feed xml for my opencart store 3.0.3.5. The idea is to create a review feed xml file and pull it via feed url in google merchant centre.
https://developers.google.com/product-r ... eds/sample
I am in need of help to create a review feed xml for my opencart store 3.0.3.5. The idea is to create a review feed xml file and pull it via feed url in google merchant centre.
https://developers.google.com/product-r ... eds/sample
You can post a request in Commercial Support section.
Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com
Ah, so some one else also have the same thing to be achive.
I have started work on this xml feed will share my code soon as i got some positive out come.
I have started work on this xml feed will share my code soon as i got some positive out come.
Urgent Questions shoot here: khnaz35@gmail.com
Enjoy nature
Just an update i have been working on the extension was able to do the admin part but got a stuck with catalog controller need a little help guys.
I have tried using this way
I have tried using this way
Code: Select all
<?php
class ControllerExtensionFeedGoogleReview extends Controller {
public function index() {
if ($this->config->get('feed_google_review_status')) {
$output = '<?xml version="1.0" encoding="UTF-8"?>';
$output .= '<urlset xmlns="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.google.com/shopping/reviews/schema/product/2.3/product_reviews.xsd">';
$this->load->model('catalog/review');
$reviews = $this->model_catalog_product->getReviewsByProductId($product_id, $start = 0, $limit = 20);
foreach ($reviews as $review) {
$output .= '<url>';
$output .= ' <loc>' . . '</loc>';
$output .= ' <changefreq>weekly</changefreq>';
$output .= ' <priority>0.5</priority>';
$output .= '</url>';
}
$output .= '</urlset>';
}
return $output;
}
}
Urgent Questions shoot here: khnaz35@gmail.com
Enjoy nature
Hello i am upload the quote Opencart 3.0.3.3 catalog/controller/extension/feed/google_review.php with correctionkhnaz35 wrote: ↑Mon May 10, 2021 9:45 pmJust an update i have been working on the extension was able to do the admin part but got a stuck with catalog controller need a little help guys.
I have tried using this wayCode: Select all
<?php class ControllerExtensionFeedGoogleReview extends Controller { public function index() { if ($this->config->get('feed_google_review_status')) { $output = '<?xml version="1.0" encoding="UTF-8"?>'; $output .= '<urlset xmlns="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.google.com/shopping/reviews/schema/product/2.3/product_reviews.xsd">'; $this->load->model('catalog/review'); $reviews = $this->model_catalog_product->getReviewsByProductId($product_id, $start = 0, $limit = 20); foreach ($reviews as $review) { $output .= '<url>'; $output .= ' <loc>' . . '</loc>'; $output .= ' <changefreq>weekly</changefreq>'; $output .= ' <priority>0.5</priority>'; $output .= '</url>'; } $output .= '</urlset>'; } return $output; } }
Code: Select all
<?php
class ControllerExtensionFeedGoogleReview extends Controller {
public function index() {
if ($this->config->get('feed_google_review_status')) {
$output = '<?xml version="1.0" encoding="UTF-8"?>';
$output .= '<urlset xmlns="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.google.com/shopping/reviews/schema/product/2.3/product_reviews.xsd">';
$this->load->model('extension/feed/google_review');
$this->load->model('catalog/review');
$this->load->model('catalog/product');
$this->load->model('catalog/category');
$reviews = $this->model_catalog_product->getReviewsByProductId($product_id, $start = 0, $limit = 20);
foreach ($reviews as $review) {
$output .= '<url>';
$output .= ' <loc>' . $this->url->link('product/review', 'product_id=' . $product['product_id']) . '</loc>';
$output .= ' <changefreq>weekly</changefreq>';
$output .= ' <priority>0.5</priority>';
$output .= '</url>';
}
$output .= '</urlset>';
}
return $output;
}
}
Code: Select all
<?php
class ControllerExtensionFeedGoogleSitemap extends Controller {
private $error = array();
public function index() {
$this->load->language('extension/feed/google_review');
$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_google_review', $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/google_review', 'user_token=' . $this->session->data['user_token'], true)
);
$data['action'] = $this->url->link('extension/feed/google_review', '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_google_review_status'])) {
$data['feed_google_review_status'] = $this->request->post['feed_google_review_status'];
} else {
$data['feed_google_review_status'] = $this->config->get('feed_google_review_status');
}
$data['data_feed'] = HTTP_CATALOG . 'index.php?route=extension/feed/google_review';
$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/google_review', $data));
}
protected function validate() {
if (!$this->user->hasPermission('modify', 'extension/feed/google_review')) {
$this->error['warning'] = $this->language->get('error_permission');
}
return !$this->error;
}
}
After that result front page url https://www.patoys.in/index.php?route=e ... gle_review is showing dead (white screen),
in admin dashboard showing 4 feeds with "heading_title" instead of "google_review" action is installed and status is showing Disabled which we are unable to edit, when click on edit we got HTTP ERROR 500. Please help me.
Regards
Himanshu
You are not outputting anything, just look at the normal google sitemap extension to learn how to send output to the response class and send the right content type header.
Besides, I do not see where the values for $product_id and $product['product_id'] in your code come from?
Last, the status of extensions is generally set in the setting table, check other extensions on how this is done.
Besides, I do not see where the values for $product_id and $product['product_id'] in your code come from?
Last, the status of extensions is generally set in the setting table, check other extensions on how this is done.
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
Who is online
Users browsing this forum: No registered users and 348 guests