You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.
I need to track down the code around the shipping info on page 1 of checkout. Basically i want to shove it inside a div tag so i can make it disappear unless required
Offline
Looking at it, the billing form and the shipping form are the same code in the ste_chkout.pl file, so i can't put a div around just the shipping form...
Offline
You could get a DIV tag around the shipping information table with a bit of PERL coding, if you're comfortable with such. In ste_chkout.pl, in the subroutine ste_chkout_intro_table_proc, look for the code:
#########
######### Print the table header.
#########
if ($caller eq "A") {
print <<ENDOFTEXT;
<BR>
<CENTER>
<TABLE WIDTH="$html_content_table_size" COLS="2" CELLPADDING="10" CELLSPACING="3">
ENDOFTEXT
} else {
print <<ENDOFTEXT;
<BR>
<CENTER>
<TABLE WIDTH="$html_content_table_size" COLS="2" CELLPADDING="10" CELLSPACING="3">
ENDOFTEXT
} ######### End of if statement.To put in the DIV tag, only for the shipping information fields, you could do something like this:
#########
######### Print the table header.
#########
if ($caller eq "A") {
print <<ENDOFTEXT;
<BR>
<CENTER>
<TABLE WIDTH="$html_content_table_size" COLS="2" CELLPADDING="10" CELLSPACING="3">
ENDOFTEXT
} elsif ($caller eq "S") {
print <<ENDOFTEXT;
<DIV ID="Whatever">
<BR>
<CENTER>
<TABLE WIDTH="$html_content_table_size" COLS="2" CELLPADDING="10" CELLSPACING="3">
ENDOFTEXT
} else {
print <<ENDOFTEXT;
<BR>
<CENTER>
<TABLE WIDTH="$html_content_table_size" COLS="2" CELLPADDING="10" CELLSPACING="3">
ENDOFTEXT
} ######### End of if statement.Then, to close the DIV tag, look a little further down in the same subroutine for the code:
#########
######### Print the table header.
#########
print <<ENDOFTEXT;
</TABLE>
</CENTER>
<BR>
ENDOFTEXT
&initialize_sub_remove('ste_chkout_intro_table_proc');
And add in an if statement to add the closing DIV tag if the caller is 'S', like:
#########
######### Print the table header.
#########
print <<ENDOFTEXT;
</TABLE>
</CENTER>
<BR>
ENDOFTEXT
if ($caller eq "S") {
print "</DIV>";
} ## End of if statement
&initialize_sub_remove('ste_chkout_intro_table_proc');
This is untested, so make sure you check it out first before taking it live. But I have a pretty high confidence level in the code, so it's worth a shot. Good luck!
Offline
Nice one Rachael! The only thing is i would now need the radio options that select whether to use billing or new shipping info moved above that div...
Offline
Thanks! I see what you're trying to do now... hide the shipping fields until they change the radio button, right? If that's what you're after, then try it this way instead. Undo the first mods if you did it, as this one is a bit different. Start by finding this code (same sub as before):
if ($caller eq "S" && $fd_func eq "ste_chkout_intro") {
if ($ship_items_found eq "1") {
&display_print('ste_shipinfotys');
} else {
&display_print('ste_shipinfoty');
} ######### End of if statement.
$row_count++;
} ######### End of if statement.And change that to:
if ($caller eq "S" && $fd_func eq "ste_chkout_intro") {
if ($ship_items_found eq "1") {
&display_print('ste_shipinfotys');
} else {
&display_print('ste_shipinfoty');
} ######### End of if statement.
$row_count++;
print "<DIV ID=\"Whatever\">";
} ######### End of if statement.Then, further toward the end of the sub, find:
} ######### End of if statement. } ######### End of foreach statement. ######### ######### Print the table header. ######### print <<ENDOFTEXT; </TABLE> </CENTER> <BR> ENDOFTEXT
Change that code to:
} ######### End of if statement.
} ######### End of foreach statement.
if ($caller eq "S" && $fd_func eq "ste_chkout_intro") {
print "</DIV>";
} ## end of if statement
#########
######### Print the table header.
#########
print <<ENDOFTEXT;
</TABLE>
</CENTER>
<BR>
ENDOFTEXTThat should put the DIV around just the table rows that contain the shipping information fields. Once again untested code, but should work. Make sure to check for valid HTML. I believe where I put the DIV tags should make all the TR and TD tags correct, but double check it once you do the mod.
Rachael
Offline
Hi,
This looks like a great mod.
What else do you need to do, to make the shipping details show when the radio bitton is selected?
Cheers
Charlie
Offline
Thanks purrfect rachael
Had to change it by getting rid of the div, closing the previous table ,adding a new table and setting the display:none to the new table.
One thing though, now the cells in the shipping form in firefox are bunched in the middle and don't span the whole table. Weird, can't see why this would be the code looks the same as the table above...
Celdirect, basically using a tiny bit of javascript in header to change the state of the table's display from none to block. And using the call to that function as an onclick on the radio buttons when selecting whether to use bill/ship
Offline
Can anyone post the final code to make this work with the radio buttons in both firefox and IE properly?
Offline