CodeIgniter Forums

Full Version: Shopping Cart Options Not Showing In View
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi Guys,

Just building a shopping cart and I have options that I would like to show in the cart view:

PHP Code:
$data = array(
       'id'      => $this->input->post('id'),
       'qty'     => $this->input->post('quantity'),
       'price'   => $this->input->post('price'),
       'name'    => $this->input->post('name'),
       'options'    => array('size' => $this->input->post('size')) 

PHP Code:
<?php $i 1?>
                <?php foreach ($this->cart->contents() as $items): ?>                
                <tr class="item first">                    
                    <?php echo form_hidden($i.'[rowid]'$items['rowid']); ?>                   
                    <td class="name"><?php echo $items['name']; ?></td>
                    <td class="price">QR <?php echo $this->cart->format_number($items['price']); ?></td>
                    <?php if ($this->cart->has_options($items['rowid']) == TRUE): ?>
                        <?php foreach ($this->cart->product_options($items['rowid']) as $size => $option_value): ?>
                            <?php echo $option_value?><br />
                        <?php endforeach; ?>
                        <?php endif; ?>
                    <td class="qnt-count"><?php echo $items['qty']; ?> </td>                    
                    <?php $total $this->cart->format_number($items['price'])*$items['qty']; ?>
                    <td class="total">QR <?php echo $total ?>.00</td>
                <?php $i++; ?>
                <?php endforeach; ?>

When I go to the view the size doesn't not show at all, no errors.  When I do a var_dump of the contents I can see the size has been selected.  Can anyone point me in the right direction?

Not to worry I have sorted it now.