Announcement

Collapse
No announcement yet.

The official PHP integration thread!

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

    The official PHP integration thread!

    Ok, since this hasn't been created yet, I think this thread should be dedicated to tips and tricks for MM5 users who wish to integrate Miva Merchant into an existing PHP site. PHP is quite powerful and I've been able to accomplish a great number of things using a combination of PHP, Miva and the MySQL database.

    Any users wishing to supply tips and tricks they may find valuable to other users needing similar things can post them here.

    Similarly, if anyone has questions regarding these techniques, ask away.

    Just as a footnote, it has been mentioned, and I happen to agree, that using multiple languages on one site isn't ideal, only that it's possible.

    With that said, hopefully I'm not the only one using PHP/Miva hehe. :D
    Webmaster
    Hobby Products International______________
    hpi racing | hot bodies


    #2
    Hmm, why is this thread named "The Official PHP integration"? Did Miva announce any such plans, or was it initiated by any Miva employee?

    Personally, I discourage people from using two different engines for parsing one page unless it is absolutely unavoidable. Starting the parser or virtual machine costs CPU time, memory and other resources, and using two of them in the same time only aggravates the situation. I'd rather suggest learning Miva Script - it is a very easy to learn scripting language, yet quite powerful. Of course, there are situations where you cannot avoid the heterogeneous scripting language environment, but you should try to avoid abusing it. Especially try avoiding mixed scripts when you have a website with heavy traffic or are hosted on a shared server.
    Ivo Truxa . @ . t r u X o f t

    Comment


      #3
      Originally posted by alexboyer
      Just as a footnote, it has been mentioned, and I happen to agree, that using multiple languages on one site isn't ideal, only that it's possible.
      Your concerns were already addressed in my initial post. The title was only slightly tongue-in-cheek. It's not an official "Miva" thing, just a bit of humor since nobody has started a thread regarding the two yet.

      Oh and just FYI, even though I agree with you about learning Miva script, it would be unreasonable to tell someone that every feature on their existing site should be ported to Miva script, which is the other reason for starting this thread.

      Our site is 16GB containing hundreds of pages and several user features all developed with PHP and we burn through almost 2 Terabytes of bandwidth each month. With the kind of traffic we get, I really wasn't prepared to approach management and say "Well I can't work on the site because I need to learn this new language and do a complete site conversion."

      I wanted to integrate Miva throughout our existing site in ways that would appear seamless to the customer. That process is still ongoing, but through much trial and error I have learned how to work with them both. It would be quite difficult to convert every feature on our site to Miva script just to keep the number of running languages to one.

      So once again, the point of this thread is primarily for users who already have an existing site written in PHP and who either don't have the time or inclination to learn a new language.

      Hope that clears it up.:)
      Last edited by alexboyer; 03-29-06, 08:16 AM.
      Webmaster
      Hobby Products International______________
      hpi racing | hot bodies

      Comment


        #4
        Originally posted by alexboyer
        Your concerns were already addressed in my initial post.
        Yes, sorry, I've overseen it. Nevertheless it is never enough warning people of it. I see far too often attempts for integrating Miva applications with PHP (or other) scripts absolutely without any reason, and often the solution is done in Miva Script much easier and faster than in PHP.
        Ivo Truxa . @ . t r u X o f t

        Comment


          #5
          Originally posted by truXoft
          Yes, sorry, I've overseen it. Nevertheless it is never enough warning people of it. I see far too often attempts for integrating Miva applications with PHP (or other) scripts absolutely without any reason, and often the solution is done in Miva Script much easier and faster than in PHP.
          Agreed. Users just starting out should learn Miva and do it all with a single language. They'll save themselves endless time and headaches that way.
          Webmaster
          Hobby Products International______________
          hpi racing | hot bodies

          Comment


            #6
            just fyi. sebenza studios has been integrating and doing jedi stuff with php and miva for years.
            Jason Henderson - JMH Web Services
            Miva Merchant Marketing Mastermind Group

            SEO & Marketing for Miva Merchant
            Miva Merchant Modules Comparison Directory
            Miva Merchant Tutorials
            Working with Miva Merchant since 1999 including search engine optimization and marketing specifically for Miva Merchant store owners.

            Comment


              #7
              We are building a new online store. However, unlike other stores, our store sells products as well as services. In services, customers can buy certain type of tests and view the results online in a few days. Also, we sell custom designed images that users can dynamically create on the website (using their test result). Among products, we have frames and merchandised that can be personalised with the images. Now here's the problem:

              The algorithms for image processing are written in ASP.NET by the contractor.
              We have a miva hosting and would like to use it to set up shop.
              We have backend that has been setup with mysql where test results are stored
              There are other miscellaneous website features (display custom image IN the frame chosen, pull test results from mysql, mathematical calculations) all of which can be easily implemented in php.

              Unfortunately, the image code will stay in ASP. We figured that we can host that software and query it remotely over the network (which again php can do). So to me it seems like that I have to use PHP (which I know) and avoid learning MIVAscript (which I am not sure can handle all the requirements).

              Please let me know how would I go about integrating the php and miva or if there's another simpler way to acheive the same results. I am experienced with php but just learning MIVA.

              Thanks a lot for your help,
              Rahul
              biosketch.net

              Comment


                #8
                What specifically do you want to accomplish with PHP?
                Webmaster
                Hobby Products International______________
                hpi racing | hot bodies

                Comment


                  #9
                  The merger of PHP and MivaScript is sometimes a necessary evil. Case in point, this forum.

                  vBulletin is written in PHP, yet we may want to add in MivaScript widgets. Oddly enough, the PHP directive "include" seems to work fine when you point it to an external web site. For example:

                  Code:
                  <?php
                      include( 'http://www.miva.com/some_script.mvc' );
                  ?>
                  Live and learn,

                  /Scott

                  Comment


                    #10
                    Ok, so can someone tell me HOW I can learn miva script then? The do***entation is scattered and hard to find. I am simply trying to find ways to do simple things I can easily do in PHP.

                    I agree that if miva can do these simple things, I'd like to learn. But such simple things as learning how to query the database proves to be difficult to learn.

                    I like the mySQL backend, but I can't seem to find good do***entation on how I can query it thru miva.

                    Here's two examples of things I'm trying to do, that I could whip out in PHP in a second. Finding info on how to do it in miva is another story.

                    Example 1)
                    I'd like to query the Categories table for each cats whose parent_id = 12
                    From that I'd like to construct links basically like this (for each)

                    a href="/mm5/merchant.mvc?Screen=CTGY&Store_Code=TCA&Category_C ode={category ID}> {category NAME} /a


                    Example 2)
                    I'd like to make breadcrumbs (yes I know about modules, but don't answer this by telling me about some module)

                    On a category screen:
                    Query to pull in the current category code, and construct the breadcrumbs based on the heirarchy of parent id categories.


                    I'd love it if there was easily found information on doing typical programming queries, conditionals, etc. on the mySQL tables in miva. Right now, I'm finding some things that explain briefly some built in functions in miva.

                    thanks for any help on getting started

                    Comment


                      #11
                      All of the docs are pretty much in one place.

                      You also need to understand some fundamental differences.

                      MIVA is the company. Merchant is the software. MIVAScript is the programming language.

                      It takes some time and studying to learn how to code in MIVAScript. Look at examples provided in the docs, forums, etc. Download the Merchant 4 API kit. Perhaps even the Limited Source Kit.

                      While the reference material is not the best, it is out there and not as scattered as it used to be.
                      Last edited by sartaingerous; 12-06-17, 10:56 AM.

                      Comment


                        #12
                        Originally posted by Scott McCollough
                        The merger of PHP and MivaScript is sometimes a necessary evil. Case in point, this forum.

                        vBulletin is written in PHP, yet we may want to add in MivaScript widgets. Oddly enough, the PHP directive "include" seems to work fine when you point it to an external web site. For example:

                        Code:
                        <?php
                            include( 'http://www.miva.com/some_script.mvc' );
                        ?>
                        Live and learn,

                        /Scott
                        Yep, since you're including a non PHP file, it gets parsed by the Miva Engine first and passed to the PHP page as plain HTML.
                        Webmaster
                        Hobby Products International______________
                        hpi racing | hot bodies

                        Comment


                          #13
                          Originally posted by Vic - WolfPaw Computers
                          All of the docs are pretty much in one place/

                          You also need to understand some fundamental differences.

                          MIVA is the company. Merchant is the software. MIVAScript is the programming language.

                          It takes some time and studying to learn how to code in MIVAScript. Look at examples provided in the docs, forums, etc. Download the Merchant 4 API kit. Perhaps even the Limited Source Kit.

                          While the reference material is not the best, it is out there and not as scattered as it used to be.
                          Yup... I understand the fundamental differences between the 3 names. I'm also working in Miva 5. Is the structure and API support of Merchant 4 the same as 5?

                          I guess I mispoke. I understand I can create mivascript to do the things I want to do. But I assumed with the new miva 5 the tokens (entities and items) would have most of what I need to do, and some of the simpler things. Am I right in thinking that it's still very limited what I can do within Merchant with regards to this new method in 5?

                          I'll look at MivaScript more and see how well it digests. But like the previous post: being able to include MVC within a PHP file... I just wonder why it can't the other way around. Same thing with an SSI to a CGI. I could create small "widgets" that pull things from the database, much easier than I can learning how to create mivascript and then determining how that integrates with Merchant.
                          Last edited by sartaingerous; 12-06-17, 10:56 AM.

                          Comment


                            #14
                            Merchant 5's API is very similar to 4's. A few functions were eliminated, others were added. That is covered in the Merchant 5 API docs and database schema.

                            You cannot do it the other way around because the Empresa Engine will not parse PHP. That is a limitation of the software.

                            I think the do***entation for the API for 5 is still very lacking, yes. Many questions have been answered in the developers forum however.

                            Comment


                              #15
                              I haven't tested this, but you should be able to use MvCALL to an external .php script and then parse the results. So you CALL out to a .php file that queries the databases and send back an XML response with the cat_id and cat_name.

                              Comment

                              Working...
                              X