i copy and paste the liquide provide on the site to add my previous and next page button. My previous and next page button link works well for all the collection except one. Could some one please help out to check what went wrong. The following is the liquid i locate from the site.
And the actual website page to show my problem
https://m-zakkaya.myshopify.com/admin/themes/131844309244/editor?previewPath=%2Fproducts%2Fkids-sunscreen-lace-lace-breathable-bucket-hat
(with the previous and next button )
https://m-zakkaya.myshopify.com/admin/themes/131844309244/editor?previewPath=%2Fproducts%2Fknitted-girl-dress
(without the previous and next button)
{%- liquid
assign previous_product = collection.previous_product
assign next_product = collection.next_product
if previous_product or next_product
else
assign collectionList = product.collections[0].handle
assign previous_product = nil
assign next_product = nil
assign last = collections[collectionList].products_count
for p in collections[collectionList].products
if p.handle == product.handle
assign prev = forloop.index | minus: 2
assign next = forloop.index
if prev >= 0
assign previous_product = collections[collectionList].products[prev].handle
endif
if last >= next
assign next_product = collections[collectionList].products[next].handle
endif
break
endif
endfor
endif
-%}
{%- if previous_product -%}
Previous
{%- endif -%}
{%- if next_product -%}
Next
{%- endif -%}
Hi @minhsien ,
I have checked and the products are not working well. Can you send me the product link that works well? I will check it.
You can also refer to my previous tutorial: https://community.shopify.com/c/shopify-design/add-previous-and-next-buttons-to-dawn-theme/td-p/1461859
Hope it helps!
Thank you for the reply. my is theme dawn 4.0 therefore i could not find
product-card.liquid file, find 'card-information__text h5
as mentioned in your post. And i am sorry that i have deleted the old
liquid, and i can’t find the original source right now. Perhaps i could
provide my shopify line for you to check?
Hi @minhsien ,
Please find ‘card_product.url’, change
card_product.url
=>
card_product.url | within: collection | default: ‘#’
Hope it helps!
Hi @minhsien ,
The next and previous button is only displayed when you visit the collection page and have a product link: https://mzakkaya.com/collections/trendy/products/kids-sunscreen-lace-lace-breathable-bucket-hat
So you need to change the product link in step 1 as per my previous instructions.
Hope it is clear to you.
Thanks for the effort! it looks and work well
1 Like
Nabeel2
September 21, 2022, 8:20pm
8
Hi @minhsien put this line in your collection page
{% assign url = card_product.url | within: collection %}
and your collection link should look something like this: -
{{ item.title | escape }}
i hope this helps