Sha256: d59e8165039e6a52177270a3e1c6c397f16dc68def7340dd470c98a70f6ec6ad

Contents?: true

Size: 619 Bytes

Versions: 5

Compression:

Stored size: 619 Bytes

Contents

class Plugins::Ecommerce::ShippingMethod < CamaleonCms::TermTaxonomy
  default_scope { where(taxonomy: :ecommerce_shipping_method) }
  belongs_to :site, :class_name => "CamaleonCms::Site", foreign_key: :parent_id
  scope :actives, -> {where(status: '1')}

  def skip_slug_validation?
    true
  end

  def get_price_from_weight(weight = 0)
    price_total = 0
    prices = get_meta("prices")
    if prices.present?
      prices.each do |key, value|
        price_total = value[:price] if value[:min_weight].to_f <= weight.to_f && value[:max_weight].to_f >= weight.to_f
      end
    end
    price_total.to_f
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
camaleon_ecommerce-2.0.4 app/models/plugins/ecommerce/shipping_method.rb
camaleon_ecommerce-2.0.3 app/models/plugins/ecommerce/shipping_method.rb
camaleon_ecommerce-2.0.2 app/models/plugins/ecommerce/shipping_method.rb
camaleon_ecommerce-2.0.1 app/models/plugins/ecommerce/shipping_method.rb
camaleon_ecommerce-2.0.0 app/models/plugins/ecommerce/shipping_method.rb