Add another column to the PDF export file

  • Chris Moyses
  • Topic Author
  • Away
  • Premium Member
  • Premium Member
More
4 days 13 hours ago #176934 by Chris Moyses
Add another column to the PDF export file was created by Chris Moyses
Hi
Would it be possible to add the membership number to the pdf export.  This would make to file content more meaningful

Regards

Chris

Please Log in or Create an account to join the conversation.

More
4 days 8 hours ago #176935 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Add another column to the PDF export file
Hi Chris

Unfortunately, the fields display in PDF export is not configurable. You will need to modify code to add the information you want to the file. The file you need to modify is components/com_osmembership/view/common/tmpl/subscriptions_pdf.php

Use the code echo OSMembershipHelper::formatMembershipId($row, $config); to display Membership ID

Once the modification is done, you should move the modified file to template override so that the change won't be lost when you update to future releases of the extension

Regards,

Tuan

Please Log in or Create an account to join the conversation.

  • Chris Moyses
  • Topic Author
  • Away
  • Premium Member
  • Premium Member
More
3 days 16 hours ago #176950 by Chris Moyses
Replied by Chris Moyses on topic Add another column to the PDF export file
Hi Tuan

Thanks for your response

Is this the code I have to change, will I have to reduce the % on the other columns, to give room for the membership number

<tr>
<td width="3%" style="text-align: center;"><?php echo $i++; ?></td>
<td width="8%"><?php echo $row->first_name; ?></td>
<td width="10%"><?php echo $row->last_name; ?></td>
<td width="20%;"><?php echo $row->plan; ?></td>
<td width="17%" style="text-align: center"><?php echo $row->from_date . ' / ' . $row->to_date; ?></td>
<td width="16%"><?php echo $row->email; ?></td>
<td width="9%" style="text-align: center;"><?php echo $row->created_date; ?></td>
<td width="6%" style="text-align: right;"><?php echo $row->amount; ?></td>
<th width="8%" height="20">
<?php
switch ($row->published)

Use the code echo OSMembershipHelper::formatMembershipId($row, $config); to display Membership ID

Do I have to use OSMembershipHelper to edit the file?

Once the modification is done, you should move the modified file to template override so that the change won't be lost when you update to future releases of the extension

Where do I find the template override?

Regards

Chris

Please Log in or Create an account to join the conversation.

More
3 days 8 hours ago #176954 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Add another column to the PDF export file
Hi Chris

Yes. That's the right block of code you need to change. Please try to make it works as you want first, then we will discuss about moving the change to template override next

Tuan

Please Log in or Create an account to join the conversation.

  • Chris Moyses
  • Topic Author
  • Away
  • Premium Member
  • Premium Member
More
2 days 17 hours ago #176979 by Chris Moyses
Replied by Chris Moyses on topic Add another column to the PDF export file
Hi Tuan

I think I am looking at the code that creates the column headers,  I see it uses OSMembershipHelper.  I will need to include the membershipid in the header.

I have inserted some code in red,  Is this correct?,  I know I will have to change the % on the other records for the membership Id to fit

$config = OSMembershipHelper::getConfig();
$i = 1;
?>
<p style="padding-bottom: 20px; text-align: center;">
<h1><?php echo Text::_('OSM_SUBSCRIPTIONS_LIST'); ?></h1>
</p>
<table border="1" width="100%" cellspacing="0" cellpadding="2" style="margin-top: 100px;">
<thead>
<tr>
<th width="3%" height="20" style="text-align: center;">
No
</th>
<th height="20" width="8%">
<?php echo Text::_('OSM_MEMBERSHIPID'); ?>

<th height="20" width="8%">
<?php echo Text::_('OSM_FIRSTNAME'); ?>
</th height="20">
<th height="20" width="10%">
<?php echo Text::_('OSM_LASTNAME'); ?>
</th height="20">
<th height="20" width="20%">
<?php echo Text::_('OSM_PLAN'); ?>
</th>

I am on a learning curve,  but I will get there

Regards

Chris

Please Log in or Create an account to join the conversation.

More
2 days 12 hours ago #176981 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Add another column to the PDF export file
Yes. That code looks OK. But you forgot to add a closing tag for th. It should be:
Code:
<th height="20" width="8%"> <?php echo Text::_('OSM_MEMBERSHIPID'); ?> </th>

Please Log in or Create an account to join the conversation.

  • Chris Moyses
  • Topic Author
  • Away
  • Premium Member
  • Premium Member
More
2 days 49 minutes ago #176987 by Chris Moyses
Replied by Chris Moyses on topic Add another column to the PDF export file
Hi Tuan

One question, on some of the lines sometimes the following </th height="20">, overtimes it is just </th
What does the difference mean

<th height="20" width="10%">
<?php echo Text::_('OSM_LASTNAME'); ?>
</th height="20">
<th height="20" width="20%">
<?php echo Text::_('OSM_PLAN'); ?>
</th>

Regards

Chris

Please Log in or Create an account to join the conversation.

More
2 days 47 minutes ago #176988 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Add another column to the PDF export file
You don't have to create about it for now. Just have the data displayed as expected in the PDF file first, then handle other things later. Having correct data displayed is the most important thing to do now

Tuan

Please Log in or Create an account to join the conversation.

  • Chris Moyses
  • Topic Author
  • Away
  • Premium Member
  • Premium Member
More
1 day 17 hours ago #176995 by Chris Moyses
Replied by Chris Moyses on topic Add another column to the PDF export file
Hi Tuan

This is the code a added in the header code
    <tr>
        <th width="3%" height="20" style="text-align: center;">
            No
        </th>
        <th height="20" width="6%">
                        <?php echo Text::_('OSM_MEMBERSHIPID'); ?>
                </th>

        <th height="20" width="8%">
            <?php echo Text::_('OSM_FIRSTNAME'); ?>
        </th height="20">
        <th height="20" width="9%">
            <?php echo Text::_('OSM_LASTNAME'); ?>
        </th height="20">
        <th height="20" width="19%">
            <?php echo Text::_('OSM_PLAN'); ?>
        </th>

This is the code I added to the column code

        <tr>
            <td width="3%" style="text-align: center;"><?php echo $i++; ?></td>
            <td width="6%"><?php echo $row->membership_id; ?></td>
            <td width="8%"><?php echo $row->first_name; ?></td>
            <td width="9%"><?php echo $row->last_name; ?></td>
            <td width="19%;"><?php echo $row->plan; ?></td>
            <td width="15%" style="text-align: center"><?php echo $row->from_date . ' / ' . $row->to_date; ?></td>
            <td width="16%"><?php echo $row->email; ?></td>

This is the error message I am gettingAn error has occurred.

0 array_push(): Argument #1 ($array) must be of type array, null given


Because I added another column, do I have to change a argument somewhere to include the new column?

Is there something I can switch on when running the code that will display the code as it is running ?
 Regards

Chris
 

Please Log in or Create an account to join the conversation.

More
1 day 8 hours ago #177000 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Add another column to the PDF export file
Hi Chris

That change should not cause the error you mentioned, maybe you changed something else as well. For this, better submit a support ticket sending us super user account of your site and tell us what we need to do to see the error

We are going to check to see what's causing the error and get it sorted

Tuan

Please Log in or Create an account to join the conversation.

Moderators: Tuan Pham Ngoc