-
Notifications
You must be signed in to change notification settings - Fork 59
/
display_cart.sublime-snippet
61 lines (44 loc) · 1.72 KB
/
display_cart.sublime-snippet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<snippet>
<content><![CDATA[
<?php echo form_open('path/to/controller/update/function'); ?>
<table cellpadding="6" cellspacing="1" style="width:100%" border="0">
<tr>
<th>QTY</th>
<th>Item Description</th>
<th style="text-align:right">Item Price</th>
<th style="text-align:right">Sub-Total</th>
</tr>
<?php \$i = 1; ?>
<?php foreach (\$this->cart->contents() as \$items): ?>
<?php echo form_hidden(\$i.'[rowid]', \$items['rowid']); ?>
<tr>
<td><?php echo form_input(array('name' => \$i.'[qty]', 'value' => \$items['qty'], 'maxlength' => '3', 'size' => '5')); ?></td>
<td>
<?php echo \$items['name']; ?>
<?php if (\$this->cart->has_options(\$items['rowid']) == TRUE): ?>
<p>
<?php foreach (\$this->cart->product_options(\$items['rowid']) as \$option_name => \$option_value): ?>
<strong><?php echo \$option_name; ?>:</strong> <?php echo \$option_value; ?><br />
<?php endforeach; ?>
</p>
<?php endif; ?>
</td>
<td style="text-align:right"><?php echo \$this->cart->format_number(\$items['price']); ?></td>
<td style="text-align:right">\$<?php echo \$this->cart->format_number(\$items['subtotal']); ?></td>
</tr>
<?php \$i++; ?>
<?php endforeach; ?>
<tr>
<td colspan="2"> </td>
<td class="right"><strong>Total</strong></td>
<td class="right">\$<?php echo \$this->cart->format_number(\$this->cart->total()); ?></td>
</tr>
</table>
<p><?php echo form_submit('', 'Update your Cart'); ?></p>
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>display_cart</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.php, text.html</scope>
<description>CI - Simple Cart Template</description>
</snippet>