Version 4.1.2
This commit is contained in:
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();
|
||||
|
||||
Reference in new issue
Block a user