Post by ashon » Sun Feb 11, 2018 6:59 am

i am getting this error when i issue a refund in opencart cpanel i have followed the fix here but still give's me error on refund - https://github.com/opencart/opencart/co ... 05de1f4807

Fatal error: Uncaught exception 'Twig_Error_Syntax' with message 'Unexpected token "string" of value "" ("name" expected) in "extension/payment/pp_express_refund.twig" at line 15.' in /home1/<Removed>/public_html/system/library/template/Twig/TokenStream.php:87 Stack trace: #0 /home1/<Removed>/public_html/system/library/template/Twig/Extension/Core.php(304): Twig_TokenStream->expect(5) #1 /home1/<Removed>/public_html/system/library/template/Twig/Extension/Core.php(277): Twig_Extension_Core->getTest(Object(Twig_Parser), 15) #2 /home1/<Removed>/public_html/system/library/template/Twig/Extension/Core.php(271): Twig_Extension_Core->parseTestExpression(Object(Twig_Parser), Object(Twig_Node_Expression_Name)) #3 [internal function]: Twig_Extension_Core->parseNotTestExpression(Object(Twig_Parser), Object(Twig_Node_Expression_Name)) #4 /home1/<Removed>/public_html/system/library/template/Twig/ExpressionParser.php(48): call_user_func(Array, Object(Twig_Parser), Object(Twig_Node_Expression_Name)) #5 /home1/<Removed>/public_html/system/libr in /home1/<Removed>/public_html/system/library/template/Twig/TokenStream.php on line 87

This is my pp_transaction file

Code: Select all

<table class="table table-striped table-bordered">
  <thead>
    <tr>
      <td class="text-left">{{ column_transaction }}</td>
      <td class="text-left">{{ column_amount }}</td>
      <td class="text-left">{{ column_type }}</td>
      <td class="text-left">{{ column_status }}</td>
      <td class="text-left">{{ column_pending_reason }}</td>
      <td class="text-left">{{ column_date_added }}</td>
      <td class="text-left">{{ column_action }}</td>
    </tr>
  </thead>
  <tbody>

  {% if transactions %}
  {% for transaction in transactions %}
  <tr>
    <td class="text-left">{{ transaction.transaction_id }}</td>
    <td class="text-left">{{ transaction.amount }}</td>
    <td class="text-left">{{ transaction.payment_type }}</td>
    <td class="text-left">{{ transaction.payment_status }}</td>
    <td class="text-left">{{ transaction.pending_reason }}</td>
    <td class="text-left">{{ transaction.date_added }}</td>
    <td class="text-left"> {% if transaction.transaction_id %} <a href="{{ transaction.view }}" data-toggle="tooltip" title="{{ button_view }}" class="btn btn-info"><i class="fa fa-eye"></i></a>
      {% if transaction.payment_type == 'instant' and (transaction.payment_status == 'Completed' or transaction.payment_status == 'Partially-Refunded') %}
      <a href="{{ transaction.refund }}" data-toggle="tooltip" title="{{ button_refund }}" class="btn btn-danger"><i class="fa fa-reply"></i></a>&nbsp;
      {% else %}
      <button type="button" value="{{ transaction.resend }}" data-toggle="tooltip" title="{{ button_resend }}" class="btn btn-info"><i class="fa fa-refresh"></i></button>
      {% endif %} </td>
  </tr>
  {% endfor %}
  {% else %}
  <tr>
    <td class="text-center" colspan="7">{{ text_no_results }}</td>
  </tr>
  {% endif %}
  </tbody>

</table>

PP_express Refund File

Code: Select all

{{ header }}{{ column_left }}
<div id="content">
  <div class="page-header">
    <div class="container-fluid">
      <div class="pull-right"> <a href="{{ cancel }}" class="btn btn-primary"><i class="fa fa-reply"></i> {{ button_cancel }}</a> </div>
      <h1>{{ heading_title }}</h1>
      <ul class="breadcrumb">
        {% for breadcrumb in breadcrumbs %}
        <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
        {% endfor %}
      </ul>
    </div>
  </div>
  <div class="container-fluid">
    {% if error is not '' %}
    <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error }}
      <button type="button" class="close" data-dismiss="alert">&times;</button>
    </div>
    {% endif %}
    {% if attention is not '' %}
    <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ attention }}
      <button type="button" class="close" data-dismiss="alert">&times;</button>
    </div>
    {% endif %}
    <div class="panel panel-default">
      <div class="panel-heading">
        <h3 class="panel-title"><i class="fa fa-pencil"></i> {{ text_refund }}</h3>
      </div>
      <div class="panel-body">
        <form action="{{ action }}" method="post" enctype="multipart/form-data" id="form" class="form-horizontal">
          <input type="hidden" name="amount_original" value="{{ amount_original }}"/>
          <input type="hidden" name="currency_code" value="{{ currency_code }}"/>
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-transaction-id">{{ entry_transaction_id }}</label>
            <div class="col-sm-10">
              <input type="text" name="transaction_id" value="{{ transaction_id }}" placeholder="{{ entry_transaction_id }}" id="input-transaction-id" class="form-control"/>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label">{{ entry_full_refund }}</label>
            <div class="col-sm-10">
              <input type="hidden" name="refund_full" value="0"/>
              <input type="checkbox" name="refund_full" id="refund_full" value="1" {{  refund_available == '' ? 'checked="checked"' : '' }} onchange="refundAmount();"/>
            </div>
          </div>
          <div class="form-group" {{ refund_available == '' ? 'style="display:none;" ' : ''}} id="partial_amount_row">
            <label class="col-sm-2 control-label">{{ entry_amount }}</label>
            <div class="col-sm-10">
              <input type="text" name="amount" value="{{ refund_available is not '' ? refund_available : '' }}" placeholder="{{ entry_amount }}" class="form-control"/>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label">{{ entry_message }}</label>
            <div class="col-sm-10">
              <textarea name="refund_message" id="paypal_refund_message" cols="40" rows="5"></textarea>
            </div>
          </div>
          <div class="pull-right"> <a onclick="$('#form').submit();" class="btn btn-primary">{{ button_refund }}</a> </div>
        </form>
      </div>
    </div>
  </div>
</div>
<script type="text/javascript"><!--
function refundAmount() {
  var valChecked = $('#refund_full').prop('checked');

  if (valChecked == true) {
    $('#partial_amount_row').hide();
  } else {
    $('#partial_amount_row').show();
  }
}
//--></script>
{{ footer }}
Last edited by ashon on Sun Feb 11, 2018 7:09 am, edited 1 time in total.

Active Member

Posts

Joined
Sat Apr 18, 2015 2:18 am

Post by straightlight » Sun Feb 11, 2018 7:01 am

No OC version posted. Please post the pp_express_refund.twig file as a ZIP file attachment.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by ashon » Sun Feb 11, 2018 7:09 am

straightlight wrote:
Sun Feb 11, 2018 7:01 am
No OC version posted. Please post the pp_express_refund.twig file as a ZIP file attachment.
added the files

Active Member

Posts

Joined
Sat Apr 18, 2015 2:18 am

Post by straightlight » Sun Feb 11, 2018 7:34 am

In both files, find all instances of:

Code: Select all

is '' %}
and / or:

Code: Select all

is not '' %}
replace each with:

Code: Select all

is null %}
if is '' %}

and replace each with:

Code: Select all

is not null %}
if: is not '' %}

This should rectify the issue.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by ashon » Sun Feb 11, 2018 8:25 am

straightlight wrote:
Sun Feb 11, 2018 7:34 am
In both files, find all instances of:

Code: Select all

is '' %}
and / or:

Code: Select all

is not '' %}
replace each with:

Code: Select all

is null %}
if is '' %}

and replace each with:

Code: Select all

is not null %}
if: is not '' %}

This should rectify the issue.
Dont work still get error

Fatal error: Uncaught exception 'Twig_Error_Syntax' with message 'Unexpected token "string" of value "" ("name" expected) in "extension/payment/pp_express_refund.twig" at line 49.' in /home1/removed/public_html/system/library/template/Twig/TokenStream.php:87 Stack trace: #0 /home1/removed/public_html/system/library/template/Twig/Extension/Core.php(304): Twig_TokenStream->expect(5) #1 /home1/removed/public_html/system/library/template/Twig/Extension/Core.php(277): Twig_Extension_Core->getTest(Object(Twig_Parser), 49) #2 /home1/removed/public_html/system/library/template/Twig/Extension/Core.php(271): Twig_Extension_Core->parseTestExpression(Object(Twig_Parser), Object(Twig_Node_Expression_Name)) #3 [internal function]: Twig_Extension_Core->parseNotTestExpression(Object(Twig_Parser), Object(Twig_Node_Expression_Name)) #4 /home1/removed/public_html/system/library/template/Twig/ExpressionParser.php(48): call_user_func(Array, Object(Twig_Parser), Object(Twig_Node_Expression_Name)) #5 /home1/removed/public_html/system/libr in /home1/removed/public_html/system/library/template/Twig/TokenStream.php on line 87

Active Member

Posts

Joined
Sat Apr 18, 2015 2:18 am

Post by straightlight » Sun Feb 11, 2018 8:56 am

What is on line 49 on the refund TWIG file? More information is needed,

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by ashon » Sun Feb 11, 2018 8:58 am

straightlight wrote:
Sun Feb 11, 2018 8:56 am
What is on line 49 on the refund TWIG file? More information is needed,
<input type="text" name="amount" value="{{ refund_available is not '' ? refund_available : '' }}" placeholder="{{ entry_amount }}" class="form-control"/>

Active Member

Posts

Joined
Sat Apr 18, 2015 2:18 am

Post by straightlight » Sun Feb 11, 2018 9:45 am

The previous instructions was to replace each instances. There are still leftovers in your file.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by ashon » Sun Feb 11, 2018 10:04 am

straightlight wrote:
Sun Feb 11, 2018 9:45 am
The previous instructions was to replace each instances. There are still leftovers in your file.
you said is not '' %} with -->} correct or just anything with not '' %

Active Member

Posts

Joined
Sat Apr 18, 2015 2:18 am

Post by straightlight » Sun Feb 11, 2018 10:44 pm

Both are mentioned on my previous instructions.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by ashon » Sun Feb 11, 2018 11:43 pm

straightlight wrote:
Sun Feb 11, 2018 10:44 pm
Both are mentioned on my previous instructions.
I really don't understand you you told me to change is " %} or is not " %} there is only two in the statements in both files and I replaced with null like you told me and I still get error I posted, but you told me I never removed all of them

Active Member

Posts

Joined
Sat Apr 18, 2015 2:18 am

Post by straightlight » Mon Feb 12, 2018 2:02 am

Although, after making these changes, you did not reposted the file so to show those changes.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by straightlight » Mon Feb 12, 2018 2:09 am

Besides, you already duplicated your post on Github, wait for their answer.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by ashon » Mon Feb 12, 2018 3:30 am

straightlight wrote:
Mon Feb 12, 2018 2:09 am
Besides, you already duplicated your post on Github, wait for their answer.
ok thats not a problem just gon confused as you told me i did not do it to all when i did and there was nothing else or less my search was lying to me when i was searching for that line

Active Member

Posts

Joined
Sat Apr 18, 2015 2:18 am

Post by straightlight » Mon Feb 12, 2018 3:33 am

The problem is with the is and is not with the use of '' . They should both be used with null in this case.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by ashon » Mon Feb 12, 2018 3:39 am

straightlight wrote:
Mon Feb 12, 2018 3:33 am
The problem is with the is and is not with the use of '' . They should both be used with null in this case.
yes so i did what you say i searched for is not " and is " and replaced is not " with is not null " and is " with is null "

Active Member

Posts

Joined
Sat Apr 18, 2015 2:18 am

Post by straightlight » Mon Feb 12, 2018 3:41 am

replaced is not " with is not null " and is " with is null "
So, no, you did not followed the instructions has provided. After those replacements, there are nowhere to be said on my above instructions to keep the '' (quotes)

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by ashon » Mon Feb 12, 2018 3:56 am

straightlight wrote:
Mon Feb 12, 2018 3:41 am
replaced is not " with is not null " and is " with is null "
So, no, you did not followed the instructions has provided. After those replacements, there are nowhere to be said on my above instructions to keep the '' (quotes)
i did not put " i was just typing its from the top of my head so i did ever tying i said apart from putting " with null

Active Member

Posts

Joined
Sat Apr 18, 2015 2:18 am

Post by ashon » Mon Feb 12, 2018 5:02 am

straightlight wrote:
Mon Feb 12, 2018 3:41 am
replaced is not " with is not null " and is " with is null "
So, no, you did not followed the instructions has provided. After those replacements, there are nowhere to be said on my above instructions to keep the '' (quotes)

Ok when i click refund with null i get this - http://prntscr.com/idc283

Active Member

Posts

Joined
Sat Apr 18, 2015 2:18 am

Post by straightlight » Mon Feb 12, 2018 5:29 am

Since the template TWIG engine error message is no longer showing and that you are reporting a different issue with PayPal Express, please create a new topic.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 248 guests