Announcement

Collapse
No announcement yet.

Pass Product Description to another page...

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

    Pass Product Description to another page...

    Not sure how to describe this (so you can imagine how difficult it was to search for an answer).

    I'm developing a site where, for some of the products, the ultimate action is for an email to be sent when the Add To Cart button is clicked (the product is not added to the shopping cart).

    When the Add To Cart button is clicked, the user is taken to a form which asks some further questions and then sends an email.

    The form has been built using software from Appnitro (which Gabe recommend some time ago). The form is on a page which is a Section in the catalog structure, with one fragment on it - the fragment contains HTML code which is an iframe to show the form.

    I want to be able to pass the product name to the form so that it can prefill one of the fields. This will be done by adding "&ProductName=actinicvariable" to the end of the HTML command that loads the form (if that makes sense)

    Can anyone give me a pointer on how to achieve this? I am completely stumped.
    Elysium:Online - Official Accredited SellerDeck Partner
    SellerDeck Design, Build, Hosting & Promotion
    Based in rural Northants

    #2
    I recall something similar (ish) earlier this year - somebody wanted to add product info (name, custom variable data) automatically to form fields on a contact us type form.

    Here they are, I think:

    http://community.actinic.com/showthread.php?t=41230
    http://community.actinic.com/showthread.php?t=41240

    Hopefully they are of some use

    Comment


      #3
      A Fragment won't contain a product name so I'm not sure how you plan to have a name to pass to the iframe.

      Without seeing the code that you've got so far it's going to be impossible to help in any detail.
      Norman - www.drillpine.biz
      Edinburgh, U K / Bitez, Turkey

      Comment


        #4
        Grant - I'm pretty sure that what Ulf was trying to do is what I'm trying to do. I'll try to decipher it and see if it matches!


        I want to pass the product decription to the <a href> tag in the following piece of code :


        HTML Code:
        !!<
        <iframe height="700" allowTransparency="true" frameborder="2" scrolling="no" style="width:90%;border:none" src="http://www.xxxxx.co.uk/machform/embed.php?id=2" title="Bridal Packages Enquiry">
        <a href="http://www.xxxxx.co.uk/machform/view.php?id=2&ProductDescription=actinicvariable" title="Bridal Packages Enquiry">Bridal Packages Enquiry</a>
        </iframe>
        >!!

        the code is the only content in a text only fragment and the fragment is the the only thing in the section - which means that the form is the only thing that appears on the content part of that page.

        The code that appears in the "Add To Cart Button With Cart Icon" layout is :

        HTML Code:
        <actinic:block if="%3cactinic%3avariable%20name%3d%22AddToCartType%22%20%2f%3e%20%3d%3d%20%22BridalPackages%22" >
         <form method="post" action="Bridal_Package_Enquiry_Page.html">
         <input type="submit" value="Send email to request package" class="form_button_add_to_cart" />
         </form>
        </actinic:block>

        Am I barking up the wrong tree?
        Elysium:Online - Official Accredited SellerDeck Partner
        SellerDeck Design, Build, Hosting & Promotion
        Based in rural Northants

        Comment


          #5
          and the fragment is the the only thing in the section
          As I said earlier a Fragment isn't a Product and cannot contain a product name. You can use the Fragment Title instead.

          Assuming you want the Fragment Title passed to the iframe, then use:
          Code:
          !!<
          <iframe height="700" allowTransparency="true" frameborder="2" scrolling="no" style="width:90%;border:none" src="http://www.xxxxx.co.uk/machform/embed.php?id=2&ProductDescription=[FragmentTitle]" title="Bridal Packages Enquiry">
          </iframe>
          >!!
          Make sure your Fragment title doesn't contain special characters as there are restrictions on what can be put into query strings.

          To see what's going on add the following to embed.php
          Code:
          <h3>The URL contains: <script type="text/javascript">document.write(location.search.substring(1));</script></h3>
          You will probably want to use PHP to extract the ProductDescription from the query string
          Code:
          $productname = $_GET['ProductDescription'];
          echo "<h3>The product name is $productname</h3>";
          Norman - www.drillpine.biz
          Edinburgh, U K / Bitez, Turkey

          Comment


            #6
            Thanks Norman. I'm not quite explaining this correctly.

            The product page has an Add To Cart button that has been changed to call Bridal_Package_Enquiry_Page.html (rather than the normal adding the product to the shopping cart).

            It is this page - Bridal_Package_Enquiry_Page.html - that has the fragment on it with the iframe.

            I want to pass the product description from the product page to Bridal_Package_Enquiry_Page.html and use the product description there. The product description will then be used in the form to auto-populate one of the fields.
            Elysium:Online - Official Accredited SellerDeck Partner
            SellerDeck Design, Build, Hosting & Promotion
            Based in rural Northants

            Comment


              #7
              Then show me the code of said add to cart button.
              Norman - www.drillpine.biz
              Edinburgh, U K / Bitez, Turkey

              Comment


                #8
                <form method="post" action="Bridal_Package_Enquiry_Page.html">
                <input type="submit" value="Send email to request package" class="form_button_add_to_cart" />
                </form>
                Elysium:Online - Official Accredited SellerDeck Partner
                SellerDeck Design, Build, Hosting & Promotion
                Based in rural Northants

                Comment


                  #9
                  This will pass the product name to Bridal_Package_Enquiry_Page.html as the entire contents of the query string.
                  Code:
                  <form method="post" action="Bridal_Package_Enquiry_Page.html?<actinic:block php="true">echo rawurlencode('<actinic:variable name="ProductName" encoding="perl" selectable="false" />');</actinic:block>">
                  Veryfy that by adding the following to Bridal_Package_Enquiry_Page.html
                  Code:
                  <h3>The query string is: <script type="text/javascript">document.write(unescape(location.search.substring(1)));</script></h3>
                  Norman - www.drillpine.biz
                  Edinburgh, U K / Bitez, Turkey

                  Comment


                    #10
                    Thanks Norman.

                    getting somewhere now :

                    The query string is: Full%20Body%20Massage
                    I just need to work out how to get that into the <a href> part of the iframe.
                    Elysium:Online - Official Accredited SellerDeck Partner
                    SellerDeck Design, Build, Hosting & Promotion
                    Based in rural Northants

                    Comment


                      #11
                      Then use JavaScript to write the IFRAME line:
                      Code:
                      <script type="text/javascript">
                      document.write('<iframe height="700" allowTransparency="true" frameborder="2"'
                      	+ ' scrolling="no" style="width:90%;border:none"'
                      	+ ' src="http://www.xxxxx.co.uk/machform/embed.php?id=2'
                      	+ '&ProductDescription=' + location.search.substring(1) + '"'
                      	+ ' title="Bridal Packages Enquiry">'
                      	+ '</iframe>');
                      </script>
                      Code above untested. I'm in Turkey where it's half past two, so I'm off for now, leaving you to look for typos.

                      PS temporarily leave out the "<" from the <iframe and </iframe bits and you'll be able to see the code on the page.
                      Norman - www.drillpine.biz
                      Edinburgh, U K / Bitez, Turkey

                      Comment


                        #12
                        Just edited #11 above. Best revisit.
                        Norman - www.drillpine.biz
                        Edinburgh, U K / Bitez, Turkey

                        Comment


                          #13
                          Thanks Norman.... I thought you were off to bed??
                          Elysium:Online - Official Accredited SellerDeck Partner
                          SellerDeck Design, Build, Hosting & Promotion
                          Based in rural Northants

                          Comment


                            #14
                            Success -thanks for your help.

                            for reference, this is the code I ended up with :

                            Code:
                            <actinic:block if="%3cactinic%3avariable%20name%3d%22AddToCartType%22%20%2f%3e%20%3d%3d%20%22SpaTreatments%22" >
                             <form method="post" action="Spa_Treatment_Booking_Page.html?<actinic:block php="true">echo rawurlencode('<actinic:variable name="ProductName" encoding="perl" selectable="false" />'); </actinic:block>">
                             <input type="submit" value="Book a treatment" class="form_button_add_to_cart" />
                             </form>
                            </actinic:block>
                            (the PHP bit passes ProductName)

                            and

                            Code:
                            <script type="text/javascript">
                            document.write('<iframe height="889" allowTransparency="true" frameborder="0" scrolling="no" style="width:100%;border:none"
                            src="http://www.xxxxxxxx.co.uk/machform/e...reatment=&#39; + unescape(location.search.substring(1)) + '"" title="Spa Treatment Booking Form">
                            <a href="http://www.xxxxxxxx.co.uk/machform/v...reatment=&#39; + unescape(location.search.substring(1)) + '" 
                            title="Spa Treatment Booking Form">Spa Treatment Booking Form</a></iframe>');
                            </script>
                            <noscript>
                            <iframe height="889" allowTransparency="true" frameborder="0" scrolling="no" style="width:100%;border:none"
                            src="http://www.xxxxxxxx.co.uk/machform/embed.php?id=4" title="Spa Treatment Booking Form">
                            <a href="http://www.xxxxxxx.co.uk/machform/view.php?id=4" title="Spa Treatment Booking Form">Spa Treatment Booking Form</a>
                            </iframe>
                            </noscript>
                            (the unescape bit retrieves ProductName)

                            I'd give a URL but it's still in test mode for the moment.... there's a couple more things I want to add.
                            Elysium:Online - Official Accredited SellerDeck Partner
                            SellerDeck Design, Build, Hosting & Promotion
                            Based in rural Northants

                            Comment


                              #15
                              I see a spurious double quote " in
                              Code:
                              src="http://www.xxxxxxxx.co.uk/machform/e...reatment=' + unescape(location.search.substring(1)) + '"" title="Spa Treatment Booking Form">
                              Norman - www.drillpine.biz
                              Edinburgh, U K / Bitez, Turkey

                              Comment

                              Working...
                              X