, Copyright 2006. License http://www.gnu.org/licenses/gpl.html GNU General Public License SDV($ZAPordertable, ""); $FmtPV['$orderpage'] = "'" . "Order.$GLOBALS[AuthId]-" . strftime("%Y%j", time()) . "'"; Markup('zapcart', '>zapdata', '/\(:zapcart (.*?):\)/ei', "ZAPcart('$1')"); // takes item name Markup('zaporder', '>{$var}', '/\(:zaporder(.*?):\)/ei', "Keep(ZAPorder('$1'))"); // takes page name where items list is found Markup('zappay', '>{$var}', '/\(:zappay(.*?):\)/ei', "Keep(ZAPpaypal('$1'))"); // takes name & path of graphic function ZAPcart($x) { global $FmtPV; $o = substr($FmtPV['$orderpage'], 1, -1); $c = '(:zapform:)(:input hidden datapage "' . $o . '":)[--ADD TO CART--] (:input text "' . $x . '" "{$' . $x . '}" size=2:) [--QTY--] (:input hidden savedata "+' . $x . '":)(:input submit button value=Add:)(:zapend:)'; return $c; } function ZAPorder($x) { global $ZAPordertable, $FmtPV, $MessagesFmt, $m; $error[no_items] = "
There are currently no items in your shopping cart!
"; $error[invalid_form] = "
There was an error processing your order.
"; if ($x != "") $o = "Order." . substr($x, 1); else $o = "Order.$GLOBALS[AuthId]-" . strftime("%Y%j", time()); if (! PageExists($o)) return $error[no_items]; $page = ReadPage($o); $contents = $page[text]; $order = ""; if (strpos($contents, "(:comment data:)")) { $d = substr($contents, strpos($contents, "(:comment data:)") + 16); $field = explode("\n\n", $d); foreach ($field as $value) { if ($value == "") continue; if (substr($value, 0, 4) == "(:if") continue; $value = substr($value, 2, -2); $v[0] = substr($value, 0, strpos($value, ': ')); $v[1] = substr($value, strpos($value, ': ') + 2); if($v[0] == "") continue; $item = ZAPgetdata($v[0], "Order.Items"); $itemname = substr($item, 0, strpos($item, "|")); $itemprice = substr($item, strpos($item, "|") + 1); $itemcost = bcmul($v[1], $itemprice, 2); $itemlist .= ",$v[0]"; $costlist .= ",$itemprice"; $order .= ""; } if ($order == "") return $error[no_items]; $itemlist = substr($itemlist, 1); $costlist = substr($costlist, 1); $order = "\n$ZAPordertable" . $order . "
$itemname      at$$itemprice  
Subtotal  
U.S. Order?
Yes No
Shipping & Handling  
  
"; return $order; } else return "
There was an error processing your order.
"; return $error[invalid_form]; } function ZAPpaypal($x) { if ($x == "") $x = "pub/paypal.gif"; else $x = substr($x, 1); return ""; }