cancel
Showing results for 
Search instead for 
Did you mean: 

How using magento 2.1.9 default rss feed generator to generate XML for all products?

SOLVED

How using magento 2.1.9 default rss feed generator to generate XML for all products?

How using magento 2.1.9 default rss feed generator to generate XML for all products? By default, there are only New, Featured, etc.... but not ALL.

 

I manually change the cid on feed url (replace top parent category cid), it shows only some of the products, not all.

 

Is there a bug or misconfiguration on my site?

 

Any feedback appreciated.


-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=
I'm always a child when talking about knowledge.
1 ACCEPTED SOLUTION

Accepted Solutions

Re: How using magento 2.1.9 default rss feed generator to generate XML for all products?

Hello @dennischan,

 

 

I guide to you how do you add all products in RSS feeds. I hope you have basic experiece in Magento 2 module create.

  • Add all product configuration
    Current, Catalog configuration comes from below file
    vendor/magento/module-catalog/etc/adminhtml/system.xml
  • You can check here $type parameter in this file which pass rss feeds slug for example "new-products" so you have to pass for "all-product" something like that you have to define in system.xml
    vendor/magento/module-rss/Controller/Feed/Index.php

  • NewProduct collection comes from this file so you have to copy that file in your module and $this->rssModel->getProductsCollection this parameter get all product collection with filter so you have to just copy that file and remove date filter 
    vendor/magento/module-catalog/Block/Rss/Product/NewProducts.php
    vendor/magento/module-catalog/Model/Rss/Product/NewProducts.php

--
If my answer is useful, please Accept as Solution & give Kudos

View solution in original post

4 REPLIES 4

Re: How using magento 2.1.9 default rss feed generator to generate XML for all products?

@dennischan

 

Magento natively generates feeds for new, special products.

 

Here you can find Magento official document: https://docs.magento.com/m2/2.1/ce/user_guide/marketing/rss-feed.html with configurations.

Manish Mittal
https://www.manishmittal.com/

Re: How using magento 2.1.9 default rss feed generator to generate XML for all products?

Thanks for your reply. But probably I didn't mention my issue clearly.

I actually am using the Magento built-in configurator as you recommended.

However, my issue is that is not working.

It can generate feeds for new, featured, etc..

But I want ALL products.

I have also tried to use the feed link and change the parameter cid as top level category, by that means, I expect it'll generate a feed for all products, but not. It's working, but it shows only some of the products. I don't know why.

 


-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=
I'm always a child when talking about knowledge.

Re: How using magento 2.1.9 default rss feed generator to generate XML for all products?

I also dig into the code, inside vendor/module-rss/controller/feed/index.php

 

i found

/** @var $rss \Magento\Rss\Model\Rss */
$rss = $this->rssFactory->create();
$rss->setDataProvider($provider);

$this->getResponse()->setHeader('Content-type', 'text/xml; charset=UTF-8');
$this->getResponse()->setBody($rss->createRssXml());

 

I wonder if anyone can point me to somewhere so I can modify the methods of

$rss->setDataProvider($provider);

$rss->createRssXml()

 

I think I may be able to enhance the feed by modifying some parameters (or modify the SQL) of the methods.

 


-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=
I'm always a child when talking about knowledge.

Re: How using magento 2.1.9 default rss feed generator to generate XML for all products?

Hello @dennischan,

 

 

I guide to you how do you add all products in RSS feeds. I hope you have basic experiece in Magento 2 module create.

  • Add all product configuration
    Current, Catalog configuration comes from below file
    vendor/magento/module-catalog/etc/adminhtml/system.xml
  • You can check here $type parameter in this file which pass rss feeds slug for example "new-products" so you have to pass for "all-product" something like that you have to define in system.xml
    vendor/magento/module-rss/Controller/Feed/Index.php

  • NewProduct collection comes from this file so you have to copy that file in your module and $this->rssModel->getProductsCollection this parameter get all product collection with filter so you have to just copy that file and remove date filter 
    vendor/magento/module-catalog/Block/Rss/Product/NewProducts.php
    vendor/magento/module-catalog/Model/Rss/Product/NewProducts.php

--
If my answer is useful, please Accept as Solution & give Kudos