How to access id in settings schema with custom variable

How to access id in settings schema with custom variable

choky
Shopify Partner
2 0 0

Hello there,

 

Is there a way to access liquid section id dynamically with custom variable

( something like: {{ section.settings }}.{{ custom_variable }} )

 

I am looping through a menu links and each link.title (plus additional formatting) is an actual the id in my json schema.

I want that link.title to use as suffix to the section.settings to access my id

 

{% for link in section.settings.menu.links %}
     {% assign image = link.title | handleize %}
     {% assign image_title = image | append: '-image-title' %}
     // Here I would print an actual result
     <p> {{section.settings.link-name-image-title}}</p>
{% endfor %}
 
Is something like this possible? I would really appreciate any help, thank you!
Replies 3 (3)

webwondersco
Shopify Partner
1190 171 174

@choky Hope you are doing well.

 

Could you please explain in a bit more detail?

 

 

Web Wonders | Shopify Partner | Connect here!
- Question answered? Mark as Accepted Solution, reply helpful? Click Like
- Hire me, if you want to design, re-design, develop a store, or make changes to the pre-built store.
- a small Coffee Tip would be greatly appreciated. :)..! Instagram
choky
Shopify Partner
2 0 0

choky_0-1706191481596.png

this is what I have in my list (Chemicals, Pool Equipment, Spa Equipment etc...)

 

In my json schema I have same amount of text settings for each list item

{
"type": "text",
"id": "chemicals-image-title",
"label": "Chemicals Image Title"
},
{
"type": "text",
"id": "pool-equimpent-image-title",
"label": "Pool Equipment Image Title"
},
{
"type": "text",
"id": "spa-equimpent-image-title",
"label": "Spa Equipment Image Title"
}
(and so on) 
 
When I loop through the links, I manage to get those IDs
{% for link in section.settings.menu.links %}
     {% assign image = link.title | handleize %}
     {% assign image_title = image | append'-image-title' %} // here I get on each iteration (chemicals-image-title, pool-equimpent-image-title, spa-equimpent-image-title...) which is exactly the id in my json schema
   Now I need a way to concatenate image_title to "section.settings" so I can get the actual value. 
     <p> {{section.settings.chemicals-image-title}}</p> // this is just example of first link that needs to look like in the end
{% endfor %}
webwondersco
Shopify Partner
1190 171 174

@choky Yes, it is tricky but interesting.

 

Can take a look at your theme code? got your point what would you like to implement.

 

can help with you this.

Web Wonders | Shopify Partner | Connect here!
- Question answered? Mark as Accepted Solution, reply helpful? Click Like
- Hire me, if you want to design, re-design, develop a store, or make changes to the pre-built store.
- a small Coffee Tip would be greatly appreciated. :)..! Instagram