$val) { if (is_array($val)) { foreach($val as $sz => $qt) { $totqty += $qt; } } else { $totqty += $val; } } //then we can get the bulk costs and all the rest $disccost = 0; if ($pcode) { $pcodes = array(); $query = 'select `pcode`, `discount` from `zsf_promocodes` where curdate() >= `startdt` and curdate() <= `stopdt`'; //pprint($query); $res = mysql_query($query, $conn); while ($row = mysql_fetch_assoc($res)) { if ($row['pcode'] == $pcode) { $disccost = $row['discount']; $discount = (1 - $row['discount']); } // $pcodes['pcode'] = $row['discount']; } //pprint($discount); if ($discount == 1) { $pcode = ''; } } foreach($sf_basket as $pid => $val) { $gid = $products[$pid][0]; $cid = $products[$pid][2]; $b_group = $groups[$gid]; $b_pname = $products[$pid][1]; /* $b_ucost = $prices[$cid][1]; if ($prices) { foreach($prices[$cid] as $k => $v) { if ($totqty >= $k) { $bkey = $k; } } } $b_bcost = $prices[$cid][$bkey]; if ($discount < 1) { $b_bcost = number_format($b_bcost * $discount, 2); } */ if (is_array($val)) { foreach($val as $sz => $qt) { $b_ucost = isset($clearprods[$pid][$sz]) ? $clearprods[$pid][$sz] : $prices[$cid][1]; $b_ucost = isset($clearprods[$pid][1]) ? $clearprods[$pid][1] : $b_ucost; if ($prices) { foreach($prices[$cid] as $k => $v) { if ($totqty >= $k) { $bkey = $k; } } } $b_bcost = isset($clearprods[$pid][$sz]) ? $clearprods[$pid][$sz] : $prices[$cid][$bkey]; $b_bcost = isset($clearprods[$pid][1]) ? $clearprods[$pid][1] : $b_bcost; if ($discount < 1) { $b_bcost = number_format($b_bcost * $discount, 2); } $siz = ($sz < 10) ? '0' . $sz : $sz; $sz *= 1; $b_tcost = $qt * $b_bcost; $basket[] = sprintf('%s|%s|%s|%s|%s|%s|%s|%s|%s', $pid, $gid, $b_group, $b_pname . ', size ' . $sz, $qt, $b_ucost, $b_bcost, $b_tcost, $sz); $totucost += $b_ucost; $totbcost += $b_bcost; $tottcost += $b_tcost; } } else { $b_ucost = isset($clearprods[$pid][$sz]) ? $clearprods[$pid][$sz] : $prices[$cid][1]; $b_ucost = isset($clearprods[$pid][1]) ? $clearprods[$pid][1] : $b_ucost; if ($prices) { foreach($prices[$cid] as $k => $v) { if ($totqty >= $k) { $bkey = $k; } } } $b_bcost = isset($clearprods[$pid][$sz]) ? $clearprods[$pid][$sz] : $prices[$cid][$bkey]; $b_bcost = isset($clearprods[$pid][1]) ? $clearprods[$pid][1] : $b_bcost; if ($discount < 1 && $b_ucost == $b_bcost) { $b_bcost = number_format($b_bcost * $discount, 2); } $b_tcost = $val * $b_bcost; $basket[] = sprintf('%s|%s|%s|%s|%s|%s|%s|%s|%s', $pid, $gid, $b_group, $b_pname, $val, $b_ucost, $b_bcost, $b_tcost, false); $totucost += $b_ucost; $totbcost += $b_bcost; $tottcost += $b_tcost; } # sort($basket); } } elseif ($_COOKIE['PHPSESSID']) { mysql_query('delete from `zsf_actvy` where `phpsessid` = \'' . $_COOKIE['PHPSESSID'] . '\'', $conn); mysql_query('delete from `zsf_pending` where `phpsessid` = \'' . $_COOKIE['PHPSESSID'] . '\'', $conn); } $basketstr .= '' . "\n"; //pprint($timeRemain); $query = 'select `freeship`, `shipcost` from `zsf_shiplimits`'; $res = mysql_query($query, $conn); list($freeship, $shipcost) = mysql_fetch_row($res); //$freeship = 25; $shipp = ($tottcost >= $freeship) ? 0 : $shipcost; ?> <?php if ($group) { echo $group . ' / '; } ?>StreamFlies.com / 541-218-1994
'; $str .= ''; if ($pcode) { $str .= ''; } $str .= ''; $str .= ''; $str .= '' . "\n"; echo $str; $isaved = $tsaved = 0; $diffship = $freeship - $tottcost; if (count($basket) > 99) { echo '' . "\n"; } foreach($basket as $line) { list ($pid, $gid, $group, $item, $qty, $ucost, $bcost, $tcost, $size) = explode('|', $line); $isaved = ($ucost - $bcost) * $qty; $tsaved += $isaved; $item = str_replace('size 0', 'size ', $item); $str = ''; // $str .= ''; $sz = ($size) ? '-' . $size : ''; $str .= ''; $str .= ''; $str .= ''; $str .= ''; if ($pcode) { $str .= ''; } $str .= ''; $str .= ''; $str .= '' . "\n"; echo $str; } $shipdisp = ($shipp > 0) ? '$' . number_format($shipp, 2) : 'FREE'; $str = ''; if($pcode) { $str .= ''; } $str .= ''; $str .= ''; $str .= '' . "\n"; #$shipmsg = ($tottcost < $freeship) ? 'Orders of $' . $freeship . ' or more qualify for FREE SHIPPING!' : 'FREE SHIPPING!'; $shipmsg = ($tottcost < $freeship) ? 'Add $' . number_format($diffship, 2) . ' to qualify for FREE SHIPPING!' : 'FREE SHIPPING!'; if ($totqty > 0) { $str .= ''; if ($pcode) { $str .= ''; } $str .= ''; $str .= '' . "\n"; $str .= ''; if ($pcode) { $str .= ''; } $str .= ''; $str .= ''; $str .= '' . "\n"; } if ($totqty > 0) { $str .= '' . "\n"; $str .= ''; } echo $str; //print_arr($basket); ?>
Item#DescriptionQty.Unit priceDiscountedTotal
Your basket contains more than 99 lines. PayPal restricts orders to 99 line items or fewer. Please remove lines until you’re at 99 lines or fewer, and place your order. Then you can return and create another order to supplement this one. Your orders will be combined and shipped in as few packages as possible. We’re sorry for the inconvenience.
' . $group . '' . $pid . $sz . '' . $item . '$' . number_format($ucost, 2) . '$' . number_format($bcost, 2) . '$' . number_format($tcost, 2) . '
' . $totqty . '$' . number_format($tottcost, 2) . '
' . $shipmsg . 'Shipping:' . $shipdisp . '
Promo code:
 $' . number_format($tottcost + $shipp, 2) . '
' . $basketstr . '
 To change quantity, enter new quantity and click \'Update basket\'.
Your basket is empty. So sad.

' . "\n"; echo '

' . $basketstr . '

' . "\n"; } ?>
$fld_val) { echo '' . "\n"; } $i = 1; foreach($basket as $vals) { list ($id, $group_id, $gdir, $pname, $qty, $unit_price, $disc_price, $ext_price, $size) = explode('|', $vals); $pname = str_replace('size 0', 'size ', $pname); $sz = ($size) ? '-' . $size : ''; echo '' . "\n"; echo '' . "\n"; echo '' . "\n"; ++$i; } if ($shipp > 0 && $tottcost > 0.01) { echo '' . "\n"; echo '' . "\n"; echo '' . "\n"; echo '' . "\n"; } ?>