Version 4.2.0

This commit is contained in:
Neo committed 2025-12-19 05:44:59 -08:00
1 parent 0dc2aee5ed
commit 96997ddd8e
2074 files changed
+125454 -55780

No files matched your search

@@ -1,13 +1,12 @@
<?php
/**
* @brief Checkout
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Nexus
* @since 10 Feb 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\modules\front\checkout;
@@ -189,7 +188,7 @@ class _checkout extends \IPS\Dispatcher\Controller
{
/* Init */
$buttonLang = 'continue_to_review';
$needBillingInfo = $this->invoice->hasItemsRequiringBillingAddress() or $this->invoice->hasPhysicalItems();
$needBillingInfo = ( $this->invoice->hasItemsRequiringBillingAddress() or $this->invoice->hasPhysicalItems() );
if ( $this->invoice->hasPhysicalItems() )
{
@@ -529,7 +528,8 @@ class _checkout extends \IPS\Dispatcher\Controller
if ( $field->purchase_show )
{
$column = $field->column;
$member->$column = $values["nexus_ccfield_{$field->id}"];
$helper = $field->buildHelper();
$member->$column = $helper::stringValue( $values["nexus_ccfield_{$field->id}"] );
}
if ( $field->type === 'Editor' )
@@ -575,10 +575,10 @@ class _checkout extends \IPS\Dispatcher\Controller
{
foreach ( array( 'cm_first_name', 'cm_last_name' ) as $k )
{
if ( $values[ $k ] != $this->invoice->member->$k )
if ( $values[ $k ] != \IPS\nexus\Customer::loggedIn()->$k )
{
$changes['name'] = $this->invoice->member->cm_name;
$this->invoice->member->$k = $values[ $k ];
$changes['name'] = \IPS\nexus\Customer::loggedIn()->cm_name;
\IPS\nexus\Customer::loggedIn()->$k = $values[ $k ];
}
}
}
@@ -587,27 +587,29 @@ class _checkout extends \IPS\Dispatcher\Controller
if ( $field->purchase_show )
{
$column = $field->column;
if ( $this->invoice->member->$column != $values["nexus_ccfield_{$field->id}"] )
$helper = $field->buildHelper();
$valueToSave = $helper::stringValue( $values["nexus_ccfield_{$field->id}"] );
if ( \IPS\nexus\Customer::loggedIn()->$column != $valueToSave )
{
$changes['other'][] = array( 'name' => 'nexus_ccfield_' . $field->id, 'value' => $field->displayValue( $values["nexus_ccfield_{$field->id}"] ), 'old' => $this->invoice->member->$column );
$changes['other'][] = array( 'name' => 'nexus_ccfield_' . $field->id, 'value' => $field->displayValue( $valueToSave ), 'old' => $field->displayValue( \IPS\nexus\Customer::loggedIn()->$column ) );
}
$this->invoice->member->$column = $values["nexus_ccfield_{$field->id}"];
\IPS\nexus\Customer::loggedIn()->$column = $valueToSave;
}
}
if ( !empty( $changes ) )
{
$this->invoice->member->log( 'info', $changes );
\IPS\nexus\Customer::loggedIn()->log( 'info', $changes );
}
/* We only want to do this if it's an actual account */
if ( $this->invoice->member->member_id )
if ( \IPS\nexus\Customer::loggedIn()->member_id )
{
$this->invoice->member->save();
\IPS\nexus\Customer::loggedIn()->save();
}
else
{
/* Otherwise, we need to store this as guest data */
$this->invoice->guest_data = array( 'member' => $this->invoice->member->changed, 'profileFields' => array(), 'securityAnswers' => array() );
$this->invoice->guest_data = array( 'member' => \IPS\nexus\Customer::loggedIn()->changed, 'profileFields' => array(), 'securityAnswers' => array() );
}
}
@@ -704,14 +706,13 @@ class _checkout extends \IPS\Dispatcher\Controller
{
\IPS\Session::i()->setAnon();
}
$member->checkLoginKey();
if ( $rememberMe )
{
$expire = new \IPS\DateTime;
$expire->add( new \DateInterval( 'P3M' ) );
\IPS\Request::i()->setCookie( 'member_id', $member->member_id, $expire );
\IPS\Request::i()->setCookie( 'pass_hash', $member->member_login_key, $expire );
}
/* Log device */
$device = \IPS\Member\Device::loadOrCreate( $member, FALSE );
$device->anonymous = $anonymous and !\IPS\Settings::i()->disable_anonymous;
$device->updateAfterAuthentication( $rememberMe );
/* Member Sync */
$member->memberSync( 'onLogin', array( $this->invoice->checkoutUrl() ) );
/* Set the invoice owner */
@@ -1047,10 +1048,12 @@ class _checkout extends \IPS\Dispatcher\Controller
}
}
}
$addressLines = $address->addressLines;
$response = \IPS\Http\Url::external( 'https://api.easypost.com/v2/addresses' )->request()->login( \IPS\Settings::i()->easypost_api_key, '' )->post( array( 'address' => array(
'street1' => array_shift( $address->addressLines ),
'street2' => count( $address->addressLines ) ? implode( ', ', $address->addressLines ) : NULL,
'street1' => array_shift( $addressLines ),
'street2' => count( $addressLines ) ? implode( ', ', $addressLines ) : NULL,
'city' => $address->city,
'state' => $address->region,
'zip' => $address->postalCode,
@@ -1117,6 +1120,7 @@ class _checkout extends \IPS\Dispatcher\Controller
if ( $memberJustCreated )
{
\IPS\Session::i()->setMember( $memberJustCreated );
\IPS\Member\Device::loadOrCreate( $memberJustCreated, FALSE )->updateAfterAuthentication( NULL );
}
\IPS\Output::i()->redirect( $destination );
@@ -1332,7 +1336,7 @@ class _checkout extends \IPS\Dispatcher\Controller
't_member=? AND t_invoice=? AND t_method=? AND t_status=? AND t_amount=? AND t_currency=?',
\IPS\Member::loggedIn()->member_id,
$this->invoice->id,
$gateway->_id,
( $gateway === NULL ) ? 0 : $gateway->_id,
\IPS\nexus\Transaction::STATUS_WAITING,
(string) $amountToPay->amount,
$amountToPay->currency
@@ -1391,7 +1395,7 @@ class _checkout extends \IPS\Dispatcher\Controller
/* Create a MaxMind request */
$maxMind = NULL;
if ( \IPS\Settings::i()->maxmind_key )
if ( \IPS\Settings::i()->maxmind_key and ( !\IPS\Settings::i()->maxmind_gateways or \IPS\Settings::i()->maxmind_gateways == '*' or in_array( $transaction->method->id, explode( ',', \IPS\Settings::i()->maxmind_gateways ) ) ) )
{
$maxMind = new \IPS\nexus\Fraud\MaxMind\Request;
$maxMind->setTransaction( $transaction );
@@ -1437,6 +1441,7 @@ class _checkout extends \IPS\Dispatcher\Controller
if ( $memberJustCreated )
{
\IPS\Session::i()->setMember( $memberJustCreated );
\IPS\Member\Device::loadOrCreate( $memberJustCreated, FALSE )->updateAfterAuthentication( NULL );
}
/* Send email receipt */
@@ -1,13 +1,12 @@
<?php
/**
* @brief Addresses
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Nexus
* @since 06 May 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\modules\front\clients;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Alternative Contacts
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Nexus
* @since 08 May 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\modules\front\clients;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Billing Agreements
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Nexus
* @since 17 Dec 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\modules\front\clients;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Cards
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Nexus
* @since 08 May 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\modules\front\clients;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Account Credit
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Nexus
* @since 08 May 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\modules\front\clients;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Donations
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Nexus
* @since 17 Jun 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\modules\front\clients;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Custom Fields
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Nexus
* @since 08 Sep 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\modules\front\clients;
@@ -95,10 +94,12 @@ class _info extends \IPS\Dispatcher\Controller
foreach ( \IPS\nexus\Customer\CustomField::roots() as $field )
{
$column = $field->column;
if ( \IPS\nexus\Customer::loggedIn()->$column != $values["nexus_ccfield_{$field->id}"] )
$helper = $field->buildHelper();
$valueToSave = $helper::stringValue( $values["nexus_ccfield_{$field->id}"] );
if ( \IPS\nexus\Customer::loggedIn()->$column != $valueToSave )
{
$changes['other'][] = array( 'name' => 'nexus_ccfield_' . $field->id, 'value' => $field->displayValue( $values["nexus_ccfield_{$field->id}"] ), 'old' => \IPS\nexus\Customer::loggedIn()->$column );
\IPS\nexus\Customer::loggedIn()->$column = $values["nexus_ccfield_{$field->id}"];
$changes['other'][] = array( 'name' => 'nexus_ccfield_' . $field->id, 'value' => $field->displayValue( $valueToSave ), 'old' => $field->displayValue( \IPS\nexus\Customer::loggedIn()->$column ) );
\IPS\nexus\Customer::loggedIn()->$column = $valueToSave;
}
if ( $field->type === 'Editor' )
@@ -1,13 +1,12 @@
<?php
/**
* @brief Invoices
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Nexus
* @since 06 May 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\modules\front\clients;
@@ -113,10 +112,10 @@ class _invoices extends \IPS\Dispatcher\Controller
if ( $page > $pages )
{
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=nexus&module=clients&controller=invoices", 'front', 'clients' ) );
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=nexus&module=clients&controller=invoices", 'front', 'clientsinvoices' ) );
}
$pagination = \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' )->pagination( \IPS\Http\Url::internal( "app=nexus&module=clients&controller=invoices", 'front', 'clients' ), $pages, $page, static::$invoicesPerPage );
$pagination = \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' )->pagination( \IPS\Http\Url::internal( "app=nexus&module=clients&controller=invoices", 'front', 'clientsinvoices' ), $pages, $page, static::$invoicesPerPage );
$invoices = new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'nexus_invoices', $where, 'i_date DESC', array( ( $page - 1 ) * static::$invoicesPerPage, static::$invoicesPerPage ) ), 'IPS\nexus\Invoice' );
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clients')->invoices( $invoices, $pagination );
@@ -1,13 +1,12 @@
<?php
/**
* @brief Network Status
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Nexus
* @since 11 Sep 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\modules\front\clients;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Purchases
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Nexus
* @since 06 May 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\modules\front\clients;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Referrals
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Nexus
* @since 15 Aug 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\modules\front\clients;
@@ -0,0 +1,55 @@
<?php
/**
* @brief Controller to redirect /clients to something sensible
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Nexus
* @since 19 May 2017
*/
namespace IPS\nexus\modules\front\clients;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* Controller to redirect /clients to something sensible
*/
class _splash extends \IPS\Dispatcher\Controller
{
/**
* Execute
*
* @return void
*/
public function execute()
{
if ( \IPS\Member::loggedIn()->member_id )
{
$where = array( array( 'ps_member=?', \IPS\Member::loggedIn()->member_id ) );
$parentContacts = \IPS\nexus\Customer::loggedIn()->parentContacts();
if ( count( $parentContacts ) )
{
$or = array();
foreach ( $parentContacts as $contact )
{
$where[0][0] .= ' OR ' . \IPS\Db::i()->in( 'ps_id', $contact->purchaseIds() );
}
}
$where[] = array( 'ps_show=1' );
if ( \IPS\Db::i()->select( 'COUNT(*)', 'nexus_purchases', $where )->first() )
{
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=nexus&module=clients&controller=purchases', 'front', 'clientspurchases' ) );
}
}
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=nexus&module=clients&controller=invoices', 'front', 'clientsinvoices' ) );
}
}
@@ -1,13 +1,12 @@
<?php
/**
* @brief Incoming Referrals
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Nexus
* @since 15 Aug 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\modules\front\promotion;
@@ -1,13 +1,12 @@
<?php
/**
* @brief View Cart
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Nexus
* @since 29 Apr 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\modules\front\store;
@@ -212,7 +211,7 @@ class _cart extends \IPS\Dispatcher\Controller
$canRegister = TRUE;
}
$itemId = $invoice->addItem( $item );
$itemId = $invoice->addItem( $item, $k );
$ids = array();
foreach ( \IPS\Db::i()->select( 'id', 'nexus_cart_uploads', array( 'session_id=? AND item_id=?', \IPS\Session::i()->id, $k ) ) as $id )
@@ -1,13 +1,12 @@
<?php
/**
* @brief Gift Vouchers
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Nexus
* @since 5 May 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\modules\front\store;
@@ -1,13 +1,12 @@
<?php
/**
* @brief View product
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Nexus
* @since 29 Apr 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\modules\front\store;
@@ -200,6 +199,50 @@ class _product extends \IPS\Content\Controller
{
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('store')->package( $package, $item, $this->_getForm( $package, $inCart, TRUE ), array_sum( $inCart ), $shippingMethods, $itemDataForShipping, $locationType, $renewalTerm );
}
$price = $package->price();
\IPS\Output::i()->jsonLd['package'] = array(
'@context' => "http://schema.org",
'@type' => "Product",
'name' => $package->_title,
'description' => strip_tags( $item->truncated() ),
'category' => $item->container()->_title,
'url' => (string) $package->url(),
'sku' => $package->id,
'offers' => array(
'@type' => 'Offer',
'availability' => ( $package->stock > 0 OR $package->stock == -1 ) ? 'http://schema.org/InStock' : 'http://schema.org/OutOfStock',
'price' => $price->amountAsString(),
'priceCurrency' => $price->currency,
'seller' => array(
'@type' => 'Organization',
'name' => \IPS\Settings::i()->board_name
),
),
);
if( $package->image )
{
\IPS\Output::i()->jsonLd['package']['image'] = (string) $package->image;
}
if( $package->reviewable )
{
\IPS\Output::i()->jsonLd['package']['aggregateRating'] = array(
'@type' => 'AggregateRating',
'ratingValue' => $item->averageReviewRating(),
'ratingCount' => $item->reviews
);
}
if( isset( $length ) )
{
\IPS\Output::i()->jsonLd['package']['depth'] = array( '@type' => 'Distance', 'name' => $length->string() );
\IPS\Output::i()->jsonLd['package']['width'] = array( '@type' => 'Distance', 'name' => $width->string() );
\IPS\Output::i()->jsonLd['package']['height'] = array( '@type' => 'Distance', 'name' => $height->string() );
\IPS\Output::i()->jsonLd['package']['weight'] = array( '@type' => 'QuantitativeValue', 'name' => $weight->string() );
}
}
}
@@ -263,9 +306,9 @@ class _product extends \IPS\Content\Controller
{
$customFields = \IPS\nexus\Package\CustomField::roots();
$stickyFields = array();
foreach ( $item->details as $j => $v )
foreach ( $item->details as $k => $v )
{
if ( $v and isset( $customFields[ $j ] ) and $customFields[ $j ]->sticky )
if ( $v and isset( $customFields[ $k ] ) and $customFields[ $k ]->sticky )
{
$stickyFields[] = $v;
}
@@ -302,35 +345,55 @@ class _product extends \IPS\Content\Controller
$renewOptions = $package->renew_options ? json_decode( $package->renew_options, TRUE ) : array();
if ( count( $renewOptions ) > 1 )
{
$options = array();
$sortedRenewOptions = array();
foreach ( $renewOptions as $k => $option )
{
if ( isset( $option['cost'][ $memberCurrency ] ) )
if ( isset( $renewOptions[ $k ]['cost'][ $memberCurrency ] ) )
{
switch ( $option['unit'] )
$sortedRenewOptions[ $k ] = new \IPS\nexus\Purchase\RenewalTerm( new \IPS\nexus\Money( $option['cost'][ $memberCurrency ]['amount'], $memberCurrency ), new \DateInterval( 'P' . $option['term'] . mb_strtoupper( $option['unit'] ) ), $package->tax ? \IPS\nexus\Tax::load( $package->tax ) : NULL, $option['add'], $package->grace_period ? new \DateInterval( 'P' . $package->grace_period . 'D' ) : NULL );
}
}
uasort( $sortedRenewOptions, function( $a, $b ) {
return $a->days() - $b->days();
} );
$options = array();
$first = NULL;
foreach ( $sortedRenewOptions as $k => $term )
{
$saving = NULL;
if ( \IPS\Settings::i()->nexus_show_renew_option_savings != 'none' )
{
if ( $first === NULL )
{
case 'd':
$term = \IPS\Member::loggedIn()->language()->addToStack('renew_days', FALSE, array( 'pluralize' => array( $option['term'] ) ) );
break;
case 'm':
$term = \IPS\Member::loggedIn()->language()->addToStack('renew_months', FALSE, array( 'pluralize' => array( $option['term'] ) ) );
break;
case 'y':
$term = \IPS\Member::loggedIn()->language()->addToStack('renew_years', FALSE, array( 'pluralize' => array( $option['term'] ) ) );
break;
$first = $term;
}
$options[ $k ] =
\IPS\Member::loggedIn()->language()->addToStack( 'renew_option', FALSE, array( 'sprintf' => array(
(string) new \IPS\nexus\Money( $option['cost'][ $memberCurrency ]['amount'], $memberCurrency ),
$term
) ) );
else
{
$saving = $term->diff( $first, \IPS\Settings::i()->nexus_show_renew_option_savings == 'percent' );
}
}
if ( $saving and ( ( \IPS\Settings::i()->nexus_show_renew_option_savings == 'percent' and $saving->isGreaterThanZero() ) or ( \IPS\Settings::i()->nexus_show_renew_option_savings == 'amount' and $saving->amount->isGreaterThanZero() ) ) )
{
if ( \IPS\Settings::i()->nexus_show_renew_option_savings == 'percent' )
{
$options[ $k ] = \IPS\Member::loggedIn()->language()->addToStack( 'renewal_amount_with_pc_saving', FALSE, array( 'sprintf' => array( $term->toDisplay(), $saving->round(1) ) ) );
}
else
{
$options[ $k ] = \IPS\Member::loggedIn()->language()->addToStack( 'renewal_amount_with_cost_saving', FALSE, array( 'sprintf' => array( $term->toDisplay(), $saving ) ) );
}
}
else
{
$options[ $k ] = $term->toDisplay();
}
}
$form->add( new \IPS\Helpers\Form\Radio( 'renewal_term', NULL, TRUE, array( 'options' => $options ) ) );
}
/* Custom Fields */
$customFields = \IPS\nexus\Package\CustomField::roots( NULL, NULL, array( array( 'cf_purchase=1' ), array( \IPS\Db::i()->findInSet( 'cf_packages', array( $package->id ) ) ) ) );
foreach ( $customFields as $field )
@@ -461,7 +524,7 @@ class _product extends \IPS\Content\Controller
}
else
{
$return['price'] = \IPS\Theme::i()->getTemplate( 'store', 'nexus' )->price( $data['price'], FALSE );
$return['price'] = \IPS\Theme::i()->getTemplate( 'store', 'nexus' )->price( $data['price'], FALSE, FALSE );
}
\IPS\Output::i()->json( $return );
}
@@ -475,7 +538,7 @@ class _product extends \IPS\Content\Controller
{
if ( \IPS\Request::i()->isAjax() )
{
\IPS\Output::i()->json( $additionalPage );
\IPS\Output::i()->json( array( 'dialog' => $additionalPage ) );
}
else
{
@@ -1,13 +1,12 @@
<?php
/**
* @brief Browse Store
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Nexus
* @since 29 Apr 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\modules\front\store;
@@ -152,6 +151,50 @@ class _store extends \IPS\Dispatcher\Controller
}
\IPS\Output::i()->breadcrumb[] = array( NULL, $category->_title );
\IPS\Output::i()->title = $category->_title;
/* Add JSON-LD
@note Google does not like categories marked up and instead recommends marking up each product separately.
@link https://developers.google.com/search/docs/guides/intro-structured-data#multiple-entities-on-the-same-page */
foreach( $packages as $package )
{
$item = \IPS\nexus\Package\Item::load( $package->id );
$price = $package->price();
\IPS\Output::i()->jsonLd['package' . $package->id ] = array(
'@context' => "http://schema.org",
'@type' => "Product",
'name' => $package->_title,
'description' => strip_tags( $item->truncated() ),
'category' => $category->_title,
'url' => (string) $package->url(),
'sku' => $package->id,
'offers' => array(
'@type' => 'Offer',
'availability' => ( $package->stock > 0 OR $package->stock == -1 ) ? 'http://schema.org/InStock' : 'http://schema.org/OutOfStock',
'price' => $price->amountAsString(),
'priceCurrency' => $price->currency,
'seller' => array(
'@type' => 'Organization',
'name' => \IPS\Settings::i()->board_name
),
),
);
if( $package->image )
{
\IPS\Output::i()->jsonLd['package' . $package->id ]['image'] = (string) $package->image;
}
if( $package->reviewable )
{
\IPS\Output::i()->jsonLd['package' . $package->id ]['aggregateRating'] = array(
'@type' => 'AggregateRating',
'ratingValue' => $item->averageReviewRating(),
'ratingCount' => $item->reviews
);
}
}
return;
}
catch ( \OutofRangeException $e )
@@ -1,13 +1,12 @@
<?php
/**
* @brief Support Index
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Nexus
* @since 08 Apr 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\modules\front\support;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Legacy Redirector
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Commerce
* @since 07 Sep 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\modules\front\support;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Support Request View
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Nexus
* @since 09 Apr 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\modules\front\support;