0 EXTRAvestiging PHP with Advanced-iFrame (standalone) integration
EXTRAvestiging  Webshop

EXTRAvestiging Webshop integratie maatwerk CMS


This is a test voor using SessionId's (see website source for the URL's)
Step 1: Set Session ID to Test123123
Step 2: Add a product to SessionId=Test123123
Step 3: Get the shoppingcart contents of SessionId=Test123123
Step 4: Continue working in the webshop using SessionId=Test123123
End of the test

Test website for Advanced iFrame integration (standalone)

CartContents


Sourcecode


<?php
require 'includes/config.php';
require 
'includes/aboutPage.class.php';

$profile = new AboutPage($info);

// Make sure we are doing https
if(empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "off"){
    
$redirect 'https://' $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    
header('HTTP/1.1 301 Moved Permanently');
    
header('Location: ' $redirect);
    exit();
}

// Start a session if it is still empty
$SessionId session_id();
if (Empty(
$SessionId))
{
  
// The Session is not started yet
  
session_start();
  
$SessionId session_id();

  echo 
'New session created : ' $SessionId;
}

?>

<!DOCTYPE html>
<html>


    <!-- Advanced iFrame Scripts -->
    <script type="text/javascript" src="//code.jquery.com/jquery-1.12.4.min.js"></script>
    <script type="text/javascript" src="./advanced-iframe/js/ai.js"></script>

    <head>
        <meta charset="utf-8" />
        <meta name="description" content="Demo page of <?php echo $profile->fullName()?>" />

        <title>EXTRAvestiging PHP with Advanced-iFrame (standalone) integration</title>

        <!-- Our CSS stylesheet file -->
        <link rel="stylesheet" href="assets/css/styles.css" />
    </head>

    <body>

         <!-- Show the page info -->
        <section id="infoPage">
            <img src="<?php echo $profile->photoURL()?>" alt="<?php echo $profile->fullName()?>" width="164" height="164" />
            <header>
                <h1><?php echo $profile->fullName()?> integratie maatwerk CMS</h1>
            </header>

            <br>This is a test voor using SessionId's (see website source for the URL's)<br>
            <a href="https://evmitconb2cwp.extravestiging.nl/GetInfo.aspx?Action=SetSessionId&SessionId=Test123123" target="_new">Step 1: Set Session ID to Test123123</a><br>
            <a href="https://evmitconb2cwp.extravestiging.nl/AddProduct.aspx?ProductId=14&SubcodeId=1&Amount=10&SessionId=Test123123" target="_new">Step 2: Add a product to SessionId=Test123123</a><br>
            <a href="https://evmitconb2cwp.extravestiging.nl/GetInfo.aspx?Action=GetShoppingcartContents&SessionId=Test123123" target="_new">Step 3: Get the shoppingcart contents of SessionId=Test123123</a><br>
            <a href="https://evmitconb2cwp.extravestiging.nl/assortiment/extravestiging-banket?SessionId=Test123123" target="_new">Step 4: Continue working in the webshop using SessionId=Test123123</a><br>
            End of the test<br><br>

            <p class="description"><?php echo nl2br($profile->description())?></p>
        </section>

         <div class="CartContents" id="CartContents">
         <h1>CartContents</hq><br>
         </div>

         <!-- Advanced iFrame Settings and Includes -->
         <?php
         $ai_settings_file 
'standalone-advanced-iframe-settings-ev.php';
         include 
'./advanced-iframe/standalone/standalone-advanced-iframe.php';
         
?>

        <script type="text/javascript">

            // Get the XML contents
            document.getElementById('EVWebshop').onload = function() {

            // Signal that we are reloading...
            console.log('iFrame reload detected');
            $("#CartContents").append('iFrame reload detected...<br>');

            // The URL to get the shopping contents. The session is hardcoded in this sample...
            var $url = 'https://evmitconb2cwp.extravestiging.nl/GetInfo.aspx?Action=GetShoppingcartContents&SessionId=Test123123&SessionOrigin=https://phpai.extravestiging.nl';

            // Get the XML contents
            var request = new XMLHttpRequest();
            request.open('GET', $url);
            request.responseType = 'document';
            request.overrideMimeType('text/xml');
            request.withCredentials = true;

            // Dump the contents to the log and show the totals on the screen
            request.onload = function()
            {
                console.log('Request onload triggered');

                if (request.readyState === request.DONE)
                {
                    if (request.status === 200)
                    {
                        console.log(request.responseXML);

                        // $("#CartContents").append('Response = ' + request.responseXML + '<br>');

                        var $doc = request.responseXML;

                        var $Itemcount = $($doc).find('Shoppingcart').attr('Itemcount');
                        var $Total = $($doc).find('Shoppingcart').attr('Total');
                        var $SessionId = $($doc).find('Shoppingcart').attr('SessionId');

                        $("#CartContents").append('URL = ' + $url + '<br>');
                        $("#CartContents").append('Items : ' + $Itemcount + ' (' + $Total + ') - '+ $SessionId + ' - See browser console for complete document info<br>');


                        //$("#CartContents").append('End...<br>');
                        $("#CartContents").append('<br>');
                    }
                }
            };

            console.log('Start sending request to ' + $url);
            request.send();
        }
        </script>

         <!-- Show the sourcecode -->
         <br><h1>Sourcecode</h1><br>
         <div class="SourceCode">
         <?php
             show_source
("index.php");
         
?>
         </div>


         <!-- Show the footer -->
        <footer>
            <h2>Creating a PHP &amp; CSS &amp; Advanced iFrame powered page</h2>
        </footer>
    </body>
</html>