Announcement

Collapse
No announcement yet.

Showing msg when Section contains no subsections

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

    Showing msg when Section contains no subsections

    Hi, this is my first Actinic project, and my first post here.

    The problem is how to show the user when they go to a section that is currently empty. This is the setup:

    6 top sections (diff types of products)
    Each top section can have 0+ subsections, which represent manufacturers.
    Each of those subsections/manufacturers can then contain products.

    We're still waiting on content from the client, but want to go live with what we have - that is 3 top sections filled with manufacturers and products, and the other 3 top sections are empty.

    This is the catalog part of the site -
    http://www.rjsxtreme.co.uk/acatalog/
    Note that I've taken a basic template and ripped out all the table-based HTML to replace it with CSS positioned HTML.

    At the top of each subsection I have placed a list of manufacturers within that subsection - this is generated via JavaScript, using the child_sections_names array. That worked fine - if there were child sections, list them as manufacturers within this section, otherwise don't create the list. That allows the list in the top level sections, but prevents it from being shown when you're viewing a manufacturer page.
    Hopefully that makes sense if you view the site!

    Is there a similar JavaScript method of getting an array of products within the current section? If so, I could check if there are no child sections AND no products, then show the 'no products available' message on the page.

    Or is there a better way of achieving this?

    #2
    Dan, Hi. I visited the site - maybe I'm being thicko (end of an Actinic day myself) but I'm not quite sure what you mean.

    It seemed fine to me to drill down and find, ok, there aren't any products (maybe the message could be slightly more toucy feely - "We are out of stock but will be on-line again soon. Please leave your email so we can etc etc..."

    Do you mean - if there is no stock - that it is apparent on the first page?

    Seems to me that would makepeople leave your site too quickly?

    Best -James
    James Gladwin

    Comment


      #3
      You'll have to do it something like this

      Code:
      In Act_ProductBody.html replace the line
      
      	NETQUOTEVAR:PRODUCTBULK
      
      with
      
      
      <script language=JavaScript>
      <!--
      var haveproducts = false;
      // -->
      </script>
      
      	NETQUOTEVAR:PRODUCTBULK
      
      <script language=JavaScript>
      <!--
      if ( ! haveproducts ) document.write('<tr><td colspan=3>No products message....</td></tr>');
      // -->
      </script>
      
      
      And in all your Product Templates (near the top) add
      
      <script language=JavaScript>
      <!--
      var haveproducts = true;
      // -->
      </script>
      This is untested so you may have to fix a few typos.

      Norman
      Norman - www.drillpine.biz
      Edinburgh, U K / Bitez, Turkey

      Comment


        #4
        Hi, thanks for the replies.

        This is not a question of stock, it's about product categories being defined, but there not being any products defined in those categories.

        I'd better explain how I've built up the catalog database.

        TopSection (Represents a type of product, like 'Watercraft')
        SubSection (Represents a product manufacturer, like Honda)
        Product (The actual product)

        The Top Sections are these -
        ATVs
        Kids ATVs
        Watercraft
        Misc Motors
        Accessories
        Used

        These Top Sections do not contain products, they only contain subsections which represent the various manufacturers. For instance, under ATVs there are -
        Honda
        Polaris
        Ram
        Suzuki
        Yamaha

        These subsections can contain products (they of course should contain products, but we're waiting on content)

        As I have the db now, I haven't defined any manufacturers that don't have defined products. But the last three TopSections - Misc Motors, Accessories and Used don't have any manufacturers defined. Therefore they have no products in them.

        What I want to happen then is when you click on Misc Motors you see a message saying 'no products defined' (or something more wordy). I had it so the JavaScript checked for child sections - if there were none, then it's obvious that there aren't any products either, so show the message. The problem with that is that in the subsections there also arent' any subsections - there are products instead.
        So if I could check for subsections and products I could show the right message.

        NormanRouxel,
        I tried what you suggested, but it now puts the message on all pages.
        I don't understand the logic of that JS, unless there's something in
        NETQUOTEVAR:PRODUCTBULK
        that should change the value of haveproducts?

        Thanks,
        Dan.

        Comment


          #5
          Hi Norman, I've looked at your solution again and got it to work! I didn't get what you meant by 'product templates' - I had put that JS code in the primary template, where it did no good at all. Now it's moved into the ProductLine template and I've tweaked the logic in the JS, it works fine!
          Thanks!

          Comment

          Working...
          X