Sha256: 222e77cc9dd3fcfe92a7b1aa7e62f932fcdd65fab490f8c615aeb9cba27964ee

Contents?: true

Size: 610 Bytes

Versions: 10

Compression:

Stored size: 610 Bytes

Contents

module Magento
  class OrderItem < Base
    class << self            
      def find_by_order_number_and_id(order_number, id)
        Magento::Order.find_by_increment_id(order_number).order_items.select{ |i| i.id == id }.first
      end
      
      def find_by_order_id_and_id(order_id, id)
        Magento::Order.find_by_id(order_id).order_items.select{ |i| i.id == id }.first
      end
    end
    
    def id
      self.item_id
    end
    
    def order
      Magento::Order.find_by_id(self.order_id)
    end
    
    def product
      Magento::Product.find_by_id_or_sku(self.product_id)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
magentor-0.3.1 lib/magento/order_item.rb
magentor-0.3.0 lib/magento/order_item.rb
magentor-0.2.18 lib/magento/order_item.rb
magentor-0.2.17 lib/magento/order_item.rb
magentor-0.2.16 lib/magento/order_item.rb
magentor-0.2.15 lib/magento/order_item.rb
magentor-0.2.14 lib/magento/order_item.rb
magentor-0.2.13 lib/magento/order_item.rb
magentor-0.2.12 lib/magento/order_item.rb
magentor-0.2.11 lib/magento/order_item.rb