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

[eluser]james182[/eluser]
OK, so i am having issues getting this to work, it shows the first but that's it.

SOLVED
#2

[eluser]InsiteFX[/eluser]
It's not a helper issue look at your code your returning ->row
which is only one record...

Which makes your foreach loop in the view useless!
#3

[eluser]james182[/eluser]
How should it be ??
I have tried using ->row(); ->result(); ->result_array();

i just want to return the name of the products in the loop
#4

[eluser]Aken[/eluser]
You should just join the product data onto whatever query is returning the ordered items list. Doing it your way is a lot of unnecessary overhead.
#5

[eluser]Matalina[/eluser]
[quote author="InsiteFX" date="1331558959"]It's not a helper issue look at your code your returning ->row
which is only one record...

Which makes your foreach loop in the view useless!
[/quote]

The foreach loop is not useless it's looping through another variable to get the id of the item.

Try ->row(0)

if that doesn't work try setting the query ->row() to a variable and returning that.
#6

[eluser]InsiteFX[/eluser]
It doe's when he is only returning a row!

Because all he will get is one record...
#7

[eluser]Aken[/eluser]
That's all he WANTS is one record... He isn't looping the results of this function, he's using this function in a loop...

Still, you should fetch this data in a better way - doing separate queries for each title is a lot of extra work. You should show more about where you're getting the data you are looping through, and how you can add titles to that instead.
#8

[eluser]CroNiX[/eluser]
if your loop is only going through one cycle, check the data you are looping over ($order->ordered_items). It could be that there is only one row there, but you don't show any code on how you get $order (referred to only in your view), so we can't tell.
#9

[eluser]james182[/eluser]
Ok thanks so far.

Here is more info, i am looping through the data to output orders and each ordered item associated with that order.

so for example:
Order A - Show Product A, Product B, Product C
Order B - Show Product A

[solved]
#10

[eluser]Aken[/eluser]
Post this model function:
Code:
$order->ordered_items = $this->orders_m->get_ordered_items($order->id);

You should be able to modify this function to include the title, so you don't need to do any additional logic elsewhere to get it.




Theme © iAndrew 2016 - Forum software by © MyBB