Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

drop down menu for addresses


gazzzzzza

Recommended Posts

I need to alter the way addresses are selected on the checkout shipping and checkout payment pages. I have had a go myself and have created a drop down menu above the button that says 'change address'.

 

The drop down menu I created has the field 'sendto' in it as i believe this is the variable that needs to be set (and is set when you use the normal selection method-i looked on checkout_shipping_address to see what variable it sends).

 

The form is set to submit to 'checkout_shipping.php' - the same page it is on. Therefore I figured that the page would grab the 'sendto' variable and use that to get the delivery address information. (the information that is sent in the sendto variable is equal to each address_book_id)

 

When i run my code I get the list of addresses which is correct but When I submit it, it runs straight through to checkout payment and the delivery address does not change. Do I have to grab the variable myself and set it = to the session variable?

 

I can grab it ($sendto = $_POST['sendto'];) but I'm not sure how to set it as the SESSION var 'sendto' which is what I think the page references...

 

Any help on this matter at all would be gratefully received.

 

My code is below:

 

----------START CODE

 

 

<!-- ADDED NEW FORM HERE -->

 

<br><br>

<form action="checkout_shipping.php" method="post" name="address">

<?

$query1 = "SELECT address_book_id, entry_street_address FROM address_book WHERE customers_id = '$customer_id' ORDER BY entry_street_address ASC";

$result1 = mysql_query($query1) or die ("Couldn't execute query.");

 

echo "<select name='sendto' class='select' value='null'>\n";

echo "<option value='' class='option' selected>Select a different delivery address....\n";

while ($row = mysql_fetch_array($result1)) {

 

$address_book_id = $row["address_book_id"];

$entry_street_address = $row["entry_street_address"];

 

echo "<option value='$address_book_id' class='option'>$entry_street_address\n"; }

echo "</select>\n"; ?>

 

<br><br>

<input type="submit" name="submitButtonName" value="Change Address" border="0" class="formfieldbutton">

 

<!-- END ADD NEW FORM -->

 

----------END CODE

always here to offer some useless advice....

Link to comment
Share on other sites

i'm not sure where or why you would want to on that page?

but im sure you could try it!

there is nothing to select there...its all text input fields

always here to offer some useless advice....

Link to comment
Share on other sites

hmmm edit function ^^ wudnt let me edit :angry:

 

 

anyways

 

here is the code

 

---- START CODE

 

<?

/* CREATES NEW FORM ON PAGE SPECIALLY FOR ADDRESS CHANGING

YOU MAY HAVE TO MOVE THE OTHER FORM CREATION FUCNTION TO BELOW THIS FORM COS IT MAY MESS IT UP */

?>

 

 

<form action="checkout_shipping.php" method="post" name="address_change">

<?

 

// SELECT ADDRESSES FOR THE CUSTOMER AND CREATE A DROP DOWN LIST USING THE RESULTS

 

// THE DROP DOWN IS SETUP TO AUTOMATICALLY SEND WHEN AN ADDRESS IS SELECTED

 

$query1 = "SELECT address_book_id, entry_street_address FROM address_book WHERE customers_id = '$customer_id' ORDER BY entry_street_address ASC";

$result1 = mysql_query($query1) or die ("Couldn't execute query.");

echo "<select name=\"address_select\" class=\"select' value=\"null\" onChange=\"document.address_change.submit()\" >\n";

echo "<option value=\"\" class=\"option\" selected>Select a different delivery address....\n"; while ($row = mysql_fetch_array($result1)) {

$address_book_id = $row["address_book_id"];

$entry_street_address = $row["entry_street_address"];

echo "<option value='$address_book_id' class='option'>$entry_street_address\n"; } echo "</select>\n"; ?>

 

/* BELOW IS A NORMAL BUTTON SELECTION METHOD - THIS CAN BE USED INSTEAD OF AUTO */

 

<!--<br><br><input type="submit" name="submitButtonName" value="Change Address" border="0" class="formfieldbutton">-->

<!--<?php echo '<br><br><a href="java script: document.forms[1].submit()">' . tep_image_button('button_change_address.gif', IMAGE_BUTTON_CHANGE_ADDRESS) . '</a>'; ?>-->

 

</form>

 

------ END CODE

always here to offer some useless advice....

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...