Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixing "1 234.00 " cost_price validation failure coming from admin pr…

…oduct controller

Closes #1592
  • Loading branch information...
commit 730ef939c8e3d0ce6a1f84dd1252d2b48c2a27d4 1 parent ba8eec9
@pirj pirj authored radar committed
Showing with 6 additions and 0 deletions.
  1. +6 −0 core/app/models/spree/variant.rb
View
6 core/app/models/spree/variant.rb
@@ -63,6 +63,12 @@ def price=(price)
end
end
+ # and cost_price
+ def cost_price=(price)
+ if price.present?
+ self[:cost_price] = price.to_s.gsub(/[^0-9\.-]/, '').to_f
+ end
+ end
# returns number of units currently on backorder for this variant.
def on_backorder
Please sign in to comment.
Something went wrong with that request. Please try again.