Post by rwassell » Tue Mar 25, 2014 11:29 pm

Hi,

I've just realised that disabled products are included in the Google Sitemap Feed, but I don't want Google knowing about products that are disabled as if someone tries to visit them they won't find the product anyway.

Ideally i'd like to modify the sitemap generator so that it says 'if not disabled, include it in the feed' but how and where would I put this in the code?

I hope someone can help as I've been Googling for ages and not been able to find an answer.

Regards,

Rob

New member

Posts

Joined
Thu Apr 12, 2012 3:38 am

Post by comprido » Tue Mar 24, 2015 5:13 pm

Hi, I note same issue. Using my CLIENT BOT PROMOTER FOR TWITTER http://www.fcsites.com/palabra-de-webma ... r-twitter/ note:
no_encontrado.jpg

product_not_found - no_encontrado.jpg (108.87 KiB) Viewed 1975 times

As I see, the query is called in catalog/controller/feed/google_sitemap.xml

Code: Select all

$products = $this->model_catalog_product->getProducts();
related with the query in catalog/model/catalog/product so, main query is:

Code: Select all

$sql = "SELECT p.product_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$customer_group_id . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$customer_group_id . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special"; 
so, just modify this query with "WHERE p.status = '1' AND"

Code: Select all

$sql = "SELECT p.product_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE p.status = '1' AND r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$customer_group_id . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$customer_group_id . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special"; 
Voila!
This should not affect the main site product listing.

Tested on 1.5.6.4 at March 25, 2015

Pedro Martin - websitesbuilder.com.au
Checkout my free extensions: https://www.opencart.com/index.php?rout ... r=comprido


User avatar
New member

Posts

Joined
Mon Sep 10, 2012 11:46 pm

Post by comprido » Tue Mar 24, 2015 5:37 pm


Pedro Martin - websitesbuilder.com.au
Checkout my free extensions: https://www.opencart.com/index.php?rout ... r=comprido


User avatar
New member

Posts

Joined
Mon Sep 10, 2012 11:46 pm

Post by tomeda » Sun May 29, 2016 8:02 am

Hi,

I was so excited when found this extension, however it didn't work on my website.

I'm using OC 1.5.6.1 and Journal 2 theme.

Would appropriate any help solving this issue!

Thanks!

OpenCart SEO Services
http://tomeda.bg


User avatar
New member

Posts

Joined
Thu Mar 19, 2015 4:48 am

Who is online

Users browsing this forum: No registered users and 9 guests