OK so I fixed everything needed fixing but if anyone has already generated purchases then they need to edit their database (read at the bottom for that )
First is the simple it's just adding the <li> </li> class to the purchases button so it don't kiss the renew button
Is for the tables in the mypaidfilesFiles.php in line 97
$table = new \IPS\Helpers\Table\Db( 'nexus_purchases', \IPS\Http\Url::internal( 'app=downloads&module=downloads&controller=browse&do=contributorsviewfile&id={$id}', 'front', 'downloads_contributors_file' ), $where );
Needs to be
$table = new \IPS\Helpers\Table\Db( 'nexus_purchases', \IPS\Http\Url::internal( "app=downloads&module=downloads&controller=browse&do=contributorsviewfile&id={$id}", 'front', 'downloads_contributors_file', $file->name_furl ), $where )
Its just the ' ' at the start and end of the url needs to be " " as it don't read the {$id} and the furl is not reading the $file->name_furl as it's not added
In the generate purchase controller we need to change the
'ps_renewals' => $expire > 0 ? 1 : 0,
on line 215 to
'ps_renewals' => $file->renewal_term,
all its doing is trying to add the expire time to the db where it should be like 1 or 6 for 1 year or 6 months and add
'ps_renewal_unit' => $file->renewal_units,
to it as it don't know the period of the renewal, but if there is no renewal set for a file, it will throw another error that renewal_units cants be null so I used
if ( $file->renewal_units )
{
$save = array(
'ps_member' => $values['mypaidfiles_member']->member_id,
'ps_name' => $file->name,
'ps_active' => 1,
'ps_start' => $values['mypaidfiles_purchased']->getTimestamp(),
'ps_expire' => $expire,
'ps_app' => "downloads",
'ps_type' => "file",
'ps_item_id' => $file->id,
'ps_renewals' => $file->renewal_term,
'ps_renewal_price' => $price,
'ps_renewal_unit' => $file->renewal_units,
'ps_renewal_currency' => \IPS\nexus\Customer::loggedIn()->defaultCurrency()
);
}
else
{
$save = array(
'ps_member' => $values['mypaidfiles_member']->member_id,
'ps_name' => $file->name,
'ps_active' => 1,
'ps_start' => $values['mypaidfiles_purchased']->getTimestamp(),
'ps_expire' => $expire,
'ps_app' => "downloads",
'ps_type' => "file",
'ps_item_id' => $file->id,
'ps_renewals' => $file->renewal_term,
'ps_renewal_price' => $price,
'ps_renewal_currency' => \IPS\nexus\Customer::loggedIn()->defaultCurrency()
);
}
another little edit will be in the purchasersRows.phtml to edit from line 24 replacing
<div class="ipsDataItem_generic ipsDataItem_size8">
{{if $row['ps_expire']}}
{lang="mypaidfiles_expires"} {datetime="$row['ps_expire']"}
{{else}}
{lang="mypaidfiles_noexpire"}
{{endif}}
</div>
with
<div class="ipsDataItem_generic ipsDataItem_size8">
{{if $row['ps_expire'] AND $row['ps_expire'] < $time}}
{lang="Expired"}
{{elseif $row['ps_expire']}}
{lang="mypaidfiles_expires"} {datetime="$row['ps_expire']"}
{{else}}
{lang="mypaidfiles_noexpire"}
{{endif}}
</div>
Adding whatever lang string you want, that way if the file is expired it will show expired instead of the expire date.
then anyone who has generated their purchases will need to edit their database adding the proper renewals terms and the renewal units otherwise it cant generate any renewal invoices and will throw a server error, Unless you make a little plugin to do it that way by pulling the file id and stuff then updating the columns
Don't mean to be rude by this post just hoping it will help / be easier with fixing the errors