I've searched the forums for help on getting line item data to display via SIM method. I've been able to hardcode the data in and it works just fine, but I need to pull from the shopping cart as it is obviously going to be dynamic and possibly have multiple items.
So far this is what I have come up with that works to display one item, but not multiple...
<input type='hidden' name="x_line_item" value="<?php echo $prodslistpostID; ?><|><?php echo $prodslistitem; ?><|><|><?php echo $prodslistquantity; ?><|><?php echo $prodslistamount; ?><|>Y" />
Any help would be amazing.
03-05-2012 02:56 PM
Here's some code I hacked together quickly. This simulates an array of two items.
<?php
$items = array(
array(
'id' => 'ID1',
'name' => 'Product Name 1',
'description' => 'Product Description 1',
'quantity' => 1,
'price' => '9.99',
'taxable' => 'Y'
),
array(
'id' => 'ID2',
'name' => 'Product Name 2',
'description' => 'Product Description 2',
'quantity' => 1,
'price' => '4.99',
'taxable' => 'Y'
)
);
foreach ($items as $item) {
$line_item = array();
foreach (array('id', 'name', 'description', 'quantity', 'price', 'taxable') as $key)
$line_item[] = $item[$key];
print '<input type="hidden" name="x_line_item" value="' .
implode('<|>', $line_item) .
'">' . "\n";
}
?>
03-05-2012 04:57 PM
Thanks for your help TJ. I think this is getting towards what I need, but not there yet. Basically, I need something that can pull items that have been added to the shopping cart and then post them to the Authorize.net hosted checkout page. This could be anywhere from 1 item to 30 items (so I would need the arrays to generate dynamically as well). I'm using Wordpress with MarketTheme if that helps any.
03-05-2012 05:30 PM
If you can do a print_r() of the item array from your cart, I can maybe write something to adapt that for you.
03-05-2012 09:50 PM
Here is what I got. Thanks again.
Array ( [423] => Array ( [postID] => 423 [quantity] => 1 [shipping] => 4.95 [shipping2] => 0 ) [368] => Array ( [postID] => 368 [quantity] => 1 [shipping] => 4.95 [shipping2] => 0 ) ) Array ( [423] => Array ( [postID] => 423 [quantity] => 1 [shipping] => 4.95 [shipping2] => 0 ) [368] => Array ( [postID] => 368 [quantity] => 1 [shipping] => 4.95 [shipping2] => 0 ) )
03-06-2012 07:35 AM
It's more helpful to view source so it's indented properly, and did you paste or output the same thing twice?
But in any case:
<?php
$items = Array(
'423' => Array(
'postID' => 423,
'quantity' => 1,
'shipping' => 4.95,
'shipping2' => 0,
),
'368' => Array(
'postID' => 368,
'quantity' => 1,
'shipping' => 4.95,
'shipping2' => 0
)
);
foreach ($items as $item) {
$line_item = array();
if (!$item['taxable'])
$item['taxable'] = 'Y';
$item['price'] += $item['shipping'] + $item['shipping2'];
foreach (array('postID', 'name', 'description', 'quantity', 'price', 'taxable') as $key)
$line_item[] = $item[$key];
print '<input type="hidden" name="x_line_item" value="' .
implode('<|>', $line_item) .
'">' . "\n";
}
?>Outputs:
<input type="hidden" name="x_line_item" value="423<|><|><|>1<|>4.95<|>Y"> <input type="hidden" name="x_line_item" value="368<|><|><|>1<|>4.95<|>Y">
You ought to be able to take it from here. If not, study the PHP manual:
03-06-2012 08:58 AM
Unfortunately I'm still not any closer. I'm sure I didn't explain my problem well. Below is the code from my shopping cart. Somehow I need to grab the line item info from here and post it to the authorize.net form.
<?php
session_start();
error_reporting (E_ALL ^ E_NOTICE);
$load = '../../../../wp-load.php';
if (file_exists($load)){
require($load);
} else {
wp_die('Error: wp-load file not found');
}
// Get Session variable data
$LANGUAGE = $_SESSION["LANGUAGE"];
$CURRENCY_SYMBOL = $_SESSION["CURRENCY_SYMBOL"];
$CURRENCY_CODE = $_SESSION["CURRENCY_CODE"];
$PPEmail = $_SESSION["PPEmail"];
$CARTDIR = $_SESSION["CARTDIR"];
$CARTURL = $CARTDIR . "cart.php";
$CHECKOUT_RETURNURL = $_SESSION["POSTSALE_URL"];
require("../language/" . $LANGUAGE . ".php");
// Payment Processing Post URL -- (Enable only one)
$ACTION_URL = "https://www.paypal.com/cgi-bin/webscr"; //Paypal
//$ACTION_URL = "https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/YOURMERCHANTIDHERE"; //Google Checkout (change merch ID)
//TODO: Create Cart Object
$crtQuantity = array();
$crtStockQuantity = array();
$crtAmount = array();
$crtShipping = array();
$crtShipping2 = array();
$crtHandling = array();
$crtHandlingCart = array();
$crtOptions = array();
$PPOptions = array();
//retrieve session Variables
if($_SESSION["Quantity"]){
$crtName = $_SESSION["Name"];
$crtNotes = $_SESSION["Notes"];
$crtPostID = $_SESSION["PostID"];
$crtQuantity = $_SESSION["Quantity"];
$crtStockQuantity = $_SESSION["StockQuantity"];
$crtAmount = $_SESSION["Amount"];
$crtShipping = $_SESSION["Shipping"];
$crtShipping2 = $_SESSION["Shipping2"];
$crtHandling = $_SESSION["Handling"];
$crtHandlingCart = $_SESSION["HandlingCart"];
$crtOptions = $_SESSION["Options"];
$PPOptions = $_SESSION["PPOptions"];
}
//convert strings to integers
function str2int($string, $concat = true) {
$length = strlen($string);
for ($i = 0, $int = '', $concat_flag = true; $i < $length; $i++) {
if (is_numeric($string[$i]) && $concat_flag) {
$int .= $string[$i];
} elseif(!$concat && $concat_flag && strlen($int) > 0) {
$concat_flag = false;
}
}
return (int) $int;
}
//Save Session Variables
function SaveSession($crtName,$crtNotes,$crtPostID,$crtAmount,$crtQuantity,$crtStockQuantity,$crtShipping,$crtShipping2,$crtHandling,$crtHandlingCart,$crtOptions,$PPOptions=' '){
$_SESSION["Name"] = $crtName;
$_SESSION["Notes"] = $crtNotes;
$_SESSION["PostID"] = $crtPostID;
$_SESSION["Quantity"] = $crtQuantity;
$_SESSION["StockQuantity"] = $crtStockQuantity;
$_SESSION["Amount"] = $crtAmount;
$_SESSION["Shipping"] = $crtShipping;
$_SESSION["Shipping2"] = $crtShipping2;
$_SESSION["Handling"] = $crtHandling;
$_SESSION["HandlingCart"] = $crtHandlingCart;
$_SESSION["Options"] = $crtOptions;
$_SESSION["PPOptions"] = $PPOptions;
}
//Monolithic display cart function
function ShowCart($crtName,$crtNotes,$crtPostID,$crtAmount,$crtQuantity,$crtStockQuantity,$crtShipping,$crtShipping2,$crtHandling,$crtHandlingCart,$crtOptions,$PPOptions){
include("cart_top.php");
global $CARTURL,$CURRENCY_SYMBOL,$ACTION_URL,$CHECKOUT_RETURNURL,$CARTDIR;
$checkout = '';
$prods = '';
$i = 1;
$ShippingTotal = 0;
$GrandTotal = 0;
// Calculation of $ShippingTotal - starts
if(!empty($crtPostID))
{
$s_values = array();
foreach( $crtPostID as $item =>$postid )
{
$r = array_key_exists($postid,$s_values);
if(!$r)
{
$s_values[$postid]['postID'] = $crtPostID[$item];
$s_values[$postid]['quantity'] = $crtQuantity[$item];
$s_values[$postid]['shipping'] = $crtShipping[$item];
$s_values[$postid]['shipping2'] = $crtShipping2[$item];
}
else
{
$s_values[$postid]['quantity'] = $s_values[$postid]['quantity'] + $crtQuantity[$item];
}
}
$ShippingTotal = 0;
foreach( $s_values as $postid =>$v )
{
if ($v['quantity'] > 1)
{
$ShippingTotal = $ShippingTotal + $v['shipping'];
$ShippingTotal = $ShippingTotal + (($v['quantity'] - 1) * $v['shipping2']);
}
else
{
$ShippingTotal = $ShippingTotal + $v['shipping'];
}
}
} // End
// Calculation of $ShippingTotal - ends
foreach( $crtAmount as $item =>$amount )
{
$GrandTotal = $GrandTotal + ($crtAmount[$item] * $crtQuantity[$item]);
// Display Comments/Special Instructions Box value
$sp_comments = '';
if (!empty($crtNotes[$item]))
{
$sp_comments = '<br><div style="margin-left: 10px;"><small><a title="'.$crtNotes[$item].'">'.mkt_SHOPCART_ITEM_SPECIAL_INSTRUCTIONS.'</a></small></div>';
}
$mkt_pk_item_amount = $CURRENCY_SYMBOL.number_format((float)($crtAmount[$item] * $crtQuantity[$item]), 2, '.', ',');
$Shipping = 'Shipping: '.$CURRENCY_SYMBOL.$Shipping;
$content .= '<tr id="'.$item.'"><td>'.$crtName[$item].$sp_comments.'</td><td style="text-align:left;">'.$crtOptions[$item].'</td><td style="text-align:center;"><input class="quantity" name="'.$item.'" type="text" value="'.$crtQuantity[$item].'" /></td><td style="text-align:center;"><a href="'.$GLOBALS["CARTURL"].'?remove='.$item.'" class="crtRemove">'.mkt_SHOPCART_ITEM_REMOVE.'</a></td><td style="text-align:right;">'.$mkt_pk_item_amount.'</td></tr>';
if ($crtHandling[$item]){
$Handling = $crtHandling[$item];
if($crtQuantity[$item] > 1){
$Handling += $crtHandlingCart[$item] * ($crtQuantity[$item] - 1);
}
$checkout .='<input type="hidden" name="handling_'.$i.'" value="'.$Handling.'" />';
}
$checkout .='<input type="hidden" name="item_name_'.$i.'" value="'.$crtName[$item].'" />
<input type="hidden" name="amount_'.$i.'" value="'.$crtAmount[$item].'" />
<input type="hidden" name="quantity_'.$i.'" value="'.$crtQuantity[$item].'" />';
// The following 4 inputs are for Google Checkout purposes
$checkout .='<input type="hidden" name="item_description_'.$i.'" value="'.$crtOptions[$item].'" />
<input type="hidden" name="item_quantity_'.$i.'" value="'.$crtQuantity[$item].'" />
<input type="hidden" name="item_price_'.$i.'" value="'.$crtAmount[$item].'" />
<input type="hidden" name="item_currency_'.$i.'" value="'.$GLOBALS["CURRENCY_CODE"].'" />';
// Shipping Calculation for each item - STARTS
$item_shipping_pk = 0;
$mkt_post_id_temp = $crtPostID[$item];
if($s_values[$mkt_post_id_temp]['quantity'] > 1)
{
$item_shipping_pk = $item_shipping_pk + $s_values[$mkt_post_id_temp]['shipping'];
$item_shipping_pk = $item_shipping_pk + (($s_values[$mkt_post_id_temp]['quantity'] - 1) * $s_values[$mkt_post_id_temp]['shipping2']);
}
else
{
$item_shipping_pk = $item_shipping_pk + $s_values[$mkt_post_id_temp]['shipping'];
}
// Shipping Calculation for each item - ENDS
// Set shipping to only 1st item charge
if ($i==1){
$ShippingTotal = $crtShipping[$item];
}
// Create value for inventory control
$mkt_pk_item_amount = (float)($crtAmount[$item] * $crtQuantity[$item]);
$prods = $prods . $crtPostID[$item] . "+:#" . $crtName[$item]. "+:#". $crtOptions[$item]. "+:#" . $crtQuantity[$item]. "+:#" . $mkt_pk_item_amount. "+:#" . $crtNotes[$item] . "+:#";
if ($i < count($crtPostID)) {
// set item shipping to zero, and add separator
$prods = $prods . "0" . "^:*";
} else {
// add total order shipping to last product record
$prods = $prods . $ShippingTotal;
}
++$i;
}
// If no item value, then display message
if ($item == null){
$content .= '<tr><td colspan=5>'.mkt_SHOPCART_NOITEMS.'</td></tr>';
}
$ItemSubTotal = $GrandTotal;
$GrandTotal = $GrandTotal + $ShippingTotal;
//session_register("grand_total");
$_SESSION["grand_total"] = $GrandTotal;
//session_register("item_subtotal");
$_SESSION["item_subtotal"] = $ItemSubTotal;
//session_register("shipping_cost");
$_SESSION["shipping_cost"] = $ShippingTotal;
$content .='
<input type="hidden" name="grand_total" value="'.$GrandTotal.'" />
<input type="hidden" name="item_subtotal" value="'.$ItemSubTotal.'" />
<input type="hidden" name="shipping_cost" value="'.$ShippingTotal.'" />
';
$mkt_pk_ItemSubTotal = $CURRENCY_SYMBOL.number_format($ItemSubTotal, 2, '.', ',');
$mkt_pk_ShippingTotal = $CURRENCY_SYMBOL.number_format($ShippingTotal, 2, '.', ',');
$mkt_pk_GrandTotal = $CURRENCY_SYMBOL.number_format($GrandTotal, 2, '.', ',');
$content .= '<tr>';
if((isset($_REQUEST['coupon'])) OR ($_SESSION['discount_code'])){
if (trim($_REQUEST['coupon'])) {
$coupon = trim($_REQUEST['coupon']);
} else {
$coupon = $_SESSION['discount_code'];
}
$new_value = mkt_calc_coupon($coupon,$ItemSubTotal);
if($new_value == false){
$show_coupon_text .= '<font color="red">'.mkt_SHOPCART_OPTIONS_COUPON_INVALID.'</font><br>';
$_SESSION['discount_value'] = '';
$_SESSION['discount_code'] = '';
}else{
$less = $GrandTotal - $ShippingTotal - $new_value;
$DiscountGrandTotal = $new_value + $ShippingTotal;
$_SESSION["grand_total"] = $DiscountGrandTotal;
$mkt_pk_GrandTotal = $CURRENCY_SYMBOL.number_format($DiscountGrandTotal, 2, '.', ',');
$show_coupon_text .= '<font color="green">'.mkt_SHOPCART_OPTIONS_COUPON_APPLIED_SUCCESS.'</font><br>';
$content .='<input type="hidden" name="discount_amount_cart" value="'.$less.'" />';
$_SESSION['discount_value'] = $less;
$_SESSION['discount_code'] = $coupon;
}
}
$show_coupon_text = '<td colspan="2" valign="top"><br>'.mkt_SHOPCART_OPTIONS_COUPON_PROMO_CODE.' <input type="text" name="coupon" value="'.$coupon.'" style="width:110px;"/><br>'.$show_coupon_text;
$show_coupon_text .= '</td>';
$content .= $show_coupon_text;
if ($_SESSION['discount_value']) {
$coupon_text1 = "<font color='green'>".mkt_SHOPCART_OPTIONS_COUPON_APPLIED_SUCCESS2."</font><br>";
$coupon_text2 = "<font color='green'>-".$CURRENCY_SYMBOL.number_format($_SESSION['discount_value'], 2, '.', ',')."</font><br>";
}
$content .= '<td colspan="2" style="text-align: right;">'.mkt_SHOPCART_SUBTOTAL.'<br/>'.$coupon_text1.mkt_SHOPCART_SHIPPING.'<br/><b>'.mkt_SHOPCART_TOTAL.'</b></td><td style="text-align:right;">'.$mkt_pk_ItemSubTotal.'<br/>'.$coupon_text2.$mkt_pk_ShippingTotal.'<br/><b>'.$mkt_pk_GrandTotal.'</b></td>';
$content .= '</tr>';
// Create product summary session variable for inventory control postsale page
$_SESSION["prods"] = $prods;
$_SESSION["mkt_pk_ItemSubTotal"] = $mkt_pk_ItemSubTotal;
$_SESSION["mkt_pk_ShippingTotal"] = $mkt_pk_ShippingTotal;
$_SESSION["mkt_pk_GrandTotal"] = $mkt_pk_GrandTotal;
$content .='
<input type="hidden" name="prods" value="'.$prods.'" />
<input type="hidden" name="mkt_pk_ItemSubTotal" value="'.$mkt_pk_ItemSubTotal.'" />
<input type="hidden" name="mkt_pk_ShippingTotal" value="'.$mkt_pk_ShippingTotal.'" />
<input type="hidden" name="mkt_pk_GrandTotal" value="'.$mkt_pk_GrandTotal.'" />
';
// The following 4 inputs are Google Checkout variables
$checkout .='<input type="hidden" name="ship_method_name_1" value="Ship Method"/>';
$checkout .='<input type="hidden" name="ship_method_price_1" value="'.$ShippingTotal.'" />';
$checkout .='<input type="hidden" name="ship_method_currency_1" value="'.$GLOBALS["CURRENCY_CODE"].'" />';
$checkout .='<input type="hidden" name="checkout-flow-support.merchant-checkout-flow-support.continue-shopping-url" value="' . $CHECKOUT_RETURNURL . '">';
// Send the ADMIN EMAIL address too...
$checkout .='<input type="hidden" name="mkt_pk_admin_email" value="'.$_SESSION["mkt_pk_admin_email"].'"/>';
include("cart_bottom.php");
echo $content;
}
if($_GET['cart']){
ShowCart($crtName,$crtNotes,$crtPostID,$crtAmount,$crtQuantity,$crtStockQuantity,$crtShipping,$crtShipping2,$crtHandling,$crtHandlingCart,$crtOptions,$PPOptions);
}
if($_GET["remove"]){
$item = removeItem($_GET["remove"]);
}
function removeItem($item){
global $crtName,$crtNotes,$crtPostID,$crtAmount,$crtQuantity,$crtStockQuantity,$crtShipping,$crtShipping2,$crtHandling,$crtHandlingCart,$crtOptions,$PPOptions;
unset($crtName[$item]);
unset($crtNotes[$item]);
unset($crtPostID[$item]);
unset($crtAmount[$item]);
unset($crtQuantity[$item]);
unset($crtStockQuantity[$item]);
unset($crtShipping[$item]);
unset($crtShipping2[$item]);
unset($crtHandling[$item]);
unset($crtHandlingCart[$item]);
unset($crtOptions[$item]);
SaveSession($crtName,$crtNotes,$crtPostID,$crtAmount,$crtQuantity,$crtStockQuantity,$crtShipping,$crtShipping2,$crtHandling,$crtHandlingCart,$crtOptions,$PPOptions);
return $item;
}
if($_GET["update"]){
foreach ($_GET as $item => $value ){
if($crtQuantity[$item]){
if (($crtStockQuantity[$item] != "") && ($value > $crtStockQuantity[$item])) {
echo "<span style='color:#F00000;'><b>" . mkt_SHOPCART_OVERSTOCK_MESSAGE . " " . $crtStockQuantity[$item] . " -- (" . $crtName[$item] . ")</b></span><br>";
$crtQuantity[$item] = $crtStockQuantity[$item];
} else {
$crtQuantity[$item] = str2int($value);
}
// If value = 0 then remove item from list
if($crtQuantity[$item] == 0){
removeItem($item);
}
}
}
SaveSession($crtName,$crtNotes,$crtPostID,$crtAmount,$crtQuantity,$crtStockQuantity,$crtShipping,$crtShipping2,$crtHandling,$crtHandlingCart,$crtOptions,$PPOptions);
ShowCart($crtName,$crtNotes,$crtPostID,$crtAmount,$crtQuantity,$crtStockQuantity,$crtShipping,$crtShipping2,$crtHandling,$crtHandlingCart,$crtOptions,$PPOptions);
}
if($_GET["add"]){
$item ="item".rand();//An Id can be used in lue of store with multiple items with the same name
$name = $_GET["item_name"];
$notes = $_GET["notes"];
$postID = $_GET["postID"];
$amt = (float)$_GET["amount"];
$handling = (float)$_GET["handling"];
$handling_cart = (float)$_GET["handling_cart"];
$quan = str2int($_GET["quantity"]);
$stockquantity = str2int($_GET["stockquantity"]);
$ppoptions = "";
$optionpricing = 0;
$options = "";
$i = 0;
if(strpos($_GET["shipping"],"/")){
$ar = explode("/",$_GET["shipping"]);
$ship = (float)$ar[0];
$ship2= (float)$ar[1];
}else{
$ship = (float)$_GET["shipping"];
$ship2= 0;
}
foreach ($_GET as $key => $value ){
$val = substr($key,0,2);
if($val=="on"){
$opt = substr($key,2,1);
$index = "os".$opt;
// Option pricing begin
$optionval = explode("@",$_GET[$index]);
$optionpricing = $optionpricing + $optionval[1];
if ($optionval[1]) {
if ($optionval[1]>0) {
$optiontext = " (+";
} else {
$optiontext = " (-";
}
$optiontext = $optiontext . $CURRENCY_SYMBOL.number_format(abs($optionval[1]), 2, '.', ',');
$optiontext = $optiontext .")";
} else {
$optiontext = "";
}
// Option pricing end
$options.= $value.': '.$optionval[0].$optiontext.'<br />';
++$i;
}
}
// Check for duplicate products
if ($crtPostID == "") {$crtPostID = array();}
$duplicate_prodIDs = array_keys($crtPostID, $postID);
for($i=0; $i<count($duplicate_prodIDs); $i++)
{
$totalprodquan += $crtQuantity[$duplicate_prodIDs[$i]];
$s1 = trim($notes);
$s2 = trim($crtNotes[$duplicate_prodIDs[$i]]);
$cmp = strcasecmp($s1, $s2);
if (($postID == $crtPostID[$duplicate_prodIDs[$i]]) && ($options == $crtOptions[$duplicate_prodIDs[$i]]) && ($cmp == 0))
{
$duplicateitemID = $duplicate_prodIDs[$i];
}
}
// Check to see if this puts it over stock quantity
if (($stockquantity !="") && ($totalprodquan + $quan > $stockquantity)) {
echo "<span style='color:#F00000;'><b>" . mkt_SHOPCART_OVERSTOCK_MESSAGE . " " . $stockquantity . " -- (" . $name . ")</b></span><br>";
} else {
if ($duplicateitemID) {
$crtQuantity[$duplicateitemID] += $quan;
$crtNotes[$duplicateitemID] = $notes;
//if($crtShipping[$item] < $ship){
$crtShipping[$item] = $ship;
$crtShipping2[$item] = $ship2;
$crtHandling[$item] = $handling;
$crtHandlingCart[$item] = $handling_cart;
//}
}else{// A new item
$crtName[$item] = $name;
$crtNotes[$item] = $notes;
$crtPostID[$item] = $postID;
$crtAmount[$item] = $amt + $optionpricing;
$crtShipping[$item] = $ship;
$crtShipping2[$item] = $ship2;
$crtHandling[$item] = $handling;
$crtHandlingCart[$item] = $handling_cart;
$crtQuantity[$item] = $quan;
$crtStockQuantity[$item] = $stockquantity;
$crtOptions[$item] = $options;
$PPOptions[$item] = $ppoptions;
}
}
//Save the Session and Display the cart
SaveSession($crtName,$crtNotes,$crtPostID,$crtAmount,$crtQuantity,$crtStockQuantity,$crtShipping,$crtShipping2,$crtHandling,$crtHandlingCart,$crtOptions,$PPOptions);
ShowCart($crtName,$crtNotes,$crtPostID,$crtAmount,$crtQuantity,$crtStockQuantity,$crtShipping,$crtShipping2,$crtHandling,$crtHandlingCart,$crtOptions,$PPOptions);
}
//***************** Function for Coupon Management - S T A R T S *******************
function mkt_calc_coupon($coupon,$order_total) {
// This function will return false, in case of any error
// Or will return value of the coupon
global $mkt_options;
global $wpdb;
global $mkt_db_version;
global $mkt_db_error;
$mkt_db_error = '';
$table_name = $wpdb->prefix . "mkt_coupon";
$coupon = trim($coupon);
$r = $wpdb->get_row("SELECT * FROM $table_name WHERE coupon = '$coupon'");
if(!$r){
return false;
}
// Check if start date valid yet. If no, return false.
if($r->start_type == 'date'){
$today_timestamp = mktime(0,0,0, date('m'), date('d'), date('Y'));
if ($today_timestamp < $r->start_date ){
return false;
}
}
// Check if it is expired. If yes, return false.
if($r->expiry_type == 'day'){
$creation_timestamp = $r->creation_date ;
$expiry_timestamp = mktime(0,0,0,date('m', $creation_timestamp), (date('d', $creation_timestamp) + $r->num_of_days) , date('Y', $creation_timestamp));
$today_timestamp = mktime(0,0,0, date('m'), date('d'), date('Y'));
if ($today_timestamp > $expiry_timestamp){
return false;
}
}
elseif($r->expiry_type == 'date'){
$today_timestamp = mktime(0,0,0, date('m'), date('d'), date('Y'));
if ($today_timestamp >= $r->expiry_date ){
return false;
}
}
if($r->type == 'amount'){
$discounted_amount = $order_total - $r->value;
}
elseif($r->type == 'percent'){
$discounted_amount = $order_total - ($order_total * $r->value /100);
}
return $discounted_amount;
}
//***************** Function for Coupon Management - E N D S *******************
?>
03-06-2012 04:55 PM
If you don't feel up to modifying the cart yourself, I would advise either asking the makers of the cart for help, or hiring an Authorize.net developer:
http://www.authorize.net/solutions/merchantsolutions/merchantservices/certifieddeveloperdirectory/
I can only help so much in the limited amount of time I have to post.
03-06-2012 07:28 PM