Announcement

Collapse
No announcement yet.

Blockif's for SPP/MPP

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Blockif's for SPP/MPP

    Hello people.

    I've searched around and found no suitable way to do this.

    I am creating a new layout which will be placed at the top of the 'main content', but there will be two layouts available, depending on the circumstances.

    If a product page (ie. section with one product in it) only has one single product, then layout ABC should be used.

    If the section contains 2+ products, then layout XYZ should be used.

    I am therefore trying to create a blockif which effectively says:

    if section == 1 product then ABClayout

    and the multi product page version:

    if section >= 1 product then XYZlayout


    Can some kind sole pull me out of this tight spot, I'm like a lost puppy dog

    Cheers,
    Grant

    #2
    listindex and listcount are what you tend to use on all situations like this. Add them both to your product layout and then see what shows on screen. You can use them to do your checking/changing. Be aware that fragments get counted too if you have any on the page.

    Comment


      #3
      Originally posted by leehack View Post
      listindex and listcount are what you tend to use on all situations like this. Add them both to your product layout and then see what shows on screen. You can use them to do your checking/changing. Be aware that fragments get counted too if you have any on the page.
      Thanks very much Lee - this is as good as I'm going to get. Shame about fragments counting in the list but I suppose I'll just have to find another way around that.

      Just had a very quick look at the fragment adding to the list count issue - after creating a fragment, on the visibility tab, if I uncheck the tab so that it is 'hidden' to all customer groups, will it still add to the listcount? Known my luck, I think I already have the answer.

      Perhaps I'll just have to create a blank fragment in all sections and use a listcount of ==2 and >=2 in the blockif. Though the generated markup will be horrible. Can't win 'em all.

      Cheers,
      Grant

      Comment


        #4
        Is this soemthing likely to change too much once set? can't you just set the layout on the parent section instead. There is a solution to skip fragments from the count, Norman posted posted some code to do this very recently (last 5 days or so), perhaps that can be used/changed to suit. Is there any uniformity to the numbers, could a dummy product layout be created to mimic a fragment layout?

        Comment


          #5
          Do this within your Product List Layout.

          Duplicate it and amend the duplicate to use an alternative Product Layout depending on whether ListCount is 1 or more.

          Note that there are several Product Layout references in said Product List Layout.
          Norman - www.drillpine.biz
          Edinburgh, U K / Bitez, Turkey

          Comment


            #6
            Unfortunately with the way things will work out, some bigger products will feature on single pages (for example, the bigger barbecues, which can have quite a lengthy description), whereas there's not much I can say about a barbecue cover. It's black, made of leather, and you put it over your barbecue, end of.

            In the future when new brands/product ranges come along, although SPP's will always be SPP's, the MPP's may change from having 10 products to 4 or maybe even 40 - though I doubt a MPP will ever change to a SPP.


            Thanks for the advice Norman, the more I think of it this does seem a logical way forward. Combining both Lee's initial idea and yours may well see a happy ending after all

            Cheers,
            Grant

            Comment


              #7
              Okay, Update time.

              I'm starting to complete the implementation of this offline, all seems well. However, I've got a slight niggle which I've hunted everywhere for a solution and I'll be damned if I can find it.

              I have created two section link layouts.

              One layout (sectionwithdescription) shows title, image and description. The other (sectionnodescription) only shows title and image.

              I want to create a blockif (I presume) inside the product list so this only shows on pages with products, which effectively says:

              if section link layout is equal to sectionnodescription

              Effectively what I want is sections with no description to have the SectionDescription variable shown only if the section link layout is 'sectionnodescription'.

              I have used SectionDescription == "" but this obviously duplicates the description where the 'sectionwithdescription' link layout is used.

              There doesn't seem to be a Condition within block's so I can set "if layout used == X" - Or is there?

              Hopefully one of you geniuses may have a solution because I'm well and truly stumped and it's causing me to find even more things to break, lol

              Thanks,
              Grant

              Comment


                #8
                Why don't you rationalise the layout so that you have just one layout and it shows the description if there is one, and not if there isn't. I do this regularly myself, wrap the whole of the html in the condition like so:

                Code:
                <actinic:block if="%3cactinic%3avariable%20name%3d%22SectionDescription%22%20%2f%3e%20%21%3d%20%22%22" >
                <div class="sectDesc"><actinic:variable name="SectionDescription" /></div>
                </actinic:block>
                If you don't like that then you can name the variable in the Blockif and evaluate whether it uses the said product layout, by using the EXACT name of the layout in commas.

                If Product Layout ="Blah Blah" etc.

                Comment


                  #9
                  You've made a good point - why don't I?! I was just implementing this idea when I thought about it.

                  On a section using 'sectionnodescription', the page will consist of two rectangles on one row, with images centre-aligned in the rectangle. 'sectionwithdescription' consists of one long rectangle, with the image left-aligned and the text to the right. Then the more I thought about it, I could have one layout, with two layouts inside, with a block around each layout - if section=empty then use sectionnodescription, if section=not empty use sectionwithdescription.

                  I'm now trying out your secondary method and will soon find the outcome, though I'm pretty certain I'll end up going with the first method.

                  Thanks very much!

                  Comment


                    #10
                    I have taken Lee's advice and created a blockif.

                    If sectiondescription != "" - this produces the layout for Leisuregrow, Weber, Outdoor Chef and Cadac. If sectiondescription == "" produces the layout for Broil King, Sterling and Royal Calor.

                    I was thinking, there is a variable called 'SectionLinkColumnCount' - could I somehow put this variable within the 'sectiondescription == "" block so that if section layout is blank, set the sectionlinkcolumncount to two, as the 'Parent' is set to 1.

                    Does anyone know if there is a known way to override the parent layout/variable within the layout?

                    Cheers,
                    Grant

                    Comment

                    Working...
                    X