Socket
Book a DemoInstallSign in
Socket

solidus_product_feed

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

solidus_product_feed

1.1.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

Solidus Product Feed

CircleCI

An extension that provides an RSS feed for products. Google Merchant Feed attributes are also implemented. An RSS link is automatically appended to the <head> tag in the layouts/spree_application file.

Installation

Add the gem to your Gemfile:

gem 'solidus_product_feed'

Install the gem:

$ bundle install

You're done! You can now see your RSS feed at /products.rss.

Usage

The feed ships with sensible defaults for your products, but customization is very easy.

Headers

You can easily change the feed's headers by putting the following in your Rails initializer:

SolidusProductFeed.configure do |config|
  config.title = 'My Awesome Store'
  config.link = 'https://www.awesomestore.com'
  config.description = 'Find out about new products on https://www.awesomestore.com first!'
  config.language = 'en-us'
end

Note that you can also pass a Proc for each of these options. The Proc will be passed the view context as its only argument, so that you can use all your helpers:

SolidusProductFeed.configure do |config|
  config.title = -> (view) { view.current_store.name }
  config.link = -> (view) { "http://#{view.current_store.url}" }
  config.description = -> (view) { "Find out about new products on http://#{view.current_store.url} first!" }
  config.language = -> (view) { view.lang_from_store(current_store.language) }
end

Item schema

If you need to alter the XML schema of a product (e.g. to add/remove a tag), you can do it by subclassing Spree::FeedProduct in your app and overriding the schema method:

module AwesomeStore
  class FeedProduct < Spree::FeedProduct
    def schema
      super.merge('g:brand' => 'Awesome Store Inc.')
    end
  end
end

Then set your custom class in an initializer:

SolidusProductFeed.configure do |config|
  config.feed_product_class = 'AwesomeStore::FeedProduct'
end

If you want to change the value of an existing tag, you can also simply override the corresponding tag method (link, price etc.). Check the source code for more details.

Testing

Be sure to add the rspec-rails gem to your Gemfile and then create a dummy test app for the specs to run against.

$ bundle exec rake test app
$ bundle exec rspec spec

FAQs

Package last updated on 22 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.