Announcement

Collapse
No announcement yet.

How do I add a condition to activate the other info prompt?

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

    How do I add a condition to activate the other info prompt?

    Hi,

    I have a selection of handmade greetings cards within my shop. On some of these I have an optional component of 'Personalisation' which the customer should tick if they require it. This will cost them an extra £0.25 on top of the cost of the card and is automatically added to the cart. They would then enter their message in the 'Other Info Prompt' box.

    Now, I have realised that even if a customer does not tick the 'Personalisation' box, they can still enter a message in the other info box. I think this could cause problems as people may use it as a way of getting the card personalised without paying the additional cost.


    I already have the following condition wrapped around the Other Info Prompt to ensure this only appears in my Handmade Card section (otherwise it would appear in the other product sections where it is not needed).

    <actinic:variable name="OtherInfoPrompt" /> != ""


    What I would like to do is either one of the following:

    1. Have a condition which means that the 'Other Info Prompt' is only shown when the customer ticks the 'Personalisation' option

    OR

    2. Have a condition which automatically selects the 'Personalisation' tick box as soon as the customer enters the personalisation message so that the extra £0.25 is added to the order.

    If option 2 is used I still need the condition above to be included too to stop it appearing in my other product sections.

    I have had a look in the help guide and tried to implement various conditions but have not had any success so far.

    Has anybody got any suggestions please?

    Thanks,
    Jules

    #2
    Has anyone any ideas on this please? I'm totally stuck on this one. Thanks
    Jules

    Comment


      #3
      Actinic produces static(fixed) pages and you want a dynamic(changing) result.

      Only way I can see to do this is to edit the Actinic produced pages and then upload by ftp overwriting the Actinic pages.

      You would have to remake the changes every time you upload from Actinic, and this would not only be very time consuming but also very prone to error.

      You would have to find the unique identifier for each other info input control, make that control invisible, then add an onblur javascrip action to the associated checkbox which checks whether or not the checkbox is ticked and toggle the input visible if the checkbox is ticked.

      Probably easier to change the html for the checkbox to 'confirm the entered personalisation message is correct', and accept that people will still get it wrong sometimes.
      Bill
      www.egyptianwonders.co.uk
      Text directoryWorldwide Actinic(TM) shops
      BC Ness Solutions Support services, custom software
      Registered Microsoft™ Partner (ISV)
      VoIP UK: 0131 208 0605
      Located: Alexandria, EGYPT

      Comment


        #4
        Thanks Bill,

        I thought it may be more complicated than I'd imagined. Unfortunately, this goes way beyond my current capabilities in this area.

        I will go with your suggestion regarding changing the HTML for the checkbox, as hopefully this should encourage people to check the box.

        I appreciate you taking the time to provide a response.

        Thanks again.
        Jules

        Comment


          #5
          You don't need to create any condition around the Other Info prompt in your product layout as Actinic already does this.

          What you'd need is a modified Product Layout that adds some JavaScript to the Other info input field. This JavaScript would interrogate the field length and set / reset the Component checkbox depending on whether it was empty or not.

          This wouldn't be too hard to do if your products only had that single Component. If they had other Components ot Attributes, then locating the correct field to alter would become tricky.
          Norman - www.drillpine.biz
          Edinburgh, U K / Bitez, Turkey

          Comment


            #6
            Hi Norman,

            What you'd need is a modified Product Layout that adds some JavaScript to the Other info input field. This JavaScript would interrogate the field length and set / reset the Component checkbox depending on whether it was empty or not
            Yes, this sounds like it would do the job. Although, I'm no expert on Javascript so how would I go about obtaining this type of script?

            This wouldn't be too hard to do if your products only had that single Component. If they had other Components ot Attributes, then locating the correct field to alter would become tricky.
            I currently use components in one other product section (tissue paper where I have a drop down list for the colours) other than the handmade cards. In this section I am only using the one component for personalisation.
            Jules

            Comment


              #7
              Put the following into your Overall Layout just above the </head> line
              Code:
              <script type="text/javascript">
              <!-- 
              function setcomp(textfield){
                var ref = 'v_' + textfield.name.substr(2) + '_1';	// ID of first Variant v_<prodref>_1
                // locate the field by its name (Actinic doesn't set the ID)
                var ifields = document.getElementsByTagName('input');
                for ( var i=0; i < ifields.length; i++ ) 
                  {
                  if ( ifields[i].name == ref ) 
                    {
                    var checkbox = ifields[i];
                    break;
                    }
                  }
                // check / uncheck as required  
                if ( textfield.value == '' )
                  {
                  checkbox.checked = false;
                  }
                else
                  {
                  checkbox.checked = true;
                  }
              }
              // -->
              </script>
              Make a Copy of your usual product layout and in that layout replace
              Code:
                          <input type="text" name="O_<Actinic:Variable Name="ProductReference"/>" size="40" maxlength="1000" value="" />
              with
              Code:
                          <input type="text" name="O_<Actinic:Variable Name="ProductReference"/>" size="40" maxlength="1000" value="" 
              			onchange="setcomp(this)"
              			/>
              However this won't stop people fiddling with the checkbox after they've entered some text. It may be a good idea to replace
              Code:
                       <actinic:variable name="ComponentList" />
              with
              Code:
                       <span style="display:none; visibility:hidden"><actinic:variable name="ComponentList" /></span>
              To hide the checkbox.

              And you'll also need to do the Advanced Guide stuff to make the Other Info field optional.
              Norman - www.drillpine.biz
              Edinburgh, U K / Bitez, Turkey

              Comment


                #8
                Hi Norman,

                Thanks very much for supplying the code. It works perfectly when adding the product from my main product layout. However, it doesn't seem to work when I add the product to my cart from my extended information window (I am using the 'Includes add to cart button' layout). I have updated the code in there too so I'm not sure why it doesn't add the extra cost for personalisation.

                Do you have any suggestions?
                Jules

                Comment


                  #9
                  Post an URL of a problem page so I can see what's happening.
                  Norman - www.drillpine.biz
                  Edinburgh, U K / Bitez, Turkey

                  Comment


                    #10
                    Ok, here you go.

                    Still in test mode at the moment. It's the extended info window one which isn't working. It will add the personalisation message to the cart but it doesn't add the cost on.



                    Also you will notice that the code is slightly different as I also had to amend the size of the 'Other Info Box' using the instructions in the AUG as well as making it optional. So where you said I should input this:

                    Code:
                    <input type="text" name="O_<Actinic:Variable Name="ProductReference"/>" size="40" maxlength="1000" value="" 
                    			onchange="setcomp(this)"
                    			/>
                    I had to input this:

                    Code:
                    <textarea name="O_<Actinic:Variable Name="ProductReference"/>" rows="5" cols="40" maxlength="1000" value="" 
                    			onchange="setcomp(this)"
                    I'm not sure if this is ok or not but just thought I would show you what I'd done in case its not correct.

                    It's best viewed in FireFox or Netscape at the moment. I have a problem with the left menu displaying incorrectly in Internet Explorer...but that's another story!

                    Thanks,
                    Jules

                    Comment


                      #11
                      The bit of code that you put into the Overall Layout just before the </head> line also needs to be put into the overall layout of the popup page.
                      Norman - www.drillpine.biz
                      Edinburgh, U K / Bitez, Turkey

                      Comment


                        #12
                        I see, that makes sense now. It's all working. Thanks very much for taking the time to help me with this, I really appreciate it. I just have one further question.

                        I wanted to restrict the number of characters entered into the other info box to 58, so I went to Design|Text and entered the following into phase 2161.

                        Code:
                        %s<input type="text" name="%s" size="%d" maxlength="58" %d value="%s" %s />
                        However, this doesn't seem to work. I thought this was supposed to stop the customer entering any more than 58 characters? Is there something I am missing here?

                        Thanks.
                        Jules

                        Comment


                          #13
                          That item isn't used in the Product Layout. Look there and fix
                          Code:
                                      <input type="text" name="O_<Actinic:Variable Name="ProductReference"/>" size="40" maxlength="1000" value="" 
                          			onchange="setcomp(this)"
                          			/>
                          Norman - www.drillpine.biz
                          Edinburgh, U K / Bitez, Turkey

                          Comment


                            #14
                            I see, sorry, for some reason I thought I needed to keep the code in to make the 'Other Info Prompt' larger, but this of course is unnecessary. I've updated it now and it's all working as it should.

                            Thanks again for your help.
                            Jules

                            Comment

                            Working...
                            X