PHP Forum

PHP Forum (http://www.selfphp.de/forum/index.php)
-   PHP Grundlagen (http://www.selfphp.de/forum/forumdisplay.php?f=12)
-   -   WooCommerce Rechnung Daten hinzufügen (http://www.selfphp.de/forum/showthread.php?t=26068)

herzblutloewe 13.11.2017 18:41:56

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 :)

herzblutloewe 18.11.2017 20:38:53

AW: WooCommerce Rechnung Daten hinzufügen
 
hat sich erledigt, kann gelöscht werden. keine Ahnung wie man seine eigene Beiträge löschen kann....

vt1816 18.11.2017 23:41:40

AW: WooCommerce Rechnung Daten hinzufügen
 
Verrätst Du noch wie es gelöst wurde? Gibt evtl. noch weitere User mit dem gleichen Problem.


Alle Zeitangaben in WEZ +2. Es ist jetzt 14:34:55 Uhr.

Powered by vBulletin® Version 3.8.3 (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.