6 Replies Latest reply on Jun 16, 2016 2:46 AM by Mike_Mitchell

    Passing a URL from Woocommerce to Webdirect, carrying over any one of 3 values.

    happyez

      Hi there

       

      I go between Wordpress/Woocommerce and WebDirect, and it is easy to do so from WP when I just have to go from one part to another: send a URL like this - https://HOST/fmi/webd#NAME.OF.FILE?script=OnFirstWindow (1=>1)

       

      However, not so easy when I have a number of packages that someone could buy, and each package will give them a certain number of credits. (3=>1). It would be great to have it go https://HOST/fmi/webd#NAME.OF.FILE?script=Package1

      https://HOST/fmi/webd#NAME.OF.FILE?script=Package2

      https://HOST/fmi/webd#NAME.OF.FILE?script=Package3

      So any one of the 3 packages all go to the same WD page, but are saved as a variable, and we set a field with either 1, 2 or 3 credits, so (3=>1). The URL from the product page on Woocommerce indicates what the package is, and how many credits will go through to the FM file.

       

      And it would be great to not have to do PHP, because, as you can see, it successful works when 1=>1. But, if anyone feels that PHP is the only way to do it this way, then maybe there is a good place that explains this clearly and is easy to replicate, or if anyone can give some hints.

       

      Like to hear what people think, and I hope this is clear!

      Eric

        • 1. Re: Passing a URL from Woocommerce to Webdirect, carrying over any one of 3 values.
          bigtom

          If you really want to use the URL to activate the script this way I would change it so that you have the script using ODBC to pull the relevant data directly from WC.

           

          I have done a few WC/FM integrations and what you are doing confuses me. However I have no idea what your scripts are doing or why. Just saying it looks odd and I am not sure why you are accessing WD this way.

           

          I would say PHP and ODBC are your best options for this. Maybe if I understood what you were trying to do it would seem like a good idea, but for now it does not.

          • 2. Re: Passing a URL from Woocommerce to Webdirect, carrying over any one of 3 values.
            happyez

            Hi Bigtom

             

            I’m definitely not an advanced programmer, so what I wrote isn’t necessarily what must happen.

             

            I would say PHP and ODBC are your best options for this. Maybe if I understood what you were trying to do it would seem like a good idea, but for now it does not.

             

             

            It was a guess on how it could happen.

            So, here goes….

            - I have three products in WooCommerce. If you choose one product, you get 10 credits.

            - You can then access WD and do some stuff on that side. Each time you do something, you spend a credit.

            (the other two products give you 20 and 30 credits respectively)

            - For WD to understand that if you press a button that takes you into WD from that 10 Credit Product, 10 is added to a “Credit” number field, and each time they access WD, it decreases by one.

            - The main thing here is that WD knows which product you have launched from to go into WD.

             

            OK, that’s the main idea. I don’t mind which way it happens, but it would be really useful if it wasn’t arduous and complicated in order to just to this one operation happening.

             

            You mentioned ODBC. I have no knowledge of how this works, but that said, I would like to stick to FM. If this involves another type of database system, I don’t want to, unless I have to. Again, I have no idea how to use it.

             

            Was it hard to integrate WC and FM? If so, any hints on ways to understand how to do it? (a download from a site, some one-pager…)

             

            Thanks

            Eric

            • 3. Re: Passing a URL from Woocommerce to Webdirect, carrying over any one of 3 values.
              bigtom

              I see what you are doing. All of your sales are in WC and WD is used as a result of credits purchased.

               

              ODBC allows a direct connection between your FM database and your WP database. FM will have access to all your WP/WC tables. You will need to be familiar with WC and how it holds all the metadata for orders and their connections to a specific user. You can then access by script the credits purchased and deduct with usage as you need to.

               

              It seems you should already have something counting credits on the FM side and this is controlled with some sort of login in WD.

               

              ODBC drivers are free for WIndows Server and for Mac there is a cost. They are available from Mac ODBC: MySQL, PostgreSQL and SQLite connectivity for Mac OS X by Actual Technologies

               

              One consideration is that you need to have remote MySQL access available on your web server. Most modern hosts have this, but some of the cheaper shared hosts do not. Sometimes you need to contact your host to enable it and sometimes you enable it your self. You might need to whitelist your FMS IP address for the connection....security stuff.

              • 4. Re: Passing a URL from Woocommerce to Webdirect, carrying over any one of 3 values.
                Mike_Mitchell

                You can pass multiple parameters in a single text string in a URL. You don't have to send just a single string. For example:

                 

                https://HOST/fmi/webd#NAME.OF.FILE?script=Package1|Package2|Package3

                 

                Then, just program the script to extract the different parameters and loop over them. This will likely be considerably easier than PHP or ODBC connectivity (although those are very good options).

                • 5. Re: Passing a URL from Woocommerce to Webdirect, carrying over any one of 3 values.
                  bigtom

                  Mike_Mitchell wrote:

                   

                  You can pass multiple parameters in a single text string in a URL. You don't have to send just a single string. For example:

                   

                  https://HOST/fmi/webd#NAME.OF.FILE?script=Package1|Package2|Package3

                   

                  Then, just program the script to extract the different parameters and loop over them. This will likely be considerably easier than PHP or ODBC connectivity (although those are very good options).

                  I figured this was possible but I did not know about the pipe delimiter. Thanks!

                  • 6. Re: Passing a URL from Woocommerce to Webdirect, carrying over any one of 3 values.
                    Mike_Mitchell

                    Cheap and cheesy. Not the best method ordinarily, but for single-value strings in a URL, works fine.