{"id":2076,"date":"2025-03-01T16:37:51","date_gmt":"2025-03-01T15:37:51","guid":{"rendered":"http:\/\/127.0.0.1\/index.php\/homepage\/"},"modified":"2025-07-22T21:59:11","modified_gmt":"2025-07-22T19:59:11","slug":"homepage","status":"publish","type":"page","link":"https:\/\/www.printcontrol.it\/","title":{"rendered":"Homepage"},"content":{"rendered":"<div class=\"wp-block-columns container is-layout-flex wp-container-core-columns-is-layout-7387b849 wp-block-columns-is-layout-flex\"><div class=\"wp-block-column col-md-5 is-layout-flow wp-block-column-is-layout-flow\"><div style=\"height:55px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n<h2 class=\"wp-block-heading\">RICERCA PER PRODOTTO<\/h2>\n\n    <form id=\"brand-category-form\" method=\"get\">\r\n        <div id=\"category-inputs\">\r\n            <!-- First dropdown for subcategories under \"BRAND\" -->\r\n            <select class=\"category-dropdown\" name=\"brand_subcategory\">\r\n                <option value=\"\">Seleziona un brand<\/option>\r\n                <option value=\"brother\">BROTHER<\/option><option value=\"canon\">CANON<\/option><option value=\"develop\">Develop<\/option><option value=\"epson\">EPSON<\/option><option value=\"hp\">HP<\/option><option value=\"konica-minolta\">Konica Minolta<\/option><option value=\"kyocera\">Kyocera<\/option><option value=\"lexmark\">Lexmark<\/option><option value=\"oki-serie-b-e-c\">Oki serie B e C<\/option><option value=\"oki-serie-es\">Oki serie ES<\/option><option value=\"olivetti\">Olivetti<\/option><option value=\"panasonic-brand\">Panasonic<\/option><option value=\"ricoh\">Ricoh<\/option><option value=\"riso\">RISO<\/option><option value=\"samsung\">SAMSUNG<\/option><option value=\"sharp\">Sharp<\/option><option value=\"toshiba\">TOSHIBA<\/option><option value=\"triumph-adler\">Triumph Adler<\/option><option value=\"utax\">Utax<\/option><option value=\"xerox\">Xerox<\/option>            <\/select>\r\n            <select class=\"child-category\" disabled>\r\n            <option value=\"\">seleziona il modello  <\/option>'\r\n            <\/select>\r\n        <\/div>\r\n        <button type=\"button\" id=\"show-products\" class=\"wpforms-submit\">CERCA I PRODOTTI<\/button>\r\n    <\/form>\r\n\r\n    <script>\r\n    jQuery(document).ready(function($) {\r\n        \/\/ Handle dropdown changes dynamically\r\n        $('.category-dropdown').on('change', function() {\r\n            var selectedCat = $(this).val();\r\n            if (!selectedCat) return;\r\n\r\n            let nextSelects = $(this).nextAll('select');\r\n            \/\/nextSelects.hide(); \/\/ temporarily hide old child selects\r\n\r\n            \/\/ AJAX request to get child categories\r\n            $.ajax({\r\n                url: 'https:\/\/www.printcontrol.it\/wp-admin\/admin-ajax.php',\r\n                type: 'POST',\r\n                data: {\r\n                    action: 'get_child_categories',\r\n                    parent_slug: selectedCat \/\/ Use slug to identify the selected category\r\n                },\r\n                success: function(response) {\r\n                    if (response) {\r\n                        $('#category-inputs select:visible').nextAll('select').remove(); \/\/ clean only if needed\r\n\t\t\t$('#category-inputs').append(response);\r\n                    }\r\n                }\r\n            });\r\n        });\r\n\r\n        \/\/ Handle dynamically added dropdowns\r\n        $(document).on('change', '.child-category', function() {\r\n            var selectedCat = $(this).val();\r\n            if (!selectedCat) return;\r\n\r\n             let nextSelects = $(this).nextAll('select');\r\n            \/\/nextSelects.hide(); \/\/ temporarily hide old child selects\r\n\r\n            $.ajax({\r\n                url: 'https:\/\/www.printcontrol.it\/wp-admin\/admin-ajax.php',\r\n                type: 'POST',\r\n                data: {\r\n                    action: 'get_child_categories',\r\n                    parent_slug: selectedCat \/\/ Use slug for the parent category\r\n                },\r\n                success: function(response) {\r\n                    if (response) {\r\n                         $('#category-inputs select:visible').nextAll('select').remove(); \/\/ clean only if needed\r\n                        $('#category-inputs').append(response);\r\n                    }\r\n                }\r\n            });\r\n        });\r\n\r\n        \/\/ Handle \"Show Products\" button click\r\n        $('#show-products').on('click', function() {\r\n            var baseUrl = 'https:\/\/www.printcontrol.it\/index.php\/categoria-prodotto\/'; \/\/ Base URL for your categories\r\n            var categoryPath = '';\r\n\r\n            \/\/ Build the category path by iterating through all selected dropdowns\r\n            $('#category-inputs select').each(function() {\r\n                var selectedCategory = $(this).val();\r\n                if (selectedCategory) {\r\n                    categoryPath += selectedCategory + '\/'; \/\/ Append selected category slugs\r\n                }\r\n            });\r\n\r\n            if (categoryPath === '') {\r\n                alert('Please select at least one category!');\r\n                return;\r\n            }\r\n\r\n            \/\/ Redirect to the constructed URL\r\n            window.location.href = baseUrl + categoryPath;\r\n        });\r\n    });\r\nwq    <\/script>\r\n    <\/div>\n\n<div class=\"wp-block-column col-md-6 col-md-offset1 is-layout-flow wp-block-column-is-layout-flow\"><div style=\"height:55px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>RICERCA PER PRODOTTO<\/p>\n","protected":false},"author":1,"featured_media":3606,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_themeisle_gutenberg_block_has_review":false,"footnotes":""},"class_list":["post-2076","page","type-page","status-publish","has-post-thumbnail","hentry"],"_links":{"self":[{"href":"https:\/\/www.printcontrol.it\/index.php\/wp-json\/wp\/v2\/pages\/2076","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.printcontrol.it\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.printcontrol.it\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.printcontrol.it\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.printcontrol.it\/index.php\/wp-json\/wp\/v2\/comments?post=2076"}],"version-history":[{"count":6,"href":"https:\/\/www.printcontrol.it\/index.php\/wp-json\/wp\/v2\/pages\/2076\/revisions"}],"predecessor-version":[{"id":2175,"href":"https:\/\/www.printcontrol.it\/index.php\/wp-json\/wp\/v2\/pages\/2076\/revisions\/2175"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.printcontrol.it\/index.php\/wp-json\/wp\/v2\/media\/3606"}],"wp:attachment":[{"href":"https:\/\/www.printcontrol.it\/index.php\/wp-json\/wp\/v2\/media?parent=2076"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}