Checkbox einfügen in user_account.tpl und user_noaccount.tpl

Hallo der Samstag ist rum, leider hab ich nicht so viel auf die Reihe bekommen.

Ich möchte für den Datenschutz eine weiter Checkbox bei der Registrierung einfügen.

Dafür habe ich mir gedacht nutze ich das Gerüst des Aufbaus des order.tpl und da diesen Part: Kann ich das so machen? Es folgt der Code im original aus dem order.tpl

<div id="orderAgbTop">
                        <form action="[{ $oViewConf->getSslSelfLink() }]" method="post" id="orderConfirmAgbTop">
                            [{ $oViewConf->getHiddenSid() }]
                            [{ $oViewConf->getNavFormParams() }]
                            <input type="hidden" name="cl" value="order">
                            <input type="hidden" name="fnc" value="[{$oView->getExecuteFnc()}]">
                            <input type="hidden" name="challenge" value="[{$challenge}]">
                            <input type="hidden" name="sDeliveryAddressMD5" value="[{$oView->getDeliveryAddressMD5()}]">
                            <div class="agb">
                                [{if $oView->isActive('PsLogin') }]
                                    <input type="hidden" name="ord_agb" value="1">
                                [{else}]
                                    [{if $oView->isConfirmAGBActive()}]
                                        [{oxifcontent ident="oxrighttocancellegend" object="oContent"}]
                                            <h3 class="section">
                                                <strong>[{ $oContent->oxcontents__oxtitle->value }]</strong>
                                            </h3>
                                           <input type="hidden" name="ord_agb" value="0">
                                            <input id="checkAgbTop" class="checkbox" type="checkbox" name="ord_agb" value="1">
                                            [{ $oContent->oxcontents__oxcontent->value }]
                                        [{/oxifcontent}]
                                    [{else}]
                                        [{oxifcontent ident="oxrighttocancellegend2" object="oContent"}]
                                            <h3 class="section">
                                                <strong>[{ $oContent->oxcontents__oxtitle->value }]</strong>
                                            </h3>
                                            <input type="hidden" name="ord_agb" value="1">
                                            [{ $oContent->oxcontents__oxcontent->value }]
                                        [{/oxifcontent}]
                                    [{/if}]
                                [{/if}]
                            </div>

                           [{oxscript add="$('#checkAgbTop').click(function(){ $('input[name=ord_agb]').val( parseInt($('input[name=ord_agb]').val()) ^ 1);});"}]

                            [{if $oView->showOrderButtonOnTop()}]
                                <div class="lineBox clear">
                                    <a href="[{ oxgetseourl ident=$oViewConf->getPaymentLink() }]" class="prevStep submitButton largeButton">[{ oxmultilang ident="PAGE_CHECKOUT_ORDER_BACKSTEP" }]</a>
                                    <button type="submit" class="submitButton nextStep largeButton">[{ oxmultilang ident="PAGE_CHECKOUT_ORDER_SUBMITORDER" }]</button>
                                </div>
                            [{/if}]
                        </form>
                    </div>

Ich habe die Dateien user_account und user_noaccount unter der Ceckbox für den Newsletter erweitert- Jedoch kann ich mit news Sub… noch nichts anfangen:

 <li>
        [{block name="user_account_newsletter"}]
        <b><label>[{ oxmultilang ident="FORM_FIELDSET_USER_ACCOUNT_data_privacy_1" }]</label></b>
        <input type="hidden" name="blnewssubscribed1" value="1">
        <input type="checkbox" class="checkbox"  name="blnewssubscribed1" value="1" [{if $oView->isNewsSubscribed() }]checked[{/if}]><!--was passiert hier?-->
        <span class="inputNote">[{ oxmultilang ident="FORM_FIELDSET_USER_data_privacy__MESSAGE" }]</span>
        [{/block}]
    </li>

Optisch sieht das bisher so aus wie ich mir das vorstelle. Vorlage ist die Newsletteranwahl. Leider steige ich bei den ganzen variablen noch nicht durch…

Ich hätte gerne eine einfache Abfrage… Datenschutz gelesen, -> Haken dran, registrieren und weiter zum nächsten Schritt in der Bestellung. Super wäre, wenn ich es auch hinbekommen könnte im else eine Fehlermeldung auszugeben, das der Haken für Datenschutz = ‘blnewssubscribed1’ noch fehlt.

Ist das für einen absoluten Neuling machbar? Muss ich dafür in anderen Datein Code agbelgen, oder geht das auch einfach in den user_account.tpl s?

Ich hab mir folgendes gedacht… dabei glaub ich die mit xxx gekennzeichneten Codeabschnitte ersetzen zu müssen.

<div id="orderAgbTop"><!--id=xxx??--> Kann das bleiben, es ist ja glaube ich der Struktur genauso wie der Ablauf bei nicht gelesenen Agb aufgebaut?-->
                        <form action="[{ $oViewConf->getSslSelfLink() }]" method="post" id="orderConfirmAgbTop"><!--id=xxx??-->
                            [{ $oViewConf->getHiddenSid() }]
                            [{ $oViewConf->getNavFormParams() }]
                            <input type="hidden" name="cl" value="order"><!--input typen=  4 zeilen, können die raus?-->
                            <input type="hidden" name="fnc" value="[{$oView->getExecuteFnc()}]">
                            <input type="hidden" name="challenge" value="[{$challenge}]">
                            <input type="hidden" name="sDeliveryAddressMD5" value="[{$oView->getDeliveryAddressMD5()}]">
                            <div class="agb"><!--kann das für die foramtierung bleiben-->
                                [{if $oView->isActive('PsLogin') }]<!--was wird hier geprüft? Kann das raus?-->
                                    <input type="hidden" name="ord_agb" value="1"><!-- org_agb würde ich durch blnewssubscribed1 ersetzen-->
                                [{else}]
                                    [{if $oView->isConfirmAGBActive()}]<!--wie kann ich das umschreiben-->
                                        [{oxifcontent ident="oxrighttocancellegend" object="oContent"}]<!-- wenn hier text ausgegeben wird, wie kann ich das über cust_lang.php oder statisch einfügen? -->
                                            <h3 class="section">
                                                <strong>[{ $oContent->oxcontents__oxtitle->value }]</strong><!-- Ist das eine Mitteilungsausgabe? Kann ich das in eckigen Klammern durch Text ersetzen?-->
                                            </h3>
                                           <input type="hidden" name="ord_agb" value="0"><!-- org_agb würde ich durch blnewssubscribed1 ersetzen-->
                                            <input id="checkAgbTop" class="checkbox" type="checkbox" name="ord_agb" value="1"><!-- org_agb würde ich durch blnewssubscribed1 ersetzen-->
                                            [{ $oContent->oxcontents__oxcontent->value }]<!-- Ist das eine Mitteilungsausgabe? Kann ich das in eckigen Klammern durch Text ersetzen?-->
                                        [{/oxifcontent}]
                                    [{else}]
                                        [{oxifcontent ident="oxrighttocancellegend2" object="oContent"}]<!-- Kann das stehen beiben? -->
                                            <h3 class="section">
                                                <strong>[{ $oContent->oxcontents__oxtitle->value }]</strong><!-- was passiert hier?-->
                                            </h3>
                                            <input type="hidden" name="ord_agb" value="1"><!-- org_agb würde ich durch blnewssubscribed1 ersetzen-->
                                            [{ $oContent->oxcontents__oxcontent->value }]<!-- was passiert hier?-->
                                        [{/oxifcontent}]
                                    [{/if}]
                                [{/if}]
                            </div>

                           [{oxscript add="$('#checkAgbTop').click(function(){ $('input[name=ord_agb]').val( parseInt($('input[name=ord_agb]').val()) ^ 1);});"}]<!-- Durch was kann ich check AgbTop ersetzen? org_agb würde ich durch blnewssubscribed1 ersetzen-->

                            [{if $oView->showOrderButtonOnTop()}]<!-- da ich nur den untern Order Butten nutzen möchte müsste das heier bis zum /div ja eigentlich weg können? oder? Andernfalls, wie würde der link für den zum nächsten Schritt aussehen?-->
                                <div class="lineBox clear">
                                    <a href="[{ oxgetseourl ident=$oViewConf->getPaymentLink() }]" class="prevStep submitButton largeButton">[{ oxmultilang ident="PAGE_CHECKOUT_ORDER_BACKSTEP" }]</a>
                                    <button type="submit" class="submitButton nextStep largeButton">[{ oxmultilang ident="PAGE_CHECKOUT_ORDER_SUBMITORDER" }]</button>
                                </div>
                            [{/if}]
                        </form>
                    </div>

Ich hoffe, es kann mir jemand helfen und ich komme euch nicht ganz so dusselig vor…

Ich habe jetzt folgendes geändert mit dem glauben das es richtig ist. Ich hab mir ne user_noaccount.php erstellt und diese in applications/controllers abgelegt. Außerdem habe ich die user_noaccount.tpl abgeändert.
Beides folgt unten:

user_noaccount.tpl

<li>
    
       <div id="orderAgbTop">
                        <form action="[{ $oViewConf->getSslSelfLink() }]" method="post" id="orderConfirmAgbTop"><!--id=xxx??-->
                            [{ $oViewConf->getHiddenSid() }]
                            [{ $oViewConf->getNavFormParams() }]
                            <input type="hidden" name="cl" value="order">
                            <input type="hidden" name="fnc" value="[{$oView->getExecuteFnc()}]">
                            <div class="agb">
                                [{if $oView->isActive('PsLogin') }]
                                    <input type="hidden" name="blnewssubscribed1" value="1">
                                [{else}]
                                    [{if $oView->isConfirmData_privacy()}]
                                        [{oxifcontent ident="oxrighttocancellegend" object="oContent"}]
                                            <h3 class="section">
                                                <strong>[{ $oContent->oxcontents__oxtitle->value }]</strong>
                                            </h3>
                                           <input type="hidden" name="blnewssubscribed1" value="0">
                                            <input id="checkAgbTop" class="checkbox" type="checkbox" name="blnewssubscribed1" value="1">
                                            [{ $oContent->oxcontents__oxcontent->value }]
                                        [{/oxifcontent}]
                                    [{else}]
                                        [{oxifcontent ident="oxrighttocancellegend2" object="oContent"}]
                                            <h3 class="section">
                                                <strong>[{ $oContent->oxcontents__oxtitle->value }]</strong>
                                            </h3>
                                            <input type="hidden" name="blnewssubscribed1" value="1">
                                            [{ $oContent->oxcontents__oxcontent->value }]
                                        [{/oxifcontent}]
                                    [{/if}]
                                [{/if}]
                            </div>

                           [{oxscript add="$('#checkAgbTop').click(function(){ $('input[name=blnewssubscribed1]').val( parseInt($('input[name=blnewssubscribed1]').val()) ^ 1);});"}]

                            
                        </form>
                         <span class="inputNote">[{ oxmultilang ident="FORM_FIELDSET_USER_ACCOUNT_NEWSLETTER_MESSAGE" }]</span>
        
                    </div>
    </li>

und hier die user_noaccount.php

<?php
cess stores ordering data to DB.
 */
class order extends oxUBase
{

    protected $_blConfirmData_privacy = null;

    /**
     * Config option "blShowOrderButtonOnTop"
     * @var bool
     */
    protected $_blShowOrderButtonOnTop = null;

    /**
     * Checks for order rules confirmation ("ord_agb", "ord_custinfo" form values)(if no
     * rules agreed - returns to order view), loads basket contents (plus applied
     * price/amount discount if available - checks for stock, checks user data (if no
     * data is set - returns to user login page). Stores order info to database
     * (oxorder::finalizeOrder()). According to sum for items automatically assigns user to
     * special user group ( oxuser::onOrderExecute(); if this option is not disabled in
     * admin). Finally you will be redirected to next page (order::_getNextStep()).
     *
     * @return string
     */
    public function execute()
    {
        if (!$this->getSession()->checkSessionChallenge()) {
            return;
        }

        $myConfig = $this->getConfig();

        if ( !oxConfig::getParameter( 'blnewssubscribed1' ) && $myConfig->getConfigParam( '_blConfirmData_privacy' ) ) {
            $this->_blConfirmAGBError = 1;
            return;
        }

        // for compatibility reasons for a while. will be removed in future
        if ( oxConfig::getParameter( 'ord_custinfo' ) !== null && !oxConfig::getParameter( 'ord_custinfo' ) && $this->isConfirmCustInfoActive() ) {
            $this->_blConfirmCustInfoError =  1;
            return;
        }

        // additional check if we really really have a user now
        if ( !$oUser= $this->getUser() ) {
            return 'user';
        }

        // get basket contents
        $oBasket  = $this->getSession()->getBasket();
        if ( $oBasket->getProductsCount() ) {

            try {
                $oOrder = oxNew( 'oxorder' );

                // finalizing ordering process (validating, storing order into DB, executing payment, setting status ...)
                $iSuccess = $oOrder->finalizeOrder( $oBasket, $oUser );

                // performing special actions after user finishes order (assignment to special user groups)
                $oUser->onOrderExecute( $oBasket, $iSuccess );

                // proceeding to next view
                return $this->_getNextStep( $iSuccess );
            } catch ( oxOutOfStockException $oEx ) {
                oxRegistry::get("oxUtilsView")->addErrorToDisplay( $oEx, false, true, 'basket' );
            } catch ( oxNoArticleException $oEx ) {
                oxRegistry::get("oxUtilsView")->addErrorToDisplay( $oEx );
            } catch ( oxArticleInputException $oEx ) {
                oxRegistry::get("oxUtilsView")->addErrorToDisplay( $oEx );
            }
        }
    }

    /**
     * Returns next order step. If ordering was sucessfull - returns string "thankyou" (possible
     * additional parameters), otherwise - returns string "payment" with additional
     * error parameters.
     *
     * @param integer $iSuccess status code
     *
     * @return  string  $sNextStep  partial parameter url for next step
     */
    protected function _getNextStep( $iSuccess )
    {
        $sNextStep = 'thankyou';

        //little trick with switch for multiple cases
        switch ( true ) {
            case ( $iSuccess === oxOrder::ORDER_STATE_MAILINGERROR ):
                $sNextStep = 'thankyou?mailerror=1';
                break;
            case ( $iSuccess === oxOrder::ORDER_STATE_INVALIDDElADDRESSCHANGED ):
                $sNextStep = 'order?iAddressError=1';
                break;
            case ( $iSuccess === oxOrder::ORDER_STATE_BELOWMINPRICE ):
                $sNextStep = 'order';
                break;
            case ( $iSuccess === oxOrder::ORDER_STATE_PAYMENTERROR ):
                // no authentication, kick back to payment methods
                oxSession::setVar( 'payerror', 2 );
                $sNextStep = 'payment?payerror=2';
                break;
            case ( $iSuccess === oxOrder::ORDER_STATE_ORDEREXISTS ):
                break;  // reload blocker activ
            case ( is_numeric( $iSuccess ) && $iSuccess > 3 ):
                oxSession::setVar( 'payerror', $iSuccess );
                $sNextStep = 'payment?payerror='.$iSuccess;
                break;
            case ( !is_numeric( $iSuccess ) && $iSuccess ):
                //instead of error code getting error text and setting payerror to -1
                oxSession::setVar( 'payerror', -1 );
                $iSuccess = urlencode( $iSuccess );
                $sNextStep = 'payment?payerror=-1&payerrortext='.$iSuccess;
                break;
            default:
                break;
        }

        return $sNextStep;
    }

    /**
     * Template variable getter. Returns payment object
     *
     * @return object
     */
    public function getPayment()
    {
        if ( $this->_oPayment === null ) {
            $this->_oPayment = false;

            $oBasket = $this->getBasket();
            $oUser = $this->getUser();

            // payment is set ?
            $sPaymentid = $oBasket->getPaymentId();
            $oPayment   = oxNew( 'oxpayment' );

            if ( $sPaymentid && $oPayment->load( $sPaymentid ) &&
                $oPayment->isValidPayment( oxSession::getVar( 'dynvalue' ),
                                           $this->getConfig()->getShopId(),
                                           $oUser,
                                           $oBasket->getPriceForPayment(),
                                           oxSession::getVar( 'sShipSet' ) ) ) {
                $this->_oPayment = $oPayment;
            }
        }
        return $this->_oPayment;
    }

   

    /**
     * Template variable getter. Returns execution function name
     *
     * @return string
     */
    public function getExecuteFnc()
    {
        return 'execute';
    }



    /**
     * Template variable getter. Returns if option "blConfirmData_privacy" is on
     *
     * @return bool
     */
    public function isConfirmData_privacy()
    {
        if ( $this->_blConfirmData_privacy === null ) {
            $this->_blConfirmData_privacy = false;
            $this->_blConfirmData_privacy = $this->getConfig()->getConfigParam( '_blConfirmData_privacy' );
        }
        return $this->_blConfirmData_privacy;
    }

    /**
     * Template variable getter. Returns if option "blConfirmAGB" was not set
     *
     * @return bool
     */
    public function isConfirmAGBError()
    {
        return $this->_blConfirmAGBError;
    }

   
}

Leider funktioniert es nicht so wie erhofft :frowning: Die Checkbox zeigt keine Wirkung :frowning:

Vielleicht hat ja einer nen Hinweis für mich …

[{oxscript add="$('#checkAgbTop').click(function(){ $('input[name=blnewssubscribed1]').val( parseInt($('input[name=blnewssubscribed1]').val()) ^ 1);});"}]

Könnte es daran liegen? Das verstehe ich leider noch so gar nicht. Und mit der Suchfunktion tue ich mich schwer, da ich nicht genau weiß wonach ich suchen muss.

Wäre für jeden Hinweis dankbar, auch für nen Hinweis nach was ich im Forum suchen müsste damit ich weiter komme…

o.k… das läuft ins leere, da brauch sich keiner mehr Gedanken zu machen