view · edit · sidebar · attach · print · history

Modifications to the ywesee ebps Service (Ebook)

21.10.2011 Update decorator to insert package size

/var/ebps/bin/decorators/ch_oddb_de.rb

    module ChOddb
      def self.decorate model
        if codes = model.metadata['article_codes']
          #ean13s = codes.collect do |hash| hash[:article_ean13] end.compact
          size_ean13s = codes.collect do |hash| [hash[:article_size], hash[:article_ean13]] end.compact
          #unless ean13s.empty?
          unless size_ean13s.empty?
            chapter = Text::Chapter.new
            chapter.heading << 'Preisvergleich'
            #ean13s.each do |ean13|
            size_ean13s.each do |size, ean13|
              href = "http://ch.oddb.org/de/gcc/compare/ean13/#{ean13}"
              #chapter.add_paragraph Text::LinkedParagraph.new(href, ean13)
              chapter.add_paragraph Text::LinkedParagraph.new(href, model.title + " " + size.to_s + " " + ean13.to_s)
            end
            model.add_chapter chapter
          end
        end
      end
    end

Note

view · edit · sidebar · attach · print · history
Page last modified on October 21, 2011, at 09:20 AM