| lostbuckarooAdvanced Member
 
 
113 Posts Pre-sales questions only(More Details...) 
 | 
 Posted - 10/24/2019 :  20:29:15   Vince, Trying to do what you suggested I created a test product with one option and then did the "view page source" for the product detail page here: https://www.lostbuckaroo.com/proddetail.php?prod=testprod
 Then went into Wordpress and added what I thought would be the pertinent Code to a new test page created within wordpress. The test page is here: https://lostbuckaroo.com/chinks-tst/
 
 The form appears to work however the popup shopping cart window shows "Cart contents:undefined item(s)" So I'm sure I'm missing some code, a script or page reference in the header or something. Please advise.
 
 Code Copied from the cart generated prod details page:
 
 
 <div class="container clearfix">
 
 <div id="primary" class="content-area">
 <main id="main" class="site-main" role="main">
 
 <div id="notifyinstockcover" style="display:none;position:fixed;width:100%;height:100%;background-color:rgba(140,140,150,0.5);top:0px;left:0px;z-index:1000">
 <div class="notifyinstock">
 <div style="padding:6px;float:left;height:31px;font-size:1.4em">We're really sorry...</div>
 <div style="padding:6px;float:right"><img src="images/close.gif" style="cursor:pointer" alt="Close" onclick="closeinstock()" /></div>
 <div style="border-left:6px solid #ffffff;border-right:6px solid #ffffff;padding:6px;background:#eeeeee;clear:both">...we don't currently have that one in stock</div>
 <div style="padding:5px;font-size:0.8em">Please add your email and we'll notify you when it's back</div>
 <div style="padding:2px 0px 4px 4px;float:left"><input style="border:1px solid #333;padding:5px;width:220px" id="nsemailadd" type="text" /></div>
 <div style="padding:4px 6px 6px 4px;float:right"><input value="Email Me" style="cursor:pointer;background:#313140;color:#fff;border:0px;border-radius:2px;padding:3px 7px" onclick="regnotifystock()" type="button" /></div>
 </div>
 </div>
 <input type="hidden" id="hiddencurr" value="$0.00" /><div id="opaquediv" style="display:none;position:fixed;width:100%;height:100%;background-color:rgba(140,140,150,0.5);top:0px;left:0px;text-align:center;z-index:10000;"></div><script type="text/javascript">
 /* <![CDATA[ */
 var xxAddWiL="The following items have been added to the wish list: ",xxBakOpt="Some of these options are not currently in stock but are available to back order.",xxCarCon="Cart contents",xxClkHere="click here",xxClsWin="Close Window",xxCntShp="Continue Shopping",xxCntTax="Country Tax",xxDigits="Please enter only digits in this field.",xxDscnts="Discounts",xxEdiOrd="Edit Order",xxEntMul="Please enter a quantity for at least one option.",xxHasAdd="has been added",xxInStNo="You will be notified by email when the product is back in stock.",xxInvCha="The following characters are invalid:",xxListPrice="<div class=\"origprice\">List Price: <span class=\"liststrike\">%s</span></div>",xxNotSto="The following product isn't currently available in our store",xxOpSkTx=" (%s)",xxOptOOS="I'm sorry, that particular option is currently out of stock",xxPrd255="Please enter a maximum of 255 chars in the field indicated.",xxPrdChs="Please choose from the available product options.",xxPrdEnt="Please enter a value where indicated.",xxPrice="Price",xxSCAdOr="The following items have been added to your order.",xxSCBakO="Item not currently in stock but placed on back order - select "Edit Order" to modify purchase.",xxSCCarT="Cart total",xxSCItem="item(s)",xxSCStkW="STOCK WARNING: Low stock on selected item, please click "Edit Order" to accept stock level.",xxValEm="Please enter a valid email address.";
 var absoptionpricediffs=false;
 var cartpageonhttps=false;
 var currDecimalSep='.';
 var currencyseparator=' ';
 var currThousandsSep=',';
 var ectbody3layouttaxinc=false;
 var extension='.php';
 var extensionabs='php';
 var hasdecimals=true;
 var hideoptpricediffs=false;
 var imgsoftcartcheckout='<input type="button" value="Checkout" class="sccheckout" onclick="ectgonoabs(\'cart.php\')" />';
 var noencodeimages=true;
 var noprice=false;
 var nopriceanywhere=false;
 var noshowoptionsinstock=false;
 var notifybackinstock=true;
 var noupdateprice=false;
 var pricezeromessage="";
 var showinstock=true;
 var showtaxinclusive=0;
 var storeurlssl='http://lostbuckaroo.com/';
 var tax=0;
 var txtcollen=8000;
 var usehardaddtocart=false;
 var usestockmanagement=false;
 var yousavetext="";
 var zero2dps='0.00';
 var currFormat1='',currFormat2='',currFormat3='';
 var currRate1=0,currRate2=0,currRate3=0;
 var currSymbol1='',currSymbol2='',currSymbol3='';
 var softcartrelated=false;
 function openEFWindow(id,askq){
 efrdiv=document.createElement('div');
 efrdiv.setAttribute('id','efrdiv');
 efrdiv.style.zIndex=1000;
 efrdiv.style.position='fixed';
 efrdiv.style.width='100%';
 efrdiv.style.height='100%';
 efrdiv.style.top='0px';
 efrdiv.style.left='0px';
 efrdiv.style.backgroundColor='rgba(140,140,150,0.5)';
 document.body.appendChild(efrdiv);
 ajaxobj=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject("MSXML2.XMLHTTP");
 ajaxobj.open("GET", 'emailfriend.php?lang=&'+(askq?'askq=1&':'')+'id='+id, false);
 ajaxobj.send(null);
 efrdiv.innerHTML=ajaxobj.responseText;
 }
 var emfrecaptchaok=false;
 var emfrecaptcharesponse='';
 function updateoptimage(theitem,themenu,opttype){
 var imageitemsrc='',mzitem,theopt,theid,imageitem,imlist,imlistl,fn=window['updateprice'+theitem];
 dependantopts(theitem);
 fn();
 if(opttype==1){
 theopt=document.getElementsByName('optn'+theitem+'x'+themenu)
 for(var i=0; i<theopt.length; i++)
 if(theopt[i].checked)theid=theopt[i].value;
 }else{
 theopt=document.getElementById('optn'+theitem+'x'+themenu)
 theid=theopt.options[theopt.selectedIndex].value;
 }
 if(imageitem=document.getElementById((globalquickbuyid!==''?'qb':'prod')+"image"+theitem)){
 if(aIM[theid]){
 if(typeof(imageitem.src)!='unknown')imageitem.src=vsdecimg(aIM[theid]);
 }
 }
 }
 function vsdecimg(timg){
 return decodeURIComponent(timg.replace("|","prodimages/").replace("<",".gif").replace(">",".jpg").replace("?",".png"));
 }
 function updateprodimage(theitem,isnext){
 return updateprodimage2(false,theitem,isnext);
 }
 function updateprodimage2(isqb,theitem,isnext){
 var imlist=pIM[theitem];
 if(!pIX[theitem])pIX[theitem]=0;
 if(isnext) pIX[theitem]++; else pIX[theitem]--;
 if(pIX[theitem]<0) pIX[theitem]=imlist.length-1;
 if(pIX[theitem]>=imlist.length) pIX[theitem]=0;
 if(document.getElementById((isqb?'qb':'prod')+"image"+theitem)){document.getElementById((isqb?'qb':'prod')+"image"+theitem).src='';document.getElementById((isqb?'qb':'prod')+"image"+theitem).src=vsdecimg(imlist[pIX[theitem]]);}
 document.getElementById((isqb?'qb':'extra')+"imcnt"+theitem).innerHTML=pIX[theitem]+1;
 return false;
 }
 /* ]]> */
 </script><script type="text/javascript">
 <!--
 function efchkextra(obid,fldtxt){
 var hasselected=false,fieldtype='';
 var ob=document.getElementById(obid);
 if(ob)fieldtype=(ob.type?ob.type:'radio');
 if(fieldtype=='text'||fieldtype=='textarea'||fieldtype=='password'){
 hasselected=ob.value!='';
 }else if(fieldtype=='select-one'){
 hasselected=ob.selectedIndex!=0;
 }else if(fieldtype=='radio'){
 for(var ii=0;ii<ob.length;ii++)if(ob[ii].checked)hasselected=true;
 }else if(fieldtype=='checkbox')
 hasselected=ob.checked;
 if(!hasselected){
 if(ob.focus)ob.focus();else ob[0].focus();
 alert("Please enter a value in the field \""+fldtxt+"\".");
 return(false);
 }
 return(true);
 }
 function efformvalidator(theForm){
 if(document.getElementById('yourname').value==""){
 alert("Please enter a value in the field \"Your Name\".");
 document.getElementById('yourname').focus();
 return(false);
 }
 if(document.getElementById('youremail').value==""){
 alert("Please enter a value in the field \"Your Email\".");
 document.getElementById('youremail').focus();
 return(false);
 }
 if(document.getElementById('askq').value!='1'){
 if(document.getElementById('friendsemail').value==""){
 alert("Please enter a value in the field \"Your Friends Email\".");
 document.getElementById('friendsemail').focus();
 return(false);
 }
 }else{
 }
 return(true);
 }
 function dosendefdata(){
 if(efformvalidator(document.getElementById('efform'))){
 var ajaxobj=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject("MSXML2.XMLHTTP");
 var yourname=document.getElementById("yourname").value;
 var youremail=document.getElementById("youremail").value;
 var friendsemail=(document.getElementById('askq').value=='1'?'':document.getElementById("friendsemail").value);
 var yourcomments=document.getElementById("yourcomments").value;
 var efcheck=document.getElementById("efcheck").value;
 postdata="posted=1&efid=" + encodeURIComponent(document.getElementById('efid').value) + (document.getElementById('askq').value=='1'?'&askq=1':'') + "&yourname=" + encodeURIComponent(yourname) + "&youremail=" + encodeURIComponent(youremail) + "&friendsemail=" + encodeURIComponent(friendsemail) + "&efcheck=" + encodeURIComponent(efcheck) + (document.getElementById("origprodid")?"&origprodid="+encodeURIComponent(document.getElementById("origprodid").value):'') + "&yourcomments=" + encodeURIComponent(yourcomments);
 for(var index=0;index<10;index++){
 if(document.getElementById('askquestionparam'+index)){
 var tval,ob=document.getElementById('askquestionparam'+index)
 fieldtype=(ob.type?ob.type:'radio');
 if(fieldtype=='text'||fieldtype=='textarea'||fieldtype=='password'){
 tval=ob.value;
 }else if(fieldtype=='select-one'){
 tval=ob[ob.selectedIndex].value;
 }else if(fieldtype=='radio'){
 for(var ii=0;ii<ob.length;ii++)if(ob[ii].checked)tval=ob[ii].value;
 }else if(fieldtype=='checkbox')
 tval=ob.value;
 postdata+='&askquestionparam'+index+'='+encodeURIComponent(tval);
 }
 }
 ajaxobj.open("POST",'emailfriend.php?lang=',false);
 ajaxobj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
 ajaxobj.send(postdata);
 document.getElementById('efrcell').innerHTML=ajaxobj.responseText;
 }
 }
 //-->
 </script>
 <div id="mainbodyspan" class="proddetail testprod" itemscope itemtype="http://schema.org/Product"><form method="post" id="ectform0" action="cart.php" onsubmit="return formvalidator0(this)" style="margin:0px;padding:0px;"><script type="text/javascript">/* <![CDATA[ */op[738]=1;ot[738]="1";
 ot[739]="2";
 sz('testprod',1,0,'');function setvals0(){
 optacpc[0]='';optmaxc[0]=0;opttype[0]=2;optperc[0]=false;
 }
 function updateprice0(){
 setvals0();updateprice(1,0,1,0,'testprod',0,false,false,false);}
 function formvalidator0(theForm){
 setvals0();return(ectvalidate(theForm,1,0,false,false));}
 /* ]]> */</script><input type="hidden" name="id" value="testprod" />
 <input type="hidden" name="mode" value="add" />
 <div class="prodnavigation detailprodnavigation"><a class="ectlink" href="categories.php">Home</a>  » <a class="ectlink" href="products.php?cat=6">Rusted Ironworks</a></div><div class="detailimage allprodimages"> </div><div class="detailname"><h1 itemprop="name">test prod</h1></div><div class="detaildescription" itemprop="description">TEst description</div><div class="detailprice" itemprop="offers" itemscope itemtype="http://schema.org/Offer"><meta itemprop="priceCurrency" content="USD"><strong>Price:</strong> <span class="price" id="pricediv0" itemprop="price" content="1.00">$1.00</span> </div><div class="detailoptions"><div class="ectoptioncontainer ectselectoption"><div class="optiontext detailoptiontext"><span class="detailoption"><label for="optn0x0">test option</label></span></div><div class="option detailoption"> <select data-optgroup="182" class="prodoption detailprodoption" onchange="updateoptimage(0,0)" name="optn0" id="optn0x0" size="1"><option value="">Please Select...</option><option value="738">1 (+$1.00)</option>
 <option value="739">2</option>
 </select></div></div></div><div class="detailquantity"><div class="detailquantitytext">Quantity:</div><div class="quantity0div detailquantity0div"><input type="text" name="quant" id="w0quant" size="2" maxlength="5" value="1" title="Quantity" class="quantity0input detailquantity0input"></div>
 </div><div class="addtocart detailaddtocart"><input type="button" value="Add to cart" class="buybutton detailbuybutton" onclick="subformid(0,'','')" /></div><div class="previousnext"><a class="ectlink" href="/proddetail.php?prod=RIWBE"><strong>« Previous</strong></a> | <a class="ectlink" href="/proddetail.php?prod=RIWSHR"><strong>Next »</strong></a></div><div class="socialmediabuttons"><div class="socialmediabutton socialaskaquestion"><input type="button" value="Ask A Question" class="askaquestion" onclick="openEFWindow('testprod',true)" /></div><div class="socialmediabutton socialfacebook"><div id="fb-root"></div><script>(function(d,s,id){var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) return;js = d.createElement(s); js.id = id;js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.7";fjs.parentNode.insertBefore(js, fjs);}(document, 'script', 'facebook-jssdk'));</script><div class="fb-like" data-href="https://www.lostbuckaroo.com/proddetail.php?prod=testprod" data-layout="button" data-action="like" data-size="small" data-show-faces="false" data-share="true"></div></div><div class="socialmediabutton sociallinkedin"><script src="//platform.linkedin.com/in.js" type="text/javascript">lang:en_US</script><script type="IN/Share" data-url="https://www.lostbuckaroo.com/proddetail.php?prod=testprod" data-counter="right"></script></div><div class="socialmediabutton socialtwitter"><script type="text/javascript" async src="https://platform.twitter.com/widgets.js"></script><a class="twitter-share-button" lang="" href="https://twitter.com/intent/tweet" data-size="default" data-url="https://www.lostbuckaroo.com/proddetail.php?prod=testprod">Tweet</a></div><div class="socialmediabutton socialpinterest"><a data-pin-do="buttonBookmark" data-pin-save="true" href="https://www.pinterest.com/pin/create/button/"></a><script async defer src="//assets.pinterest.com/js/pinit.js"></script></div><div class="socialmediabutton socialgoogle"><script src="https://apis.google.com/js/platform.js" async defer>lang:"" </script><div class="g-plusone" data-href="https://www.lostbuckaroo.com/proddetail.php?prod=testprod"></div></div></div><div class="review" id="reviews"> <br /><span class="review numreviews">Product Reviews</span><span class="review showallreview"></span><br /><hr class="review showallreview" /><span class="review noreview">No Reviews For This Product.</span><br /><hr class="review" /><span class="review clickreview"><a class="ectlink" rel="nofollow" href="/proddetail.php?prod=testprod&review=true">Click to review this product</a></span><br /><hr class="review" /></div></form></div><script type="text/javascript">updateprice0();document.getElementById('optn0x0').onchange();</script>
 
 
 
 </main><!-- #main -->
 </div><!-- #primary -->
 
 
 
 
  |