diff --git a/app/models/product_order_product.rb b/app/models/product_order_product.rb index 2aac2e7..0128305 100755 --- a/app/models/product_order_product.rb +++ b/app/models/product_order_product.rb @@ -1,5 +1,6 @@ class ProductOrderProduct < ActiveRecord::Base belongs_to :order + belongs_to :product_order belongs_to :product diff --git a/app/views/public/products/show.html.haml b/app/views/public/products/show.html.haml index 1785a3a..c275435 100755 --- a/app/views/public/products/show.html.haml +++ b/app/views/public/products/show.html.haml @@ -17,7 +17,11 @@ .product_description %h1= @product_lang.title =simple_format @product_lang.description - + -nbr_products = ProductOrderProduct.joins(:product_order).where(:product_orders => {:completed_finish => true},:product_id => @product.id).sum("product_order_products.qty") + + + + .price -if !@product.price_reduced_ht? = number_to_currency(@product.price_ht, locale: :fr) @@ -37,7 +41,10 @@ = number_to_currency(@product.price_ttc, locale: :fr) - + + + + -@porduct_order_product = ProductOrderProduct.new(product_id: @product.id ) -@porduct_order_product.product_option_id = @product.product_options_in_stock.first.id if @product.product_options_in_stock.first -@porduct_order_product.product_size_id = @product.product_sizes_in_stock(@porduct_order_product.product_option_id).first.id if @product.product_sizes_in_stock(@porduct_order_product.product_option_id).first @@ -71,11 +78,38 @@ = f.submit "Ajouter à la commande", :class => "add_to_cart btn" - - -if 1==2 - -if [1,2,14,15,33,13,30].include?(@product.product_category_id) - .size_guide - =link_to "Guide des tailles", "/fr/guide-des-tailles.html", :target => "_blank" + %br + %br + %div + .clock{:style => "margin:2em;display:inline-block;width:auto;margin:0;margin-left:-5px;"} + + :javascript + var countup; + + + var clock = $('.clock').FlipClock(0, { + clockFace: 'Counter', + minimumDigits: 1, + callbacks:{ + init:function (){ + + } + } + }); + if(clock_max > 0){ + countup = setInterval(function() { + clock.increment(); + if(clock.getTime().time >= clock_max) { + clock.stop(); + clearInterval(countup); + } + }, 0);} + %div{:style => "padding:10px 15px;display:inline-block;text-transform:uppercase;font-weight:bold;font-size:30px;line-height:35px;position:relative;top:-10px;padding-left:3px;"} + déjà + %br + commandés :coffeescript