Welcome Guest, Not a member yet? Register   Sign In
CART Content not passing in VIEW
#1

[eluser]fnbhns[/eluser]
Dear All, I have a project, which is working nicely in the main folder also showing the CART value in sidebar. But I puted the same project in Sub-Folder, Its not showing the value from CART' in Sidebar view.

In controller there is a function with CART

Code:
add_items() {
.......
......
$return = $this->cart->insert($item);  
}

This is just some stray code left behind, I just wanted to see what value that was being returned after the item was added. I do nothing with the $return value now, I just printed it before.


$this->cart->contents() is meant to return the carts contents…

I’ve

print_r($this->cart->contents());

in the Addtocart function to check if the item was added to the cart properly, it is I get the item returned back to me fine.

in the VIEW

Code:
$this->cart->contents();

Now when I go to the Showcart page and the Showcart function is called I do the same thing. I should get the item returned back to me… but all I am getting is an empty array. Why isn’t the cart holding any data?

Highly expecting your kind advices and comments. Thanking you in Advance.
#2

[eluser]include[/eluser]
Try something like this in your view, it loops through each item in the cart array and displays it;

Code:
<?php
If (!$this->cart->contents()){
    echo '<p class="cart_empty">You don\'t have any items yet.</p>';
}
else { ?&gt;

<table class="quickcart" cellpadding="6" cellspacing="1"  border="0">

&lt;?php $i = 1; ?&gt;

&lt;?php foreach ($this->cart->contents() as $items): ?&gt;

  <tr>
    <td>&lt;?php echo $items['qty']; ?&gt;</td>
    <td>&lt;?php echo $items['name']; ?&gt;</td>
    <td>&lt;?php echo $this->cart->format_number($items['price']); ?&gt;</td>
    <td>£&lt;?php echo $this->cart->format_number($items['subtotal']); ?&gt;</td>
  </tr>

&lt;?php $i++; ?&gt;

&lt;?php endforeach; ?&gt;

</table>
&lt;?php } ?&gt;

Just doing our first app that uses the cart functions so had a bit of fun with it recently!
#3

[eluser]fnbhns[/eluser]
# INCLUDE, Thanks for your message. But i am suffereing almost 3 days, just to find out where the linking got problem......!!!
#4

[eluser]InsiteFX[/eluser]
I would start by checking all your application paths.




Theme © iAndrew 2016 - Forum software by © MyBB