CodeIgniter Forums
How to make pagination for shopping cart ? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: How to make pagination for shopping cart ? (/thread-52767.html)



How to make pagination for shopping cart ? - El Forum - 06-25-2012

[eluser]Mario "St.Peter" Valentino[/eluser]
Dear all,

i have little problem. i have a shopping cart list using cart class. i success to show all list items using this code

Code:
$result = "";
foreach($this->cart->contents() as $items)
{  
$result .= "<div class=\"cartcontent\">";  
$result .= " &lt;input type=\"hidden\" class=\"item-id-".$no."\"  value=\"".$items['id']."\"&gt;";
$result .= " &lt;input type=\"hidden\" class=\"qty-id-".$no."\"   value=\"".$items['qty']."\"&gt;";
$result .= " &lt;input type=\"hidden\" name=\"rowid[]\" value=\"".$items['rowid']."\"&gt;";
$result .= " <span class=\"cc01\"><img ></span>";
$result .= " <span class=\"cc02\">".$items['name']."</span>";
$result .= " <span class=\"cc03\">&lt;input type=\"text\" class=\"qty-edit\" name=\"qty[]\" value=\"".$items['qty']."\" size=\"3\" id=\"".$no."\"&gt;&lt;/span>";
$result .= " <span class=\"cc04\">Rp ".number_format($items['price'],0,",",".")."</span>";
$result .= " <span class=\"cc05\">Rp ".number_format($items['subtotal'],0,",",".")."</span>";
$result .= " <span class=\"cc06\"><div class=\"cc06link\">Hapus</div></span>";
$result .= "</div>";
  
$no++;
}

i don't know how to make pagination using this data.

please help me.


thanks



How to make pagination for shopping cart ? - El Forum - 06-25-2012

[eluser]skunkbad[/eluser]
CI's pagination class will not paginate data from the CI Cart. You're going to have to come up with your own custom pagination. Just search the internet for php pagination basics, and I'm sure you will find many tutorials.