
NFD
Members-
Posts
44 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
NFD's Achievements

Member (2/5)
0
Reputation
-
Ok, I am now using the following: <SCRIPT> function reloadRadio(form){ var val=form.cat.value; self.location='index.php?cat=' + val ; } </SCRIPT> and <!-- BEGIN: loop --> <input type="radio" name="cat" id="cat" value="{TXT_TOP_LEVEL_CATEGORY_ID}" onClick="reloadRadio(this.form)" {RADIO_CHECKED} > {TXT_TOP_LEVEL_CATEGORY_NAME} <!-- END: loop --> All works how I want, with one exception : its not picking up on the value. What am I doing wrong here?
-
Hi, Currently I use these two snippets: <SCRIPT language=JavaScript> function reload(form) { var val=form.cat.options[form.cat.options.selectedIndex].value; self.location='index.php?cat=' + val ; } </script> and <select name="cat" onchange="reload(this.form)" class="dropDown" > <!-- BEGIN: loop --> <option value="{TXT_TOP_LEVEL_CATEGORY_ID}" {TOP_LEVEL_SELECTED}>{TXT_TOP_LEVEL_CATEGORY_NAME}</option> <!-- END: loop --> </select> Now what I want to do is instead of using the drop downs, is replace them with radio buttons. What is the best way of going about this?
-
That is exactly what I needed! Thank you so very much! Now I do indeed have an id and the quantity to work with for each option. Again, thank you, very much appreciated
-
Hi, Got a bit of an interesting problem here regarding quantity fields on a dynamically generated form in a shopping cart. On the view product page, what I am trying to do is have it so there is a form a customer can fill out specifying a quantity for each option available. All options relate directly to the product being viewed. e.g. 1 x red colored widget 5 x black colored widgets 0 x white colored widgets 2 x blue colored widgets Here is the query I am currently running to retrieve the available options for a product: if($prodArray == TRUE && $prodArray[0]['subOptionsStatus']==1){ $subOptionsQuery = "SELECT * FROM ".$glob['dbprefix']."inventory_sub_options WHERE subOptionStatus = 1 AND subOptionProductId = ".$db->mySQLSafe($_GET['productId'])." ORDER BY subOptionIdSortId "; $subOptionsResults = $db->select($subOptionsQuery); } if($subOptionsResults == TRUE){ for ($i=0; $i<count($subOptionsResults); $i++){ $view_prod->assign("VAL_SUB_OPTION_ID", $subOptionsResults[$i]['subOptionId']); $view_prod->assign("VAL_SUB_OPTION_GENDER", $subOptionsResults[$i]['subOptionGender']); $view_prod->assign("VAL_SUB_OPTION_COLOR", $subOptionsResults[$i]['subOptionColor']); $view_prod->assign("VAL_SUB_OPTION_STYLE", $subOptionsResults[$i]['subOptionStyle']); $view_prod->assign("VAL_SUB_OPTION_SIZE", $subOptionsResults[$i]['subOptionSize']); $view_prod->assign("VAL_SUB_OPTION_PRICE", priceFormat($subOptionsResults[$i]['subOptionPrice'])); $view_prod->parse("view_prod.prod_true.sub_options.sub_option_loop"); } $view_prod->parse("view_prod.prod_true.sub_options"); } That so far does exactly what I want. Then there is the html for the form itself. Here is what I currently have: <table cellpadding="0" cellspacing="0" width="100%" border="1"> <tr> <td align="center" colspan="6"><strong>Title Goes Here</strong></td> </tr> <tr> <td align="center"><strong>Gender</strong></td> <td align="center"><strong>Color</strong></td> <td align="center"><strong>Style</strong></td> <td align="center"><strong>Size</strong></td> <td align="center"><strong>Price</strong></td> <td align="center"><strong>Qty</strong></td> </tr> <!-- BEGIN: sub_option_loop --> <tr> <td align="center">{VAL_SUB_OPTION_GENDER}</td> <td align="center">{VAL_SUB_OPTION_COLOR}</td> <td align="center">{VAL_SUB_OPTION_STYLE}</td> <td align="center">{VAL_SUB_OPTION_SIZE}</td> <td align="center">{VAL_SUB_OPTION_PRICE}</td> <td align="center"> <input name="subOptionQuantity[]" type="text" value="0" size="2" class="textbox" style="text-align:center;" /> <input type="hidden" name="multiadd" value="{VAL_SUB_OPTION_ID}" /> </td> </tr> <!-- END: sub_option_loop --> <input type="hidden" name="multiAddMaster" value="{PRODUCT_ID}" /> </table> Now I don't think that is quite correct when it comes to the fields themselves, but visually it achieves what I want to be displayed. Finally, there is the code to run when the form itself gets submitted. The standard code for just a single product is like this: if(isset($_POST['add']) && $_POST['add']>0) { // add product to the cart if($_POST['quan']>0){ $quantity = ceil($_POST['quan']); } else { $quantity = 1; } } As above, that is simply how it adds a single product based off quantity entered. Obviously it does more after all that, but i am just trying to get the initial stage working first. My 2 questions are: 1. What changes need to be made to the HTML code I am currently using? 2. How do I do the add quantity for each one specified in the form using the above as an example? If the quantity is at 0, I want it ignored. If the quantity is greater than 0, its to be added as its own entry. Once I get past this initial stage, I am hoping it ends up basically adding each as its own product to the cart. Any help provided getting started here would be greatly appreciated.
-
This originally started here: http://www.phpfreaks.com/forums/index.php/topic,204898.0.html and has progressed now into purely a javascript problem I need help with. I am having one last issue with getting a field update working correctly. i.e. When I selection an option from a drop down list, I need it to fill out details in a form from a php array. In firefox, this works perfectly. In IE however, it doesn't appear to do anything. Here is a small snippet of the javascript I am using: <script type="text/javascript"> function data_copy_address_{VAL_AA_SID}() { document.getElementById('title').value = "{VAL_AA_TITLE}"; document.getElementById('firstName').value = "{VAL_AA_FIRST_NAME}"; document.getElementById('lastName').value = "{VAL_AA_LAST_NAME}"; document.getElementById('add_1').value = "{VAL_AA_ADDRESS_1}"; document.getElementById('add_2').value = "{VAL_AA_ADDRESS_2}"; document.getElementById('town').value = "{VAL_AA_CITY}"; document.getElementById('county').value = "{VAL_AA_STATE}"; document.getElementById('postcode').value = "{VAL_AA_ZIP}"; document.getElementById('country').value = "{VAL_AA_COUNTRY_NAME}"; } </script> Here is an example of a form field to be filled: <td><input name="delInf[title]" type="text" class="textbox" id="title" value="{VAL_DEL_TITLE}" size="7" maxlength="30" /> And here is the select itself: <select name="addresses" id="addresses" class="textbox"> <option value="0">Please select...</option> <!-- BEGIN: addresses_loop --> <option onclick="data_copy_address_{VAL_AA_SID}()" value="{VAL_AA_SID}">{VAL_AA_TITLE} {VAL_AA_FIRST_NAME} {VAL_AA_LAST_NAME},{VAL_AA_ADDRESS_1} {VAL_AA_ADDRESS_2} {VAL_AA_CITY}, {VAL_AA_STATE}, {VAL_AA_ZIP}, {VAL_AA_COUNTRY_NAME}</option> <!-- END: addresses_loop --> <option onclick="data_copy_address_clear()" value="clear">Clear above and manually enter address</option> <option onclick="data_copy_address_default()" value="default">Deliver to invoice address</option> </select> I have since learned that IE wont process the onclicks assigned to an option and therefore populate the fields. If I use something like: <select name="addresses" id="addresses" class="textbox" onchange="data_copy_address_{VAL_AA_SID}()"> that then inserts the data from the last entry in the array only. Would it be possible to have either a dummy kind of call there that then forces IE to use the onclicks? Or would it be possible to have something like: onchange="data_copy_address_()" on the select and then have the ID of the option clicked passed to the JS itself? i.e. If option id '2' (via {VAL_AA_SID}) is selected it then runs: function data_copy_address_({VAL_AA_SID}) { document.getElementById('title').value = "{VAL_AA_TITLE}"; document.getElementById('firstName').value = "{VAL_AA_FIRST_NAME}"; document.getElementById('lastName').value = "{VAL_AA_LAST_NAME}"; document.getElementById('add_1').value = "{VAL_AA_ADDRESS_1}"; document.getElementById('add_2').value = "{VAL_AA_ADDRESS_2}"; document.getElementById('town').value = "{VAL_AA_CITY}"; document.getElementById('county').value = "{VAL_AA_STATE}"; document.getElementById('postcode').value = "{VAL_AA_ZIP}"; document.getElementById('country').value = "{VAL_AA_COUNTRY_NAME}"; } Or something along those lines?
-
Alrighty, I will try that. Thank you for all your help getting this far
-
Alrighty.... I have now got this working exactly how I want in Firefox, but of course it fails in IE. Java Snippet: <script type="text/javascript"> function data_copy_address_{VAL_AA_SID}() { document.getElementById('title').value = "{VAL_AA_TITLE}"; document.getElementById('firstName').value = "{VAL_AA_FIRST_NAME}"; document.getElementById('lastName').value = "{VAL_AA_LAST_NAME}"; document.getElementById('add_1').value = "{VAL_AA_ADDRESS_1}"; document.getElementById('add_2').value = "{VAL_AA_ADDRESS_2}"; document.getElementById('town').value = "{VAL_AA_CITY}"; document.getElementById('county').value = "{VAL_AA_STATE}"; document.getElementById('postcode').value = "{VAL_AA_ZIP}"; document.getElementById('country').value = "{VAL_AA_COUNTRY_NAME}"; } </script> Form Field Example: <td><input name="delInf[title]" type="text" class="textbox" id="title" value="{VAL_DEL_TITLE}" size="7" maxlength="30" /> Drop Down Code: <select name="addresses" id="addresses" class="textbox"> <option value="0">Please select...</option> <!-- BEGIN: addresses_loop --> <option onclick="data_copy_address_{VAL_AA_SID}()" value="{VAL_AA_SID}">{VAL_AA_TITLE} {VAL_AA_FIRST_NAME} {VAL_AA_LAST_NAME},{VAL_AA_ADDRESS_1} {VAL_AA_ADDRESS_2} {VAL_AA_CITY}, {VAL_AA_STATE}, {VAL_AA_ZIP}, {VAL_AA_COUNTRY_NAME}</option> <!-- END: addresses_loop --> <option onclick="data_copy_address_clear()" value="clear">Clear above and manually enter address</option> </select> So as above it works perfectly in Firefox. I just need to get it to work in IE. Any pointers?
-
Thanks for that, very much appreciated. Then the last thing I need to get this all working so I can retain the current field names, which are required as part of the form processing, is there a way to use these type of labels: delInf[postcode] i.e. $value = formname.fieldname.value="empty"; becomes $value = formname.delInf[postcode].value="empty"; Is there a way of doing that?
-
Thanks for the suggestion I just took a quick look at innerHTML, and have a couple questions. On the surface I can use that to create the dynamic ids, and then do the change, so thats good as I can retain the names for each field. I see I can use it change things like the ahref values (url, target, text etc) but how would I get it change the value of value="" which isn't a link but is the form value?
-
Once last attempt for the night...any advice would be great Now using a drop down instead of radio buttons. Very basic javascript: <script type="text/javascript"> function data_copy_address() { document.cart.title.value="YES"; } </script> New html: <td colspan="2">Ship to this address:<br> <select name="addresses" id="addresses" onchange="data_copy_address()" class="textbox"> <option value="0">Please select...</option> <!-- BEGIN: addresses_loop --> <option value="{VAL_AA_SID}">{VAL_AA_TITLE} {VAL_AA_FIRST_NAME} {VAL_AA_LAST_NAME},{VAL_AA_ADDRESS_1} {VAL_AA_ADDRESS_2} {VAL_AA_CITY}, {VAL_AA_STATE}, {VAL_AA_ZIP}, {VAL_AA_COUNTRY_NAME}</option> <!-- END: addresses_loop --> </select> </td> So now all I need to know is: - the best way to have the correct fields retrieved based off what option was selected in the drop down - if I can either use "delInf[title]" for field names or use just "title" but it auto copies the value to a hidden field called "delInf[title]".
-
Another method I attempted is.... Javascript: <!-- BEGIN: js --> <!-- BEGIN: addresses_loop_js --> <script type="text/javascript"> function data_copy{VAL_AA_SID}() { if(document.cart.copy[0].checked){ document.cart.title.value="{VAL_AA_TITLE}"; document.cart.firstname.value="{VAL_AA_FIRST_NAME}"; document.cart.lastname.value="{VAL_AA_LAST_NAME}"; document.cart.add_1.value="{VAL_AA_ADDRESS_1}"; document.cart.add_2.value="{VAL_AA_ADDRESS_2}"; document.cart.town.value="{VAL_AA_CITY}"; document.cart.county.value="{VAL_AA_STATE}"; document.cart.postcode.value="{VAL_AA_ZIP}"; document.cart.country.value="{VAL_AA_COUNTRY_NAME}"; } </script> <!-- END: addresses_loop_js --> <!-- END: js --> Inputs: <!-- BEGIN: addresses_loop --> <input type=radio name=copy value='yes' onclick="data_copy{VAL_AA_SID}()";><i>Ship to :</i><br> <!-- END: addresses_loop --> Now using that method, I can look at the source and see that: - both the js loop and the input loops are created - both get the correct name assigned - the data is there in the js loop But when I goto use the radio button itself, the data doesn't get populated. If I am going about this completely the wrong way, please feel free to point me in the correct direction.
-
Hi, What I am basically trying to do here is when a user selects a radio button, it changes the values of other fields. More specifically, when they select the radio button to use X address, the details for X get auto filled into the relevant fields. Here is the PHP snippet that fetches the available address: $additionalAddressesQuery = "SELECT * FROM ".$glob['dbprefix']."Cube_Addship WHERE customerid = '".$ccUserData[0]['customer_id']."'"; $additionalAddresses = $db->select($additionalAddressesQuery); if($additionalAddresses==TRUE){ for($i=0; $i<count($additionalAddresses); $i++){ $view_cart->assign("VAL_AA_SID",$additionalAddresses[$i]['sid']); $view_cart->assign("VAL_AA_CUSTOMERID",$additionalAddresses[$i]['customerid']); $view_cart->assign("VAL_AA_TITLE",$additionalAddresses[$i]['stitle']); $view_cart->assign("VAL_AA_FIRST_NAME",$additionalAddresses[$i]['sfirstname']); $view_cart->assign("VAL_AA_LAST_NAME",$additionalAddresses[$i]['slastname']); $view_cart->assign("VAL_AA_ADDRESS_1",$additionalAddresses[$i]['sadd']); $view_cart->assign("VAL_AA_ADDRESS_2",$additionalAddresses[$i]['sadd2']); $view_cart->assign("VAL_AA_CITY",$additionalAddresses[$i]['scity']); $view_cart->assign("VAL_AA_STATE",$additionalAddresses[$i]['sstate']); $view_cart->assign("VAL_AA_ZIP",$additionalAddresses[$i]['szip']); $view_cart->assign("VAL_AA_COUNTRY_NAME",countryName($additionalAddresses[$i]['scountry'])); $view_cart->assign("VAL_AA_COUNTRY_ID",$additionalAddresses[$i]['scountry']); $view_cart->parse("view_cart.cart_true.step_3.additional_adresses.js.addresses_loop_js"); $view_cart->parse("view_cart.cart_true.step_3.additional_adresses.addresses_loop"); } $view_cart->parse("view_cart.cart_true.step_3.additional_adresses.js"); $view_cart->parse("view_cart.cart_true.step_3.additional_adresses"); } Here is a couple of the fields I am looking at populating upon selection: <tr> <td><strong>{TXT_FIRST_NAME}</strong></td> <td><input name="delInf[firstname]" type="text" class="textbox" id="firstname" value="{VAL_DEL_FIRST_NAME}" maxlength="100" /></td> </tr> <tr> <td><strong>{TXT_LAST_NAME}</strong></td> <td><input name="delInf[lastname]" type="text" class="textbox" id="lastname" value="{VAL_DEL_LAST_NAME}" maxlength="100" /></td> </tr> Here is the inputs I am currently using to make the selection: <input type=radio name=copy value='yes' onclick="data_copy()";><i>Ship to :</i><br> <input type=radio name=copy value='no' onclick="data_copy()";><i>Clear above, enter shipping address.</i> And lastly, here is the javascript currently used to perform the population: <!-- BEGIN: js --> <script type="text/javascript"> function data_copy() { <!-- BEGIN: addresses_loop_js --> if(document.cart.copy[{VAL_AA_SID}].checked){ document.cart.delInf[title].value="{VAL_AA_TITLE}"; document.cart.delInf[firstname].value="{VAL_AA_FIRST_NAME}"; document.cart.delInf[lastname].value="{VAL_AA_LAST_NAME}"; document.cart.delInf[add_1].value="{VAL_AA_ADDRESS_1}"; document.cart.delInf[add_2].value="{VAL_AA_ADDRESS_2}"; document.cart.delInf[town].value="{VAL_AA_CITY}"; document.cart.delInf[county].value="{VAL_AA_STATE}"; document.cart.delInf[postcode].value="{VAL_AA_ZIP}"; document.cart.delInf[country].value="{VAL_AA_COUNTRY_NAME}"; } <!-- END: addresses_loop_js --> </script> <!-- END: js --> Now obviously, this is not working as I need it to. Actually, it doesn't work at all! One problem I think I have is using "delInf[country]" in the javascript. This bit I should be able to counter by renaming those to simply "country" for example. The main problem I am having is getting the loop itself to match up with the inputs and getting all inputs to work. Any assistance that could be provided here would be highly appreciated.
-
Hi, What I am trying to do is update one field on one table based upon a match of anoother field on another table. Here is my initial query (at this stage entered via phpmyadmin): UPDATE `table1` SET `test_id` = 'table2.test_id' WHERE `group` = 'table2.group' ; Whilst the query itself runs, it affects 0 rows which is unexpected as there are 2000+ matches. Firstly I need to know what part of the query am I doing incorrectly? Afterwards, I want to have a go at making it a query run as part of a php file that does alot of data inserts first. Any help that can be given would be much appreciated :)
-
Thats Fehnris :) Can you please explain how to put it into a loop that will also update the table?
-
Hi everyone, What I am looking at doing is combining two database fields into one. To explain that better.... I currently have two fields: - date ( int(16) ) e.g. 20050425 - time ( varchar(10) ) e.g. 20:57 What I want is one field: - newtime ( int(10) ) e.g. 1114376220 (unix time stamp) I have around 200+ of these to do and would like to automate the process. Is there a way of reading the two existing fields and converting them into the one field? Thankyou in advance :)