Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

Commit

Permalink
Change dimensions aswell as price
Browse files Browse the repository at this point in the history
  • Loading branch information
dedman committed Sep 13, 2012
1 parent b9f2739 commit 827d355
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
5 changes: 5 additions & 0 deletions app/assets/javascripts/store/variant_options.js
Expand Up @@ -181,6 +181,11 @@ function VariantOptions(params) {
if (variant) {
$('#variant_id, form[data-form-type="variant"] input[name$="[variant_id]"]').val(variant.id);
$('#product-price .price').removeClass('unselected').text(variant.price);

$('.width').text(variant.width);
$('.height').text(variant.height);
$('.depth').text(variant.depth);

if (variant.count > 0 || allow_backorders)
$('#cart-form button[type=submit]').attr('disabled', false).fadeTo(100, 1);
$('form[data-form-type="variant"] button[type=submit]').attr('disabled', false).fadeTo(100, 1);
Expand Down
19 changes: 11 additions & 8 deletions app/models/spree/variant_decorator.rb
@@ -1,17 +1,20 @@
Spree::Variant.class_eval do

include ActionView::Helpers::NumberHelper

attr_accessible :option_values

def to_hash
actual_price = self.price
#actual_price += Calculator::Vat.calculate_tax_on(self) if Spree::Config[:show_price_inc_vat]
{
:id => self.id,
:count => self.count_on_hand,
:price => number_to_currency(actual_price)
{
:id => self.id,
:count => self.count_on_hand,
:price => number_to_currency(actual_price),
:width => self.width,
:height => self.height,
:depth => self.depth
}
end

end

0 comments on commit 827d355

Please sign in to comment.