0

I have a shopping cart array of structs running and im trying to dynamically get the data to the screen.

<cfoutput>
<cfloop from="1" to="#ArrayLen(session.shoppingcart)#" index="idx">
    <cfloop collection="#session.shoppingcart[idx]#" item="key">
    <cfset mydata = session.shoppingcart[idx][key] >
    #key# #mydata# #session.shoppingcart[idx][key]#   
    </cfloop>
</cfloop>
</cfoutput>

When I set the mydata variable, i am able to simply apply #mydata# to the page and it displays.

When i try to apply #session.shoppingcart[idx][key]# to the page i get an error stating that it cannot display this as a simple value.

Any ideas on how to get this information to display on screen ?

thanks in advance

1
  • 3
    You seem to be suggesting that if you output just #mydata#, then it renders fine, but if you output just #session.shoppingcart[idx][key]# then you get an error? Can you add the exact error message (ie: copy and paste it from the screen) to your question. Yuo are also not telling us something or not including all the code because - from your code - mydata and session.shoppingcart[idx][key] have exactly the same values. So will - accordingly - render the same. What have you not told us / not included? Commented Dec 3, 2013 at 9:08

1 Answer 1

5

Sounds like session.shoppingcart[idx][key] is an object of some sort. You can use <cfdump var="#session.shoppingcart[idx][key]#"> to see the keys and values in that object.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.