this.getProductIDBySKU(ref, function (product_id) {
if (product_id === null) {
- var url = this.fluidbook.settings.product_zoom_references[ref];
+ var url = this.fluidbook.settings.product_zoom_references[ref][0];
$this.fluidbook.hideLoader();
$this.fluidbook.openInPopupIframe(url);
} else {
return;
}
var $this = this;
+ console.log('check qty for ' + sku);
this.getProductIDBySKU(sku, function (product_id) {
if ($this.minQuantities[sku] === undefined) {
- $this.minQuantities[sku] = 1;
+ console.log('no qty for ' + sku);
+ var e = sku.split('.');
+ if (e.length > 1) {
+ e.pop();
+ var nsku = e.join('.') + '.';
+ console.log('check qty for ' + nsku);
+ $this.getProductIDBySKU(nsku, function (product_id) {
+ if ($this.minQuantities[nsku] === undefined) {
+ console.log('no qty for ' + nsku);
+ var ee = nsku.split('.');
+ if (ee.length > 1) {
+ ee.pop();
+ ee.pop();
+ var nnsku = ee.join('.') + '.';
+ console.log('check qty for ' + nnsku);
+ $this.getProductIDBySKU(nnsku, function (product_id) {
+ console.log('no qty for ' + nnsku);
+ if ($this.minQuantities[nnsku] === undefined) {
+ $this.minQuantities[nnsku] = 1;
+ }
+ $this.minQuantities[nsku] = $this.minQuantities[nnsku];
+ $this.minQuantities[sku] = $this.minQuantities[nnsku];
+ callback($this.minQuantities[nnsku]);
+ });
+ return;
+ }
+ } else {
+ $this.minQuantities[sku] = $this.minQuantities[nsku];
+ }
+ callback($this.minQuantities[nsku]);
+ });
+ return;
+ }
+ } else {
+ callback($this.minQuantities[sku]);
}
- callback($this.minQuantities[sku]);
});
},
if (data[0].min !== undefined) {
min = data[0].min;
}
+ console.log('set min qty for ' + sku + ' : ' + min)
$this.minQuantities[sku] = min;
}
$this.idBySku[sku] = product_id;
var unit = $this.parseFloat(item.product_price_value);
var ht = unit * qty;
+ var options = {};
+ $.each(item.options, function (k, opt) {
+ options[opt.option_id] = opt.option_value;
+ });
+
content += '<tr>';
content += '<td class="name">' + item.product_name + '<div class="m">' + $this.fluidbook.l10n.__('unit price') + ': ' + $this.formatPrice(unit);
content += '<br />' + $this.fluidbook.l10n.__('price') + ': ' + $this.formatPrice(ht) + '</div></td>';
if (step === undefined) {
step = 1;
}
- content += '<td class="quantity"><input name="' + item.item_id + '" class="cartqty" type="number" step="' + step + '" min="0" max="10000" value="' + qty + '" /></td>';
+ content += '<td class="quantity"><input data-options=\'' + JSON.stringify(options) + '\' name="' + item.item_id + '" class="cartqty" type="number" step="' + step + '" min="0" max="10000" value="' + qty + '" /></td>';
content += '<td class="price_unit">' + $this.formatPrice(unit) + '</td>';
content += '<td class="price_excluding_taxes">' + $this.formatPrice(ht) + '</td>';
content += '<td class="delete"><a href="#" data-cart-delete="' + item.item_id + '">' + getSpriteIcon('interface-close') + '</a></td>';
var $this = this;
var input = $(el).find('input.cartqty');
var item_id = $(input).attr('name');
+ var options = $(input).data('options');
var newVal = $this.parseInt($(input).val());
if (newVal === 0) {
});
} else {
this.fluidbook.displayLoader();
+
$.ajax({
url: $this.baseURL + 'checkout/cart/updateItemOptions/id/' + item_id,
method: "post",
- data: {item: item_id, qty: newVal, form_key: this.getFormKey()},
+ data: {item: item_id, qty: newVal, super_attribute: options, form_key: this.getFormKey()},
xhrFields: {withCredentials: true},
success: function () {
$this.updateCartData(function () {