Einzelnen Beitrag anzeigen
  #1  
Alt 13.11.2017, 18:41:56
herzblutloewe herzblutloewe ist offline
Anfänger
 
Registriert seit: Nov 2017
Alter: 29
Beiträge: 2
WooCommerce Rechnung Daten hinzufügen

Servus zusammen, wie ihr bestimmt gleich merkt, bin überhaupt kein php Profi und bräuchte bitte Hilfe.

Ich würde gern das Rechnung Theme von WooCommerce individualisieren.

Für das Ändern von den Rechnungen hab ich das PlugIn "WooCommerce PDF Invoices by Bas Elbers" (free Version).

Die geben als Hilfe zum Hinzufügen von eigenen Feldern folgendes an:
Use below code to display meta-data. Replace {META_KEY} with the actual key. If you use another plugin, just ask the key from the author of that plugin.

PHP-Code:
<?php echo BEWPI()->templater()->get_meta'{META_KEY}' ); ?>
Important: A custom template is required to add a custom field to the PDF invoice.

Mit "WooCommerce Checkout Manager by Visser Labs"
habe ich dem Checkout-Feld ein paar individuelle Felder hinzugefügt.
Diese hätte ich gerne auch in der PDF Rechnung, die ja durch das andere Plugin erstellt wird.

Dieses PlugIn gibt zum Ändern von PDF Rechungen folgende Hilfe:
The above plugin requests that you code the fields in the template. To access the saved data, use the abbreviation name of the field. As we are using the first abbreviation field as an example. Where „myfield1“ is the abbreviation name, and „My custom field:“ is the label.

Example:
PHP-Code:
custom_field(&#8218;myfield1‘, ‚My custom field:‘); ?> 
Wie kann ich nun diese beiden Codes irgendwie in das PDF Theme bekommen, dass noch ein paar individuelle Felder da drin stehen?

Ich habs mal probiert mit (letzte Zeile durch mich hinzugefügt)
PHP-Code:
        <td>

            <?php

            
if ( $templater->get_option'bewpi_show_ship_to' ) && ! empty( $formatted_shipping_address ) && $formatted_shipping_address !== $formatted_billing_address && ! $templater->has_only_virtual_products$line_items ) ) {

                
printf'<strong>%s</strong><br />'esc_html__'Ship to:''woocommerce-pdf-invoices' ) );

                echo 
$formatted_shipping_address;
                
                echo 
custom_field('myfield17''My custom field:');
            }

            
?>

        </td>
Sorry für meine Unfähigkeit.
Danke für eure Hilfe!

Edit: Bearbeiten an sich funktioniert übrigens. Hab als Test einfach mal die gesamte Rechnungsadresse rausgenommen und sie wird nicht in der Rechnung angezeigt. Also muss ich nur irgendwie den Code hinbekommen, mit eurer Hilfe :)

Geändert von herzblutloewe (13.11.2017 um 18:46:44 Uhr) Grund: detailierte Infos
Mit Zitat antworten