#1 September 30, 2016 7:54am

daansk44
Member
From: Amersfoort, The Netherlands
Registered: September 12, 2016
Posts: 42

Using mollie with Bigtree

Hellow,

My question off today smile

I am buzzy adding Mollie (dutch payment company) within Bigtree.
In my Template (startpayment.php) I do this:

But when I go to the payment Page I get this
I know bigtree rewrites a lot, haha.
Normally this is working with just php

Fatal error: Cannot redeclare class Mollie_API_Autoloader in /home/onepageshop/public_html/templates/layouts/Mollie/API/Autoloader.php on line 32

<?

//site/extensions/Startpayment.php

include 'extensions/Mollie/API/Autoloader.php';
$mollie = new Mollie_API_Client;
 // = new Mollie_API_Client;
$mollie->setApiKey("test_xxx");



$payment = $mollie->payments->create(array(
    'amount' => $amount,
    'description' => '$DES',
    'redirectUrl' => '$returnsite',
    'metadata' => array(
    'order_id' => $orderID)));

// bewaar de payment_id voor als de gebruiker terugkeert
$_SESSION['mollie_payment_id'] = $payment->id;
echo '<br>';
echo getcwd() . "\n";

?>
<?

//Mollie/API/Autoloader.php

* @license     Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php
 * @author      Mollie B.V. <info@mollie.com>
 * @copyright   Mollie B.V.
 * @link        https://www.mollie.com
 */
class Mollie_API_Autoloader
{
	/**
	 * @param string $class_name
	 */
	public static function autoload ($class_name)
	{
		if (strpos($class_name, "Mollie_") === 0)
		{
			$file_name = str_replace("_", "/", $class_name);
			$file_name = realpath(dirname(__FILE__) . "/../../{$file_name}.php");

			if ($file_name !== false)
			{
				require $file_name;
			}
		}
	}

	/**
	 * @return bool
	 */
	public static function register ()
	{
		return spl_autoload_register(array(__CLASS__, "autoload"));
	}

	/**
	 * @return bool
	 */
	public static function unregister ()
	{
		return spl_autoload_unregister(array(__CLASS__, "autoload"));
	}
}

Mollie_API_Autoloader::register();

?> 

Offline

#2 October 3, 2016 3:20pm

timbuckingham
Administrator
From: Baltimore, MD
Registered: April 2, 2012
Posts: 978

Re: Using mollie with Bigtree

My only guess would be that somehow that Autoloader.php file was already included once? If it was stored in /custom/inc/required/ then it would automatically be included but it looks like you have it in a subdirectory of templates or site.

Offline

Board footer

Powered by FluxBB

The Discussion Forum is not available on displays of this size.