CMX Adverts Design Services and Free Hosting
Content Management Xtendable Anti-SQL Scripts Tips n Snippets
About Store Services Forum Privacy Contact
A complete ecommerce shopping cart cms in one page of code.
Hi! again!.This is another complete cms in just one page of code.
As with all my scripts its flatfile database and packed with the essentials and its Xtendable. CMXtendable.
I got this thing that I like to put together scripts in one page. Try to do everyting in one page can be a challenge. I like to juggle if get open/close etc etc..
So this is another result of my efforts.
I had to do some work arounds because of the session setting problem and the refresh but it works great.
Had to use meta refresh as header refresh throws error. And had to set the quantity variable as the session value was not set on first add to cart
You can break it up and avoid those problems if you like.
Features include.
Flat file delimited database.
Data file has column for catagory if you want to add menu. see heredoc script for menu function.
Function that sets the associative array from an array of key names.
You can set shipping rate by percentage and add a base handling fee.
You can set a tax rate just one for now.
Set checkout action to your method.
if you need a form setup for your gateway donate and i will set it up for you.
Check it out the demo and give it a whirl on this site! You can download it for free below. Please donate a dollar for me.
Its works great and looks great too!. I hope you can find it useful. Check it out below. If you have a comment stop at the forum!
Click here for the Shopping Flat File One Page Ecommerce CMS Demo.
Click here for the File Format Example.
1: <?php
2: session_start();
3: $starttime = microtime();
4: $startarray = explode(" ", $starttime);
5: $starttime = $startarray[1] + $startarray[0];
6: $self = $_SERVER['PHP_SELF'];
7: $PAYMENT_GATEWAY=$self;]
8: //data file
9: $fl=’cart-data.txt’;
10: //add to cart action
11: $page_name=’one-page-ecommerce-cart-cms.php’;
12: //set file product fields array
13: $fields=array(
14: ‘id’,
15: ‘product_code’,
16: ‘product_name’,
17: ‘product_desc’,
18: ‘product_img’,
19: ‘price’,
20: ‘weight’,
21: ‘catalog’,
22: ‘catid’,
23: );
24:
25: $taxout=”;
26: $shipout=”;
27: //gateway and other form variables
28: $tax_rate=’6′;
29: $taxstate=’WV’;
30: $currency=’USD’;
31: //base handling added to ship percentage
32: $handling=’5′;
33: $ship_rate=’10’;
34: //$price=’amount’;
35: //$name=’item_name’;
36: //$num=’item_num’;
37: //$desc=’item_desc’;
38:
39: function flock_utf8_contents($filename){
40: $return = FALSE;
41: if(file_exists($filename) and is_readable($filename)){
42: if($handle = @fopen($filename, ‘r’)){
43: while(!$return){
44: if(flock($handle, LOCK_SH)){
45: if($return = file_get_contents($filename)){
46: flock($handle, LOCK_UN);
47: }}}fclose($handle);}}
48: return mb_convert_encoding($return, ‘UTF-8’,
49: mb_detect_encoding($return, ‘UTF-8, ISO-8859-1’, true));}
50:
51:
52:
53: $str=flock_utf8_contents($fl);
54:
55: function parse_file() {
56: global $str;
57: global $fields;
58: $res=array();
59: $lines=array();
60: $output = array();
61: $output = explode("\n", $str);
62: $output=array_filter($output);
63: $output=array_map(‘trim’, $output);
64: foreach ($output as $key=>$data) {
65: $lines = explode(‘;’, $data);
66: $res[]=array_combine($fields,$lines);
67: }
68: return $res;
69: }
70:
71: $current_url = base64_encode("http://".$_SERVER[object 4].$_SERVER['REQUEST_URI']);
72:
73: $res=parse_file();
74:
75: function find($string, $array){
76: foreach ($array as $key => $value) {
77: unset ($array[$key]);
78: if (in_array($string, $value)) {
79: $array[$key] = $value;}}
80: return $array;}
81:
82: ?>
83: <!doctype html>
84: <html lang="en">
85: <head>
86: <meta charset="utf-8">
87: <title>php simple ecommerce cms with shopping cart just one page of code remarkable and free <?php echo $title;?></title>
88: <meta name="description" content="Free php flatfile database ecommerce and shopping cart script. A complete ecommerce shop and cart all on just one page of code. Easy to set up checkout form to post to google paypal or your gateway. Can modify for you as well. Another great cmxtendable script from handicapped george.">
89: <meta name="robots" content="index">
90: <style type="text/css">
91: body, html {
92: margin-top:10px;
93: font-size:14px;
94: height:100%;
95: min-height:100%;
96: font-family: Tahoma, Arial;
97: background:#E0E0E0;
98: background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#FFFFFF), to(#E0E0E0 ));*/
99: background: -moz-linear-gradient(top, #FFFFFF 0%, #E0E0E0 100%);*/
100: background: -o-linear-gradient(top, #FFFFFF 0%, #E0E0E0 100%);*/
101: background: linear-gradient(top, #FFFFFF 0%, #E0E0E0 100%);*/
102: }
103: #wrapper {
104: padding:20px;
105: width:750px;
106: margin: auto;
107: min-height:100%;
108: background-color: #ffffff;
109: border: 2px solid #333;
110: /* curved border radius */
111: -moz-border-radius:20px;
112: -webkit-border-radius:20px;
113: -o-border-radius:20px;
114: border-radius:20px;
115: }
116: .box{
117: display: none;
118: width: 100%;
119: }
120:
121: a:hover + .box,.box:hover{
122: display: block;
123: position: relative;
124: z-index: 100;
125: }
126: </style>
127:
128: </head>
129:
130: <body>
131:
![]() |
Shopping136: Flatfile Ecommerce CMXtendable Shopping Cart all in just one page of code. |
139:
140:
141: <br>
142:
147:
148: echo ‘
149: echo “”;
150: echo ‘
‘;
151: echo ‘
‘.$val[“product_name”].’
‘;
152: echo ‘
‘;
153: echo ‘
‘;
154: //echo ‘<input type="text" name="product_qty" value="1" />’;
155: echo ‘</div>’;
156: echo ‘<input type="hidden" name="product_code" value="’.$val["product_code"].’">’;
157: echo ‘<input type="hidden" name="type" value="add" />’;
158: echo ‘<input type="hidden" name="return_url" value="’.$current_url.’">’;
159: echo ‘</form>’;
160: echo ‘</div>’;
161: }
162:
163: ?>
164:
165: </div>
166:
167:
‘;
173: $total = 0;
174: echo “”;
175: echo ‘
- ‘;
- ‘;
189: if(empty($cart_itm['qty'])){
190: $cart_itm['qty']=’1’;
191: }
192: echo ‘‘;
193: echo ‘‘.$rs['product_name'].’ (Item # :’.$rs['product_code'].’) ‘;
194: echo ‘Qty : ‘.$cart_itm['qty'].’‘;
195: echo ‘‘.$rs['product_desc'].’‘;
196: echo ‘‘.$currency.$rs['price'].’‘;
197: echo ‘</div>’;
198: echo ‘<span style="background:crimson;padding-right:5px;padding-left:5px;text-align:center;"><a style="text-decoration:none;font-weight:bold;color:white;text-align:center;" href="’.$page_name.’?removep=’.$cart_itm["code"].’&return_url=’.$current_url.’">× Delete</a></span>’;
199: echo ‘</li>’;
200: $subtotal = ($cart_itm['price']*$cart_itm['qty']);
201: $total = ($total + $subtotal);
202: echo ‘<input type="hidden" name="item_name['.$cart_items.']" value="’.$rs['product_name'].’" />’;
203: echo ‘<input type="hidden" name="item_code['.$cart_items.']" value="’.$rs['product_code'].’" />’;
204: echo ‘<input type="hidden" name="item_desc['.$cart_items.']" value="’.$rs['product_desc'].’" />’;
205: echo ‘<input type="hidden" name="item_qty['.$cart_items.']" value="’.$cart_itm["qty"].’" />’;
206:
207: $cart_items ++;
208:
209: }}
210: echo ‘</ul>’;
211: echo ‘<span class="check-out-txt">’;
212: if($tax_rate){
213: $tax = $total * $tax_rate / 100;
214: $tax=substr($tax,0,-1);
215: $total=$total+$tax;
216: $taxout= "$taxstate tax: $tax_rate% $tax";
217: }
218: if($ship_rate){
219: $shipping = $total * $ship_rate / 100;
220: $shipping =$shipping+ $handling;
221: $shipout= ‘shipping ‘.$currency.number_format($shipping,2);
222: $total=$total+$tax+$shipping;
223: }
224: echo ‘<strong>’.$shipout.'<br>Total. : ‘.$currency.number_format($total,2).’ – ‘.$taxout.'</strong>’;
225: echo ‘</span>’;
226: if($subtotal>=0){
227: echo ‘<br><br><input type="submit" name="type" value="Begin Checkout">’;
228: }
229: echo ‘</form>’;
230: }else{
231: echo ‘<strong>Cart is empty add something.</strong>’;
232: }
233: ?>
234: </div>
235: <?php
236: if(isset($_GET["emptycart"]) && $_GET["emptycart"]==1){
237: $return_url = base64_decode($_GET["return_url"]);
238: session_destroy();
239: // header(‘Location:’.$return_url);
240: echo "<meta http-equiv=\"Refresh\" content=\"0;URL=$return_url\">";
241: }
242:
243: if(isset($_POST["type"]) && $_POST["type"]==’add’){
244:
245: $product_code = filter_var($_POST["product_code"], FILTER_SANITIZE_STRING);
246: $product_qty = filter_var($_POST["product_qty"], FILTER_SANITIZE_NUMBER_INT);
247: $return_url = base64_decode($_POST["return_url"]); //return url
248:
249: if($product_qty > 10){
250: die("Maximum quantity of 10 reached.");
251: }
252:
253: $res=parse_file();
254: for($i=0; $i<count($res); $i++){
255: $results = find ($product_code, $res);
256: }
257: if ($results) {
258: foreach ($results as $key=>$rs) {
259: $new_product = array(array(‘name’=>$rs['product_name'], ‘code’=>$rs['product_code'], ‘qty’=>$cart_itm["qty"], ‘price’=>$rs['price']));
260:
261: if(isset($_SESSION["products"])){
262: $found = false;
263: foreach ($_SESSION["products"] as $cart_itm){
264: if($cart_itm["code"] == $product_code){
265: $product[] = array(‘name’=>$cart_itm["name"], ‘code’=>$cart_itm["code"], ‘qty’=>$product_qty, ‘price’=>$cart_itm["price"]);
266: $found = true;
267: }else{
268: $product[] = array(‘name’=>$cart_itm["name"], ‘code’=>$cart_itm["code"], ‘qty’=>$cart_itm["qty"], ‘price’=>$cart_itm["price"]);
269: }
270: }
271: if($found == false) {
272: $_SESSION["products"] = array_merge($product, $new_product);
273: }else{
274: $_SESSION["products"] = $product;
275: }
276: }else{
277: $_SESSION["products"] = $new_product;
278: }
279: }
280: }
281: // header(‘Location:’.$return_url);
282: echo "<meta http-equiv=\"Refresh\" content=\"0;URL=$return_url\">";
283: }
284: if(isset($_GET["removep"]) && isset($_GET["return_url"]) && isset($_SESSION["products"])){
285: $product_code = $_GET["removep"]; //get the product code to remove
286: $return_url = base64_decode($_GET["return_url"]); //get return url
287:
288: foreach ($_SESSION["products"] as $cart_itm){
289: if($cart_itm["code"]!=$product_code){
290: $product[] = array(‘name’=>$cart_itm["name"], ‘code’=>$cart_itm["code"], ‘qty’=>$cart_itm["qty"], ‘price’=>$cart_itm["price"]);
291: }
292: $_SESSION["products"] = $product;
293: }
294: // header(‘Location:’.$return_url);
295: echo "<meta http-equiv=\"Refresh\" content=\"0;URL=$return_url\">";
296: }
297:
298: echo "";
299: $endtime = microtime();
300: $endarray = explode(" ", $endtime);
301: $endtime = $endarray[1] + $endarray[0];
302: $totaltime = $endtime – $starttime;
303: $totaltime = round($totaltime,4);
304: echo "
This search took $totaltime seconds to complete.”;
305:
306: function convert($size)
307: {
308: $unit=array(‘b’,’kb’,’mb’,’gb’,’tb’,’pb’);
309: return @round($size/pow(1024,($i=floor(log($size,1024)))),2).’ ‘.$unit[$i];
310: }
311:
312: echo ‘ Memory usage ‘ . convert(memory_get_usage(true)) . ‘‘; // 123 kb
313:
314:
315: echo ‘</div>’;
316: echo ‘<p style="width:100%;text-align:center;"><a href="http://www.cmxads.com/one-page-ecommerce-cms.php">Cmxads.com One Page Ecommerce CMS Php Script</a></p>’;
317: echo ‘</body>’;
318: echo ‘</html>’;
319: ?>I you would like a text file of the script emailed to you donate a dollar or two. Any modifications you would like are a dollar each task.
Please help me
Donate Bitcoin
1KtuX6N6xM2YxijE7JfPeHZmtGKGQwgfpc

name:Ulrike Date:06.5.19 @ 02:35am IP:31.184.238.111
I am using this worked out great I sent you 9 cents.name:Katerine Date:05.16.19 @ 23:58pm IP:95.79.170.165
Thanks I sent you 89 cents.name:Coralee Date:05.11.19 @ 19:57pm IP:5.164.239.197
Thanks you are awesome. Working out good for me. I sent you 48 cents.name:Judas Date:05.8.19 @ 16:45pm IP:31.184.238.22
Worked out great for me I sent you 29 cents.name:Brandon Date:04.14.18 @ 10:24am IP:37.115.155.222
Thanks alot I sent you 19 cents.name:Summer Date:04.12.18 @ 09:01am IP:95.128.163.218
Thanks you are cool I sent you 7 cents.name:Coralee Date:02.23.18 @ 01:57am IP:146.185.223.252
Thanks for sharing.name:Abbie Date:01.2.18 @ 12:41pm IP:193.201.224.201
Thanks I sent you 89 cents.name:Coralee Date:12.26.17 @ 10:27am IP:37.115.155.222
Thanks you are awesome I sent you 6 cents.name:Rachal Date:11.27.17 @ 03:04am IP:91.200.12.106
This worked out great I sent you 19 cents.name:Rozella Date:11.27.17 @ 02:37am IP:91.200.12.106
Tyvm.name:Hope Date:11.27.17 @ 02:23am IP:91.200.12.106
Thanks you are awesome. Working out good for me. I sent you 48 cents.name:Melaine Date:11.27.17 @ 00:19am IP:91.200.12.143
Thank you you are the best. Works like a charm. I sent you 22 cents.name:Julie Date:11.27.17 @ 00:14am IP:91.200.12.106
Thanks for sharing.name:Shantelle Date:11.27.17 @ 00:13am IP:91.200.12.7
Thanks you are awesome. Working out good for me. I sent you 48 cents.name:Julie Date:11.27.17 @ 00:01am IP:91.200.12.143
Thanks I sent you 89 cents.name:Melaine Date:11.26.17 @ 23:59pm IP:91.200.12.106
Thanks I love you I sent you 58 cents.name:Summer Date:11.26.17 @ 23:59pm IP:91.200.12.7
This worked out great for me too. I sent you 82 cents.Name: 

Post It!
Click Here to Reload
Bitads.tk
Earn Bitcoin for clicking ads. Sales and signup commission too. Earn downline commission. Use the safelist and site banner rotator too.Get Easy Bitcoin
Take surveys rewards vary Click here to signup.Get 57.00 USD in Bitcoin
Buy and sell Bitcoin free wallet Click here to signup.Earn and win free bitcoin.
Browser mining for free bitcoin too.URL Cloaking with tracking
Url shortening service with link click tracking
Click here.Chatter. Twitter Lite Script
Want your own twitter like website check this out. More features to come
Click here.Crypto Currency Cart
No middleman cart ecommerce cms for bitcoin litecoin.
Click here.FREE CMXads WEBHOSTING
Free hosting no domain needed. Use your domain or cmxads subdomain.
Click here.PAID CMXads WEBHOSTING
Host Unlimited Domains only 35.00 per year. Pay monthly. Free SSL
Click here.WEB DESIGN SPECIAL
Cheap Scripting, Web Design and Hosting Special.
Click herehelp to rid the web of adobe flash. developers incorporate html5 media players into your applications. even basic styling works with the base players see the audio players bottom of index page.
if your starting out testing the waters with a new product or service and dont have mega bux to possibly waste then dont. let me write your slogans design your logo and if you need a jingle I also compose music. Compared to a pro nyc or la ad agency i work for peanuts and can produce the same quality attention grabbing advertising slogans and all your very creative ad copyGet the php timer script.
This website will implode in 45 minutes
Check this out!Free Useful Scripts
Total Database Class
NEW Bitcoin LiteCoin free web wallet
NEW 2018 Bitcoin Litecoin and CC Cart System
Casino Slots Script
5 Card Stud Poker
Login Attempts Monitor
Multi-topic Ajax Php FFDB Comments Script
One Page Ecommerce CMS
URL Submit Search and Spider Script
Secure editable dynamic paypal button
EZ cloak url shortening script
Video Showcase Script
Anonymous Blogger FlatFile Blogger Script
Forum Board Guestbook Combo Script
The Latest Scripts
NEW 2018 Bitcoin Litecoin and CC Cart System
MLM Marketer Starter System
URL Shortening Script
Chatter a Twitter Script
Crypto Currency Cart
Mega Marketer System
The Universal Affiliate TextDB Script
SafeList PhP TextDB Script
FFA Email Marketing Script
Try out the Demo’s
NEW Bitcoin LiteCoin free web wallet
NEW 2018 Bitcoin Litecoin and CC Cart System
Chatroom/Support Php Ajax Demo
MLM Marketer Starter System
URL Shortening Service
Chatter a Twitter Lite Script
Crypto Currency Cart
Multi-topic FFDB Comments System
Shopping One Page Ecommerce CMS
Universal Affiliate Script textDB
SafeList Email System
Mega Marketer System
Scripts n Tips Script Search
Anonymous Blogger FlatFile Blogger Script
Board Guestbook Comments Combo Script
Script Tips Tutorials
SEO checklist guide
Php Javascript and CGI Script Search
PhP error troubleshooting
Validate HTML5Page views today 147
Online today 129
Bots today googlebot bingbot yandex
Hackers leave a message:
 Submit
This page took 0.008 seconds to render
176: $cart_items = 0;
177:
178: foreach ($_SESSION[“products”] as $cart_itm)
179: {
180: $product_code = $cart_itm[“code”];
181: $res=parse_file();
182: for($i=0; $i$rs) {
187:
188: echo ‘
