J1mmy
03-13-2007, 05:41 PM
I have a script which requires a minor modification to be made and I have been quoted £30/$60 for this modification to be done. The work will be done by the publisher themselves, so its a bit of a monopoly. Though, they are fine with myself altering it.
Well, its s checkout script, the section requiring mofdification is the discount part. Right now, the discount is applied to everything - the grand total. However, insted, I would like the discount to be only applied to one item through the checkout.
For eg, lets say, the script is for web hosting. First the customer selects the domain, then a package, then any extras, then checkout. So I would like this discount code to take affect on the web hosting price only - not the grand total as it is currently configured.
Here is the Code that needs to be editted:
<?php
$empty = mysql_db_query($db, "delete from table_discountlog where identifier='$my_session'", $connection);
check_mysql($empty);
# CHECK FOR ACCOUNT TYPE DISCOUNT
$query = mysql_db_query($db, "SELECT inddiscount from table_customers where username='$username'", $connection);
while ($row = mysql_fetch_array($query)) {
$inddiscount = $row["inddiscount"];
}
if($inddiscount > 0) { $first_discount = ($total_price/100) * $inddiscount; }
# CHECK FOR SET FEE DISCOUNTS
$query = mysql_db_query($db, "SELECT discount from table_discounts where type='Set Fee' and code='$discount'", $connection);
while ($row = mysql_fetch_array($query)) {
$set_discount_value = $row["discount"];
}
if($set_discount_value > 0) { $second_discount = $set_discount_value; }
# CHECK FOR PERCENTAGE DISCOUNTS
$query = mysql_db_query($db, "SELECT discount from table_discounts where type='Percentage' and code='$discount'", $connection);
while ($row = mysql_fetch_array($query)) {
$discount_value = $row["discount"];
}
if($discount_value > 0) { $third_discount = $total_price * ($discount_value/100); }
$total_discount = $first_discount + $second_discount + $third_discount;
# $total_discount = currency_format("%.2f",$total_discount);
if($total_discount > 0) {
$now = time();
$insert = mysql_db_query($db, "INSERT into table_discountlog (discount, identifier, added) VALUES ('$total_discount', '$my_session', '$now')", $connection);
}
?>
So, am I being ripped off for this alteration, or is it something I can do myself. I get help from you guys with :)
Well, its s checkout script, the section requiring mofdification is the discount part. Right now, the discount is applied to everything - the grand total. However, insted, I would like the discount to be only applied to one item through the checkout.
For eg, lets say, the script is for web hosting. First the customer selects the domain, then a package, then any extras, then checkout. So I would like this discount code to take affect on the web hosting price only - not the grand total as it is currently configured.
Here is the Code that needs to be editted:
<?php
$empty = mysql_db_query($db, "delete from table_discountlog where identifier='$my_session'", $connection);
check_mysql($empty);
# CHECK FOR ACCOUNT TYPE DISCOUNT
$query = mysql_db_query($db, "SELECT inddiscount from table_customers where username='$username'", $connection);
while ($row = mysql_fetch_array($query)) {
$inddiscount = $row["inddiscount"];
}
if($inddiscount > 0) { $first_discount = ($total_price/100) * $inddiscount; }
# CHECK FOR SET FEE DISCOUNTS
$query = mysql_db_query($db, "SELECT discount from table_discounts where type='Set Fee' and code='$discount'", $connection);
while ($row = mysql_fetch_array($query)) {
$set_discount_value = $row["discount"];
}
if($set_discount_value > 0) { $second_discount = $set_discount_value; }
# CHECK FOR PERCENTAGE DISCOUNTS
$query = mysql_db_query($db, "SELECT discount from table_discounts where type='Percentage' and code='$discount'", $connection);
while ($row = mysql_fetch_array($query)) {
$discount_value = $row["discount"];
}
if($discount_value > 0) { $third_discount = $total_price * ($discount_value/100); }
$total_discount = $first_discount + $second_discount + $third_discount;
# $total_discount = currency_format("%.2f",$total_discount);
if($total_discount > 0) {
$now = time();
$insert = mysql_db_query($db, "INSERT into table_discountlog (discount, identifier, added) VALUES ('$total_discount', '$my_session', '$now')", $connection);
}
?>
So, am I being ripped off for this alteration, or is it something I can do myself. I get help from you guys with :)