Posted - 08/08/2024 : 21:00:14
I prefer to do this type of thing with javascript in the DOM and avoid hacking the back end code. It should not be too much trouble to check the products in the cart - and hide the selection for the email payment selection. While this can be undone in the browser, most folks would never know how to do it, and if they do, I would cancel their order. I'm .asp and I would use that to check the products in the cart against the category, or maybe easier a keyword in the search terms, or a custom field, and if found, use javascript to hide that email payment option. I'm not that good with .php, and I am pretty busy with a new project, but maybe with this idea, someone can help. This would be done in your cart.php page after the include line that calls up the cart. step 1 - check for product - need php code end result is true or false if product exists step 2 (verified works - with radio payment options - code is commented) <script> var phpcheck = [your php variable goes here and should resolve to true or false] if (document.getElementsByClassName("copayradio1")[0] && phpcheck == true){ //check to see if the an excluded product exists and be sure the payment options are showing. var noemlpmt = document.getElementsByClassName("copayradio1") //get the payment radio divs for( i = 0; i < noemlpmt.length; i++ ){ //loop through the payment radio divs text = document.getElementsByClassName("copayradio1")[i].innerHTML; //get the inner text of the payment radio divs noemlpmtz = text.includes("EFT") //check to see if word "EFT" is in the div - will resolve to true if found if (noemlpmtz == true){ document.getElementsByClassName("copayradio1")[i].style.display='none' //hide the payment radio that has the word EFT in it. }}} </script> That's half the work there. confirmed works. Thanks, David
Edited by - dbdave on 08/08/2024 21:07:28
|