We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Vendor name linked to corresponding collection

Solved

Vendor name linked to corresponding collection

ph-kera
Visitor
2 0 0

Hello, 

I sell on my website some objects made by different vendors. I give each vendor a personalized showcase page with collages, videos and more pictures. Technically individual templates of collections. 

On a product page, I wanted the vendor name to be clickable and linked to the corresponding collection/vendor showcase. 

Following the instructions from another chat (underneath), I edited the code in main-product.liquid as follows:

 

Find this line of code under {%- when 'text' -%} code

{{- block.settings.text -}}

Copy

Change it to this and save your file

<a href="{{ product.vendor | url_for_vendor }}">

    {{- block.settings.text -}}

</a>

 

My problem is half solved. Now, a click on the vendor name directs to an empty page where all the vendor's products are showcased. But not to my nice collection pages. 

 

I wanted to redirect the url for each vendor, but it doesn't work as the source url still exists, right. It would have been:

- From mywebsite.com/collections/vendors?q=name%20collection

- To mywebsite.com/collections/name-collection 

 

Is there a dynamic solution to redirect each vendor to its corresponding collection page?

Or will I have to migrate the content for each of my current vendor collection page to a possible new template of vendor page?

 

My theme is Craft, thank you in advance.

Best

Ph

Accepted Solution (1)

YOD_Solutions
Shopify Partner
284 29 43

This is an accepted solution.

How about:

{%- assign vendor_collection_handle = product.vendor | handle -%}
<a href="/collections/{{ vendor_collection_handle }}">{{ product.vendor }}</a>

you can modify "vendor_collection_handle" to match the pattern of your vendor collection handle.

Founder @ JsRates: Custom Shipping Rates
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more about JsRates visit the JsRates home page or JsRates documentation
- Find JsRates on Shopify app store

View solution in original post

Replies 3 (3)

YOD_Solutions
Shopify Partner
284 29 43

This is an accepted solution.

How about:

{%- assign vendor_collection_handle = product.vendor | handle -%}
<a href="/collections/{{ vendor_collection_handle }}">{{ product.vendor }}</a>

you can modify "vendor_collection_handle" to match the pattern of your vendor collection handle.

Founder @ JsRates: Custom Shipping Rates
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more about JsRates visit the JsRates home page or JsRates documentation
- Find JsRates on Shopify app store
ph-kera
Visitor
2 0 0

Thank you!

miguel_by
Excursionist
20 0 7

Could you help me out, this is my code snippet:

<div class="product-card-info">
<div class="product-card-vendor"><a href="#" title="{{ 'onboarding.product_vendor' | t }}">{{ 'onboarding.product_vendor' | t }}</a></div>
<a href="#" title="{{ product_card_product.title | escape }}" class="product-card-title">{{ 'onboarding.product_title' | t }}</a>
{% render 'product-price', product: product_card_product %}
{%- if settings.show_products_rating and product_card_product.metafields.reviews.rating.value != blank -%}
<div class="star-rating" style="--star-rating: 5;"></div>
{%- endif -%}

</div>