Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

schema not linking to product

schema not linking to product

Naomi_NN
Shopify Partner
2 0 0

Hi, anyone has idea how to fix the code so it will link to a product ? right now it's only linking to homepage...

 


<div class="section-grid" style="margin-top:10rem; margin-bottom:15rem">
<!-- grid title -->
<h2>{{ section.settings.title }}</h2>
<div class="grid_top_products">
{% for block in section.blocks %}
{% if block.type == 'small_block_one' %}
<div class={{block.type}} >
<a href="{{ block.settings.link }}" alt=" {{ block.settings.text }}">
<img src=" {{ block.settings.image_one | img_url: '450x450', crop: 'center', scale: 2 }}" alt=" {{ block.settings.text }}">
</a>
<!-- text -->
<a href="{{ block.settings.link }}" alt=" {{ block.settings.text }}">
<h4> {{ block.settings.text }} </h4>
</a>
<!-- product -->
<a href="{{ block.settings.link }}" alt=" {{ block.settings.text }}">
{{ block.settings.product.title }}
</a>
</div>
{% elsif block.type == 'small_block_two' %}
<div class={{block.type}} >
<a href="{{ block.settings.link }}" alt=" {{ block.settings.text }}">
<img src=" {{ block.settings.image_two | img_url: '450x450', crop: 'center', scale: 2 }}" alt=" {{ block.settings.text }}">
</a>
<!-- text -->
<a href="{{ block.settings.link }}" alt=" {{ block.settings.text }}">
<h4> {{ block.settings.text }} </h4>
</a>
<!-- product -->
<a href="{{ block.settings.link }}" alt=" {{ block.settings.text }}">
{{ block.settings.product.title }}
</a>
</div>
{% elsif block.type == 'large_block' %}
<div class={{block.type}} >
<a href="{{ block.settings.link }}" alt=" {{ block.settings.text }}">
<img src=" {{ block.settings.image_three | img_url: '450x450', crop: 'center', scale: 2 }}" alt=" {{ block.settings.text }}">
</a>
<!-- text -->
<a href="{{ block.settings.link }}" alt=" {{ block.settings.text }}">
<h4> {{ block.settings.text }} </h4>
</a>
<!-- product -->
<a href="{{ block.settings.link }}" alt=" {{ block.settings.product }}">
{{ block.settings.product.title }}
</a>
</div>
{% endif %}
{% endfor %}
</div>
</div>


{% schema %}
{
"name": "grid-top-products",
"tag": "section",
"class": "shopify-section--stackable shopify-section--extra-small shopify-section--text-first",
"settings": [
{
"id": "title",
"type": "text",
"label": "add a grid",
"default": "Grid Top"
}
],
"max_blocks": 10,
"blocks": [
{
"type": "small_block_one",
"name": "small_block_one",
"settings": [
{
"id": "text",
"type": "richtext",
"label": "text"
},
{
"id": "product",
"type": "product",
"label": "product"
},
{
"id": "title",
"type": "text",
"label": "text"
},
{
"id": "image_one",
"type": "image_picker",
"label": "image"
},
{
"id": "link",
"type": "url",
"label": "link"
}
]
},
{
"type": "large_block",
"name": "large_block",
"settings": [
{
"id": "text",
"type": "richtext",
"label": "text"
},
{
"id": "product",
"type": "product",
"label": "product"
},
{
"id": "title",
"type": "text",
"label": "text"
},
{
"id": "image_three",
"type": "image_picker",
"label": "image"
},
{
"id": "link",
"type": "url",
"label": "link"
}
]
},
{
"type": "small_block_two",
"name": "small_block_two",
"settings": [
{
"id": "text",
"type": "richtext",
"label": "text"
},
{
"id": "product",
"type": "product",
"label": "product"
},
{
"id": "title",
"type": "text",
"label": "text"
},
{
"id": "image_two",
"type": "image_picker",
"label": "image"
},
{
"id": "link",
"type": "url",
"label": "link"
}
]
}
],
"presets": [
{
"name": "grid-top-products",
"blocks": [
{
"type": "small_block_one"
},
{
"type": "small_block_two"
},
{
"type": "large_block"
}
]
}
]
}
{% endschema %}

 

 

 

Replies 0 (0)