Home Communication board WiKi Get Quote

Solution of some problems with modules in X-Cart-WordPress integration

Earlier we have descibed how it is possible to integrate X-Cart with WordPress, you can find the script description here.

In some of WordPress modules the script execution is stopped within the module scripts. It can happen due to a number of reasons, the main one - a separate page layout of the module. In such situation we get broken integration as a result.

It's possible to solve this problem by execution of WordPress in a separate thread. You have to create an additional “invoke-blog.php” file in the X-Cart:

<?php
$_SERVER = unserialize($argv[1]);
$_GET = unserialize($argv[2]);
$_POST = unserialize($argv[3]);

chdir('blog');
include "index.php";

We have to create the additional file because we are going to use “system” call for the WordPress execution, and there is no way to transfer the $_GET and $_POST params. As you can see from the code above, we use command line parameters in order to construct all the params for the WordPress.

Finally we should replace the WordPress call in the “blog.php” from the following:

chdir('blog/');
include_once 'index.php';

with the new one:

system("php invoke-blog.php ".escapeshellarg(serialize($_SERVER)).' '.escapeshellarg(serialize($_GET)).' '.escapeshellarg(serialize($_POST)));

This solution is not implemented within the default integration, because the system command is turned off at most of hostings. If it's your case - you have to ask your hoster to enable it.

If required, you can review an initial How to integrate X-Cart and WordPress blog software article.

 
Home About us Privacy statement Terms & Conditions Refund policy © 2007–2024 ArsCommunity