R
R
Ruslan Absalyamov2018-07-18 17:33:53
1C-Bitrix
Ruslan Absalyamov, 2018-07-18 17:33:53

How to save invoice in pdf format?

I need to make it so that in the sale.order.ajax module where the invoice is displayed, so that when the link is generated, a pdf invoice of this receipt is generated. That is, the received data contains the received html layout.
Just a previous developer or a standard solution looks like this

<tr>
                  <td>
                                        <? if (strlen($arPaySystem["ACTION_FILE"]) > 0 && $arPaySystem["NEW_WINDOW"] == "Y" && $arPaySystem["IS_CASH"] != "Y"): ?>
                      <?
                      $orderAccountNumber = urlencode(urlencode($arResult["ORDER"]["ACCOUNT_NUMBER"]));
                      $paymentAccountNumber = $payment["ACCOUNT_NUMBER"];
                      ?>
                      <script>
                        window.open('<?=$arParams["PATH_TO_PAYMENT"]?>?ORDER_ID=<?=$orderAccountNumber?>&PAYMENT_ID=<?=$paymentAccountNumber?>');
                      </script>
                    <?=Loc::getMessage("SOA_PAY_LINK", array("#LINK#" => $arParams["PATH_TO_PAYMENT"]."?ORDER_ID=".$orderAccountNumber."&PAYMENT_ID=".$paymentAccountNumber))?>
                    <? if (CSalePdf::isPdfAvailable() && $arPaySystem['IS_AFFORD_PDF']): ?>
                    <br/>
                      <?=Loc::getMessage("SOA_PAY_PDF", array("#LINK#" => $arParams["PATH_TO_PAYMENT"]."?ORDER_ID=".$orderAccountNumber."&pdf=1&DOWNLOAD=Y"))?>
                    <? endif ?>
                    <? else: ?>
                      <?=$arPaySystem["BUFFERED_OUTPUT"]?>
                    <? endif ?>
                  </td>
                </tr>

The link does not always $arPaySystem['IS_AFFORD_PDF']) = falsedisplay, but the link turned out to be clumsy, because it does not lead to downloading a pdf file, but to a non-existent page. I don’t understand how to be here
And yes, there is no payment.php file in the order. What should be kept there?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Emelyanov, 2018-07-19
@babarun

payment.phpconnects after placing an order at the moment of transition to payment, usually displays either a receipt or a form for sending data to the payment gateway.

I need to make it so that in the sale.order.ajax module where the invoice is displayed, so that when the link is generated, a pdf invoice of this receipt is generated.
Theory: buffer the html receipts, pass the resulting html to any library that can generate pdf from html. Now about your code: see where $arPaySystem['IS_AFFORD_PDF'] is formed and why it is false.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question