-->
Bandeja Furacão Pet Para Gatos Joy Black
- Código Interno: 230251
- Código de Barras: 7908163639217
- Marca: Furacao Pet
- Avaliação: -
//opt_price = opt_price.replace("R$", ""); -->
//alert(opt_price); -->
quantity = parseFloat(document.getElementById("input-cantidad-" + opt_id).value);
qty = parseFloat(qty);
quantity = parseFloat(quantity) + parseFloat(qty);
if (quantity > max) {
quantity = max;
}
document.getElementById("input-cantidad-" + opt_id).value = quantity;
}
function minus_options(opt_id, qty) {
//alert(opt_id); -->
//opt_price = opt_price.replace("R$", ""); -->
//alert(opt_price); -->
quantity = parseFloat(document.getElementById("input-cantidad-" + opt_id).value);
qty = parseFloat(qty);
quantity = parseFloat(quantity) - parseFloat(qty);
if (quantity < 0) {
quantity = 0;
}
document.getElementById("input-cantidad-" + opt_id).value = quantity;
}
function myaddcart(product_id, quantity) {
var allRequiredChecked = verifyRequiredInputs();
if (allRequiredChecked) {
cart.add(product_id, quantity, 'produto');
} else {
alert('Escolha todas as opções necessárias');
}
}
function verifyRequiredInputs() {
return true;
var requiredGroups = $('.form-group.required');
for (var i = 0; i < requiredGroups.length; i++) {
var inputGroup = $(requiredGroups[i]).find('input[type="radio"], input[type="checkbox"], input[type="number"]');
var checked = false;
for (var j = 0; j < inputGroup.length; j++) {
if ($(inputGroup[j]).is(':checked')) {
checked = true;
break;
}
}
if (!checked) {
return false;
}
}
return true;
}
document.getElementById("input-cantidad-230251").addEventListener("keydown", function (event) {
if (event.key === "Enter") {
weight = parseFloat(weight);
plus_product(product_id, weight)
// você pode adicionar qualquer outra ação aqui
}
});
function plus_product2(product_id, quantity, weight) {
quantity = parseFloat(document.getElementById("input-cantidad-" + product_id).value);
quantity = (parseFloat(quantity) + parseFloat(weight)) - parseFloat(weight);
var input = document.getElementById("input-cantidad-" + product_id);
var quantity1 = parseFloat(input.value);
weight = parseFloat(weight);
if (Math.abs((quantity1 / weight) - Math.round(quantity1 / weight)) > 0.0001) {
input.value = 0;
alert("O produto é vendido em múltiplos de " + weight);
}else{
document.getElementById("input-cantidad-" + product_id).value = quantity.toFixed(round);
myaddcart(product_id,quantity);
}
}
function plus_product(product_id, weight, stock) {
quantity = parseFloat(document.getElementById("input-cantidad-" + product_id).value);
weight = parseFloat(weight);
quantity = parseFloat(quantity) + parseFloat(weight);
if (quantity > stock) {
return false;
}
if (weight == 1) {
round = 0;
} else {
round = 3;
}
document.getElementById("input-cantidad-" + product_id).value = quantity.toFixed(round);
myaddcart(product_id,quantity);
}
function minus_product(product_id, weight) {
quantity = document.getElementById("input-cantidad-" + product_id).value;
weight = parseFloat(weight);
if (quantity > weight) {
quantity = parseFloat(quantity) - weight;
} else {
quantity = 0;
}
if (weight == 1) {
round = 0;
} else {
round = 3;
}
document.getElementById("input-cantidad-" + product_id).value = quantity.toFixed(round);
myaddcart(product_id,quantity);
if(quantity == 0){
$("#plus-minus-buttons").fadeOut("fast",function(){
$("#addcart-button").fadeIn("fast")
});
}
}
$("#button-shipping").on("click", function () {
var total_product = 'R$13,49';
total_product = parseFloat(total_product.replace(/[^\d.,-]/g, '').replace(',', '.'));
$(".alert-danger").remove();
$("#shipping-result").html('
');
$.ajax({
url: "index.php?route=extension/total/shipping/quote",
type: "post",
data: {cep: encodeURIComponent($("input[name='CEP']").val()), total_product: total_product},
dataType: "json",
beforeSend: function () {
$("#button-shipping").button("loading");
},
complete: function () {
$("#button-shipping").button("reset");
},
success: function (json) {
if (json.error) {
$("header").after(
' ' +
json.error +
'
'
);
$("html, body").animate({ scrollTop: 0 }, "slow");
}
if(json.add_address){
$(".shipping-address-body").html('Nenhum endereço cadastrado, clique no botão para adicionar um endereço.');
} else {
var html = json.address.address_1 + ', '+ json.address.company +' - '+ json.address.address_2 +'
' + json.address.city + ' - '+ json.address.postcode +'';
$(".shipping-address-body").html(html);
}
$("#shipping-result").removeClass('d-none');
var html = '';
var html_stores = '';
for (i in json.shipping_method) {
if (json.shipping_method[i].pickup == '0') {
html += '';
html += ' ';
html += '
';
html += '' + json.shipping_method[i].delivery_text + '
';
html += '
';
}
}
html += '';
html += ' ';
html += '
';
html += '
';
$("#shipping-result").html(html);
},
error: function (xhr, ajaxOptions, thrownError) {
alert(
thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText
);
},
});
});
$(".short-desc").showMore({
buttontxtmore:"Mostrar mais",
buttontxtless:"Mostrar menos",
minheight: 75
});
$('#button-review').on('click', function() {
$.ajax({
url: 'index.php?route=product/product/write&product_id=230251',
type: 'post',
dataType: 'json',
data: $('#form-review').serialize(),
beforeSend: function() {
$('#button-review').button('loading');
},
complete: function() {
$('#button-review').button('reset');
},
success: function (json) {
$('.alert-dismissible').remove();
if (json['error']) {
$('#review').after(' ' + json['error'] + '
');
}
if (json['success']) {
$('#review').after(' ' + json['success'] + '
');
$('input[name=\'name\']').val('');
$('textarea[name=\'text\']').val('');
$('input[name=\'rating\']:checked').prop('checked', false);
}
}
});
});
-->