Skip to content

Commit

Permalink
Fixes return Url on customer twig template. #23
Browse files Browse the repository at this point in the history
  • Loading branch information
andrelopez committed Mar 10, 2019
1 parent 6a5307b commit af7c333
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/elements/PaymentForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,12 @@ public function init()
}

/**
* @param Order|null $order
* @return string
* @throws \Throwable
* @throws \yii\base\Exception
*/
public function getReturnUrl()
public function getReturnUrl(Order $order = null)
{
// by default return to the same page
$returnUrl = '';
Expand All @@ -178,6 +180,10 @@ public function getReturnUrl()
$returnUrl = $this->getSiteUrl($this->returnUrl);
}

if ($order){
$returnUrl = Craft::$app->getView()->renderObjectTemplate($returnUrl, $order);
}

return $returnUrl;
}

Expand Down
2 changes: 1 addition & 1 deletion src/templates/_emails/admin.twig
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
<tr>
<td align="center" valign="top" mc:edit="body5"
style="color: #434345; font-weight: bolder; font-family: 'Trebuchet MS', Helvetica, sans-serif, 'Lato', sans-serif; font-size: 16px; mso-line-height-rule: exactly; line-height: 24px; font-weight: 400;">
{{ "Button: " }} {{ order.getPaymentForm().name }}
{{ "Payment Form: " }} {{ order.getPaymentForm().name }}
</td>
</tr>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion src/templates/_emails/customer.twig
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
style="color: #ffffff; font-family: 'Trebuchet MS', Helvetica, sans-serif, 'Lato', sans-serif; padding: 0 25px; font-size: 14px; mso-line-height-rule: exactly; line-height: 24px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.06em">
<span style="color: #ffffff;">
<a style="text-decoration: none; color: #ffffff;"
href="{{ order.getPaymentForm().returnUrl }}">read more</a>
href="{{ order.getPaymentForm().getReturnUrl(order) }}">read more</a>
</span>
</td>
</tr>
Expand Down

0 comments on commit af7c333

Please sign in to comment.