simple one page php script

Solutions on MaxInterview for simple one page php script by the best coders in the world

showing results for - "simple one page php script"
Martín
10 Jun 2020
1<div id="product-grid">
2	<div class="txt-heading">Choose your products</div>
3	<div class="product-item">
4		<div class="product-image">
5			<img src="data/camera.jpg" id="<?php echo "3DcAM01";?>"
6				class="product-img">
7		</div>
8		<div>
9			<strong><?php echo "FinePix Pro2 3D Camera";?></strong>
10		</div>
11		<div class="product-price"><?php echo "1500.00";?></div>
12
13		<input type="button" id="add_<?php echo "3DcAM01";?>"
14			value="Add to cart" class="btnAddAction"
15			onClick="cartAction('add', '<?php echo "3DcAM01";?>','<?php echo "FinePix Pro2 3D Camera";?>','<?php echo "1500.00";?>')" />
16
17	</div>
18	<div class="product-item">
19		<div class="product-image">
20			<img src="data/watch.jpg" id="<?php echo "wristWear03";?>"
21				class="product-img">
22		</div>
23		<div>
24			<strong><?php echo "Luxury Ultra thin Wrist Watch";?></strong>
25		</div>
26		<div class="product-price"><?php echo "300.00";?></div>
27
28		<input type="button" id="add_<?php echo "wristWear03";?>"
29			value="Add to cart" class="btnAddAction"
30			onClick="cartAction('add', '<?php echo "wristWear03";?>','<?php echo "Luxury Ultra thin Wrist Watch";?>','<?php echo "300.00";?>')" />
31	</div>
32	<div class="product-item">
33		<div class="product-image">
34			<img src="data/laptop.jpg" id="<?php echo "LPN45";?>"
35				class="product-img">
36		</div>
37		<div>
38			<strong><?php echo "XP 1155 Intel Core Laptop";?></strong>
39		</div>
40		<div class="product-price"><?php echo "800.00";?></div>
41
42		<input type="button" id="add_<?php echo "LPN45";?>"
43			value="Add to cart" class="btnAddAction"
44			onClick="cartAction('add', '<?php echo "LPN45";?>','<?php echo "XP 1155 Intel Core Laptop";?>','<?php echo "800.00";?>')" />
45	</div>
46</div>
Killian
29 Mar 2017
1<?php
2use Phppot\Cart;
3require_once __DIR__ . './../Model/Cart.php';
4$cartModel = new Cart();
5?>
6<input type="hidden" id="cart-item-count"
7	value="<?php echo $cartModel->cartSessionItemCount; ?>">
8<?php
9if ($cartModel->cartSessionItemCount > 0) {
10    ?>
11<table width="100%" id="cart-table" cellpadding="10" cellspacing="1"
12	border="0">
13	<tbody>
14		<tr>
15			<th>Name</th>
16			<th>Quantity</th>
17			<th class="text-right">Price</th>
18			<th class="text-right">Action</th>
19		</tr>   
20<?php
21    $item_total = 0;
22    $i = 1;
23    foreach ($_SESSION["cart_item"] as $item) {
24        ?>
25        <tr>
26			<td><?php echo $item["name"]; ?></td>
27			<td><input type="number" name="quantity" class="quantity"
28				value="<?php echo $item['quantity']; ?>"
29				data-code='<?php echo $item["code"]; ?>' size=2
30				onChange="updatePrice(this)" /> <input type="hidden" class='total'
31				name="total" value="<?php echo $item["price"]; ?>" /></td>
32			<td class="prc text-right" id="price" <?php echo $i;?>><?php echo $item["price"]; ?></td>
33        <?php $i++; ?>
34        <td class="text-right"><a
35				onClick="cartAction('remove','<?php echo $item["code"]; ?>')"
36				class="btnRemoveAction"><img src="./view/images/icon-delete.png"
37					alt="Remove Item" /></a></td>
38		</tr>
39    <?php
40        $item_total += ($item["price"] * $item['quantity']);
41    }
42    ?>
43        <tr id="tot">
44			<td class="text-right" colspan="3"><strong>Total (USD): </strong> <span
45				id="total"><?php echo $item_total;?></span></td>
46			<td class="text-right"><a id="btnEmpty"
47				onClick="cartAction('empty', '');">Empty Cart</a></td>
48		</tr>
49	</tbody>
50</table>
51<?php
52} else {
53    ?>
54<div id="empty-cart">Your cart is empty</div>
55<?php
56}