Shopify: selecting alternate Template for "All Products" page - shopify

I am trying to customise my debut theme and am a bit stuck.
I am trying to create an alternate template for the template that shows all my products.
I am able to create an alternate collections.liquid and it also shows up in the admin an it all works fine. But my confusion is, this seems to be the same template for rendering the all my products (not just the products from that collection) too, but how/where select the alternate template for that in the admin?
In other words I am attempting to change the template for collections/all

By default the collections/all uses the collection.liquid file.
As you said you can create a new template collection.custom.liquid that you can use.
The interesting part is that there is no actual collection/all page in the admin. This is the default page that ALL shopify shops have (similar to the homepage/404/cart page). So you don't have access to it from the admin panel by default.
In order to change the ALL collection page you need to create it yourself. Go to your collections admin page and create a new collection with the handle all and this will overwrite the default all collection and you will be able to choose a different template for it.
TLDR; create a new "all" collection in the admin panel and choose the custom template for it.

you have check here collection type grid or list which is enabled from the theme option
collection-template.liquid file that show collection/all item list
if want to change the alternative template goto the template directory. page.collection_list.liquid

Related

Using two different blog listing page templates for the two different blogs in our shop

Hi we have two blog types defined within our shop and they both use the same template right now.
Specifically I want to make changes to just one of the two blogs listing pages (the page where a summary and thumbnail of each blog article is shown).
How can I achieve this? Will this automatically happen if I name the templates to something specific a bit like how wordpress handles templating ?
What you need to do is:
in admin/themes click on the three dots and edit the code
in the left pane create a new template in the templates directory
select blog as template and give it a name, e.g. second_blog
this will create a new template file blog.second_blog.json
go back to admin: /admin/blogs
select the blog to which you want to assign the new template
on the bottom right in the theme template dropdown, select the template second_blog
In the theme editor select the new template and make the desired changes
You now have two blog templates which you can design individually
What you need to do is:
in admin/themes click on the three dots and edit the code
in the left pane create a new template in the templates directory
select blog as template and give it a name, e.g. second_blog
this will create a new template file blog.second_blog.json
go back to admin: /admin/blogs
select the blog to which you want to assign the new template
on the bottom right in the theme template dropdown, select the template second_blog
In the theme editor select the new template
and make the desired changes
You now have two blog templates which
you can design individually
The process is documented here.

How to access code of a specific page in shopify?

I am building a Shopify website https://fone-kase-plus.myshopify.com/.
For example, I want to modify code of this page only: https://fone-kase-plus.myshopify.com/pages/iphone-6 .
How is it possible to do it?
If you go in the admin, and to that page (from Online Store/Pages) on the right you will see "Theme Template" and a name. That's the template that is applied to that page.
That name is a file in your theme under templates with a name like page.your-template-name.liquid.
If you copy that file and create another one like page.another-template-name.liquid you can then apply that template only to the pages you want. Then you modify that template file to make a page as you like.

Shopify: How to make a custom template editable in the theme editor?

I am using the theme "Debut" and I've copied it to make a custom theme out of it.
Then, under "Edit code" I have create a new template for "blog".
Now, when I click on "Customize" button at my template, and the theme editor opens, I have a select box in the top bar where I can select the themes templates, and the pages I've created. But I can't find my custom blog template there, to edit it via the drag & drop editor.
How can I achieve this?
Any help is highly appreciated, thanks!
Once you add any custom template for a blog, product, or collection, they are not available directly into the backend customizer in Shopify.
In backend default templates are available, you need to assign the template to a page, product or blog and then navigate to the desired page, collection or product and blog page into backend using customizer window and then you able to edit the sections and blocks that are added to custom template code.

Creating a secondary index page with identical sections as primary index page but different content?

I'm attempting to create a secondary index page for a theme that I'm working on. It would have the same sections as the primary index page, but with different content. I don't mind hardcoding this instead of it being editable from theme editor.
I've created a new index template called secondary, and copied the code from index.liquid into it. Everything shows up fine.
Then I tried to create a new block in the settings_data.json, right under content_for_index called content_for_secondary, but trying to call it in my new page template isn't working.
I've looked all over for documentation but I can't seem to find exactly how Shopify is handling sections in the settings_data.json and how I can create a new array of sections to call in an alternate template.
Has anyone had any experience with this?
You can't change {{ content_for_index }} it's a global variable. You can read more about it here.
Therefore {{ content_for_secondary }} isn't actually anything, this is why nothing is rendered.
Depending on what you are trying to achieve I think you are best off creating the index sections as statically included sections using {% section 'foobar' %} This way the content on the homepage will still be largely editable. You won't however be able to adjust their order in the theme settings. Check out the link above it will tell you all you need to know.
You might create a page template, for example called secondary_home.
Then, duplicate available sections for homepage (do not use the same or content will be the same), and include them in your new template.
Create a page using the template you created.
Load page in "Customize theme" then set settings for each sections.
Please note that this is only possible with statics sections as dynamic ones are only available for home.

Piranha CMS customisation

A few questions on customisation with Piranha CMS.
Is there a way to create additional custom site-wide items similar to those from the site helper? http://piranhacms.org/docs/api-reference/site-helper
e.g. to be able to set a phone number used throughout the site but still editable in the settings section of the manager.
Is is possible to create additional custom items for a page, e.g. page subtitle, and for those to appear in the Information section of page editing? Creating a region for say a page subtitle seems overkill.
Is it possible to create a custom page type with a region that is a collection of HtmlRegions or similar? e.g. for the purpose of managing a set of FAQs or similar enumerated content?
Is is possible to define custom settings properties for a page type?
Yes, you can add regions to your site in the same way as with page types under Settings > Sites. You then add content for them under Content > Pages > Edit Site.
You can add simple text properties on the page type. They will be shown as single line text inputs under Properties when editing the page.
No native support, however the region body can be anything that can be serialized to JSON so you have to handle this in the edit view for your region.
There is no support for injecting fields into the page settings, however if it's important you can override the whole edit view for pages and do anything you like by placing a copy of the view in the manager area in your local project. You can find the views in the github repo in the 2.2.5 branch.
Regards
HÃ¥kan