Welcome Guest, Not a member yet? Register   Sign In
cart2
#1

I am trying to test this program:

http://localhost/cart2/



404 Page Not Found
The page you requested was not found.

reference:  http://www.codeigniter.com/user_guide/li.../cart.html



views/cart_display.php



PHP Code:
<?php echo form_open('path/to/controller/update/method'); ?>

<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> 



controllers/update/method.php


PHP Code:
<?php


class Method extends CI_Controller {

    function 
__construct()
    {
        
parent::__construct();
        
        
$this->load->library('cart');
        
    }
    
    function 
display()
    {
        
$this->load->view('cart_display.php');
    }
    
    
?>


application/config/routes.php

PHP Code:
$route['default_controller'] = 'update/method/display';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE


Looks like there is some error in the program, how to fix it?

Can you help?
" If I looks more intelligence please increase my reputation."
Reply
#2

I'm being totally serious. Are you a troll having fun?
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
Reply
#3

With respect to the CI cart library, I quote from the User Guide, the link to which you have posted in this thread:

"The Cart library is DEPRECATED and should not be used. It is currently only kept for backwards compatibility."
CI 3.1 Kubuntu 19.04 Apache 5.x&nbsp; Mysql 5.x PHP 5.x PHP 7.x
Remember: Obfuscation is a bad thing.
Clarity is desirable over Brevity every time.
Reply
#4

(06-01-2016, 09:04 PM)albertleao Wrote: I'm being totally serious. Are you a troll having fun?

I think he/she is. These cannot be serious questions. Actually I am quite enjoying reading some of them now, they are quire funny sometimes, although I have completely given up trying to help.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB