discount voucher script not working
i have script doesnt work ....(when doesnt work...nothing happens when add discount code , submit page)
in backend want able add own codes script either discounts set fee or percentage
for example
ds123%10
for %10
ds345£10
for £10
on shopping cart have following
mysql_select_db($database_lotties, $lotties);
$query_rsvoucher = "select * lottie_vouchercode";
$rsvoucher = mysql_query($query_rsvoucher, $lotties) or die(mysql_error());
$row_rsvoucher = mysql_fetch_assoc($rsvoucher);
$totalrows_rsvoucher = mysql_num_rows($rsvoucher);
// voucher code
if (isset($_post['vouchcode']) && $_post['vouchcode'] == $row_rsvoucher['vcode']) {
$mycode = $row_rsvoucher['vcode'];
$spos = strpos($mycode, "%");
if ($spos !== false) {
$myvalue = substr($mycode, $spos+1);
$myvalue = $xcart_sumtotal * $myvalue / 100;
} else {
$spos = strpos($mycode, "£");
if ($spos !== false) {
$myvalue = substr($mycode, $spos+1);
}
}
$mytotal = $xcart_sumtotal - $myvalue;
$_session['vouchcode'] = $myvalue;
} else unset($_session['vouchcode']);
then form
<td><input type="text" name="vouchcode" value="<?php echo @$_post['vouchcode']; ?>" size="32" /></td>
<td><input type="submit" value="update" /></td>
once form has been submitted echo shown
<?php echo doformatcurrency($myvalue, 2, ',', '.', '£ ', ''); ?>
if working should sent checkout....
thanks in advance
More discussions in Develop server-side applications in Dreamweaver
adobe
Comments
Post a Comment