PayPal Error :: Transaction refused bc of invalid argument

Questions around the TYPO3 integration and plugins
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Nils
Posts: 14
Joined: 10 Nov 2016, 10:19

Re: PayPal Error :: Transaction refused bc of invalid argume

Post by Nils » 21 Feb 2017, 10:56

I renamed some things with "..." or "XXX":

Executing statement "ALTER TABLE "mshop_product_stock" CHANGE COLUMN "warehouseid" "typeid" INTEGER NOT NULL" failed: An exception occurred while executing 'ALTER TABLE "mshop_product_stock" CHANGE COLUMN "warehouseid" "typeid" INTEGER NOT NULL':

SQLSTATE[HY000]: General error: 1025 Error on rename of './XXX/#sql-593_18fd80' to './XXX/mshop_product_stock' (errno: 150)
#0 /var/.../typo3conf/ext/aimeos/Resources/Libraries/aimeos/aimeos-core/lib/mwlib/src/MW/Setup/Task/Base.php(126): Aimeos\MW\DB\Statement\DBAL\Simple->execute()
#1 /var/.../typo3conf/ext/aimeos/Resources/Libraries/aimeos/aimeos-core/lib/mshoplib/setup/ProductRenameStockWarehouse.php(97): Aimeos\MW\Setup\Task\Base->execute('ALTER TABLE "ms...', 'db-product')
#2 /var/.../typo3conf/ext/aimeos/Resources/Libraries/aimeos/aimeos-core/lib/mwlib/src/MW/Setup/Manager/Multiple.php(204): Aimeos\MW\Setup\Task\ProductRenameStockWarehouse->migrate()
#3 /var/.../typo3conf/ext/aimeos/Resources/Libraries/aimeos/aimeos-core/lib/mwlib/src/MW/Setup/Manager/Multiple.php(198): Aimeos\MW\Setup\Manager\Multiple->migrateTasks(Array, Array)
#4 /var/.../typo3conf/ext/aimeos/Resources/Libraries/aimeos/aimeos-core/lib/mwlib/src/MW/Setup/Manager/Multiple.php(198): Aimeos\MW\Setup\Manager\Multiple->migrateTasks(Array, Array)
#5 /var/.../typo3conf/ext/aimeos/Resources/Libraries/aimeos/aimeos-core/lib/mwlib/src/MW/Setup/Manager/Multiple.php(198): Aimeos\MW\Setup\Manager\Multiple->migrateTasks(Array, Array)
#6 /var/.../typo3conf/ext/aimeos/Resources/Libraries/aimeos/aimeos-core/lib/mwlib/src/MW/Setup/Manager/Multiple.php(198): Aimeos\MW\Setup\Manager\Multiple->migrateTasks(Array, Array)
#7 /var/.../typo3conf/ext/aimeos/Resources/Libraries/aimeos/aimeos-core/lib/mwlib/src/MW/Setup/Manager/Multiple.php(112): Aimeos\MW\Setup\Manager\Multiple->migrateTasks(Array)
#8 /var/.../typo3conf/ext/aimeos/Classes/Setup.php(76): Aimeos\MW\Setup\Manager\Multiple->migrate()
#9 /var/.../typo3temp/ExtensionManager/UpdateScripts/ext_update9db0a92204a53e69894c4bc712cd3591.php(47): Aimeos\Aimeos\Setup::execute()
#10 /var/.../typo3/sysext/extensionmanager/Classes/Utility/UpdateScriptUtility.php(39): ext_update9db0a92204a53e69894c4bc712cd3591->main()
#11 /var/.../typo3/sysext/extensionmanager/Classes/Controller/UpdateScriptController.php(55): TYPO3\CMS\Extensionmanager\Utility\UpdateScriptUtility->executeUpdateIfNeeded('aimeos')
#12 [internal function]: TYPO3\CMS\Extensionmanager\Controller\UpdateScriptController->showAction('aimeos')
#13 /var/.../typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php(283): call_user_func_array(Array, Array)
#14 /var/.../typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php(176): TYPO3\CMS\Extbase\Mvc\Controller\ActionController->callActionMethod()
#15 /var/.../typo3/sysext/extbase/Classes/Mvc/Dispatcher.php(86): TYPO3\CMS\Extbase\Mvc\Controller\ActionController->processRequest(Object(TYPO3\CMS\Extbase\Mvc\Web\Request), Object(TYPO3\CMS\Extbase\Mvc\Web\Response))
#16 /var/.../typo3/sysext/extbase/Classes/Mvc/Web/BackendRequestHandler.php(32): TYPO3\CMS\Extbase\Mvc\Dispatcher->dispatch(Object(TYPO3\CMS\Extbase\Mvc\Web\Request), Object(TYPO3\CMS\Extbase\Mvc\Web\Response))
#17 /var/.../typo3/sysext/extbase/Classes/Core/Bootstrap.php(206): TYPO3\CMS\Extbase\Mvc\Web\BackendRequestHandler->handleRequest()
#18 /var/.../typo3/sysext/extbase/Classes/Core/Bootstrap.php(193): TYPO3\CMS\Extbase\Core\Bootstrap->handleRequest()
#19 /var/.../typo3/sysext/backend/Classes/Http/BackendModuleRequestHandler.php(214): TYPO3\CMS\Extbase\Core\Bootstrap->run('', Array)
#20 /var/.../typo3/sysext/backend/Classes/Http/BackendModuleRequestHandler.php(92): TYPO3\CMS\Backend\Http\BackendModuleRequestHandler->dispatchModule('tools_Extension...')
#21 /var/.../typo3/sysext/core/Classes/Core/Bootstrap.php(302): TYPO3\CMS\Backend\Http\BackendModuleRequestHandler->handleRequest(Object(TYPO3\CMS\Core\Http\ServerRequest))
#22 /var/.../typo3/sysext/backend/Classes/Http/Application.php(94): TYPO3\CMS\Core\Core\Bootstrap->handleRequest(Object(TYPO3\CMS\Core\Http\ServerRequest))
#23 /var/.../typo3/index.php(20): TYPO3\CMS\Backend\Http\Application->run()
#24 /var/.../typo3/index.php(21): {closure}()
#25 {main}

User avatar
aimeos
Administrator
Posts: 7835
Joined: 01 Jan 1970, 00:00

Re: PayPal Error :: Transaction refused bc of invalid argume

Post by aimeos » 21 Feb 2017, 11:08

Can you post the output of

Code: Select all

SHOW CREATE TABLE mshop_product_stock
Does the "warehouseid" column contains always values which are NOT NULL?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Nils
Posts: 14
Joined: 10 Nov 2016, 10:19

Re: PayPal Error :: Transaction refused bc of invalid argume

Post by Nils » 21 Feb 2017, 11:22

CREATE TABLE `mshop_product_stock` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`parentid` int(11) NOT NULL,
`warehouseid` int(11) NOT NULL,
`siteid` int(11) NOT NULL,
`stocklevel` int(11) DEFAULT NULL,
`backdate` datetime DEFAULT NULL,
`mtime` datetime NOT NULL,
`ctime` datetime NOT NULL,
`editor` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `unq_msprost_sid_pid_wid` (`siteid`,`parentid`,`warehouseid`),
KEY `idx_msprost_sid_stocklevel` (`siteid`,`stocklevel`),
KEY `idx_msprost_sid_backdate` (`siteid`,`backdate`),
KEY `fk_msprost_whid` (`warehouseid`),
KEY `fk_msprost_pid` (`parentid`),
CONSTRAINT `fk_msprost_pid` FOREIGN KEY (`parentid`) REFERENCES `mshop_product` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `fk_msprost_whid` FOREIGN KEY (`warehouseid`) REFERENCES `mshop_product_stock_warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci

Does the "warehouseid" column contains always values which are NOT NULL?
Yes, all values are set to 1.

User avatar
aimeos
Administrator
Posts: 7835
Joined: 01 Jan 1970, 00:00

Re: PayPal Error :: Transaction refused bc of invalid argume

Post by aimeos » 21 Feb 2017, 16:07

Not 100% sure why this happens. Error 150 is usually a foreign key constraint error and your mshop_product_stock table still contains the fk_msprost_whid constraint, which should have been dropped before renaming the column.

Can you please remove the mshop_stock and mshop_stock_type tables if they exists, make sure, the mshop_product_stock and mshop_product_stock_warehouse tables exist, the admin interface is working and replace the file

Code: Select all

Resources/Libraries/aimeos/aimeos-core/lib/mshoplib/setup/ProductRenameStockWarehouse.php
in the Aimeos extension with this content before you execute the Aimeos update script in Extension Manager:

Code: Select all

<?php

/**
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
 * @copyright Aimeos (aimeos.org), 2016
 */


namespace Aimeos\MW\Setup\Task;


/**
 * Renames the stock warehouse table to type
 */
class ProductRenameStockWarehouse extends \Aimeos\MW\Setup\Task\Base
{
	private $stmts = array(
		'constraint' => 'ALTER TABLE "mshop_product_stock" DROP FOREIGN KEY "fk_msprost_whid"',
		'typeid' => 'ALTER TABLE "mshop_product_stock" CHANGE COLUMN "warehouseid" "typeid" INTEGER NOT NULL',
		'table' => 'ALTER TABLE "mshop_product_stock_warehouse" RENAME TO "mshop_product_stock_type"',
	);


	/**
	 * Returns the list of task names which this task depends on.
	 *
	 * @return string[] List of task names
	 */
	public function getPreDependencies()
	{
		return array( 'ProductChangeStockWarehouseIdNotNull', 'ProductWarehouseRenameTable', 'ProductWarehouseAddLabelStatus', 'TablesAddLogColumns', 'TablesChangeSiteidNotNull' );
	}


	/**
	 * Returns the list of task names which depends on this task.
	 *
	 * @return string[] List of task names
	 */
	public function getPostDependencies()
	{
		return array( 'TablesCreateMShop' );
	}


	/**
	 * Cleans up the tables
	 */
	public function clean()
	{
		$this->migrate();
	}


	/**
	 * Creates the MShop tables
	 */
	public function migrate()
	{
		$this->msg( 'Rename warehouse table', 0 ); $this->status( '' );

		$schema = $this->getSchema( 'db-product' );


		$this->msg( 'Drop "mshop_product_stock.fk_msprost_whid"', 1 );

		if( $schema->tableExists( 'mshop_product_stock' )
			&& $schema->constraintExists( 'mshop_product_stock', 'fk_msprost_whid' )
		) {
			$this->execute( $this->stmts['constraint'], 'db-product' );
			$this->status( 'done' );
		}
		else
		{
			$this->status( 'OK' );
		}


		$this->msg( 'Rename "mshop_product_stock.wareshouseid"', 1 );

		if( $schema->tableExists( 'mshop_product_stock' )
			&& $schema->columnExists( 'mshop_product_stock', 'warehouseid' )
		) {
			$this->execute( $this->stmts['typeid'], 'db-product' );
			$this->status( 'done' );
		}
		else
		{
			$this->status( 'OK' );
		}


		$this->msg( 'Rename "mshop_product_stock_wareshouse"', 1 );

		if( $schema->tableExists( 'mshop_product_stock_warehouse' ) )
		{
			$this->execute( $this->stmts['table'], 'db-product' );
			$this->status( 'done' );
		}
		else
		{
			$this->status( 'OK' );
		}
	}
}
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Nils
Posts: 14
Joined: 10 Nov 2016, 10:19

Re: PayPal Error :: Transaction refused bc of invalid argume

Post by Nils » 22 Feb 2017, 11:28

Installing and executing the update script went without any problems :)

But now I get an error in the frontend (and the products aren't listed anymore):

Class "\Aimeos\Client\Html\Catalog\Lists\Head\Standard" not available

It's on a page where I inserted the catalog list plugin to list products of a certain category.

Nils
Posts: 14
Joined: 10 Nov 2016, 10:19

Re: PayPal Error :: Transaction refused bc of invalid argume

Post by Nils » 22 Feb 2017, 14:40

The error occured because of this typoscript configuration:

plugin.tx_aimeos.settings.client.html.catalog.lists.standard.subparts {
0 = head
1 = items
}

I used this to get rid of the list type options (grid, list) and the sorting options above and below the product list. What do I have to do to get it working again?

And now the great news: Buying with PayPal using a sandbox doesn't throw any errors anymore. I'm guided through the process and get back to the page showing a confirmation about the order. Hurray! :P

Thank you very much for your help.


The only two things remaining that occured after the update are the typoscript conf above and an override that isn't working any longer. My intent was to hide or deactivate the user account creation checkbox on the checkout summary page.

I used the following to accomplish it:

plugin.tx_aimeos.settings.client.html.checkout.standard.summary.option.standard.template-body = checkout/standard/summary-option-body-wo-account-option.php

What do I have to modify to make it work again?

User avatar
aimeos
Administrator
Posts: 7835
Joined: 01 Jan 1970, 00:00

Re: PayPal Error :: Transaction refused bc of invalid argume

Post by aimeos » 22 Feb 2017, 16:37

Great! We will push the change now into the 2016.10 branch as well :-)

The 2017.x branch is a major version including some backward incompatible changes, e.g. the radically simplified template system. Now it's much easier to implement a custom design.

You now have to copy the "catalog/lists/body-default.php" and "checkout/standard/summary-body-default.php" to your own Aimeos extension and remove/change anything you don't need/want.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Nils
Posts: 14
Joined: 10 Nov 2016, 10:19

Re: PayPal Error :: Transaction refused bc of invalid argume

Post by Nils » 23 Feb 2017, 10:10

Done it and it works. Thank you :)

Post Reply