Static/Dynamic sections for page customisations for the same page template

Shopify Partner
9 0 3

Hello,

 

Aim

Create a page based on a new template (success) that can be setup for a new (person-attending) events (e.g. Tour, with each event placed into new Event based Product Collection).  New events will be added on the whim of the shop owner/administrator.

They can cope with adding a new product, a new collection and creating a page based on a template and maybe customising a newly added page to add sections but may struggle with editing code (scary thought).

 

I wish to allow the shop administrator (non-technical) to add a new page based on this template, then customise a given page so they may provide the Product Collection via a section i.e. "Tours" - which will apply to one page only but there may be other pages which share the same template.

The page will display products from the Product Collection.

I don't want to have to create a new page template for each product collection.

 

Attempts and resulting problems

1.  I created two pages based on a custom template along with a static section - they shared the same static section variables I.e. I changed the static section setting for Product Collection and it changed for the other page too.

2.  Thinking that a dynamic section would store its settings for a section more independently, I created a dynamic section - but then found out the hard way that dynamic sections can only be added to the home page.

 

Questions/requests

How can I provide a way for my administrator to create pages and set a setting for the product collection?

I am thinking that the only way to achieve this is to use the Admin API to duplicate an existing page and then customise on my own platform, then publish a new page with the appropriate customisations - seems overkill (though ok if only option) when all I need is the ability to add sections specific to a page but instead I'll have to create a new page template for even Product Collection. 

Even if there is a partial solution to achieve this in the short term with static sections that would at least be something.

 

Requests to Shopify

  • Desirable - sections added to pages sharing a template should have their settings independent from other pages (or some way to unhook from sharing because I see the value in sharing e.g. header/footer)
  • Ideally - Allow dynamic sections for other pages (other than home page) - this would be absolutely wonderful for content creation. 

 

Please tell me if I have overlooked something obvious (or if some features are available only on mythic Plus level - I might only be going for Advanced Level) - only just started playing around using Shopify so I'm learning by walking in the fire (actually it's more like Gandalf vs the Balrog)   :-) 

 

Many thanks for your advice. *head nod*

Dan.

 

0 Likes
Highlighted
Shopify Partner
2000 25 538

Hey Dan, you can try it with the following concept:

Use static section, but with several blocks.

 

Each block will have all settings you want for this section, plus a "filter" field.

 

The code will loop over section blocks, find the one which matches current page and use settings from this block.

For example, for product page you have block with the following "filter" setting:

	"settings":	[
          {
            "type":	"product",
            "id":	"product",
            "label":	"Show for this product"
          }, 
... Other settings ...
]

And then the code to loop over blocks:

  {% for block in section.blocks %}
    {% if template.name == 'product' and block.settings.product != product.handle %}
    	{% continue %}
    {% endif %}
  
    <div {{ block.shopify_attributes }}>
     ...actually output something based on the other block settings...
</div>
{% endfor %}

 

This way you can "emulate" dynamic sections on pages other than home.

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com! My post solved your problem? This is my Paypal too :)
0 Likes