Announcement

Collapse
No announcement yet.

advanced hyperlinks

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

    advanced hyperlinks

    I have a challenge for the people with alot more brains than me!

    I need to create a hyperlink on a product page that links to an online form.
    I then need the product name to be automatically inserted into the form and then, to make things a little more confusing i need the page to be linked back to the original product page when the submit button is pressed.

    hope this makes sense, i don't really know where to start. i have made a hyperlink to the form, just need the info to auto insert.

    Thanks in advance

    Olly

    #2
    anyone got any ideas on how i could do this?

    Comment


      #3
      Hi,

      To be able to do the Auto Insert you will need the link to include the product reference, this should be possible using a NETQUOTEVAR to suffix the URL with, NETQUOTEVAR:PRODREF

      The form page will require java script to read the prodref parameter and to insert it into the appropriate field in the form.

      An alternative if the form is on the same server as Actinic, may be to write a perl script, possibly a function in ShoppingCart.pl which could pass the product reference and serve the form with the product reference filled. Using a function in ShoppingCart.pl would enable the possibility to fill in other details from the product object.

      The usual disclaimer goes, Actinic does not support script changes and all changes are to be made at the users risk. I would advise making a backup of any file before editing it.

      Kind regards,
      Bruce King
      SellerDeck

      Comment


        #4
        Bruce, thanks for your responce.

        although this sounds like the right solution, unfortunatly my knowledge in HTML and scripting etc. is very limited and i am having trouble attempting the NETQUOTEVAR:PRODUCTREF, not to mention writing perl script.

        Would it be possible for you to break this solution down to give me a better idea of how to approach this?

        Hope this isn't too much trouble

        Thanks
        Olly

        Comment


          #5
          Going about it the simplest way: firstly you need to add the name, or better, the product reference, to the URL, like this:

          Code:
          <a href="yourFormPage.html?ref=NETQUOTEVAR:PRODUCTREF">Click here</a>
          Passing the full product name is more difficult since you will need to encode certain characters (eg spaces) before adding them to the URL, and decode them again at the other end. This way will work fine for numeric references.

          Next, you need the form page to be able to read the reference. Add this directly after the <body> tag in your form page:

          Code:
          <input type="hidden" id="url" />
          <Script type="text/javascript">
          document.getElementById("url").value=window.location;
          var str=document.getElementById("url").value;
          str=str.substring(str.lastIndexOf("ref=")+4,str.length);
          </script>
          Now you have the product reference stored in the Javascript variable 'str', so you can write it to the page wherever you want - in this case, inside a form field:

          Code:
          <input type="text" value="<script type="text/javascript">document.write(str)</script>" />
          Now when you click the link, the form page should open with the field containing the product reference. See how you get on with that, and if you really need the name rather than the reference, you'll need a bit more code.
          www.gbradley.co.uk
          Web Development, Actinic Patches, Scripts & more

          Comment


            #6
            thanks for your responce

            I have had a quick attempt at this and the form displayed '<script type=' within an input box and then 'document.write(str)' following the input box. Anybody any ideas why?
            If it helps this doesn't really need to be within an input box aslong as the information is displayed and sent with the form.

            once i've got this working:
            If i replace NETQUOTEVAR:PRODUCTREF with NETQUOTEVAR:PAGEHEADER, will i get the results i'm after or will this give me the spacing errors that you suggested before?

            Olly

            Comment


              #7
              has anyone got any ideas with this, i'm sure its something simple like a typing error somewhere. Not too sure where though!!

              Thanks
              Olly

              Comment

              Working...
              X