Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted July 4, 20204 yr I’ve tried passing the purchases template from nexus in a block but with no luck . I want to display purchases displayed in the my purchases page Which is shown on the url My site.com/clients im guessing it’s because the page controller is missing (cms rather than nexus) and the $purchases variable is not passed . Is there an easier way of doing this ?
July 6, 20204 yr Solution This is how we list purchases on that page, which you could emulate in a custom block $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' ); /* Get only the purchases from active applications */ $where[] = array( "ps_app IN('" . implode( "','", array_keys( \IPS\Application::enabledApplications() ) ) . "')" ); $purchases = array(); foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'nexus_purchases', $where, 'ps_active DESC, ps_expire DESC, ps_start DESC' ), 'IPS\nexus\Purchase' ) as $purchase ) { $purchases[ $purchase->parent ][ $purchase->id ] = $purchase; } \IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clients')->purchases( $purchases );
July 9, 20204 yr Author ok thanks again,i tired adding in some of the code you stated above but it wont display anything.Sorry for asking so many questions