Jump to content

Possible bug in checkout front module (IPS 4.6)


Go to solution Solved by RangeMachine,

Recommended Posts

  • Solution
Posted (edited)

After upgrade to IPS 4.6 my customers are not able to purchase/renew/etc any item.

OutOfRangeException:  (0)
#0 /var/www/censored/applications/nexus/modules/front/checkout/checkout.php(1176): IPS\Patterns\_ActiveRecord::load()
#1 /var/www/censored/system/Helpers/Wizard/Wizard.php(181): IPS\nexus\modules\front\checkout\_checkout->_pay()
#2 /var/www/censored/applications/nexus/modules/front/checkout/checkout.php(170): IPS\Helpers\_Wizard->__toString()
#3 /var/www/censored/system/Dispatcher/Controller.php(101): IPS\nexus\modules\front\checkout\_checkout->manage()
#4 /var/www/censored/applications/nexus/modules/front/checkout/checkout.php(57): IPS\Dispatcher\_Controller->execute()
#5 /var/www/censored/system/Dispatcher/Dispatcher.php(153): IPS\nexus\modules\front\checkout\_checkout->execute()
#6 /var/www/censored/index.php(13): IPS\_Dispatcher->run()
#7 {main}

Theres part of code from applications\nexus\modules\front\checkout\checkout.php (line 1171) file:

		/* Verify stock level one last time. It's possible someone added an item to their cart, then someone else did and checked out and the stock level is now 0. */
		foreach ( $this->invoice->items as $item )
		{
			if( $item->appKey == 'nexus' AND $item->typeKey == 'package' )
			{
				$package = \IPS\nexus\Package::load( $item->id );
				$data = $package->optionValuesStockAndPrice( $package->optionValues( $item->details ) );
	
				if ( $data['stock'] != -1 and $data['stock'] < $item->quantity )
				{
					\IPS\Output::i()->error( \IPS\Member::loggedIn()->language()->addToStack( 'not_enough_in_stock_checkout', FALSE, array( 'pluralize' => array( $data['stock'] ), 'sprintf' => array( $item->name ) ) ), '1X196/G', 403, '' );
				}
			}
		}

From what I can see $package = \IPS\nexus\Package::load( $item->id ); tries to load Package with purchase id, eg \IPS\nexus\Package::load( 672 ) in my case for my profile and of course it fails because theres no package with 672 id. Commenting this code fixes the problem.

I guess it should use package id instead of purchase id, but I personally have no idea how to get package id from invoice.

UPDATE: IPS support confirmed bug and it will be fixed in the next update.

Edited by RangeMachine
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...