Version 4.1.2

This commit is contained in:
Neo committed 2025-12-19 05:32:19 -08:00
1 parent 3ba79295ee
commit 28bd025b35
1131 files changed
+63658 -20579

No files matched your search

@@ -68,7 +68,6 @@ class _product extends \IPS\Content\Controller
\IPS\Output::i()->error( 'node_error', '2X240/1', 404, '' );
}
$package = \IPS\nexus\Package::load( $item->id );
$category = \IPS\nexus\Package\Group::load( $item->group );
/* Do we have any in the cart already (this will affect stock level)? */
$inCart = 0;
@@ -89,6 +88,17 @@ class _product extends \IPS\Content\Controller
/* No - show the full page */
else
{
/* We need to create a dummy item so we can work out ship times/prices */
$itemDataForShipping = NULL;
if ( $package->physical )
{
try
{
$itemDataForShipping = $package->createItemForCart( $package->price() );
}
catch ( \OutOfBoundsException $e ) { }
}
/* If physical, get available shipping methods */
$shippingMethods = array();
$locationType = 'none';
@@ -123,7 +133,7 @@ class _product extends \IPS\Content\Controller
}
foreach ( \IPS\nexus\Shipping\FlatRate::roots( NULL, NULL, $where ) as $rate )
{
if ( ( $shipAddress and $rate->isAvailable( $shipAddress ) ) or ( $rate->locations === '*' ) )
if ( ( $shipAddress and $rate->isAvailable( $shipAddress, array( $itemDataForShipping ), $memberCurrency ) ) or ( $rate->locations === '*' ) )
{
$shippingMethods[] = $rate;
}
@@ -134,7 +144,7 @@ class _product extends \IPS\Content\Controller
{
try
{
$fromAddress = \IPS\GeoLocation::buildFromJson( \IPS\Settings::i()->site_address );
$fromAddress = \IPS\GeoLocation::buildFromJson( \IPS\Settings::i()->easypost_address ?: \IPS\Settings::i()->site_address );
$length = new \IPS\nexus\Shipping\Length( $package->length );
$width = new \IPS\nexus\Shipping\Length( $package->width );
@@ -156,18 +166,7 @@ class _product extends \IPS\Content\Controller
catch ( \IPS\Http\Request\Exception $e ) { }
}
}
/* We need to create a dummy item so we can work out ship times/prices */
$itemDataForShipping = NULL;
if ( count( $shippingMethods ) )
{
try
{
$itemDataForShipping = $package->createItemForCart( $package->price() );
}
catch ( \OutOfBoundsException $e ) { }
}
/* Do we have renewal terms? */
$renewalTerm = NULL;
$renewOptions = $package->renew_options ? json_decode( $package->renew_options, TRUE ) : array();
@@ -58,6 +58,7 @@ class _store extends \IPS\Dispatcher\Controller
{
if ( isset( \IPS\Request::i()->csrfKey ) and \IPS\Request::i()->csrfKey === \IPS\Session\Front::i()->csrfKey )
{
$_SESSION['cart'] = array();
$_SESSION['currency'] = \IPS\Request::i()->currency;
}
$currency = \IPS\Request::i()->currency;
@@ -175,7 +176,11 @@ class _store extends \IPS\Dispatcher\Controller
$where[] = "( p_member_groups='*' OR " . \IPS\Db::i()->findInSet( 'p_member_groups', \IPS\Member::loggedIn()->groups ) . ' )';
$where[] = array( 'p_store=?', 1 );
$popularProducts = new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( 'nexus_packages.*', 'nexus_purchases', $where, 'COUNT(*) DESC', $nexus_store_popular[0], 'ps_item_id' )->join( 'nexus_packages', 'ps_item_id=p_id' ), 'IPS\nexus\Package' );
$popularIds = \IPS\Db::i()->select( 'nexus_purchases.ps_item_id', 'nexus_purchases', $where, 'COUNT(ps_item_id) DESC', $nexus_store_popular[0], 'ps_item_id' )->join( 'nexus_packages', 'ps_item_id=p_id' );
if( count( $popularIds ) )
{
$popularProducts = new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( 'nexus_packages.*', 'nexus_packages', array( \IPS\Db::i()->in( 'p_id', iterator_to_array( $popularIds ) ) ), 'FIELD(p_id, ' . implode( ',', iterator_to_array($popularIds) ) . ')' ), 'IPS\nexus\Package' );
}
}
/* Display */