Announcement

Collapse
No announcement yet.

Listcount outside the box

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

    Listcount outside the box

    I am trying to show the number of items in a list according to some criteria. Here is the code I have so far:

    Code:
    <actinic:block type="EntireSectionList" >
    <actinic:block if="%3cactinic%3avariable%20name%3d%22MetSectID%22%20%2f%3e%20%3d%3d%20135">
    	<actinic:block type="ProductList" >
    <actinic:variable name="ProductReference" />
    </actinic:block>
    </actinic:block>
    	
    </actinic:block>
    MetSectID is the criteria and it is set to 135 (A section containing seven subsections in a SPPP set up)

    The code works because it lists all seven products.

    My question is how do I count this value so I can use it on my page to diplay how many items fit the ciriteria.

    I have tried placing listcount in variaous places with no sucess
    Unusual Silver Jewellery
    Giftmill - Unusual Gifts
    Crystal Healing Jewellery
    Steampunk Jewellery

    #2
    There is listindex and listcount, not sure if that makes any difference to your situation.

    I've read your post a couple of times and struggling to understand what you are trying to do. If you get no further replies, that opinion may be popular in which case try to explain a bit better if you can.

    Comment


      #3
      Many appologies for the poor question, when you've been working on something for hours it all seems logical to me.

      I am in the process of designing another jewellery site and unlike our other site this one sells White Gold, Yellow Gold, Silver etc.

      All the products are in one major section so all the Bracelets will be under a section called Bracelets in subsections 1,2,3 etc.

      What I am trying to do is to show to the customer is how many Bracelets there are in total then how many White Gold, how many Silver etc.

      Clicking on 'White Gold' in the Bracelets section fires a hard coded search link that only show the white gold items. Using Normans Multi Column Search Results the customer doesn't realise they are looking at search results rather than normal section listings.

      When all is done there will be a box on the left hand side something like the following:

      Bracelets (140)

      White Gold (80)
      Yellow Gold (40)
      Silver (20)

      The site in question is www.metallious.co.uk

      The variable MetSectID is one I created that is basically the TLS SectionID but it fliters down to all the subsections - in this case The SectionID for bracelets is 135.
      Unusual Silver Jewellery
      Giftmill - Unusual Gifts
      Crystal Healing Jewellery
      Steampunk Jewellery

      Comment


        #4
        I think whether you can do this will come down to the number of products you have in total as the process you need to use can grind sites to a halt if too many. Whats the ultimate number of products approx?

        I have this link in my archive too, see if that makes any sense or is of any use - http://community.actinic.com/archive...p/t-29223.html

        Comment


          #5
          The number of products will probably be around 1000 by the time I'm done so not an excessive amount.

          Thanks for the link - I'll take a look and post back.
          Unusual Silver Jewellery
          Giftmill - Unusual Gifts
          Crystal Healing Jewellery
          Steampunk Jewellery

          Comment


            #6
            Thanks for the link Lee - Normans Code looks promissing as usual.

            The code I have used is as follows:

            Code:
            <actinic:block php="true">
            $productcount = 0;
            </actinic:block>
            
            <actinic:block type="EntireSectionList" />
            	<actinic:block if="%3cactinic%3avariable%20name%3d%22MetSectID%22%20%2f%3e%20%3d%3d%20135" >
            	<actinic:block type="ProductList" />
            		<actinic:block php="true">
            		$productcount++;
            		</actinic:block>
            	</actinic:block>
            	</actinic:block>
            </actinic:block>
            
            <actinic:block php="true">
            echo "There are $productcount products";
            </actinic:block>
            It works fine apart from the fact that it returns double the actual number of products expected. I do not use any fragments so it is not counting them and adding ProductReference into the block shows that it is only showing the correct products.

            Maybe it is something to do with all the products being in their own section.

            If nobody knows I will dig out my Perl book and see if I can work out how to divide the result by 2.
            Unusual Silver Jewellery
            Giftmill - Unusual Gifts
            Crystal Healing Jewellery
            Steampunk Jewellery

            Comment


              #7
              Adding this bit before the echo part seems to work.

              Code:
              <actinic:block php="true">
              $productcount = $productcount/2;
              </actinic:block>
              Unusual Silver Jewellery
              Giftmill - Unusual Gifts
              Crystal Healing Jewellery
              Steampunk Jewellery

              Comment

              Working...
              X