Version 4.1.2
This commit is contained in:
1 parent
3ba79295ee
commit
28bd025b35
1131 files changed
+63658
-20579
No files matched your search
@@ -307,15 +307,16 @@ class _checkout extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Checkbox( 'reg_admin_mails', $guestData ? $guestData['member']['allow_admin_mails'] : TRUE, FALSE ) );
|
||||
\IPS\Member::loggedIn()->language()->words[ "reg_agreed_terms" ] = \IPS\Member::loggedIn()->language()->get( 'reg_agreed_terms', FALSE, array( 'sprintf' => array( \IPS\Http\Url::internal( 'app=core&module=system&controller=terms', 'front', 'terms' ) ) ) );
|
||||
\IPS\Member::loggedIn()->language()->words[ "reg_agreed_terms" ] = sprintf( \IPS\Member::loggedIn()->language()->get("reg_agreed_terms"), \IPS\Http\Url::internal( 'app=core&module=system&controller=terms', 'front', 'terms', array(), PROTOCOL_RELATIVE ) );
|
||||
|
||||
/* Build the appropriate links for registration terms & privacy policy */
|
||||
if ( \IPS\Settings::i()->privacy_type == "internal" )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words[ "reg_agreed_terms" ] .= \IPS\Member::loggedIn()->language()->get( 'reg_privacy_link', FALSE, array( 'sprintf' => array( \IPS\Http\Url::internal( 'app=core&module=system&controller=privacy', 'front', 'privacy' ), 'data-ipsDialog data-ipsDialog-size="wide" data-ipsDialog-title="' . \IPS\Member::loggedIn()->language()->get("privacy") . '"' ) ) );
|
||||
\IPS\Member::loggedIn()->language()->words[ "reg_agreed_terms" ] .= sprintf( \IPS\Member::loggedIn()->language()->get("reg_privacy_link"), \IPS\Http\Url::internal( 'app=core&module=system&controller=privacy', 'front', 'privacy', array(), PROTOCOL_RELATIVE ), 'data-ipsDialog data-ipsDialog-size="wide" data-ipsDialog-title="' . \IPS\Member::loggedIn()->language()->get("privacy") . '"' );
|
||||
}
|
||||
else if ( \IPS\Settings::i()->privacy_type == "external" )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words[ "reg_agreed_terms" ] .= \IPS\Member::loggedIn()->language()->get( 'reg_privacy_link', FALSE, array( 'sprintf' => array( \IPS\Http\Url::external( \IPS\Settings::i()->privacy_link ), 'target="_blank"' ) ) );
|
||||
\IPS\Member::loggedIn()->language()->words[ "reg_agreed_terms" ] .= sprintf( \IPS\Member::loggedIn()->language()->get("reg_privacy_link"), \IPS\Http\Url::external( \IPS\Settings::i()->privacy_link ), 'target="_blank"' );
|
||||
}
|
||||
$form->add( new \IPS\Helpers\Form\Checkbox( 'reg_agreed_terms', (bool) $guestData, TRUE, array(), function( $val )
|
||||
{
|
||||
@@ -552,7 +553,7 @@ class _checkout extends \IPS\Dispatcher\Controller
|
||||
$shipMethods = array();
|
||||
foreach ( \IPS\nexus\Shipping\FlatRate::roots() as $rate )
|
||||
{
|
||||
if ( $rate->isAvailable( $this->invoice->shipaddress ) )
|
||||
if ( $rate->isAvailable( $this->invoice->shipaddress, iterator_to_array( $this->invoice->items ), $this->invoice->currency, $this->invoice ) )
|
||||
{
|
||||
$shipMethods[ $rate->id ] = $rate;
|
||||
}
|
||||
@@ -612,14 +613,18 @@ class _checkout extends \IPS\Dispatcher\Controller
|
||||
foreach ( $data['items'] as $item )
|
||||
{
|
||||
$weightInOz += ( $item->weight->float('oz') * $item->quantity );
|
||||
|
||||
foreach ( array( 'length', 'width', 'height' ) as $k )
|
||||
$heightInInches += ( $item->height->float('in') * $item->quantity );
|
||||
|
||||
foreach ( array( 'length', 'width' ) as $k )
|
||||
{
|
||||
$v = "{$k}InInches";
|
||||
$$v += ( $item->$k->float('in') * $item->quantity );
|
||||
if ( $item->$k->float('in') > $$v )
|
||||
{
|
||||
$$v = $item->$k->float('in');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
$easyPost = \IPS\nexus\Shipping\EasyPostRate::getRates( $lengthInInches, $widthInInches, $heightInInches, $weightInOz, $this->invoice->member, $this->invoice->shipaddress, $this->invoice->currency );
|
||||
@@ -846,6 +851,7 @@ class _checkout extends \IPS\Dispatcher\Controller
|
||||
public function _pay( $data )
|
||||
{
|
||||
/* How much are we paying? */
|
||||
$this->invoice->recalculateTotal();
|
||||
$amountToPay = $this->invoice->amountToPay();
|
||||
if ( isset( \IPS\Request::i()->split ) and \IPS\Request::i()->split < $amountToPay->amount )
|
||||
{
|
||||
@@ -943,7 +949,12 @@ class _checkout extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$paymentMethodOptions[0] = \IPS\Member::loggedIn()->language()->addToStack( 'account_credit_with_amount', FALSE, array( 'sprintf' => array( \IPS\nexus\Customer::loggedIn()->cm_credits[ $this->invoice->currency ] ) ) );
|
||||
}
|
||||
|
||||
$form = new \IPS\Helpers\Form( 'select_method', 'checkout_pay', $this->invoice->checkoutUrl() );
|
||||
if ( isset( \IPS\Request::i()->split ) )
|
||||
{
|
||||
$form->hiddenValues['split'] = $amountToPay->amount;
|
||||
}
|
||||
$form->class = 'ipsForm_vertical';
|
||||
if ( count( $paymentMethodOptions ) > 1 )
|
||||
{
|
||||
@@ -955,7 +966,7 @@ class _checkout extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
if ( \IPS\Settings::i()->nexus_tac === 'checkbox' )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\Checkbox( 'i_agree_to_tac', FALSE, TRUE, array( 'labelHtmlSprintf' => array( "<a href='" . htmlentities( \IPS\Settings::i()->nexus_tac_link, \IPS\HTMLENTITIES, 'UTF-8', FALSE ) . "' target='_blank'>" . \IPS\Member::loggedIn()->language()->addToStack( 'terms_and_conditions' ) . '</a>' ) ), function( $val )
|
||||
$form->add( new \IPS\Helpers\Form\Checkbox( 'i_agree_to_tac', FALSE, TRUE, array( 'labelHtmlSprintf' => array( "<a href='" . htmlspecialchars( \IPS\Settings::i()->nexus_tac_link, \IPS\HTMLENTITIES, 'UTF-8', FALSE ) . "' target='_blank'>" . \IPS\Member::loggedIn()->language()->addToStack( 'terms_and_conditions' ) . '</a>' ) ), function( $val )
|
||||
{
|
||||
if ( !$val )
|
||||
{
|
||||
|
||||
@@ -79,7 +79,7 @@ class _addresses extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clients')->template( \IPS\Theme::i()->getTemplate('clients')->addresses( $billingAddress, $shippingAddress, $otherAddresses ) );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clients')->addresses( $billingAddress, $shippingAddress, $otherAddresses );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -138,7 +138,7 @@ class _addresses extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clients')->template( $form );
|
||||
\IPS\Output::i()->output = $form;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ class _alternatives extends \IPS\Dispatcher\Controller
|
||||
$contact->alt_id;
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clients')->template( \IPS\Theme::i()->getTemplate('clients')->alternatives() );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clients')->alternatives();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,7 +131,7 @@ class _alternatives extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clients')->template( $form );
|
||||
\IPS\Output::i()->output = $form;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ class _cards extends \IPS\Dispatcher\Controller
|
||||
catch ( \Exception $e ) { }
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clients')->template( \IPS\Theme::i()->getTemplate('clients')->cards( $cards ) );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clients')->cards( $cards );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,7 +89,7 @@ class _cards extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clients')->template( $form );
|
||||
\IPS\Output::i()->output = $form;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ class _credit extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
/* Display */
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clients')->template( \IPS\Theme::i()->getTemplate('clients')->credit( $balance, $pastWithdrawals, $pastWithdrawalsPagination, $canWithdraw, $canTopup ) );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clients')->credit( $balance, $pastWithdrawals, $pastWithdrawalsPagination, $canWithdraw, $canTopup );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -63,7 +63,7 @@ class _donations extends \IPS\Dispatcher\Controller
|
||||
\IPS\Output::i()->sidebar['enabled'] = FALSE;
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'donations.css' ) );
|
||||
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clients')->template( \IPS\Theme::i()->getTemplate('clients')->donations() );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clients')->donations();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -86,6 +86,6 @@ class _info extends \IPS\Dispatcher\Controller
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=nexus&module=clients&controller=info', 'front', 'clientsinfo', array(), \IPS\Settings::i()->nexus_https ) );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clients')->template( \IPS\Theme::i()->getTemplate('clients')->info( $form ) );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clients')->info( $form );
|
||||
}
|
||||
}
|
||||
@@ -92,7 +92,7 @@ class _invoices extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
$invoices = new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'nexus_invoices', $where, 'i_date DESC' ), 'IPS\nexus\Invoice' );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clients')->template( \IPS\Theme::i()->getTemplate('clients')->invoices( $invoices ) );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clients')->invoices( $invoices );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,7 +103,7 @@ class _invoices extends \IPS\Dispatcher\Controller
|
||||
public function view()
|
||||
{
|
||||
$shipments = $this->invoice->shipments();
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clients')->template( \IPS\Theme::i()->getTemplate('clients')->invoice( $this->invoice ) );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clients')->invoice( $this->invoice );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -102,7 +102,7 @@ class _purchases extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$purchases[ $purchase->parent ][ $purchase->id ] = $purchase;
|
||||
}
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clients')->template( \IPS\Theme::i()->getTemplate('clients')->purchases( $purchases ) );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clients')->purchases( $purchases );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,7 +112,7 @@ class _purchases extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
public function view()
|
||||
{
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clients')->template( \IPS\Theme::i()->getTemplate('clients')->purchase( $this->purchase ) );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clients')->purchase( $this->purchase );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -130,7 +130,7 @@ class _purchases extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clients')->template( $output );
|
||||
\IPS\Output::i()->output = $output;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -212,7 +212,7 @@ class _purchases extends \IPS\Dispatcher\Controller
|
||||
\IPS\Output::i()->redirect( $invoice->checkoutUrl() );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clients')->template( $form );
|
||||
\IPS\Output::i()->output = $form;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -61,6 +61,6 @@ class _referrals extends \IPS\Dispatcher\Controller
|
||||
|
||||
$rules = new \IPS\nexus\CommissionRule\Iterator( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'nexus_referral_rules' ), 'IPS\nexus\CommissionRule' ), \IPS\Member::loggedIn() );
|
||||
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clients')->template( \IPS\Theme::i()->getTemplate('clients')->referrals( $url, $rules ) );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clients')->referrals( $url, $rules );
|
||||
}
|
||||
}
|
||||
@@ -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 */
|
||||
|
||||
Reference in new issue
Block a user