Anleitung Call Back Formular erweitern / umbauen (nicht updatesicher)

Thema wurde von Alex (living-zone.de), 4. September 2014 erstellt.

  1. Alex (living-zone.de)

    Alex (living-zone.de) Erfahrener Benutzer

    Registriert seit:
    24. Mai 2012
    Beiträge:
    60
    Danke erhalten:
    13
    Danke vergeben:
    20
    #1 Alex (living-zone.de), 4. September 2014
    Zuletzt bearbeitet: 4. September 2014
    Hallo,

    folgendes ist integriert worden (Gambio Version: v2.0.15.4 r14570):

    1 Name und Vorname trennen
    2 Fehlermeldungen separat pro Textfeld ausgeben
    3 Formulardaten bei Shopkunden ausfüllen
    4 Checkboxen einbauen
    5 Radiobutton einbauen
    6 Select liste einbauen


    root/gm/ajax/callback_service.php
    zeile suchen:
    PHP:
        if(empty($_GET['name']) || empty($_GET['telephone'])){
            
    $errors .= GM_CALLBACK_SERVICE_ERROR '<br />';
        }
    ersetzen mit:
    PHP:
        // Formulare. Callback Service
        
    if(empty($_GET['firstname'])){
            
    $errors .= GM_CALLBACK_SERVICE_FIRSTNAME_ERROR '<br />';
        }
        if(empty(
    $_GET['lastname'])){
            
    $errors .= GM_CALLBACK_SERVICE_LASTNAME_ERROR '<br />';
        }
        if(empty(
    $_GET['telephone'])){
            
    $errors .= GM_CALLBACK_SERVICE_TELEFON_ERROR '<br />';
        }
        
    // Formulare. Callback Service ende
    zeilen suchen:
    PHP:
        $text GM_CALLBACK_SERVICE_MAIL_NAME $_POST['name']
    "\n"GM_CALLBACK_SERVICE_MAIL_EMAIL $_POST['email']
    "\n" GM_CALLBACK_SERVICE_MAIL_TELEPHONE $_POST['telephone']
    "\n" GM_CALLBACK_SERVICE_MAIL_TIME $_POST['time']
    "\n\n" GM_CALLBACK_SERVICE_MAIL_MESSAGE "\n" $message;
    ersetzen mit:
    PHP:
        // Formulare. Callback Service
        
    $text GM_CALLBACK_SERVICE_MAIL_FIRSTNAME ' ' $_POST['firstname']
    "\n"GM_CALLBACK_SERVICE_MAIL_LASTNAME ' ' $_POST['lastname']
    "\n"GM_CALLBACK_SERVICE_MAIL_EMAIL $_POST['email']
    "\n" GM_CALLBACK_SERVICE_MAIL_TELEPHONE $_POST['telephone']
    "\n" GM_CALLBACK_SERVICE_MAIL_TIME $_POST['time']
    "\n" GM_CALLBACK_SERVICE_MAIL_CHECKBOX_1 ' ' GM_CALLBACK_SERVICE_MAIL_CHECKBOX $_POST['checkbox_1']
    "\n" GM_CALLBACK_SERVICE_MAIL_CHECKBOX_2 ' ' GM_CALLBACK_SERVICE_MAIL_CHECKBOX $_POST['checkbox_2']
    "\n" GM_CALLBACK_SERVICE_MAIL_RADIO ' ' $_POST['radio']
    "\n" GM_CALLBACK_SERVICE_MAIL_SELECT ' ' $_POST['select']
    "\n" GM_CALLBACK_SERVICE_MAIL_MESSAGE "\n" $message;
        
    // Formulare. Callback Service ende
    zeilen suchen:
    PHP:
    xtc_php_mail(CONTACT_US_EMAIL_ADDRESSCONTACT_US_NAMECONTACT_US_EMAIL_ADDRESSCONTACT_US_NAME''$email$_POST['name'], ''''GM_CALLBACK_SERVICE_SUBJECT $_POST['name'] . ', ' $_POST['telephone'], nl2br(htmlentities_wrapper($text)), html_entity_decode_wrapper($text));
    ersetzen mit:
    PHP:
    // Formulare. Callback Service
    xtc_php_mail(CONTACT_US_EMAIL_ADDRESSCONTACT_US_NAMECONTACT_US_EMAIL_ADDRESSCONTACT_US_NAME''$email$_POST['lastname'], ''''GM_CALLBACK_SERVICE_SUBJECT $_POST['firstname'] .' '$_POST['lastname'], nl2br(htmlentities_wrapper($text)), html_entity_decode_wrapper($text));
    // Formulare. Callback Service ende
    --------------------------------------------------
    root/gm/javascript/GMCallbackService.js
    komplett ersetzen mit:
    PHP:
    /* GMCallbackService.js <?php
    #   --------------------------------------------------------------
    #   GMCallbackService.js 2012-06-13 gambio
    #   Gambio GmbH
    #   http://www.gambio.de
    #   Copyright (c) 2012 Gambio GmbH
    #   Released under the GNU General Public License (Version 2)
    #   [http://www.gnu.org/licenses/gpl-2.0.html]
    #   --------------------------------------------------------------
    ?>*/
    var gm_callback_service = new GMCallbackService();
    function GMCallbackService(){
        this.check_callback = function(){
            $('#gm_callback_service_error_message').load('gm_ajax.php?module=callback_service&check=1'
                                                                            + '&firstname=' + escape($('#gm_callback_service_firstname').val())
                                                                            + '&lastname=' + escape($('#gm_callback_service_lastname').val())
                                                                            + '&telephone=' + escape($('#gm_callback_service_telephone').val())
                                                                            + '&vvcode=' + $('#vvcode').val()
                                                                            + '&recaptcha_response_field=' +  encodeURI($('#recaptcha_response_field').val())
                                                                            + '&recaptcha_challenge_field=' + encodeURI($('#recaptcha_challenge_field').val())
                                                                            + '&XTCsid=' + gm_session_id,
                    function(errors){
                        if(errors == '') gm_callback_service.send_form();
                        else{
                            $('#gm_callback_service_error_message').addClass('error_message').html(errors);
                            try{
                                Recaptcha.reload();
                            }
                            catch (e){
                                $('#vvcode').val('');
                                $('#vvcode_image').attr('src', 'gm_create_vvcodes.php?rand=' + Math.random() + '&XTCsid=' + gm_session_id);
                            }
                        }
                    }
            );
        }
        this.send_form = function(){
            var query = $("#gm_callback_service_form").serialize();
            jQuery.ajax({
                data:         query,
                url:             'gm_ajax.php?module=callback_service&XTCsid=' + gm_session_id,
                type:         "POST",
                success:     function(sent_success) {
                    $("#gm_callback_service_success").addClass('approved_message').html(sent_success);
                }
            });
        }
    }
    $(document).ready(function(){
        $("#gm_callback_service_send").click(function(){
                    gm_callback_service.check_callback();
                    return false;
                }
            );
    });
    --------------------------------------------------
    root/media/content/gm_callback_service.php
    zeilen suchen:
    PHP:
        $smarty_gm_muster_catalog = new Smarty;
    danach einfügen:
        
    // Formulare. Callback Service
        
    $customer_address_query xtc_db_query("select c.customers_firstname, c.customers_cid, c.customers_gender, c.customers_lastname, c.customers_telephone, c.customers_email_address, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, co.countries_id, co.countries_name, co.countries_iso_code_2, co.countries_iso_code_3, co.address_format_id, ab.entry_state from " TABLE_CUSTOMERS " c, " TABLE_ADDRESS_BOOK " ab left join " TABLE_ZONES " z on (ab.entry_zone_id = z.zone_id) left join " TABLE_COUNTRIES " co on (ab.entry_country_id = co.countries_id) where c.customers_id = '" $_SESSION['customer_id'] . "' and ab.customers_id = '" $_SESSION['customer_id'] . "' and c.customers_default_address_id = ab.address_book_id");
        
    $customer_address xtc_db_fetch_array($customer_address_query);
        
    // Formulare. Callback Service ende
    zeilen suchen:
    PHP:
        $smarty_gm_callback_service->assign('NAME'GM_CALLBACK_SERVICE_NAME);
        
    $smarty_gm_callback_service->assign('NAME_VALUE'$_SESSION['customer_first_name'] . ' ' $_SESSION['customer_last_name']);
        
    $smarty_gm_callback_service->assign('EMAIL'GM_CALLBACK_SERVICE_EMAIL);
        
    $smarty_gm_callback_service->assign('TELEPHONE'GM_CALLBACK_SERVICE_TELEPHONE);
    ersetzen mit:
    PHP:
        // Formulare. Callback Service ende
        
    $smarty_gm_callback_service->assign('FIRSTNAME'GM_CALLBACK_SERVICE_FIRSTNAME);
        
    $smarty_gm_callback_service->assign('FIRSTNAME_VALUE'$customer_address['customers_firstname']);
        
    $smarty_gm_callback_service->assign('LASTNAME'GM_CALLBACK_SERVICE_LASTNAME);
        
    $smarty_gm_callback_service->assign('LASTNAME_VALUE'$customer_address['customers_lastname']);
        
    $smarty_gm_callback_service->assign('TELEPHONE'GM_CALLBACK_SERVICE_TELEPHONE);
        
    $smarty_gm_callback_service->assign('TELEPHONE_VALUE'$customer_address['customers_telephone']);
        
    $smarty_gm_callback_service->assign('EMAIL'GM_CALLBACK_SERVICE_EMAIL);
        
    $smarty_gm_callback_service->assign('EMAIL_VALUE'$customer_address['customers_email_address']);
        
        
    $smarty_gm_callback_service->assign('CHECKBOX'GM_CALLBACK_SERVICE_CHECKBOX);
        
    $smarty_gm_callback_service->assign('CHECKBOX_1'GM_CALLBACK_SERVICE_CHECKBOX_1);
        
    $smarty_gm_callback_service->assign('CHECKBOX_2'GM_CALLBACK_SERVICE_CHECKBOX_2);
        
        
    $smarty_gm_callback_service->assign('RADIO'GM_CALLBACK_SERVICE_RADIO);
        
    $smarty_gm_callback_service->assign('RADIO_1'GM_CALLBACK_SERVICE_RADIO_1);
        
    $smarty_gm_callback_service->assign('RADIO_2'GM_CALLBACK_SERVICE_RADIO_2);
        
        
    $smarty_gm_callback_service->assign('SELECT'GM_CALLBACK_SERVICE_SELECT);
        
    $smarty_gm_callback_service->assign('SELECT_0'GM_CALLBACK_SERVICE_SELECT_0);
        
    $smarty_gm_callback_service->assign('SELECT_1'GM_CALLBACK_SERVICE_SELECT_1);
        
    $smarty_gm_callback_service->assign('SELECT_2'GM_CALLBACK_SERVICE_SELECT_2);
        
    $smarty_gm_callback_service->assign('SELECT_3'GM_CALLBACK_SERVICE_SELECT_3);
        
    $smarty_gm_callback_service->assign('SELECT_4'GM_CALLBACK_SERVICE_SELECT_4);
        
    $smarty_gm_callback_service->assign('SELECT_5'GM_CALLBACK_SERVICE_SELECT_5);
        
    // Formulare. Callback Service ende
    --------------------------------------------------
    root/lang/english/callback_service.php
    vor "?>" einfügen:
    PHP:
        // Formulare. Callback Service
        
    define('GM_CALLBACK_SERVICE_FIRSTNAME''First name:');
        
    define('GM_CALLBACK_SERVICE_FIRSTNAME_ERROR''Please enter your first name.');
        
    define('GM_CALLBACK_SERVICE_LASTNAME''Last name:');
        
    define('GM_CALLBACK_SERVICE_LASTNAME_ERROR''Please enter your last name.');
        
    define('GM_CALLBACK_SERVICE_TELEFON_ERROR''Please enter your phone number.');
        
    define('GM_CALLBACK_SERVICE_MAIL_FIRSTNAME''Vorname:');
        
    define('GM_CALLBACK_SERVICE_MAIL_LASTNAME''Name:');
        
        
    define('GM_CALLBACK_SERVICE_CHECKBOX''Checkbox: ');
        
    define('GM_CALLBACK_SERVICE_CHECKBOX_1''Checkbox 1');
        
    define('GM_CALLBACK_SERVICE_CHECKBOX_2''Checkbox 2');
        
    define('GM_CALLBACK_SERVICE_MAIL_CHECKBOX''Checkbox: ');
        
    define('GM_CALLBACK_SERVICE_MAIL_CHECKBOX_1''Checkbox 1');
        
    define('GM_CALLBACK_SERVICE_MAIL_CHECKBOX_2''Checkbox 2');
        
        
    define('GM_CALLBACK_SERVICE_RADIO''Radio: ');
        
    define('GM_CALLBACK_SERVICE_RADIO_1''Radio 1');
        
    define('GM_CALLBACK_SERVICE_RADIO_2''Radio 2');
        
    define('GM_CALLBACK_SERVICE_MAIL_RADIO''Radio: ');
        
        
    define('GM_CALLBACK_SERVICE_SELECT''Select: ');
        
    define('GM_CALLBACK_SERVICE_SELECT_0''Please select...');
        
    define('GM_CALLBACK_SERVICE_SELECT_1''Select 1');
        
    define('GM_CALLBACK_SERVICE_SELECT_2''Select 2');
        
    define('GM_CALLBACK_SERVICE_SELECT_3''Select 3');
        
    define('GM_CALLBACK_SERVICE_SELECT_4''Select 4');
        
    define('GM_CALLBACK_SERVICE_SELECT_5''Select 5');
        
    define('GM_CALLBACK_SERVICE_MAIL_SELECT''Select: ');
        
    // Formulare. Callback Service ende
    --------------------------------------------------
    root/lang/german/callback_service.php
    vor "?>" einfügen:
    PHP:
        // Formulare. Callback Service
        
    define('GM_CALLBACK_SERVICE_FIRSTNAME''Vorname:');
        
    define('GM_CALLBACK_SERVICE_FIRSTNAME_ERROR''Bitte geben Sie Ihren Vornamen ein.');
        
    define('GM_CALLBACK_SERVICE_LASTNAME''Nachname:');
        
    define('GM_CALLBACK_SERVICE_LASTNAME_ERROR''Bitte geben Sie Ihren Nachnamen ein.');
        
    define('GM_CALLBACK_SERVICE_TELEFON_ERROR''Bitte geben Sie Ihre Telefonnummer ein.');
        
    define('GM_CALLBACK_SERVICE_MAIL_FIRSTNAME''Vorname:');
        
    define('GM_CALLBACK_SERVICE_MAIL_LASTNAME''Name:');
        
        
    define('GM_CALLBACK_SERVICE_CHECKBOX''Checkbox: ');
        
    define('GM_CALLBACK_SERVICE_CHECKBOX_1''Checkbox 1');
        
    define('GM_CALLBACK_SERVICE_CHECKBOX_2''Checkbox 2');
        
    define('GM_CALLBACK_SERVICE_MAIL_CHECKBOX''Checkbox: ');
        
    define('GM_CALLBACK_SERVICE_MAIL_CHECKBOX_1''Checkbox 1');
        
    define('GM_CALLBACK_SERVICE_MAIL_CHECKBOX_2''Checkbox 2');
        
        
    define('GM_CALLBACK_SERVICE_RADIO''Radio: ');
        
    define('GM_CALLBACK_SERVICE_RADIO_1''Radio 1');
        
    define('GM_CALLBACK_SERVICE_RADIO_2''Radio 2');
        
    define('GM_CALLBACK_SERVICE_MAIL_RADIO''Radio: ');
        
        
    define('GM_CALLBACK_SERVICE_SELECT''Select: ');
        
    define('GM_CALLBACK_SERVICE_SELECT_0''Bitte ausw&auml;hlen...');
        
    define('GM_CALLBACK_SERVICE_SELECT_1''Select 1');
        
    define('GM_CALLBACK_SERVICE_SELECT_2''Select 2');
        
    define('GM_CALLBACK_SERVICE_SELECT_3''Select 3');
        
    define('GM_CALLBACK_SERVICE_SELECT_4''Select 4');
        
    define('GM_CALLBACK_SERVICE_SELECT_5''Select 5');
        
    define('GM_CALLBACK_SERVICE_MAIL_SELECT''Select: ');
        
    // Formulare. Callback Service ende
    --------------------------------------------------
    root/templates/dein-template/module/gm_callback_service.html
    zeilen suchen:
    PHP:
        <div class="input">
            <
    label>{$NAME}</label>
            <
    input type="text" id="gm_callback_service_name" name="name" value="" class="input-text callback_service_fields" /> *
        </
    div>
        <
    div class="input">
            <
    label>{$EMAIL}</label>
            <
    input type="text" id="gm_callback_service_email" name="email" value="" class="input-text callback_service_fields" />
        </
    div>
        <
    div class="input">
            <
    label>{$TELEPHONE}</label>
            <
    input type="text" id="gm_callback_service_telephone" name="telephone" value="" class="input-text callback_service_fields" /> *
        </
    div>
    ersetzen mit:
    PHP:
        <div class="input">
            <
    label>{$FIRSTNAME}</label>
            <
    input type="text" id="gm_callback_service_firstname" name="firstname" value="{$FIRSTNAME_VALUE}class="input-text callback_service_fields" /> *
        </
    div>
        <
    div class="input">
            <
    label>{$LASTNAME}</label>
            <
    input type="text" id="gm_callback_service_lastname" name="lastname" value="{$LASTNAME_VALUE}class="input-text callback_service_fields" /> *
        </
    div>
        <
    div class="input">
            <
    label>{$EMAIL}</label>
            <
    input type="text" id="gm_callback_service_email" name="email" value="{$EMAIL_VALUE}class="input-text callback_service_fields" />
        </
    div>
        <
    div class="input">
            <
    label>{$TELEPHONE}</label>
            <
    input type="text" id="gm_callback_service_telephone" name="telephone" value="{$TELEPHONE_VALUE}class="input-text callback_service_fields" /> *
        </
    div>
        <
    div class="input">
            <
    label>{$CHECKBOX}</label>
            <
    input type="checkbox" name="checkbox_1" value="ja" checked="checked" class="callback_service_fields"> {$CHECKBOX_1}<br>
            <
    input type="checkbox" name="checkbox_2" value="ja" class="callback_service_fields"> {$CHECKBOX_2}
        </
    div>
        <
    div class="input">
            <
    label>{$RADIO}</label>
            <
    input type="radio" name="radio" value="radio_1" checked="checked" class="callback_service_fields"> {$RADIO_1}<br>
            <
    input type="radio" name="radio" value="radio_2" class="callback_service_fields"> {$RADIO_2}
        </
    div>
        <
    div class="input">
            <
    label>{$SELECT}</label>
                <
    select name="select" class="input-select">
                    <
    option value="-">{$SELECT_0}</option>
                    <
    option value="{$SELECT_1}">{$SELECT_1}</option>
                    <
    option value="{$SELECT_2}">{$SELECT_2}</option>
                    <
    option value="{$SELECT_3}">{$SELECT_3}</option>
                    <
    option value="{$SELECT_4}">{$SELECT_4}</option>
                    <
    option value="{$SELECT_5}">{$SELECT_5}</option>
            </
    select>
        </
    div>
     

    Anhänge:

  2. MP Solution

    MP Solution Erfahrener Benutzer

    Registriert seit:
    2. Oktober 2013
    Beiträge:
    2.945
    Danke erhalten:
    456
    Danke vergeben:
    93
    Hallo auch,

    und wenn ich das ganze im Usermod unterbringe, würde das dann Updatesicher sein?

    LG
    Jörg
     
  3. Anonymous

    Anonymous G-WARD 2015/2016

    Registriert seit:
    20. Februar 2012
    Beiträge:
    8.871
    Danke erhalten:
    1.546
    Danke vergeben:
    1.121
    naja, die php-Dateien lassen sich ja nicht als -USERMOD speichern, da muss man wohl Overloads machen, aber da kenne ich mich nicht mit aus,,,,,,,
     
  4. MP Solution

    MP Solution Erfahrener Benutzer

    Registriert seit:
    2. Oktober 2013
    Beiträge:
    2.945
    Danke erhalten:
    456
    Danke vergeben:
    93
    :confused:warum wußte ich das...

    LG
    Jörg
     
  5. Alex (living-zone.de)

    Alex (living-zone.de) Erfahrener Benutzer

    Registriert seit:
    24. Mai 2012
    Beiträge:
    60
    Danke erhalten:
    13
    Danke vergeben:
    20
    ...dafür hast du bestimmt schon eine Videoanleitung :)
     
  6. MP Solution

    MP Solution Erfahrener Benutzer

    Registriert seit:
    2. Oktober 2013
    Beiträge:
    2.945
    Danke erhalten:
    456
    Danke vergeben:
    93
    Zur Zeit habe ich noch 30 neue Videos in Arbeit. Aber dieses habe ich noch nicht aufgenommen.

    Lg
    Jörg
     
  7. Avenger

    Avenger G-WARD 2012/13/14/15

    Registriert seit:
    26. April 2011
    Beiträge:
    4.771
    Danke erhalten:
    1.478
    Danke vergeben:
    89
    Mit Version 2.0.x keine Chance (außer man nutzt mein erweitertes USERMOD-Konzept) mit 2.1.x schon eher....