set condition for schema block text if the collection is fill then overwrite the schema block text

Solved

set condition for schema block text if the collection is fill then overwrite the schema block text

Shuja5developer
Shopify Partner
2 0 0

hi everyone 

this is schema 

{% schema %}
{
"name": "Third section",
"settings": [
{
"id" : "myfav",
"type" : "text",
"label" : "top left heading"
},
{
"id" : "myshop",
"type" : "text",
"label" : "top right heading"
}
],
"blocks": [
{
"type": "image_picker",
"name" : "Image Slide",
"settings" :[


{
"id" : "textone",
"type" : "text",
"label" : "Text"
},
{
"id" : "imageone",
"type" : "image_picker",
"label" : "Image right"
},
{
"id" : "collection",
"type" : "collection",
"label" : "collection"
}




]
}
],
"presets": [
{
"name": "Top Banner",
"category": "Custom Sections"
}
]
}
{% endschema %}

 

 

 

this is condition 

 

 


<span class="image_arrows_1">{% if block.settings.textone==blank %} {% elsif collections[block.settings.collection].title %}{{collections[block.settings.collection].title}}{{ collection.title }}{% endif %}</span>

Ahmad58_1-1645051628935.png

 

you can see in the picture over  the water text  can change to Ahmad58 

anyone help me to condition

 

Accepted Solution (1)

LitExtension
Shopify Partner
4931 1006 1186

This is an accepted solution.

Hi @Shuja5developer,

Please change code:

<span class="image_arrows_1">
  {% if block.settings.textone != blank %} 
    {{ block.settings.textone }}
  {% elsif collections[block.settings.collection].title %}
  	{{collections[block.settings.collection].title}}{{ collection.title }}
  {% endif %}
</span>

Hope it helps!

LitExtension - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify
Contact us:
- Email: contact@litextension.com

View solution in original post

Replies 2 (2)

BananaMoon
Excursionist
64 1 5

Hello,

 

Yes your schema is nicely formatted, now you need to put it into assets (in theme).

Then call it like {{ assetname.xxx }}, it would be a good asset start

 

Have fun with Shopify,

LitExtension
Shopify Partner
4931 1006 1186

This is an accepted solution.

Hi @Shuja5developer,

Please change code:

<span class="image_arrows_1">
  {% if block.settings.textone != blank %} 
    {{ block.settings.textone }}
  {% elsif collections[block.settings.collection].title %}
  	{{collections[block.settings.collection].title}}{{ collection.title }}
  {% endif %}
</span>

Hope it helps!

LitExtension - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify
Contact us:
- Email: contact@litextension.com