Sha256: 2dc64ea76e67c036b01de238ffdfe26c6061365c0f8b228123756bde249047d9

Contents?: true

Size: 1.29 KB

Versions: 2

Compression:

Stored size: 1.29 KB

Contents

xml.instruct! :xml, :version=>"1.0" 
xml.rss(:version=>"2.0", "xmlns:g" => "http://base.google.com/ns/1.0") do
  xml.channel do
    xml.title("#{@taxon.name} Product Feed")
    xml.link(spree.nested_taxons_url(:id => @taxon.permalink))
    xml.description("The latest products offered by #{Spree::Config[:site_name]} in the #{@taxon.name} category.")
    xml.language('en-us')
    
    Spree::Product.active.in_taxon(@taxon).includes([:master]).order(:created_at).reverse_order.limit(10).each do |product|
      xml.item do
        xml.title(product.name)
        xml.description(product.description)
        xml.author('webmaster@alarmgrid.com (AlarmGrid.com)')               
        xml.pubDate(product.created_at.to_s(:rfc822))
        xml.link(product_url(product))
        xml.guid(product_url(product))

        if product.images.count > 0
          xml.tag!('g:image_link', "http:" + product.images.first.attachment.url(:product))
        end

        xml.tag!('g:price', product.price)
        xml.tag!('g:condition', 'new')
        xml.tag!('g:id', product.id)
        xml.tag!('g:brand', 'Honeywell') # Hard code for now... add in manufacturer
        # xml.tag!('g:availability', product.count_on_hand > 0 ? 'in stock' : 'out of stock')
        # xml.tag!('g:availability', 'in stock')
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree_grid_feed-1.1.8 app/views/spree/taxons/show.xml.builder
spree_grid_feed-1.1.7 app/views/spree/taxons/show.xml.builder