close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Optionnal charges

Thread began 5/25/2009 12:15 am by vandenheuvel.claude346907 | Last modified 5/26/2009 11:46 pm by vandenheuvel.claude346907 | 2431 views | 6 replies |

vandenheuvel.claude346907

Optionnal charges

Hi
I would like to have an optionnal charges with radio button "yes" & "no"
so i apply on the Ecart Merchandissing Rule the condition "Based on session variable value" and i've done on the cart page :

the session is
<?php
if (!session_id()) session_start();
if(!isset($_SESSION["choix"])) {
$_SESSION["choix"] = "".((isset($_POST["choix"]))?$_POST["choix"]:"") ."";
}
?>
the radio button :
oui : <input type="radio" name="choix" value="1" checked/><br>
non : <input type="radio" name="choix" value="0" />

the function call :
function WAEC_PIERROT_Assurance() {
$totalTax = 0;
if (true && (((isset($_SESSION['choix'])?$_SESSION['choix']:"") == "1"))) {
$totalTax += ($this->TotalColumn("TotalPrice") * 0.0285);//Result
}
return WA_eCart_FormatNumber($totalTax, $this->ForceDecimalsC, $this->DecimalPlacesC);
}

but it doesn't work : no caluculation apply
Do you have an idea ?

Sign in to reply to this post

Ray BorduinWebAssist

The trigger for the set session value is wrong.

It is set to " if session does not exist " which means it is created as zero the first time someone visits the page and is not updated.

Instead use the lightning bolt and trigger off of the radio button itself. It will look like:

<?php
if (!session_id()) session_start();
if(((isset($_POST["choix"]))?$_POST["choix"]:"") != "") {
$_SESSION["choix"] = "".((isset($_POST["choix"]))?$_POST["choix"]:"") ."";
}
?>

Sign in to reply to this post
Did this help? Tips are appreciated...

vandenheuvel.claude346907

sorry doen'st work,

do i've to do something to post the raio button value ?

Sign in to reply to this post

Ray BorduinWebAssist

No it should work.

Add some debug code:

<?php
if (!session_id()) session_start();
if(!isset($_SESSION["choix"])) {
die("Session set to: " . $_POST["choix"]);
$_SESSION["choix"] = "".((isset($_POST["choix"]))?$_POST["choix"]:"") ."";
}
?>

Is your form method="post"... do you have this page specified as the form action?

Sign in to reply to this post
Did this help? Tips are appreciated...

vandenheuvel.claude346907

my apologies,

i've made a mistake, the optional taxe rule is ok, but now i've an over problem
when i clic to valid the cart it says :
________________________________

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/xxxxxxxxxxxxxxxxxx/line xx
________________________________

this line correspond of :
<?php
// WA eCart Redirect
if ($PIERROT->redirStr != "") {
header("Location: ".$PIERROT->redirStr);
}
?>

for the form the code is :
_________________________________
<form action="<?php echo ($_SERVER["PHP_SELF"].(isset($_SERVER["QUERY_STRING"])?"?".htmlentities($_SERVER["QUERY_STRING"]):""));?>" method="post" >
_________________________________

??????????????

Sign in to reply to this post

Ray BorduinWebAssist

This usually means you have a blank line of code, or content before the redirect.

So the page: by (output started at /var/www/vhosts/xxxxxxxxxxxxxxxxxx/line xx

that is where the line of code you referenced. This error should reference two lines of code. The code where the error occurred, and the line where the output started. Usually the correction is made in the line where the output started... if you send both lines then I could suggest which to update and to what.

Sign in to reply to this post
Did this help? Tips are appreciated...

vandenheuvel.claude346907

Thank you Ray, it's ok

I switched two lines so that it works

Best regards

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...