{"id":2873865,"date":"2021-03-09T07:43:59","date_gmt":"2021-03-09T15:43:59","guid":{"rendered":"https:\/\/caringsunshine.com\/?page_id=2873865"},"modified":"2023-12-05T13:04:01","modified_gmt":"2023-12-05T21:04:01","slug":"reorder-products-quickly","status":"publish","type":"page","link":"https:\/\/caringsunshine.com\/es\/reorder-products-quickly\/","title":{"rendered":"Reordenar los productos r\u00e1pidamente"},"content":{"rendered":"<div class=\"row\"  id=\"row-1631753192\">\n\n\t<div id=\"col-629040127\" class=\"col medium-6 small-12 large-6\"  >\n\t\t\t\t<div class=\"col-inner\"  >\n\t\t\t\n\t\t\t\n\n    <script src=\"https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/3.2.1\/jquery.min.js\"><\/script>\n    <script>\n        document.body.addEventListener('input', function(e) {\n            calculate();\n        });\n        document.body.addEventListener('click', function(e) {\n            calculate();\n        });\n\n        window.onload = function() {\n            calculate();\n        };\n        window.onunload = function() {};\n\n        function calculate() {\n            jQuery(document).ready(function($) {\n                grandtotal = 0;\n                atc_list.textContent = '0';\n                ds_list.textContent = '0';\n\n                var count = 0;\n                var one_step = '<table><tr><td><b>Product<\/b><\/td><td style=\"text-align: right\"><b>Quantity<\/b><\/td><td style=\"text-align: right\"><b>Price<\/b><\/td><\/tr>';\n                $(\"input[type=number]\").each(function() {\n                    var $this = $(this),\n                        id = $this.attr('id');\n                    var temp = new Array();\n                    temp = $(this).attr('id').split(\"^\");\n\n                    if (temp.length > 2) {\n                        productid = temp[1];\n                        price = temp[2];\n                        count = count + 1;\n                        var productname = document.getElementById(\"ra*\" + temp[1]).value;\n                        itemquantity = $(this).val();\n                        total = price * itemquantity;\n                        grandtotal = grandtotal + total;\n                        if (parseInt(itemquantity) > 0) {\n                            atc_list.textContent = atc_list.textContent + ',' + productid;\n                            ds_list.textContent = ds_list.textContent + ',' + parseInt(itemquantity);\n                            one_step = one_step + '<tr><td>' + productname + '<\/td><td style=\"text-align: right\">' + itemquantity + '<\/td><td style=\"text-align: right\">$' + total.toFixed(2) + '<\/td><\/tr>';\n                        }\n                        document.getElementById(\"lt\" + productid).textContent = '$' + total.toFixed(2);\n                    }\n                })\n                shipping = 0;\n                if (grandtotal > 75)\n                    shipping = 0.00;\n                else\n                    shipping = 2.99;\n\n                \/\/ Black Friday 2025 discount - 5% off regular price for orders over $75\n                var bf_discount = 0;\n                \/\/if (grandtotal > 75) {\n                \/\/    bf_discount = grandtotal * 0.06667;\n                \/\/}\n\n                one_step = one_step + '<tr><td><\/td><td style=\"text-align: left;\">Subtotal: <\/td><td style=\"text-align: right;\">$' + grandtotal.toFixed(2) + '<\/td><\/tr>';\n                if (bf_discount > 0) {\n                    one_step = one_step + '<tr><td><\/td><td style=\"text-align: left;\"><span style=\"color: green;\">BF Discount (5%): <\/span><\/td><td style=\"text-align: right;\"><span style=\"color: green;\">-$' + bf_discount.toFixed(2) + '<\/span><\/td><\/tr>';\n                }\n                one_step = one_step + '<tr><td><\/td><td style=\"text-align: left;\">Shipping: <\/td><td style=\"text-align: right;\">$' + shipping.toFixed(2) + '<\/td><\/tr>';\n                one_step = one_step + '<tr><td><\/td><td style=\"text-align: left;\">Sales tax: <\/td><td style=\"text-align: right;\">$' + '0.00' + '<\/td><\/tr>';\n                one_step = one_step + '<tr><td><\/td><td style=\"text-align: left;\"><b>Total: <\/b><\/td><td style=\"text-align: right;\"><b>$' + (grandtotal - bf_discount + shipping).toFixed(2) + '<\/b><\/td><\/tr>';\n                one_step = one_step + '<\/table>';\n                one_step = one_step + '<table><tr><td style=\"text-align: right;\"><button id=\"instant-buy\" class=\"single_add_to_cart_button button alt\" style=\"margin-right: 0;\" onclick=\"instant_buy(event)\">One-Click Purchase<\/button><\/td><\/tr><\/table>';\n                document.getElementById(\"one-step-table\").innerHTML = one_step;\n                document.getElementById(\"totaltop\").textContent = '$' + grandtotal.toFixed(2);\n                document.getElementById(\"totalbottom\").textContent = '$' + grandtotal.toFixed(2);\n                if (grandtotal == 0)\n                    document.getElementById(\"add-to-cart-block\").style.display = \"none\";\n                else\n                    document.getElementById(\"add-to-cart-block\").style.display = \"block\";\n                if (grandtotal == 0)\n                    document.getElementById(\"one-step-table\").innerHTML = \"<i>Your order will show here as you build it.<\/i>\";\n\n\n            });\n        }\n\n        function add_to_cart() {\n            document.getElementById(\"add1\").disabled = true;\n            calculate();\n\n\n            atc_link = '\/internal-use-reorder-add-to-cart?list=' + document.getElementById('atc_list').textContent + '&quantities=' + document.getElementById('ds_list').textContent;\n            console.log(atc_link);\n            window.location.href = atc_link;\n            \/*var xmlhttp = new XMLHttpRequest();\n            xmlhttp.onreadystatechange = function() {\n                if (this.readyState == 4 && this.status == 200) {\n                    window.location.href = \"https:\/\/caringsunshine.com\/checkout\";\n                }\n            };\n            xmlhttp.open(\"GET\",atc_link,true);\n            xmlhttp.send(); *\/\n        }\n\n        let instant_buy_state = false;\n\n        function instant_buy(e) {\n            e.target.disabled = true;\n            console.log('here');\n            e.preventDefault();\n            e.stopPropagation();\n            if (!instant_buy_state) {\n                instant_buy_state = true;\n                e.target.innerHTML = \"Processing...\";\n                e.target.disabled = true;\n                atc_link = '\/internal-use-instant?list=' + document.getElementById('atc_list').textContent + '&quantities=' + document.getElementById('ds_list').textContent + '&order=' + '0';\n                console.log(atc_link);\n                window.location.href = atc_link;\n                return;\n                \/*\n                var xmlhttp = new XMLHttpRequest();\n                xmlhttp.onreadystatechange = function() {\n                    if (this.readyState == 4 && this.status == 200) {\n                        \/\/window.location.href = \"https:\/\/caringsunshine.com\/checkout\";\n                    }\n                };\n                xmlhttp.open(\"GET\",atc_link,true);\n                xmlhttp.send(); *\/\n            }\n        }\n    <\/script>\n\n    <h2>Pedidos r\u00e1pidos de productos<\/h2><p>\u00a1Ooops! No podemos extraer su historial de pedidos anteriores.<\/p><p>Si ya nos ha hecho un pedido anteriormente, <a href=\"\/es\/my-account\/\">con\u00e9ctate aqu\u00ed.<\/a> (Si no conoce su contrase\u00f1a, <a href=\"https:\/\/caringsunshine.com\/es\/my-account\/lost-password\/\">haga clic aqu\u00ed<\/a> y le enviaremos un enlace de acceso instant\u00e1neo).<\/p><p>Si no nos ha hecho pedidos anteriormente, <a href=\"https:\/\/caringsunshine.com\/es\/\">haga clic aqu\u00ed para realizar su primer pedido.<\/a> Se le crear\u00e1 una cuenta autom\u00e1ticamente al pasar por caja.<\/p>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\n\t\n<\/div>","protected":false},"excerpt":{"rendered":"","protected":false},"author":37812,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"rapid":[],"class_list":["post-2873865","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/caringsunshine.com\/es\/wp-json\/wp\/v2\/pages\/2873865","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/caringsunshine.com\/es\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/caringsunshine.com\/es\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/caringsunshine.com\/es\/wp-json\/wp\/v2\/users\/37812"}],"replies":[{"embeddable":true,"href":"https:\/\/caringsunshine.com\/es\/wp-json\/wp\/v2\/comments?post=2873865"}],"version-history":[{"count":13,"href":"https:\/\/caringsunshine.com\/es\/wp-json\/wp\/v2\/pages\/2873865\/revisions"}],"predecessor-version":[{"id":3208849,"href":"https:\/\/caringsunshine.com\/es\/wp-json\/wp\/v2\/pages\/2873865\/revisions\/3208849"}],"wp:attachment":[{"href":"https:\/\/caringsunshine.com\/es\/wp-json\/wp\/v2\/media?parent=2873865"}],"wp:term":[{"taxonomy":"rapid","embeddable":true,"href":"https:\/\/caringsunshine.com\/es\/wp-json\/wp\/v2\/rapid?post=2873865"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}