1

EE v2.5.5

On the cart page i need to get image title based on its id. Instead tag {title} shows the title of cart item. So high level variable rewrite low level.

{exp:cartthrob:cart_items_info}<br>
   {title} // shows cart item title, for example "Product 1"

   {exp:channel:entries channel="images" entry_id="{item_options:image_id}" limit="1"}

      {title} //should show image title, for example - "Image 1", but shows "Product 1"
   {/exp:channel:entries}       

{/exp:cartthrob:cart_items_info}

How can i solve this?

1 Answer 1

1

Yes, you're getting variable collision there. You'll need to embed the inner channel:entries tag and pass the entry_id to the embed:

{embed="_embeds/_cart_item_title" entry_id="{item_options:image_id}"}

And then in that template:

{exp:channel:entries channel="images" entry_id="{embed:entry_id}" limit="1" dynamic="no" disable="member_data|pagination|categories|custom_fields"}
    {title}
{/exp:channel:entries}  
1
  • Tnx, it helped!
    – johnode
    Commented Nov 24, 2015 at 18:30

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.