diff --git a/core/lib/Thelia/Form/CustomerLogin.php b/core/lib/Thelia/Form/CustomerLogin.php index dee785735..4948586d7 100755 --- a/core/lib/Thelia/Form/CustomerLogin.php +++ b/core/lib/Thelia/Form/CustomerLogin.php @@ -25,6 +25,7 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\Email; +use Symfony\Component\Validator\ConstraintViolation; use Symfony\Component\Validator\ExecutionContextInterface; use Thelia\Core\Translation\Translator; use Thelia\Model\Base\CustomerQuery; @@ -67,9 +68,6 @@ class CustomerLogin extends BaseForm "data" => 0 )) ->add("password", "password", array( - "constraints" => array( - new Constraints\NotBlank() - ), "label" => Translator::getInstance()->trans("Please enter your password"), "label_attr" => array( "for" => "password" @@ -90,6 +88,18 @@ class CustomerLogin extends BaseForm $context->addViolation("A user already exists with this email address. Please login or if you've forgotten your password, go to Reset Your Password."); } } + + //$propertyPath = + $context->getViolations()->add(new ConstraintViolation( + 'failed password', + 'toto', + array(), + $context->getRoot(), + 'children[password].data', + 'propertyPath' + )); + + } public function getName() diff --git a/templates/default/assets/js/script.js b/templates/default/assets/js/script.js index 2cc7d4b99..cc351f27c 100644 --- a/templates/default/assets/js/script.js +++ b/templates/default/assets/js/script.js @@ -159,6 +159,78 @@ }).filter(':has(:checked)').addClass('active'); }); + + if($("body").is(".page-product")){ + + var $quantityInput = $("#quantity"); + + + var $btnAddToCart = $(".btn_add_to_cart", $("#form-product-details")); + + var $productMeta = $("#stockInformations"); + + var $inStock = $(".in",$productMeta); + var $outOfStock = $(".out",$productMeta); + + var $old_price_container = $(".old-price", $("#product-details")); + + + // Switch Quantity in product page + $("select", $(".product-options")).change(function(){ + var $select_quantity = $(this).find(":selected").attr("data-quantity"); + var $old_price = $(this).find(":selected").attr("data-old-price"); + + var $best_price = $(this).find(":selected").attr("data-price"); + + $quantityInput.attr("max", $select_quantity); + + // Show Out Of Stock OR In Stock + if($select_quantity == 0){ + $btnAddToCart.attr("disabled", true); + + $productMeta.removeClass("in-stock"); + $productMeta.addClass("out-of-stock"); + + $productMeta.attr("href", "http://schema.org/OutOfStock"); + + $outOfStock.show(); + $inStock.hide(); + + }else{ + $btnAddToCart.attr("disabled", false); + + $productMeta.removeClass("out-of-stock"); + $productMeta.addClass("in-stock"); + + $productMeta.attr("href", "http://schema.org/InStock"); + + $inStock.show(); + $outOfStock.hide(); + } + + if(parseInt($quantityInput.val()) > parseInt($select_quantity)){ + $quantityInput.val($select_quantity); + } + + if($old_price_container.size() > 0 ){ + $(".price", $old_price_container).html($old_price); + $(".price", $(".special-price")).html($best_price); + }else{ + $(".price", $(".regular-price")).html($best_price); + } + + }).change(); + + $quantityInput.focusout(function() { + $quantityInput.attr("max", $select_quantity); + if(parseInt($quantityInput.val()) > parseInt($select_quantity)){ + $quantityInput.val($select_quantity); + } + }); + } + + + $('#limit-top').change(function(e){ window.location = $(this).val() }); diff --git a/templates/default/assets/less/thelia/product.less b/templates/default/assets/less/thelia/product.less index e3b26c683..c1f9f4ec2 100755 --- a/templates/default/assets/less/thelia/product.less +++ b/templates/default/assets/less/thelia/product.less @@ -15,10 +15,20 @@ .in-stock { font-style: italic; text-transform: uppercase; + + .quantity{ + font-style: italic; + } + } + // Out of Stock + .out-of-stock { + font-style: italic; font-weight: bold; + text-transform: uppercase; } - // Out of Stock - .out-of-stock {} + #stockInformations{ + + } } diff --git a/templates/default/assets/themes/default/less/theme.less b/templates/default/assets/themes/default/less/theme.less index 2bc0dceed..32a8063fc 100755 --- a/templates/default/assets/themes/default/less/theme.less +++ b/templates/default/assets/themes/default/less/theme.less @@ -260,6 +260,7 @@ header { content: @shopping-cart; font-size: 1.3em; } + } // Cart - Remove button @@ -512,6 +513,7 @@ td.product, } .product-btn { + min-height: 26px; .btn-cart { .btn-block; } diff --git a/templates/default/product.html b/templates/default/product.html index cfc70e688..7f9b9f04d 100644 --- a/templates/default/product.html +++ b/templates/default/product.html @@ -88,9 +88,32 @@ + {loop name="stock_meta" type="product_sale_elements" product="$ID"} + {loop name="combi_meta" type="attribute_combination" product_sale_elements="$ID"} + {if $LOOP_COUNT == 0} + {if $QUANTITY == 0} + + {assign var="current_stock_class" value = "out-of-stock"} + {assign var="current_stock_href" value = "http://schema.org/OutOfStock"} + + {else} + + {assign var="current_stock_class" value = "out-of-stock"} + {assign var="current_stock_href" value = "http://schema.org/OutOfStock"} + + {/if} + {/if} + {/loop} + {/loop}