0

im trying to make a custom PDF-Invoice for my Magento Store. So i edited the invoice.phtml File and did some Changes. Somehow it worked pretty fine, but there are still two problems and i dont know where i have to do changes to fix this.

When i download a PDF-Invoice there is allways a empty Page and i dont know why! Can you help me?

This is my invoice.phtml

<style>
.pdf_content {
    margin-top: 0mm;
    margin-left: 0mm;
    font-family: Arial, "sans-serif";
    font-size: 12px;
}
.pdf_logo {
    position: absolute;
    width: 36.07mm;
    height: 65.7mm;
    margin-left: 158mm;
    margin-top: 12.5mm;
}
.brief_absender {
    position: absolute;
    padding-top: 45mm;
    padding-left: 23.5mm;
    font-size: 9pt;
}
.adresse_kunde {
    position: absolute;
    margin-top: 55mm;
    margin-left: 23.5mm;
    height: 21.50mm;
    width: 55mm;
    font-size: 12pt;
}
.rechnungsdaten_kunde {
    position: absolute;
    margin-top: 80mm;
    margin-left: 158mm;
    width: 47mm;
    height: 16mm;
    font-size: 9pt;
}
hr {
    width: 100%;
    color: #63b32e;
    border-top: 1px;
}
.footer_data {
    position: absolute;
    width: 210mm;
    height: 16.17mm;
    margin-top: 270mm;
}
p.inhalt {
    position: absolute;
    width: 175mm;
    margin-top: 105mm;
    margin-left: 23.5mm;
    display: block;
}
.green {
    color: #63b32e;
}
</style>

<div class="pdf_content"> <img src="../head_logo_daten.png" class="pdf_logo" />
    <p class="brief_absender"><span class="green">Das ist der Absender</p>
    
    <!-- Rechnungsadresse einblenden -->
    <div class="adresse_kunde">
        <?php if ($this->data["formated_billing_address"]): ?>
        <?php foreach ($this->data["formated_billing_address"] as $bill_detail): ?>
        <?php if ($bill_detail): ?>
        <?php echo __($bill_detail) ?><br/>
        <?php endif; ?>
        <?php endforeach; ?>
        <?php endif; ?>
    </div>
    
    <!-- Rechnungsdetails einblenden -->
    <div class="rechnungsdaten_kunde">
        <hr class="line_green" style="height: 1px;">
        Rechnungs Nr.: <?php echo $this->data['invoiceNo']; ?><br/>
        Bestellung vom: <?php echo $this->data['order_date']; ?><br/>
    </div>
    
    <!-- Rechnungsnummer -->
    <p class="inhalt">
    
    <h4 style="font-size: 14pt">Rechnung: <?php echo $this->data['invoiceNo']; ?></h4>
    
    <table style="width: 175mm; font-size: 12pt;">
        <tr valign="middle">
            <th width="6%" height="30">Anzahl</th>
            <th width="38%" height="30">Produkt</th>
            <th width="38%" height="30">SKU</th>
            <th width="9%" height="30">Stückpreis</th>
            <th width="9%" height="30">Endpreis</th>
            <?php if (isset($this->data['all_Items'][0][1]['label_price'])): ?>
            <th height="30"><?php echo __('Price inc Tax'); ?></th>
            <th height="30"><?php echo __('Total inc Tax'); ?></th>
            <?php endif; ?>
        </tr>
        <?php foreach ($this->data['all_Items'] as $index => $item): ?>
        <?php
        if ( isset( $value[ 'pdf_project_name' ] ) && !empty( $value[ 'pdf_project_name' ] ) ) {
            $pdfProjectName = $value[ 'pdf_project_name' ];
        } else {
            $pdfProjectName = false;
        }
        ?>
        <tr>
            <td><?php echo number_format($item['item_qty'], 0) ?></td>
            <td><?php echo isset($item['color']) ? $item['name'].', '.$item['color'] : $item['item_name'] ?>
                <?php if (isset($pdfProjectName) && $pdfProjectName): ?>
                <?php echo 'Projektname - '.$pdfProjectName ?>
                <?php endif; ?>
                <?php /** todo: fix text out of pdf when print selection inside pdf */ ?>
                <?php if (isset($item['print_selection']) && !empty($item['print_selection'])): ?>
                - <?php echo $item['print_selection']; ?>
                <?php endif; ?>
            </td>
            <td><?php echo $item['item_sku'] ?></td>
            <td><?php echo $item[0]['price_data'] ?></td>
            <td><?php echo $item[0]['price_subtotal'] ?></td>
            <?php if (isset ($item[1]['price_data'])): ?>
            <td><?php echo $item[1]['price_data'] ?></td>
            <td><?php echo $item[1]['price_subtotal'] ?></td>
            <?php endif ?>
        </tr>
        <?php endforeach; ?>
        <tr>
            <?php
            $columns = '5';
            if ( isset( $item[ 1 ][ 'price_data' ] ) || isset( $this->data[ 'all_Items' ][ 0 ][ 1 ][ 'label_price' ] ) ) {
                $columns = '7';
            }
            ?>
            <td colspan="<?php echo $columns; ?>" style="width: 100%;">
                <hr class="line_green" style="height: 1px; width: 100%;">
            </td>
        </tr>
    </table>
    <table>
        <?php foreach ($this->data['bundled_items'] as $key => $value): ?>
        <tr>
            <td><p style="margin:0; line-height:0.5;"><?php echo number_format($value['qty'], 0).' x '.$value['name']; ?></p></td>
        </tr>
        <?php endforeach; ?>
    </table>
    
    <table class="green" style="font-weight: bold; font-size: 12pt;">
        <?php foreach ($this->data['new_totals'] as $key => $value): ?>
        <tr>
            <td style="width:280px;"></td>
            <td style="width:200px; padding-right: 15px;"><?php echo $key ?></td>
            <td style="width:85px; text-align: right;"><?php echo $value ?></td>
        </tr>
        <?php endforeach; ?>
    </table>
    
    <p style="font-size: 10pt;">
        Bezahlart: <?php echo __($this->data['PaymentMethod']); ?>
        <?php if (isset($this->data['order']['shippingMethod'])): ?><br />
        Versand: <?php echo __($this->data['order']['shippingMethod']); ?>
        <?php endif; ?>
    </p>
    
    </p>
    <img src="../footer_daten.png" class="footer_data" /> 
</div>

and why are there two times taxes? enter image description here

I appreciate every comment or help :)

Greetings

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.