[eluser]h311m4n[/eluser]
Hi guys,
First time poster here, been using CodeIgniter for the past 6 months and I love it, it's so simple and intuitive.
I got a question however. I understand the shopping cart is a very basic library and wasn't developped to take every situation into account.
Here's what I can't seem to do: I have some products. Some of them have both a monthly fee and a unique setup fee.
The monthly fee is set in as the price in the cart. Since I didn't have any other option, I used the "options" to set the setup fee. It works like a charm, however I'm stuck when it comes to calculate the total of those setup fees.
In my view, I have tried the following, however it only ever echoes the fee of the last product that was added to the cart:
Code:
$total = 0;
if ($this->cart->has_options($item['rowid'])) {
foreach ($this->cart->product_options($item['rowid']) as $option => $value){
$total += $value;
}
echo $total;
I know in my head the solution is simple, however I do honestly lack some coding logic when it comes to loops and the likes...
Can anybody help me on this?
Thanks in advances!