Verfasste Forenbeiträge

Ansicht von 8 Antworten - 1 bis 8 (von insgesamt 8)
  • Thread-Starter opflaum

    (@opflaum)

    Die Plugins kann man hier komplett herunterladen:

    http://psyma.secondlevelserver.de/contact-persons.zip (Plugin1)
    http://psyma.secondlevelserver.de/contact-places.zip (Plugin2)
    http://psyma.secondlevelserver.de/job-offers.zip (Plugin3)

    Wäre super wenn mir jemand weiterhelfen kann.

    Thread-Starter opflaum

    (@opflaum)

    Ich habe davon nun 3 Plugins gemacht. Soweit so gut.

    Alle 3 Plugins funktionieren im Frontend ohne Probleme. Im Backend funktioniert aber nur Plugin 1 und 2. Das dritte gibt keine Ausgabe. Wenn ich Plugin 2 aber deaktiviere, funktioniert das dritte ebenfalls. (also 1 und 3).

    Die Einbindung für die Plugins sieht so aus:

    Plugin 1:

    add_action('admin_menu', 'profileAddMenu'); // Adminmenü hinzufügen
    add_action('admin_enqueue_scripts', 'init_scripts'); // Scripte und Styles einbinden
    add_action('wp_enqueue_scripts', 'init_frontend'); // Scripte für Frontend einbinden
    add_action('wp_ajax_newUser', 'newUser'); // Neuen User speichern
    add_action('wp_ajax_editUser', 'editUser'); // User bearbeiten
    add_action('wp_ajax_getUsers', 'getUsers'); // UserTabelle Backend anzeigen
    add_action('wp_ajax_deleteUser', 'deleteUser'); // Einzelnen User löschen
    add_action('wp_ajax_getUserData', 'getUserData'); // Userdaten auslesen und in Formular einfügen
    add_action('wp_ajax_getFrontendUsers', 'getFrontendUsers'); // Alle User im Frontend ausgeben
    add_action('wp_ajax_nopriv_getFrontendUsers', 'getFrontendUsers'); // Alle User im Frontend ausgeben
    add_shortcode('contact-persons-userlist', 'cUserList'); // Shortcode für Userliste
    add_shortcode('contact-persons-user', 'cUser'); // Shortcode für Userliste
    
    function profileAddMenu() 
    {
        add_menu_page('Contact Persons', 'ContactPersons', 'manage_options', 'contact-persons/index.php', '', 'dashicons-businessperson', 20 );
    }
    
    function init_scripts() 
    {    
        wp_register_style('contact-persons', plugins_url('contact-persons/css/style.css'));
        wp_enqueue_style('contact-persons');
    	wp_enqueue_script( 'jquery' );
        wp_enqueue_script('preview', plugins_url('contact-persons/js/preview.js'));
        wp_enqueue_script('functions', plugins_url('contact-persons/js/functions.js'));
    }
    
    function init_frontend() 
    {    
    	wp_enqueue_script( 'jquery' );
        wp_enqueue_script('frontend', plugins_url('contact-persons/js/frontend.js'));
    }

    Plugin 2:

    add_action('admin_menu', 'profileAddMenu2'); // Adminmenü hinzufügen
    add_action('admin_enqueue_scripts', 'init_scripts2'); // Scripte und Styles einbinden
    add_action('wp_enqueue_scripts', 'init_frontend2'); // Scripte für Frontend einbinden
    add_action('wp_ajax_saveNewPlace', 'saveNewPlace'); // Neuen Standort speichern
    add_action('wp_ajax_getAllPlaces', 'getAllPlaces'); // Alle Standorte im Backend ausgeben
    add_action('wp_ajax_deletePlace', 'deletePlace'); // Standort löschen
    add_action('wp_ajax_getPlaceData', 'getPlaceData'); // Standort bearbeiten und in Formular einfügen
    add_action('wp_ajax_getFrontendPlaces', 'getFrontendPlaces'); // Standortliste im Frontend ausgeben
    add_action('wp_ajax_nopriv_getFrontendPlaces', 'getFrontendPlaces'); // Standortliste im Frontend ausgeben
    add_shortcode('contact-places-list', 'cPlacesList'); // Shortcode für Liste
    
    function profileAddMenu2() 
    {
        add_menu_page('Contact Places', 'ContactPlaces', 'manage_options', 'contact-places/index.php', '', 'dashicons-location-alt', 21 );
    }
    
    function init_scripts2() 
    {    
        wp_register_style('contact-places', plugins_url('contact-places/css/style.css'));
        wp_enqueue_style('contact-places');
    	wp_enqueue_script( 'jquery' );
        wp_enqueue_script('functions2', plugins_url('contact-places/js/functions.js'));
        wp_enqueue_script('gmaps', 'https://maps.googleapis.com/maps/api/js?key=AIzaSyBX9A65h__PfBmj4Enmw8rB_10SFdJU2tY&callback=initMap');
    }
    
    function init_frontend2() 
    {    
    	wp_enqueue_script( 'jquery' );
        wp_enqueue_script('frontend2', plugins_url('contact-places/js/frontend.js'));
    }
    

    Plugin 3:

    add_action('admin_menu', 'profileAddMenu3'); // Adminmenü hinzufügen
    add_action('admin_enqueue_scripts', 'init_scripts3'); // Scripte und Styles einbinden
    add_action('wp_enqueue_scripts', 'init_frontend3'); // Scripte für Frontend einbinden
    add_action('wp_ajax_getAllJobOffers', 'getAllJobOffers'); // Alle Jobs im Backend anzeigen
    add_action('wp_ajax_saveJob', 'saveJob'); // Job speichern
    add_action('wp_ajax_getJob', 'getJob'); // Jobdaten auslesen für Formular
    add_action('wp_ajax_delJob', 'delJob'); // Job löschen
    add_action('wp_ajax_getFrontendJobs', 'getFrontendJobs'); // Jobs im Frontend auslesen
    add_action('wp_ajax_nopriv_getFrontendJobs', 'getFrontendJobs'); // Jobs im Frontend ausgeben
    add_shortcode('job-offers-list', 'jobOffersList'); // Shortcode für alle Stellenangebote
    
    function profileAddMenu3() 
    {
        add_menu_page('Job Offers', 'JobOffers', 'manage_options', 'job-offers/index.php', '', 'dashicons-welcome-learn-more', 22 );
    }
    
    function init_scripts3() 
    {    
        wp_register_style('job-offers', plugins_url('job-offers/css/style.css'));
        wp_enqueue_style('job-offers');
    	wp_enqueue_script( 'jquery' );
        wp_enqueue_script('joBackendJs', plugins_url('job-offers/js/backend.js'));
    }
    
    function init_frontend3() 
    {    
        wp_enqueue_script('jquery');
        wp_enqueue_script('joFrontendJs', plugins_url('job-offers/js/frontend.js'));
    }

    Wenn ich Plugin 1 und 2 aufrufe, erhalte ich in der Konsole:
    XHR POST http://localhost/psyma_neu/wp-admin/admin-ajax.php

    Bei Plugin erscheint das aber nicht. Obwohl die Funktionen etc. alle gleich aufgebaut sind. Wenn ich Plugin 2 deaktivere, erhalte ich die Ausgabe auch bei Plugin 3.

    Thread-Starter opflaum

    (@opflaum)

    Ah okay. Dann versuch ich das gleich mal aus. Vielen Dank erstmal.

    Thread-Starter opflaum

    (@opflaum)

    @story1line Vielen Dank. Ich versuche es mal. Vielleicht klappt es ja dann.

    Thread-Starter opflaum

    (@opflaum)

    Leider nicht…

    Ich vermute dass liegt an dem global $product;

    Ich habe direkt die single-product.php als Template verwendet. Dort habe ich alle Funktionen etc. rausgeschmissen und meinen „eigenen Code“ eingefügt.

    Zusammengefasst sieht die aktuell so aus:

    <?php
    /**
     * The Template for displaying all single products
     *
     * This template can be overridden by copying it to yourtheme/woocommerce/single-product.php.
     *
     * HOWEVER, on occasion WooCommerce will need to update template files and you
     * (the theme developer) will need to copy the new files to your theme to
     * maintain compatibility. We try to do this as little as possible, but it does
     * happen. When this occurs the version of the template file will be bumped and
     * the readme will list any important changes.
     *
     * @see 	    https://docs.woocommerce.com/document/template-structure/
     * @package 	WooCommerce/Templates
     * @version     1.6.4
     */
    
    if ( ! defined( 'ABSPATH' ) ) {
    	exit; // Exit if accessed directly
    }
    
    get_header( 'shop' );
    
    global $product;
    ?>
    <div class="woo-detailseite">
        <div class="woo-topLeft">
            <div class="leftFrame">
                <?php
                $attachment_ids = $product->get_gallery_image_ids();
                
                foreach ( $attachment_ids as $attachment_id ) {
                    $full_size_image = wp_get_attachment_image_src( $attachment_id, 'full' );
                    echo $full_size_image;
                }
                ?>
                <div class="lf-row">
                    <div class="lf-cell" id="lf1">
                        test
                    </div>
                </div>
                <div class="lf-row">
                    <div class="lf-cell" id="lf2">
                        test
                    </div>
                </div>
                <div class="lf-row">
                    <div class="lf-cell" id="lf3">
                        test
                    </div>
                </div>
                ?>
                
            </div>
        </div>
        <div class="woo-topRight">
        
        </div>
        <div class="clear"></div>
        <div class="test"></div>
    </div>
    Thread-Starter opflaum

    (@opflaum)

    Ich habe es auch schon direkt so versucht:

    $usrFile = $_FILES['usrFile']['tmp_name'];
    $wpdb->query( "load data local infile '".$usrFile."' INTO TABLE s2_vuser FIELDS TERMINATED BY ';' LINES TERMINATED BY '\n' IGNORE 1 LINES (vuser_anrede, vuser_vorname,vuser_nachname,vuser_email)" );

    Wenn ich dann $usrFile ausgebe erhalte ich:
    /Applications/XAMPP/xamppfiles/temp/phpKP4vbV

    Im Übrigen übergebe ich das Formular mit jQuery:

    $( document ).on("submit", "#myimportform", function(event) {
        event.preventDefault();
            
        var myform = document.getElementById("myimportform");
        var form_data = new FormData(myform);
        
        $.ajax({
            url: ajaxurl,
            type: 'POST',
            data: form_data,
            contentType:false,
            processData:false,
            cache: false,
            success: function(data) {
                console.log(data);
            }
        });
    });

    Dennoch wird die Datei einfach nicht importiert. Sie muss auch nicht auf dem Server gespeichert werden – es würde ausreichen sie einfach temporär zu importieren und dann zu löschen…..

    Thread-Starter opflaum

    (@opflaum)

    okay super. Vielen lieben Dank. Ich werde es später mal versuchen und mich gegebenenfalls noch einmal melden. 🙂

    Thread-Starter opflaum

    (@opflaum)

    Okay, das habe ich soweit verstanden. Kann ich aber der aufgerufenen Seite irgendwie sagen dass diese in Ordnung ist sofern diese aus dem Backend geöffnet wird?

Ansicht von 8 Antworten - 1 bis 8 (von insgesamt 8)