Announcement

Collapse
No announcement yet.

Pass cart product detail to mysql

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

    Pass cart product detail to mysql

    To complete the functionality of the site I only need to know how to pass "cart produtc detail" variable to mysql.
    I get to pass the "Total Row" variable, but "cart produtc detail" not yet.

    When I try record any variable from "cart produtc detail" (e.g.roductnameonline) into mysql appear "NETQUOTEVAR:PRODUCTNAME"... and no the name of the products. the same problem with variables prodref and quantity.

    I need it only for finish my project.

    Excuse me in insisting on this subject. it is very important for me!

    I am thankful for any help.

    #2
    how about using the img tag to pass data to an sql page.

    invoke this img call through javascript ,with the tags, generated using actinic.

    Comment


      #3
      my java knowledge is null. Could you exemplify with a code here?

      Thx

      Comment


        #4
        eeshk, lazy lazy. i suggest a book called 'sams learn javascript in 24 hours'.

        i did it by placing this in the cart table, near the product item.

        <script>
        //?qprodname=test&qprodid=test&qimgname=test
        var imgname = ('NETQUOTEVAR:THUMBNAIL');
        var name = ('NETQUOTEVAR:PRODUCTNAME').replace(/(<([^>]+)>)/ig,'');
        var refname = ('NETQUOTEVAR:PRODREF').replace('&nbsp;','');
        document.write('<img src="http://www.mywebsitename.co.uk/upsell/insert.php?qprodname='+name+'&qprodid='+refname+'&qimgname='+imgname+'" style="height:1px;width:1px" />')
        </script>
        the php url that the image goes to, logs the data to a mysql database.

        Comment


          #5
          Still send:

          NETQUOTEVAR:PRODUCTNAME

          Comment


            #6
            If you're using JavaScript, try removing the

            <!--

            and

            // -->

            comments as they may interfere with the NETQUOTEVAR expansion.
            Norman - www.drillpine.biz
            Edinburgh, U K / Bitez, Turkey

            Comment


              #7
              I put the following code in the "receipt page", below the code for the button "done":

              (code button)
              <input type="submit" name="ACTION" value="<actinic:variable encoding="html" name="DoneButton" />" />


              (code to mysql)
              <script>
              var name = ('<actinic:variable name="TheOrderNumber" />');
              document.write('<img src="/acatalog/conecta_boleto_direto.php?qprodname='+name+'" style="height:1px;width:1px" />')
              </script>

              work fine, order number is recorded in mysql, but with productnameonline...:


              var name = ('<actinic:variable name="ProductNameOnline" />').replace(/(<([^>]+)>)/ig,'');
              document.write('<img src="/acatalog/conecta_boleto_direto.php?qprodname='+name+'" style="height:1px;width:1px" />')
              </script>


              It is recorded in the mysql: NETQUOTEVAR:PRODUCTNAME

              Comment


                #8
                I put the following code in the "receipt page", below the code for the button "done":
                Some Variables are only valid in certain parts of the layouts. The ProductNameOnline one is only valid within layout Cart Product Details and not where you're putting it. Look in that template for the line:-

                <td width="280">
                <Actinic:Variable Name="ProductNameOnline"/>

                and add the following below (I've changed the document.write for an Alert for debuging).

                Code:
                <script>
                var name = ('<actinic:variable name="ProductNameOnline" />').replace(/(<([^>]+)>)/ig,'');
                alert('<img src="/acatalog/conecta_boleto_direto.php?qprodname='+name+'" style="height:1px;width:1px" />')
                </script>
                Now test this (using the Alert) on a product and you'll see it works fine. However if your products have Attributes then you'll find that this layout is used for them too.

                You'll have to capture order number via a different template as you're already doing.
                Norman - www.drillpine.biz
                Edinburgh, U K / Bitez, Turkey

                Comment


                  #9
                  Yes. Work fine! The products and quantity are recorded into mysql.Thank you for your help. But a have a new problem

                  I observed that this script appears in chackout page 0, 1, 2 and in the receipt. This way... when I add the product in the cart the data are recorded in the mysql separately (I am testing with book Great Expectations model). When I click checkout it is recorded again, when a clink next button recorded again... and so on. In the end I have 5 data recorded separately.

                  See attached.

                  (sorry my english again)

                  Luciano
                  Attached Files

                  Comment


                    #10
                    That's to be expected since you are calling this code every time the product is displayed in the Cart.

                    I have no solution for you.
                    Norman - www.drillpine.biz
                    Edinburgh, U K / Bitez, Turkey

                    Comment


                      #11
                      Norman,
                      Thank you for your help. I will think other solution.


                      Luciano

                      Comment


                        #12
                        You could create some unique identifier (e.g. sequence number in Cart) and pass that with each product line. Before adding to the database, check that you've not already got one with that ID in there.

                        You'll also have to allow for the fact that customers can edit the cart, change quantities, delete items, etc.

                        Alternatively only do your SQL in the checkout at a particular phase or even better at the Done page. They can't change anything after that.
                        Norman - www.drillpine.biz
                        Edinburgh, U K / Bitez, Turkey

                        Comment


                          #13
                          Norman,

                          Thank you once again!

                          "Alternatively only do your SQL in the checkout at a particular phase or even better at the Done page. They can't change anything after that."

                          I tried to do this, without success

                          I think that to send the data when done be pressed is a way, but I still not to get to do this.

                          I think that to save it (receipt html) is an alternative.

                          Do you agree?

                          Comment


                            #14
                            It's really up to you how you do this. I've no idea how why you want to do this, or how you're taking payment. It's close to the payment stage that you should be doing your SQL.
                            Norman - www.drillpine.biz
                            Edinburgh, U K / Bitez, Turkey

                            Comment


                              #15
                              I will try to explain:

                              The payment is made with the receipt that is generated in the own site.
                              (see attach)

                              The ordernumber is inserted in the own receipt.

                              This receipt is stored in the mysql.

                              I send to the buyer an e-mail showing the bought products and the link to generate the receipt.

                              as this: www.my-ecommerce.com/receipt?ordernumber=XXX

                              To send the link is an important stage and it needs to be an automatic process.

                              Like this, the people can print the receipt at any moment.
                              Attached Files

                              Comment

                              Working...
                              X