Thread tagged as: Problem, Shop

Filtering using ID within Block


This might not be possible but thought I would ask. If I am using blocks in a product.html template like this:

<perch:block type="clock" label="Clock Specific">
        <perch:shop id="main_colour" type="select" label="Main Colour" options="White|white,Cream|cream,Grey|grey,Black|black,Red|red,Yellow|yellow,Blue|blue,Green|green,Purple|purple,Orange|orange,Pink|pink,Copper|copper,Chrome/Silver|chromesilver, Gold/Brass|goldbrass, Brown/Wood|brownwood" />
<perch:block type="watch" label="Watch Specific">

Can I then use the ID as part of a filter? So:

    'template' => 'products/category_grid',
    'count' => 24,
    'paginate' => true,

It isn't working, which may be a scope issue, but wanted to check.



Mike Harrison

Mike Harrison 37 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

No, you can't filter blocks.

OK thanks.

More broadly, my issue is I have two very different product types in my Shop, and am using Blocks to provide the relevant content fields for the editor i.e. so they don't have to scroll through a load of Clock-specific content to add the information for the Watch they are adding.

It seems like Blocks is a bad idea for this due to filtering / categorising issues. Is there a better approach to letting the user select the relevant fields for the product, or should I just leave it as a big long edit form with dividers to break it up?

Drew McLellan

Drew McLellan 2638 points
Perch Support

What do you need? Multiple product templates?

That would be great but I may well be the only person asking for it! In which case I am happy to work around and just have a well laid-out product.html master template.

If it were to be added, something that worked a bit like the Post Type setup for Blog would be perfect for me for this instance. Then I could create the Product Types for the client to select from when they create a new product.