Announcement

Collapse
No announcement yet.

The official PHP integration thread!

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

    #16
    I did find a module: External File Pro by ADS that seems to do what I was needing to do. I haven't worked enough to do my programming tasks and see if it works for all aspects, but so far it looks like it does what it says.

    Comment


      #17
      how exactly would one access the mysql data in miva from php? and i cannot afford a modual for anything, so please dont suggest that.

      Comment


        #18
        Well, start learning - this isn't a 2 minute job unless you know PHP and mySQL pretty well. Here's a good tutorial you can start with:

        http://www.freewebmasterhelp.com/tutorials/phpmysql/

        Comment


          #19
          I know both pretty well, in miva 4 I did most of my work utilizing open UI for the miva inner stuff, and php 'work arounds' for most everything else. I just can't seem to wrap my brain around how to get it to connect right. I will learn the miva script one way or another, but their are things i need php for which miva either would not be able to do, or php can handle more efficently.

          Comment


            #20
            Like this:

            Code:
            <?php
            $username = "mySQL_username";
            $password = "mySQL_password";
            $hostname = "localhost";
            $dbh = mysql_connect($hostname, $username, $password) 
            	or die("Unable to connect to MySQL");
            print "Connected to MySQL<br>";
            // do your stuff here - whatever you need to do
            mysql_close($dbh);
            ?>

            Comment


              #21
              We are switching to Miva 5, and I no longer use Miva's login Screens or the PROD Screen either. These three screens are now all written in PHP because of the extra requirements we had. Our Miva 4 was customized heavily by a third party company a long time ago and also contained extra modules that are not available for Miva 5 yet. So instead of trying my hand at writing MivaScript to make up the functionality that we had, we decided that PHP would give us the ability to expand functionality, faster, cheaper, and easier.

              Comment


                #22
                Re: The official PHP integration thread!

                Hi there,

                I am one of those who don't want to learn Mivascript because i don't have the time to learn a new language. I already have some php scripts that i want to integrate into Miva 5 and I have read through this thread and many other online documents but still can't do this. can someone please help me out. any help will be appreciated.

                thanks

                Comment


                  #23
                  Re: The official PHP integration thread!

                  What specifically are you trying to do?
                  Webmaster
                  Hobby Products International______________
                  hpi racing | hot bodies

                  Comment


                    #24
                    Re: The official PHP integration thread!

                    Hi,

                    In the Customer Account, I want to add 2 fields. One asks the customer if they want to participate in a Rewards program we are offering (they can say YES or NO). The other field asks them for the the e-mail of the person who referred them to our company.

                    When a customer checkout their order, I collect the information I need, namely, Customer name, e-mail, password, address, orders made (and the cost), etc. This is the kind of information I pull from Miva Merchant in order to update the Database and perform the necessary calculations. For example:

                    If customer B says they want to participate in the rewards program, and they were referred by customer A then i have to link B to A in a list. Then if B makes a purchase, I keep track of orders made. THen I perform the calculations that are necessary so that i can assign commissions to A who referred B to us.

                    I have already written all the code in PHP and designed a prototype for the system. the prototype works fine, but now i need to integrate it into my miva store. THis morning I actually bought a module called
                    ADS External File Pro Module, to help me make use of my php scripts. I just installed it, but idon't know how it works yet....thats what i'm working on right now.

                    any suggestions or advice will be greatly appreciated!

                    Thanks

                    Comment


                      #25
                      Re: The official PHP integration thread!

                      Can PHP be used in Miva 4, too? Can it be used any where, a template, a category page, a product page? Can a call to the db (that miva normally accesses) be done with PHP and the results displayed? Basically, I have a miva site (not PHP and integrate miva 5 into it as per OP) and want to know if I can use PHP in it.

                      Thanks.

                      Comment


                        #26
                        Re: The official PHP integration thread!

                        PHP *should* work in MivaScript 4.x just as easily (read as: lots of trial and error) as in 5.x.

                        Since you're running MivaMerchant 4.x, it would mean that all of your databases are using dBase. And I don't think PHP has any built-in functionality for dBase. Once you find a method for connecting to the database then there is one more hurdle to over come; indexes.

                        MivaScript uses a proprietary index system, so any PHP script you create will not be able to use our indexes so you'll have to work a little harder to get the correct information out. Speaking of which, ONLY read from the databases. Do not try and update any database using PHP. It will put the indexes out of sync and cause a lot of problems when trying to use the store.

                        With all that doom and gloom out of the way, the way to use PHP inside of MivaScript would be via the <MvCALL> command. CALL the PHP script and let it do it's work. It should also be possible for the PHP to return back information that MivaScript can then use within it's own application.

                        I've heard of a number of examples where MivaScripts would MvCALL a perl/cgi script to get information and return results the MivaScript would display. Directory listings, accessing files outside of the Empresa "sandbox", and performing regex text manipulations are but a few examples.

                        Good luck if you take the plunge to get the two languages to work together.

                        /Scott

                        Comment


                          #27
                          Re: The official PHP integration thread!

                          Just to throw this in there, there is a free "api" available called PHPXBase. I tried once to get it to work and wasn't able, but you can give it a shot and see if you have better luck.
                          I'm not sure what your reasoning is for staying with Miva 4, but Miva 5 is going to be a lot easier to work with -- especially if you have more fluent with PHP than MivaScript.

                          Comment


                            #28
                            Re: The official PHP integration thread!

                            Originally posted by Brandon MUS
                            Just to throw this in there, there is a free "api" available called PHPXBase. I tried once to get it to work and wasn't able, but you can give it a shot and see if you have better luck.
                            I'm not sure what your reasoning is for staying with Miva 4, but Miva 5 is going to be a lot easier to work with -- especially if you have more fluent with PHP than MivaScript.
                            PHP has a function called dbase_open that worked for me when I had a client wanting to pull info from Miva 4.x's dBase files. Scott's right about not attempting to write to dBase... dBase is notorious for corrupting if more than one process attempts to write to it simultaneously in addition to the custom indices...

                            dbase_open()
                            dbase_numrecords()
                            dbase_get_record_with_names()
                            dbase_close()

                            Reference:
                            http://us.php.net/dbase

                            The only PITA is they don't have the ability to arbitrarily pull a row out like you can with MySQL so I ended up having to build a fairly substantial array out of the entire table and parse search parameters against it from there. It was far slower than MySQL, but surprisingly not as much as I had expected and it worked which is all I cared about since the client didn't want to upgrade to MySQL 5.
                            Webmaster
                            Hobby Products International______________
                            hpi racing | hot bodies

                            Comment


                              #29
                              Re: The official PHP integration thread!

                              Originally posted by percy
                              Hi,

                              In the Customer Account, I want to add 2 fields. One asks the customer if they want to participate in a Rewards program we are offering (they can say YES or NO). The other field asks them for the the e-mail of the person who referred them to our company.

                              When a customer checkout their order, I collect the information I need, namely, Customer name, e-mail, password, address, orders made (and the cost), etc. This is the kind of information I pull from Miva Merchant in order to update the Database and perform the necessary calculations. For example:

                              If customer B says they want to participate in the rewards program, and they were referred by customer A then i have to link B to A in a list. Then if B makes a purchase, I keep track of orders made. THen I perform the calculations that are necessary so that i can assign commissions to A who referred B to us.

                              I have already written all the code in PHP and designed a prototype for the system. the prototype works fine, but now i need to integrate it into my miva store. THis morning I actually bought a module called
                              ADS External File Pro Module, to help me make use of my php scripts. I just installed it, but idon't know how it works yet....thats what i'm working on right now.

                              any suggestions or advice will be greatly appreciated!

                              Thanks
                              I've typically run the info through Javascript (I know, I know) and pull the info out of the s01_Customers table by referencing the cookie htscallerid that Miva creates.
                              Webmaster
                              Hobby Products International______________
                              hpi racing | hot bodies

                              Comment


                                #30
                                Re: The official PHP integration thread!

                                I gave up trying to find good Miva 5 documentation and purchased the ADS External File Pro Module module so I could call out to PHP scripts. We have been using it with excellent results, for over a year.

                                My honest assessment is, if instead, I had tried to do all of this using Miva's languages and tools, I'd still be trying to pull it all together. (Given that I already knew PHP and had developed PHP classes tailored to our business logic for querying MySql databases.)
                                Last edited by Dee; 10-01-07, 12:39 PM.

                                Comment

                                Working...
                                X