PDA

View Full Version : Displaying Shipping Options with Radio Buttons


Jethro
15-Dec-2005, 02:24 PM
I would like to display the shipping options in a table if possible or at least, with radio button selection as you can with an attribute. Can anyone shed any light on how to this? Any help much appreciated.

Jethro

NormanRouxel
15-Dec-2005, 03:56 PM
It looks like this one is hard coded into ShippngTemplate.pl in the Site1\ShipControl folder - lines 429 - 467. It could be changed but would require a bit of Perl skill.

NormanRouxel
15-Dec-2005, 04:19 PM
Edit ShippingTemplate.pl in the Site1\ShipControl folder (back it up first)

Replace

#
# Start the SELECT tag
#
$sSelectHTML = "<SELECT ID='lstClass' NAME='ShippingClass'>\n";
foreach $phashShipping (@::s_arrSortedShippingHashes) # for each shipping option
{
#
# Handle the label by appending the cost if we're displaying prices
#
$sClassLabel = $$phashShipping{ShippingLabel};
if ($::s_Ship_bDisplayPrices) # displaying prices?
{
my (@PriceResponse) =
ActinicOrder::FormatPrice($$phashShipping{Cost},
$::TRUE,
\%::s_Ship_PriceFormatBlob);

$sClassLabel .= sprintf($sPriceLabelFormat, $PriceResponse[2]); # add the price to the label
}
#
# Set the SELECTED attribute
#
$sClassID = $$phashShipping{ShippingClass};

my $sSelected =
($sClassID eq $::s_hashShipData{'ShippingClass'}) ? # if this one is the current selection
'SELECTED ': # make it the selected value else
''; # just another value
#
# Format as an OPTION tag
#
$sSelectHTML .= sprintf("<OPTION %s Value='%s'>%s\n",
$sSelected, $sClassID, $sClassLabel);
}
#
# End the SELECT tag
#
$sSelectHTML .= "</SELECT>\n";
}

with

#
# Start the RADIO list
#
$sSelectHTML = '';
foreach $phashShipping (@::s_arrSortedShippingHashes) # for each shipping option
{
#
# Handle the label by appending the cost if we're displaying prices
#
$sClassLabel = $$phashShipping{ShippingLabel};
if ($::s_Ship_bDisplayPrices) # displaying prices?
{
my (@PriceResponse) =
ActinicOrder::FormatPrice($$phashShipping{Cost},
$::TRUE,
\%::s_Ship_PriceFormatBlob);

$sClassLabel .= sprintf($sPriceLabelFormat, $PriceResponse[2]); # add the price to the label
}
#
# Set the CHECKED attribute
#
$sClassID = $$phashShipping{ShippingClass};

my $sSelected =
($sClassID eq $::s_hashShipData{'ShippingClass'}) ? # if this one is the current selection
'checked ': # make it the selected value else
''; # just another value
#
# Format as an RADIO tag
#
$sSelectHTML .= sprintf("<input type='radio' %s NAME='ShippingClass' Value='%s'>%s\n",
$sSelected, $sClassID, $sClassLabel);
}
}

If you want each choice on a separate line then change

$sSelectHTML .= sprintf("<input type='radio' %s NAME='ShippingClass' Value='%s'>%s\n",

to be

$sSelectHTML .= sprintf("<input type='radio' %s NAME='ShippingClass' Value='%s'>%s<br>\n",

Jethro
16-Dec-2005, 03:34 PM
Thanks for your reply, I will give it a go.

Jethro

jxm28788
20-Mar-2011, 12:13 PM
Edit ShippingTemplate.pl in the Site1\ShipControl folder...

Thanks, I've tried this and it's just what I wanted - except for one small glitch.

Although the window is plenty wide enough it's wrapping the shipping type descriptions onto two lines.

(see attachment)

I've had a look at the templates, and the .pl file and I can't see where it's setting the width.

Any ideas how to stop this? It's not like there's a shortage of space there!

leehack
20-Mar-2011, 03:55 PM
That will be the html, not the perl doing the sizes, if you firebug the live code it will show you the relevant coding for that part, I'd expect a 2 column table by the looks of it, set your preferred width on the <td>.

jxm28788
20-Mar-2011, 04:06 PM
Yes, but the problem is, where's the html code in actinic?

oh wait, think I just found it in a really obvious place...:o

Duncan Rounding
20-Mar-2011, 04:13 PM
I would expect this is in a table towards the bottom of Act_Order01.html

jxm28788
20-Mar-2011, 04:17 PM
Yes, that would be where I would expect to find it... but it was in the Act_ShippingSelectTemplate.html template...

Problem solved!

Thanks.

jxm28788
09-Apr-2011, 08:47 AM
Is there a similar fix for the country dropdown on the first page?