0 || ! PSE_CHECK_AVAILABILITY) {
- $pse.availability
- .removeClass("out-of-stock")
- .addClass("in-stock")
- .attr("href", "http://schema.org/InStock");
-
- $pse.quantity.val(pse.quantity);
-
- $pse.submit.attr("disabled", false);
- } else {
- $pse.new.removeClass("in-stock")
- .addClass("out-of-stock")
- .attr("href", "http://schema.org/OutOfStock");
-
- $pse.submit.attr("disabled", true);
- }
-
- // price
- $pse.priceOld.html(pse.promo);
- $pse.price.html(pse.price);
- }
-
- /*
- if (qty == 0) {
- // Disable button
- $btnAddToCart.attr("disabled", true);
-
- // Update stock information
- $stockInformation
- .removeClass("in-stock")
- .addClass("out-of-stock")
- .attr("href", "http://schema.org/OutOfStock");
-
- } else {
- // Active button
- $btnAddToCart.attr("disabled", false);
-
- // Update Field Quantity if the current value is over Max
- if (parseInt($quantityInput.val()) > parseInt(qty)) {
- $quantityInput.val(qty);
- }
-
- // Update stock information
- $stockInformation
- .removeClass("out-of-stock")
- .addClass("in-stock")
- .attr("href", "http://schema.org/InStock");
- }
-
- // HTML5 number attribute
- $quantityInput.attr("max", qty);
-
- // Update Prices
- $(".old-price > .price", $productDetails).html($current.data('old-price'));
- $(".special-price > .price, .regular-price > .price", $productDetails).html($current.data('price'));
- */
-
- var pseExist = function pseExist(selection) {
- var pseId,
- pse = null,
- combinations,
- i,
- j,
- existCombination;
-
- for (pse in PSE){
- pseId = pse;
- combinations = PSE[pse].combinations;
- for (i = 0; i < selection.length; i++){
- existCombination = false;
- for (j = 0; j < combinations.length; j++){
- if (selection[i] == combinations[j]){
- existCombination = true;
- break;
- }
- }
- if (existCombination === false) {
- break;
- }
- }
- if (existCombination) {
- return pseId;
- }
- }
-
- return false;
- }
-
- var getFormSelection = function getFormSelection() {
- var selection = [],
- combinationId;
-
- for (combinationId in $pse.options){
- selection.push($pse.options[combinationId].val());
- }
-
- return selection;
- }
-
- buildProductForm();
- updateProductForm();
-
+ window.pseManager.load();
}
$(document).on('submit.form-product', '.form-product', function () {
@@ -384,55 +387,6 @@
return;
});
- /*
-
-
- $(document).on('change.quantity', 'select:has([data-quantity])', function () {
- var $productDetails = $(this).closest("#product-details"),
- $stockInformation = $("#stock-information", $productDetails),
- $quantityInput = $("#quantity", $productDetails),
- $btnAddToCart = $(".btn_add_to_cart", $productDetails);
-
- var $current = $(":selected", this);
- var qty = $current.data("quantity");
-
- // Show Out Of Stock OR In Stock
- if (qty == 0) {
- // Disable button
- $btnAddToCart.attr("disabled", true);
-
- // Update stock information
- $stockInformation
- .removeClass("in-stock")
- .addClass("out-of-stock")
- .attr("href", "http://schema.org/OutOfStock");
-
- } else {
- // Active button
- $btnAddToCart.attr("disabled", false);
-
- // Update Field Quantity if the current value is over Max
- if (parseInt($quantityInput.val()) > parseInt(qty)) {
- $quantityInput.val(qty);
- }
-
- // Update stock information
- $stockInformation
- .removeClass("out-of-stock")
- .addClass("in-stock")
- .attr("href", "http://schema.org/InStock");
- }
-
- // HTML5 number attribute
- $quantityInput.attr("max", qty);
-
- // Update Prices
- $(".old-price > .price", $productDetails).html($current.data('old-price'));
- $(".special-price > .price, .regular-price > .price", $productDetails).html($current.data('price'));
-
- });
- */
-
// Toolbar
var $category_products = $ ('#category-products');
diff --git a/templates/frontOffice/default/assets/less/thelia/product.less b/templates/frontOffice/default/assets/less/thelia/product.less
index 86d8f7c6e..cbc91f228 100644
--- a/templates/frontOffice/default/assets/less/thelia/product.less
+++ b/templates/frontOffice/default/assets/less/thelia/product.less
@@ -16,7 +16,7 @@
// In Stock
.in-stock {
- color: #44B661;
+ color: @brand-success;
font-style: italic; font-weight: bold;
text-transform: uppercase;
@@ -29,7 +29,7 @@
}
// Out of Stock
.out-of-stock {
- color: #FF0000;
+ color: @brand-warning;
font-style: italic; font-weight: bold;
text-transform: uppercase;
diff --git a/templates/frontOffice/default/product.html b/templates/frontOffice/default/product.html
index c059d0cd8..41d962ab4 100644
--- a/templates/frontOffice/default/product.html
+++ b/templates/frontOffice/default/product.html
@@ -132,8 +132,8 @@
- {intl l="Special Price:"} {format_number number="{$TAXED_PROMO_PRICE}"} {currency attr="symbol"}
- {intl l="Regular Price:"} {format_number number="{$TAXED_PRICE}"} {currency attr="symbol"}
+ {intl l="Special Price:"} {format_number number="{$TAXED_PROMO_PRICE}"} {currency attr="symbol"}
+ {intl l="Regular Price:"} {format_number number="{$TAXED_PRICE}"} {currency attr="symbol"}
@@ -186,7 +186,7 @@
{/form_field}
-
+
@@ -267,6 +267,42 @@
{/if}
+{* javascript confiuguration to display pse *}
+{$pse=[]}
+{$combination_label=[]}
+{$combination_values=[]}
+{loop name="pse" type="product_sale_elements" product="{product attr="id"}"}
+{$pse[$ID]=["id" => $ID, "isDefault" => $IS_DEFAULT, "isPromo" => $IS_PROMO, "isNew" => $IS_NEW, "ref" => "{$REF}", "ean" => "{$EAN}", "quantity" => {$QUANTITY}, "price" => "{format_number number="{$TAXED_PRICE}"} {currency attr="symbol"}", "promo" => "{format_number number="{$TAXED_PROMO_PRICE}"} {currency attr="symbol"}" ]}
+{$pse_combination=[]}
+{loop name="combi" type="attribute_combination" product_sale_elements="$ID"}
+{if ! $combination_label[$ATTRIBUTE_ID]}
+{$combination_label[$ATTRIBUTE_ID]=["name" => "{$ATTRIBUTE_TITLE}", "values" => []]}
+{/if}
+{if ! $combination_values[$ATTRIBUTE_AVAILABILITY_ID]}
+{$combination_label[$ATTRIBUTE_ID]["values"][]=$ATTRIBUTE_AVAILABILITY_ID}
+{$combination_values[$ATTRIBUTE_AVAILABILITY_ID]=["{$ATTRIBUTE_AVAILABILITY_TITLE}", $ATTRIBUTE_ID]}
+{/if}
+{$pse_combination[]=$ATTRIBUTE_AVAILABILITY_ID}
+{/loop}
+{$pse[$ID]["combinations"]=$pse_combination}
+{/loop}
+
+{if $pse_count > 1}
+{/if}
+