Announcement

Collapse
No announcement yet.

How I send list of the bought products to mysql?

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

    How I send list of the bought products to mysql?

    I'm testing actinic locally (with php, mysql, perl and so on), it work fine. I get to send to mysql some variables. I added in receipt page:

    In top page:

    <form method="post" target="_blank" action="http://localhost/acatalog/write_to_mysql.php">


    In end page:

    <input name="ACTION" type="submit" value="Send to mysql">
    <input type="hidden" name="valorboleto" value="<actinic:variable name="NumericOrderTotal" />">
    <input type="hidden" name="sacado" value="<actinic:variable name="InvoiceName" selectable="false" />">
    <input type="hidden" name="numerodocumento" value="<actinic:variable name="TheOrderNumber" />">
    <input type="hidden" name="endereco" value="<actinic:variable name="InvoiceAddress1" />">
    <input type="hidden" name="bairro" value="<actinic:variable name="InvoiceAddress2" />">
    <input type="hidden" name="cidade" value="<actinic:variable name="InvoiceAddress3" />">


    work fine! but...

    The problem:

    I need send to mysql the list of the bought products as display the receipt page: DESCRIPTION , QUANTITY, PRICE , COST , SUBTOTAT, TOTAL.

    I tried <actinic:variable name="ProductNameOnline" />

    don´t work:

    variable to send, but in mysql write> NETQUOTEVAR:PRODUCTNAME

    I tried other forms also but it didn't work.

    (sorry my english)

    Does anyone help me?

    #2
    OK Luciano

    I can give you a system to give you a list of product details that have been ordered - and display it separately from the shopping cart.

    You might be able to do something with this code to pass the values to the SQL as required.

    Here are the instructions:
    1. Go to 'Design | Library | Layouts' and open the 'Shopping Cart Product Details' group.
    2. Right-click on 'Cart Product Details' and select 'New Layout'
    3. Call the new layout something like 'Customised Product Details'
    4. Now open the 'Shopping Cart Order Line Lists' group
    5. Right-click on 'Order Line List' and select 'New Layout'
    6. Call it 'New Order Line List'
    7. Replace the content layout with the following: <actinic:variable name="CartProductDetails" value="Customised Product Details" />
    8. Now open the 'Shopping Cart Table' group and open 'Checkout Shopping Cart Grid'
    9. Paste the following code just before the last line...
      Code:
      <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Receipt%22">
      <Actinic:XMLTEMPLATE NAME="OrderLine"> 
            <actinic:variable value="New Order Line List" name="OrderLineList" />
      </Actinic:XMLTEMPLATE> 
      </actinic:block>
    You can now edit the 'Customised Product Details' layout as required as this is the layout that formats the product details.

    Comment


      #3
      Hi Chris,

      Thank you for your help!

      I followed your instructions, the variables were created but my knowledge limit me . I don't know as sending the data for the mysql, I tried several times to send variable ProductNameOnline :

      from receipt page:
      <input type="hidden" name="products" value= "<actinic:variable name="ProductNameOnline" />">

      to:

      connect_mysql.php

      $products = $_POST['products'];
      (...)

      In mysql is recorded:

      NETQUOTEVAR:PRODUCTNAME


      Please, have patience with me

      Could you help me once again?


      Luciano

      Comment


        #4
        Sorry Luciano - no idea on this.

        You need to maybe ask a web developer to do this for you.

        Comment


          #5
          Tkank you

          Chris,

          Ok. thank you for answering.

          Luciano

          Comment


            #6
            Hi, I have a similar problem, can anyone recommend a developer who might be able to help me with this?! Thanks, Tom

            Comment


              #7
              I have followed Chris's post.

              In the receipt page I just get a duplicate block of the product lines from the main receipt regardless of the formating changes I make to "Customised Product Details"

              It's as if it is not really acting on "Customised Product Details"

              Does any one have any hints?

              Thanks

              Comment


                #8
                Hi there

                Err - I don't have any hints other than 'make sure you are editing the right layout'. Try changing a piece of text to red or something - see if it affects the main cart rather than this ancilliary cart.

                Comment


                  #9
                  Hi

                  Thats what I thought - so the other line is so different it is can't be being used.

                  I have attached two screen shots - one of the receipt page and one of the viewinside actinic - where you can see its very different......

                  Scratching my head...

                  Thanks
                  Attached Files

                  Comment


                    #10
                    Hmmm - I can't get this working either. I think the way the rendering of the shopping cart grid works is different from other lists, and you can only use one single set of product line details at once.

                    Sorry about that. It's a pain I know. I'll update the Advanced User Guide.

                    Comment


                      #11
                      Sorry - did your last post mean:

                      I am out of luck... Or that you will put a solution in the Advanced User Guide?

                      Just wasn't sure what you meant.

                      Thanks

                      Comment


                        #12
                        The former, sadly. I got all excited when I saw it working in preview so I added it to the AUG. Sadly, I failed to actually properly test it. I need to remove the exercise from the Advanced User Guide.

                        Thanks for letting me know there's a problem with it - and I'm really sorry this affects you. Perhaps if you post a new question outlining what you are looking to achieve, there may be another way to do it.

                        Comment


                          #13
                          Thanks for help.

                          I got annoyed with it last night so attempted a different approach. Basically using a JavaScript Array and sub-processing it - It works for Product Reference and Quantity (which is what I needed) in the Receipt page. Couldn't get it work with Price but I don't need that in any case.

                          Instructions:
                          1. Initialise the array prior to the orderline section
                          2. add to the array during the order line section
                          3. at bottom of Recipt template read the array and use it as desired.

                          Obviously doesn't work if the client does not have JavaScript - but as 99% do - it's better than nought.

                          Cheers for all the help.

                          Comment


                            #14
                            can you post the code so that others may learn??

                            Comment


                              #15
                              In Actinic (the application):

                              1. Go to Design – Library – Shopping Cart Table –
                              a. Double Click on “Checkout Shopping Cart Grid”
                              b. Look for:

                              <Actinic:XMLTEMPLATE NAME="OrderLine">
                              <actinic:variable name="OrderLineList" />
                              </Actinic:XMLTEMPLATE>

                              And immediately above this block enter:

                              <!-- Initialise the Array for Storing Details -->
                              <script type="text/javascript" >
                              var i;
                              i=0;
                              var myProducts = new Array();
                              var myQuantities = new Array();
                              var myPrices = new Array();

                              </script>
                              <!-- End Initialisation -->

                              c. Apply Changes and Close the open window

                              2. Go to Design – Library – Shopping Cart Product Details –
                              a. Double Click on Cart Product Details
                              b. About 4 lines down in this template (when compared to the out-of-the-box template) you will have:

                              <actinic:block if="%3cactinic%3avariable%20name%3d%22IsProductReferenceVisible%22%20%2f%3e" >
                              <td width="90">
                              <Actinic:Variable Name="ProdRef"/>
                              </td>
                              </actinic:block>

                              Immediately below this enter:

                              <script type="text/javascript" >
                              myProducts[i] = '<actinic:variable name="ProdRef" />';
                              myQuantities[i] = '<actinic:variable name="Quantity" />';
                              i=i+1;
                              </script>

                              c. Apply the Changes and close the open window

                              3. Ensure you are on the “Design” Tab (as opposed to Content or Orders)
                              a. From the drop down select the page type “Receipt”
                              b. In the design tree (on the right – big pane)
                              i. Select the top entry “Receipt Page Layout”
                              c. Now in the main window scroll all the way to the bottom so you can see the </body></html> tags
                              d. Now paste in, before the </body> tag:



                              <script type="text/javascript" >
                              var Products='';

                              for (i=0;i<myProducts.length;i++)
                              {
                              if (myProducts[i] == '&nbsp;'){
                              //alert('Product with no reference');
                              }
                              else{
                              Products = Products + myProducts[i]+','+myQuantities[i]+';';
                              }
                              }

                              var OrderID = '<actinic:variable name="OrderNumberOnlineXML" />';


                              </script>

                              in the last bit obviously you could alter the Products line to do what you desire - include printing it etc.

                              Hope it helps everyone - This is used in my service see: http://community.actinic.com/showthread.php?t=28734

                              Comment

                              Working...
                              X