Blueprint Field conditionals - is there a max amount?

Struggling with this one. Any help is greatly appreciated.

I have a large/long blueprint for various product types (apologies). I’m trying to use a field conditional “when” a toggles value for item_type is met…

  1. The toggles field is not showing up unless I remove the fields with conditionals / and or remove conditionals
  2. Is there a limit on the number of conditionals one can use for fields? Again I have a lot. as shown below.
  3. Am I just making a stupid mistake I don’t see?
  4. Maybe there’s a better way to do this?

Blueprint: item.yml
* Just a note, I am using the Table Field plugin by Bogdan Condorachi


title: Item
tabs:       
  product:
    label: Product Info
    columns:
      - width: 2/3
        sections:
          items:
            type: fields
            fields:

              product_title:
                label: Title
                type: text
                buttons: false
                size: large
                width: 1/2

              price:
                label: Retail Price
                type: number
                placeholder: 00.00
                step: .01
                before: $
                width: 1/4
                after: Before Tax

              wholesale_price:
                label: Wholesale Price
                type: number
                placeholder: 00.00
                step: .01
                before: $
                width: 1/4
                after: Before Tax

              line_2:
                type: line
                width: 1/1

              item_type:
                label: Product Type
                type: toggles           
                options:
                  - value: book
                    text: "Book"
                  - value: music
                    text: "Music"
                  - value: apparel
                    text: "Apparel"
                  - value: accessory
                    text: "Accessory"
                  - value: art
                    text: "Art"
                  - value: product
                    text: "Product"
                width: 1/1

              sold_out:
                label: Sold Out?
                type: toggle
                text:
                  - "no"
                  - "yes"
                width: 1/3

              in_stock:
                label: In Stock?
                type: toggle
                text:
                  - "no"
                  - "yes"
                width: 1/4

              new_release:
                label: Item New?
                type: toggle
                text:
                  - "No"
                  - "Yes"
                width: 1/4 

              preorder_release:
                label: Preorder Release?
                type: toggle
                text:
                  - "No"
                  - "Yes"
                width: 1/4  

              headline_1:
                type: headline
                label: Product Details
                width: 1/1

              line_3:
                type: line
                width: 1/1

              author:
                label: Author
                type: text
                buttons: false
                size: medium
                width: 2/3
                when:
                  item_type: "Book"
              
              book_description:
                label: Book Description
                type: textarea
                buttons: false
                size: small
                width: 2/3
                when:
                  item_type: "Book"
 
              book_type:
                label: Release Type
                type: checkboxes
                columns: 2
                options:
                  - "Hardcover"
                  - "Softcover"
                  - "Zine"
                  - "Periodical"
                width: 1/3
                when:
                  item_type: "Book"
              
              page_count:
                label: Page Count
                type: number
                width: 1/3
                when:
                  item_type: "Book"
              
              book_dimensions:
                label: Dimensions (inches)
                type: text
                placeholder: "L x W x H"
                width: 1/3
                when:
                  item_type: "Book"
              
              book_publisher:
                label: Publisher
                type: text
                buttons: false
                size: medium
                width: 2/3
                when:
                  item_type: "Book"

              isbn: 
                label: ISBN ISSN
                type: text
                buttons: false
                size: medium
                width: 1/3
                when:
                  item_type: "Book"
              
              book_catalog_number:
                label: Catalog Number
                type: text
                buttons: false
                size: medium
                width: 1/3
                when:
                  item_type: "Book"
              
              music_artist:
                label: Composer/Artist
                type: text
                buttons: false
                size: medium
                width: 2/3
                when:
                  item_type: "Music"
              
              artist_website:
                label: Artist Website
                type: table
                columns:
                  - label: Name
                    type: text
                  - label: URL
                    type: url
                width: 1/1
                when:
                  item_type: "Music"
              
              music_description:
                label: Music Description
                type: textarea
                buttons: false
                size: small
                width: 2/3
                when:
                  item_type: "Music"

              music_format:
                label: Format
                type: checkboxes
                columns: 2
                options:
                  - "Vinyl"
                  - "CD"
                  - "Cassette"
                width: 2/3
                when:
                  item_type: "Music"

              music_duration:
                label: Duration (minutes)
                placeholder: "00:00"
                type: text
                width: 1/3
                when:
                  item_type: "Music"

              music_catalog_number:
                label: Catalog Number
                type: text
                buttons: false
                size: medium
                width: 1/3
                when:
                  item_type: "Music"
              
              music_label:
                label: Record Label
                type: text
                buttons: false
                size: medium
                width: 1/3
                when:
                  item_type: "Music"
              
              music_publisher:
                label: Publisher
                type: table
                columns:
                  - label: Name
                    type: text
                  - label: URL
                    type: url
                width: 1/1
                when:
                  item_type: "Music"
              
              apparel_description:
                label: Apparel Description
                type: textarea
                buttons: false
                size: small
                width: 2/3
                when:
                  item_type: "Apparel"

              apparel_type:
                label: Apparel Type
                type: checkboxes
                columns: 2
                options:
                  - "T-Shirt"
                  - "Hoodie"
                  - "Crew"
                  - "Jacket"
                  - "Other"
                width: 1/1
                when:
                  item_type: "Apparel"
              
              apparel_materials:
                label: Materials
                type: text
                buttons: false
                size: medium
                width: 1/3
                when:
                  item_type: "Apparel"

              apparel_color:
                label: Color
                type: text
                buttons: false
                size: medium
                width: 1/3
                when:
                  item_type: "Apparel"
              
              apparel_sizes:
                label: Available Sizes
                type: checkboxes
                columns: 2
                options:
                  - "XS"
                  - "S"
                  - "M"
                  - "L"
                  - "XL"
                  - "XXL"
                width: 1/3
                when:
                  item_type: "Apparel"
              
              accessory_type:
                label: Accessory Type
                type: toggles
                options:
                  - "Tote Bag"
                  - "Hat"
                  - "Pin"
                  - "Patch"
                  - "Sticker"
                  - "Other"
                width: 1/1
                when:
                  item_type: "Accessory"
              
              accessory_description:
                label: Accessory Description
                type: textarea
                buttons: false
                size: small
                width: 2/3
                when:
                  item_type: "Accessory"
              
              art_artist:
                label: Artist
                type: text
                buttons: false
                size: medium
                width: 2/3
                when:
                  item_type: "Art"
              
              art_title:
                label: Title of Artwork
                type: text
                buttons: false
                size: medium
                width: 2/3
                when:
                  item_type: "Art"

              art_description:
                label: Art Description
                type: textarea
                buttons: false
                size: small
                width: 2/3
                when:
                  item_type: "Art"

              art_website:
                label: Artist Website
                type: table
                columns:
                  - label: Name
                    type: text
                  - label: URL
                    type: url
                width: 1/1
                when:
                  item_type: "Art"
              
              art_year:
                label: Year Created
                type: number
                width: 1/3
                when:
                  item_type: "Art"

              art_medium:
                label: Medium
                type: text
                buttons: false
                size: medium
                width: 1/3
                when:
                  item_type: "Art"
              
              art_dimensions:
                label: Dimensions (inches)
                type: text
                placeholder: "L x W x H"
                width: 1/3
                when:
                  item_type: "Art"

              item_type:
                label: Product Type
                type: text
                buttons: false
                size: medium
                width: 1/1
                when:
                  item_type: "Product"

              product_description:
                label: Product Description
                type: textarea
                buttons: false
                size: small
                width: 2/3
                when:
                  item_type: "Product"
              
              product_brand:
                label: Brand
                type: text
                buttons: false
                size: medium
                width: 2/3
                when:
                  item_type: "Product"
              
              product_model:
                label: Model Number
                type: text
                buttons: false
                size: medium
                width: 1/3
                when:
                  item_type: "Product"
              
              product_sku:
                label: SKU
                type: text
                buttons: false
                size: medium
                width: 1/3
                when:
                  item_type: "Product"
              
              product_color:
                label: Color
                type: text
                buttons: false
                size: medium
                width: 1/3
                when:
                  item_type: "Product"
              
              product_dimensions:
                label: Dimensions (inches)
                type: text
                placeholder: "L x W x H"
                width: 1/3
                when:
                  item_type: "Product"
              
              product_weight:
                label: Weight (lbs)
                type: number
                step: .01
                width: 1/3
                when:
                  item_type: "Product"  
                
      - width: 1/3
        sticky: true
        sections:
          sidebar:
            type: fields
            fields:
              cover: 
                extends: fields/cover
                label: Hero Image

              listing_date: 
                label: Listing Date
                type: date
                width: 1/2

              releasae_date: 
                label: Release Date
                type: date
                width: 1/2

              tags: 
                label: Product Category
                type: tags
                width: 1/1

              stockist:
                label: Stockists
                type: table
                columns:
                  - label: Name
                    type: text
                  - label: URL
                    type: url
                  - label: Country
                    type: text
                  - label: State/Province
                    type: text
                  - label: City
                    type: text
                width: 1/1
              
              shipping:
                type: checkboxes
                columns: 2 
                options:
                  - USPS Priority Mail
                  - USPS Priority Mail Express
                  - USPS 2nd Day Air
                  - Digital Delivery
                width: 1/1
      

  images:
    label: Product Images
    columns:
      - width: 1/1
        sticky: true
        sections:
          procuct_images:
            type: fields
            fields:
      
              gallery:
                label: Product Images
                type: files
                template: image
                info: "{{file.alt}}<br>{{ file.dimensions }}"
                layout: cards
                size: small
                image:
                  cover: true
                  ratio: 1/1
                  back: white
             


Cheers. Emmit.

What I notice here is that you are using the label “Book” rather than the stored value “book”, which will not work. If you correct to the value, you should be fine.

And no, there is no maximum.

Yes, I had tried it with the stored value - with and without ““… but didn’t work. Tried again, and it’s still not working. This is what I’m getting in the panel… You can see the Toggles field isn’t even showing up right below the first Line Field..

I copy-pasted the above into a blueprint item.yml in a Starterkit, and the first error I get is a duplicate key item_type, which again references item_type:

              item_type:
                label: Product Type
                type: text
                buttons: false
                size: medium
                width: 1/1
                when:
                  item_type: "Product"

Keys need to be unique, just a bit surprised you are not getting this error. But using the value is the way to go, never the label.

Yes. I just saw that as well and changed it - but didn’t change anything.

:man_shrugging:

For me, it works once I change the when conditions to their lowercase equivalents (apart from the table fields that I don’t have)

so weird. I got it working.. but first i deleted the Cache folder contents. Thanks for helping me work through this!

1 Like