{"product_id":"canidreams-food-peptide-controle-du-poids-et-des-articulations","title":"Canidreams Food - Peptide + Contrôle du poids et des articulations","description":"\u003cdiv id=\"dog-food-calculator\" style=\"margin-top: 20px; padding: 20px; border: 2px solid #ffa500; border-radius: 12px; background-color: #fff8f0;\"\u003e\n  \u003ch3 style=\"color: #d35400; font-size: 20px; margin-bottom: 15px;\"\u003eCalculez la ration quotidienne de croquettes pour votre chien 🐶\u003c\/h3\u003e\n\n  \u003clabel for=\"dog-weight\" style=\"font-weight: bold;\"\u003ePoids du chien (en kg) :\u003c\/label\u003e\u003cbr\u003e\n  \u003cinput type=\"number\" id=\"dog-weight\" min=\"1\" step=\"0.1\" placeholder=\"Ex: 10\" style=\"margin: 10px 0; padding: 10px; width: 100%; border: 1px solid #ffa500; border-radius: 6px;\"\u003e\u003cbr\u003e\n\n  \u003clabel for=\"bag-weight-select\" style=\"font-weight: bold;\"\u003ePoids du sac de croquettes :\u003c\/label\u003e\u003cbr\u003e\n  \u003cselect id=\"bag-weight-select\" style=\"margin: 10px 0; padding: 10px; width: 100%; border: 1px solid #ffa500; border-radius: 6px;\"\u003e\n    \u003coption value=\"2\"\u003e2 kg\u003c\/option\u003e\n    \u003coption value=\"6\"\u003e6 kg\u003c\/option\u003e\n    \u003coption value=\"12\"\u003e12 kg\u003c\/option\u003e\n  \u003c\/select\u003e\u003cbr\u003e\n\n  \u003cbutton id=\"calc-btn\" style=\"background-color: #ffa500; color: white; padding: 10px 20px; border: none; border-radius: 6px; cursor: pointer; font-weight: bold;\"\u003eCalculer\u003c\/button\u003e\n\n  \u003cdiv id=\"result\" style=\"margin-top: 20px; color: #333; font-size: 16px; font-weight: bold;\"\u003e\u003c\/div\u003e\n\u003c\/div\u003e\n\n\u003cscript\u003e\n(function() {\n  const container = document.getElementById('dog-food-calculator');\n  const weightInput = container.querySelector('#dog-weight');\n  const bagSelect = container.querySelector('#bag-weight-select');\n  const resultElement = container.querySelector('#result');\n  const btn = container.querySelector('#calc-btn');\n\n  \/\/ Prix fixe par sac selon le poids\n  const bagPrices = {\n    2: 19.99,\n    6: 49.99,\n    12: 85.99\n  };\n\n  function calculateDogFood() {\n    const weight = parseFloat(weightInput.value);\n    const bagWeight = parseFloat(bagSelect.value);\n\n    if (isNaN(weight) || weight \u003c= 0) {\n      resultElement.textContent = \"Veuillez entrer un poids valide pour le chien.\";\n      return;\n    }\n\n    let baseWeight, maxWeight, baseRation, maxRation, ratio, ration;\n\n    if (weight \u003c= 5) {\n      baseWeight = 1; maxWeight = 5; baseRation = 25; maxRation = 85; ratio = 15;\n    } else if (weight \u003c= 10) {\n      baseWeight = 5; maxWeight = 10; baseRation = 85; maxRation = 145; ratio = 12;\n    } else if (weight \u003c= 20) {\n      baseWeight = 10; maxWeight = 20; baseRation = 145; maxRation = 245; ratio = 10;\n    } else if (weight \u003c= 30) {\n      baseWeight = 20; maxWeight = 30; baseRation = 245; maxRation = 335; ratio = 9;\n    } else if (weight \u003c= 40) {\n      baseWeight = 30; maxWeight = 40; baseRation = 335; maxRation = 415; ratio = 8;\n    } else {\n      baseWeight = 40; baseRation = 415; ratio = 10;\n      ration = Math.round(baseRation + ((weight - baseWeight) * ratio));\n    }\n\n    if (weight \u003c= 40) {\n      ration = (weight === maxWeight) ? maxRation : Math.round(baseRation + ((weight - baseWeight) * ratio));\n    }\n\n    const bagInGrams = bagWeight * 1000;\n    const days = Math.floor(bagInGrams \/ ration);\n\n    \/\/ Calcul du prix par jour selon le sac sélectionné\n    const bagPrice = bagPrices[bagWeight];\n    const pricePerDay = (bagPrice \/ days).toFixed(2);\n\n    resultElement.innerHTML = `\n      ➤ Ration exacte recommandée : \u003cspan style=\"color: #d35400;\"\u003e${ration}g\u003c\/span\u003e par jour.\u003cbr\u003e\n      ➤ Un sac de \u003cspan style=\"color: #d35400;\"\u003e${bagWeight}kg\u003c\/span\u003e durera environ \u003cspan style=\"color: #d35400;\"\u003e${days} jours\u003c\/span\u003e.\u003cbr\u003e\n      ➤ Prix des croquettes par jour : \u003cspan style=\"color: #d35400;\"\u003e${pricePerDay} €\u003c\/span\u003e.\n    `;\n  }\n\n  btn.addEventListener('click', calculateDogFood);\n})();\n\u003c\/script\u003e\n","brand":"Canidreams","offers":[{"title":"100g","offer_id":56518681919813,"sku":null,"price":1.5,"currency_code":"EUR","in_stock":true},{"title":"1,5kg","offer_id":56518681952581,"sku":null,"price":24.99,"currency_code":"EUR","in_stock":true},{"title":"10kg","offer_id":56518681985349,"sku":null,"price":124.99,"currency_code":"EUR","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0728\/2055\/6101\/files\/Gemini_Generated_Image_gqmomxgqmomxgqmo.jpg?v=1791832555","url":"https:\/\/canidreams.com\/products\/canidreams-food-peptide-controle-du-poids-et-des-articulations","provider":"Canidreams","version":"1.0","type":"link"}