Post by ab-oc » Mon May 19, 2014 5:21 am

:drunk:
Hallo zusammen,

ich experimentiere immer noch mit OC und bin nun beim Checkout angelangt.
Bei Schritt 5 (Zahlungsart) sieht OC eine Checkbox vor, mit welcher man den AGB's zustimmen muss, bevor man weiter zu Schritt 6 (Auftrag bestätigen) kommt.
Meiner Meinung nach ist es üblicher wenn man den AGB's im Rahmen der Zusammenfassung (Schritt 6 - Auftrag bestätigen) zustimmen muss.
Daher möchte ich gerne die Checkbox samt zugehörigen Text und Überprüfung von Schritt 5 zu Schritt 6 "umziehen".

Meine bisherigen Versuche sind leider gescheitert.
Die Checkbox sowie die Textanzeige bekommen ich beim Schritt 6 angezeigt, jedoch gelingt die Überprüfung nicht.

Kann mir jemand helfen? Vielleicht hat der Eine oder Andere auch das gleiche Problem?

Gruß

Andreas

New member

Posts

Joined
Tue Apr 29, 2014 11:22 pm

Post by OSWorX » Mon May 19, 2014 4:22 pm

Einfach die Prüfung ob die AGB akzeptiert wurden im controller aus payment.php in die confirm.php kopieren.

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by ab-oc » Tue May 20, 2014 12:55 am

Hallo Osworx,

kannst Du mir sagen, welche Teile des Quellcodes genau?
In confirm.tpl muss ich ja die entsprechenden Passagen auch einfügen. Auch hier steh ich etwas auf dem Schlauch...

Danke schonmal...

Gruß

Andreas

New member

Posts

Joined
Tue Apr 29, 2014 11:22 pm

Post by OSWorX » Tue May 20, 2014 1:01 am

ab-oc wrote:Hallo Osworx,

kannst Du mir sagen, welche Teile des Quellcodes genau?
In confirm.tpl muss ich ja die entsprechenden Passagen auch einfügen. Auch hier steh ich etwas auf dem Schlauch...

Danke schonmal...

Gruß

Andreas
Im Prinzip in

Code: Select all

../catalog/controller/checkout/payment_method.php
das hier verschieben

Code: Select all

if ($this->config->get('config_checkout_id')) {
				$this->load->model('catalog/information');

				$information_info = $this->model_catalog_information->getInformation($this->config->get('config_checkout_id'));

				if ($information_info && !isset($this->request->post['agree'])) {
					$json['error']['warning'] = sprintf($this->language->get('error_agree'), $information_info['title']);
				}
			}
in

Code: Select all

../catalog/controller/checkout/confirm.php
sowie aus

Code: Select all

../catalog/view/theme/TEMPLATENAME/template/checkout/payment_method.tpl
das hier

Code: Select all

<?php if ($text_agree) { ?>
<div class="buttons">
  <div class="right"><?php echo $text_agree; ?>
    <?php if ($agree) { ?>
    <input type="checkbox" name="agree" value="1" checked="checked" />
    <?php } else { ?>
    <input type="checkbox" name="agree" value="1" />
    <?php } ?>
    <input type="button" value="<?php echo $button_continue; ?>" id="button-payment-method" class="button" />
  </div>
</div>
<?php } else { ?>
<div class="buttons">
  <div class="right">
    <input type="button" value="<?php echo $button_continue; ?>" id="button-payment-method" class="button" />
  </div>
</div>
<?php } ?>
<script type="text/javascript"><!--
$('.colorbox').colorbox({
	width: 640,
	height: 480
});
//--></script> 
in

Code: Select all

../catalog/view/theme/TEMPLATENAME/template/checkout/confirm.tpl
Ungetestet - wenns funktioniert, schick ich die Rechnung.

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by ab-oc » Tue May 20, 2014 3:07 am

Hallo Osworx,

hab die Verschiebungen gemacht, und nach diversen Kleinigkeiten, die noch zusätzlich notwendig waren, folgender Stand:

Code: Select all

confirm.php

Code: Select all

$json = array();

Code: Select all

// ANFANG - Anzeige T&C inkl. Checkbox
                $this->data['button_continue'] = $this->language->get('button_continue');
                if (!$json) {
                         if ($this->config->get('config_checkout_id')) {
                                 $this->load->model('catalog/information');

                                 $information_info = $this->model_catalog_information->getInformation($this->config->get('config_checkout_id'));

                                 if ($information_info) {
                                         $this->data['text_agree'] = sprintf($this->language->get('text_agree'), $this->url->link('information/information/info', 'information_id=' . $this->config->get('config_checkout_id'), 'SSL'), $information_info['title'], $information_info['title']);
                                 } else {
                                         $this->data['text_agree'] = '';
                                 }
                         } else {
                                 $this->data['text_agree'] = '';
                         }

                         if (isset($this->session->data['agree'])) {
                                 $this->data['agree'] = $this->session->data['agree'];
                         } else {
                                 $this->data['agree'] = '';
                         }
                }
                $this->response->setOutput(json_encode($json));
// ENDE - Anzeige T&C inkl. Checkbox

Code: Select all

config.tpl

Code: Select all

<?php if ($text_agree) { ?>
<div class="buttons">
  <div class="right"><?php echo $text_agree; ?>
    <?php if ($agree) { ?>
    <input type="checkbox" name="agree" value="1" checked="checked" style="float:none;" />
    <?php } else { ?>
    <input type="checkbox" name="agree" value="1" style="float:none;" />
    <?php } ?>
    <input type="button" value="<?php echo $button_continue; ?>" id="button-payment-method" class="button colorButton remove-bottom" />
  </div>
</div>
<?php } else { ?>

<?php } ?>
<script type="text/javascript"><!--
$('.colorbox').fancybox({
        width:560,
        height:560,
        autoDimensions: false
        });
//--></script>
Jetzt ist im Schritt 6 unter der Produktauflistung und über dem "Kaufen"-Button folgendes zu sehen:

Die Terms & Conditions habe ich gelesen und bin einverstanden. [ ] "Weiter"

Also gewünschter Text, Checkbox und Button. Soweit so gut. Jetzt scheitere ich an der Überprüfung.
Im Schritt 5 wird ja eine Warnmeldung ausgegeben, wenn die Checkbox nicht angehakt wurde. Bei mir im Schritt 6 funktioniert dies noch nicht. Ich kann die Checkbox anhaken und auf den Button "Weiter", dann wird der Haken in der Checkbox lediglich gelöscht, keine Warnmeldung...

Was muss ich in config.php und ggf. in config.tpl noch ändern / ergänzen, damit die Prüfung funktioniert und der "Weiter"-Button den "Kaufen"-Button ersetzt? ???

Gruß

Andreas

P.S.: Ist vielleicht auch für Dein Modul "Legal" interessant...

New member

Posts

Joined
Tue Apr 29, 2014 11:22 pm

Post by OSWorX » Tue May 20, 2014 5:09 am

ab-oc wrote: Also gewünschter Text, Checkbox und Button. Soweit so gut. Jetzt scheitere ich an der Überprüfung.
Im Schritt 5 wird ja eine Warnmeldung ausgegeben, wenn die Checkbox nicht angehakt wurde. Bei mir im Schritt 6 funktioniert dies noch nicht. Ich kann die Checkbox anhaken und auf den Button "Weiter", dann wird der Haken in der Checkbox lediglich gelöscht, keine Warnmeldung...

Was muss ich in config.php und ggf. in config.tpl noch ändern / ergänzen, damit die Prüfung funktioniert
In config.php nichts und in config.tpl gibt es garnicht!
Meinst wahrscheinlich confirm.*
ab-oc wrote:.. und der "Weiter"-Button den "Kaufen"-Button ersetzt? ???
Verstehe ich noch weniger!
Welcher Button 'Kaufen' soll wo durch was ersetzt werden???

Wenn keine Überprüfung gemacht wird, dann fehlt halt noch ein wenig Code in beiden.
Wahrscheinlich das validate()
ab-oc wrote:... ist vielleicht auch für Dein Modul "Legal" interessant...
Versteht ich jetzt nicht ganz, denn dort wird AGB sowie Widerruf sowieso abgefragt - eine Checkbox dort ist rechtlich nicht notwendig (wurde von mehreren unabhängigen Rechtsanwälten bestätigt).

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by ab-oc » Tue May 20, 2014 7:35 pm

OSWorX wrote:ab-oc wrote:
Also gewünschter Text, Checkbox und Button. Soweit so gut. Jetzt scheitere ich an der Überprüfung.
Im Schritt 5 wird ja eine Warnmeldung ausgegeben, wenn die Checkbox nicht angehakt wurde. Bei mir im Schritt 6 funktioniert dies noch nicht. Ich kann die Checkbox anhaken und auf den Button "Weiter", dann wird der Haken in der Checkbox lediglich gelöscht, keine Warnmeldung...

Was muss ich in config.php und ggf. in config.tpl noch ändern / ergänzen, damit die Prüfung funktioniert

In config.php nichts und in config.tpl gibt es garnicht!
Meinst wahrscheinlich confirm.*
Stimmt... ::)
OSWorX wrote:ab-oc wrote:
.. und der "Weiter"-Button den "Kaufen"-Button ersetzt?

Verstehe ich noch weniger!
Welcher Button 'Kaufen' soll wo durch was ersetzt werden???
Ok, missverständlich formuliert. Mein jetziger Stand ist der, dass im Schritt 6 zwei Buttons existieren. Der eigentliche "Kaufen"-Button welcher original zu Schritt 6 gehört, zuzüglich des "Weiter"-Buttons, welcher aus Schritt 5 "umkopiert" wurde.
Klar brauch ich nur einen Button zum Kaufen. Jetzt muss eben einer wieder entfernt werden, ich bin mir nur nicht sicher welcher geschickter ist, da bisher auch die Validierung bei mir nicht funktioniert. Bisher dachte ich, dass diese Validierung über den "Weiter"-Button ausgelöst wird. ??? Oder nicht?
OSWorX wrote:ab-oc wrote:
... ist vielleicht auch für Dein Modul "Legal" interessant...

Versteht ich jetzt nicht ganz, denn dort wird AGB sowie Widerruf sowieso abgefragt - eine Checkbox dort ist rechtlich nicht notwendig (wurde von mehreren unabhängigen Rechtsanwälten bestätigt).
Bei Deinem Legal wird AGB und Widerruf auch in Schritt 5 abgefragt, oder?

Kannst Du mir zu dem validate() noch ein paar mehr Hinweise geben? Du kennst Dich offensichtlich sehr gut aus, mit dem OpenCart-System...

Danke

Andreas

New member

Posts

Joined
Tue Apr 29, 2014 11:22 pm

Post by OSWorX » Tue May 20, 2014 8:06 pm

ab-oc wrote:Du kennst Dich offensichtlich sehr gut aus, mit dem OpenCart-System...
Netter Scherz .. oder wie soll ich das verstehen??
Würde anonsten wohl kaum dermassen heikle Module wie z.B. LEGAL erstellen können - oder ?!
ab-oc wrote:Bei Deinem Legal wird AGB und Widerruf auch in Schritt 5 abgefragt, oder?
Ganz wie Standard - und das genügt.
Im Modul LEGAL wird in der integrierten und verpflichtenden abschliessenden BUTTONLÖSUNG sowohl auf AGB als auch Widerruf hingewiesen.
Das genügt vollkommen - irgendwelche Checkboxen oder weitere Abfragen sind hier nicht mehr erforderlich.
ab-oc wrote:Kannst Du mir zu dem validate() noch ein paar mehr Hinweise geben?
Ja, aber letztendlich läuft es doch auch eine ziemliche Modifikation des Systems raus - daher zum letztenmal gratis hier ein Hinweis, mehr dann als Auftragsarbeit.

In der checkout.tpl siehe:

Code: Select all

$('#button-payment-address').live('click', function() {
	$.ajax({
		url: 'index.php?route=checkout/payment_address/validate',
Siehe dazu weiter unten:

Code: Select all

function quickConfirm(module){
	$.ajax({
		url: 'index.php?route=checkout/confirm',
Die Validierung erfolgt dann in der confirm.php anstatt der payment_method.php, siehe dort dazu:

Code: Select all

if ($information_info && !isset($this->request->post['agree'])) {
Doppelte Buttons:

Code: Select all

<input type="button" value="<?php echo $button_continue; ?>" id="button-payment-method" class="button colorButton remove-bottom" />
rausnehmen

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by ab-oc » Tue Jun 10, 2014 11:36 pm

Hallo,

für alle, die an der Lösung interessiert sind:

Schritt 1:

Code: Select all

theme/*/template/checkout/payment_method.tpl

Code: Select all

<?php if ($text_agree) { ?>
<div class="buttons">
  <div class="right"><?php echo $text_agree; ?>
    <?php if ($agree) { ?>
    <input type="checkbox" name="agree" value="1" checked="checked" style="float:none;" />
    <?php } else { ?>
    <input type="checkbox" name="agree" value="1" style="float:none;" />
    <?php } ?>
    <input type="button" value="<?php echo $button_continue; ?>" id="button-payment-method" class="button colorButton remove-bottom" />
  </div>
</div>
<?php } else { ?>
Code komplett entfernen.

Schritt 2

Code: Select all

theme/*/template/checkout/confirm.tpl

Code: Select all

<!-- ANFANG 1 - Checkbox and Terms & Conditions which moved from step 5 (payment-method) to step 6 (confirm) -->
                 <?php if ($text_agree) {  ?>
                 <div class="buttons">
                 <div class="right"><?php echo $text_agree; ?>
                 <?php if ($agree) { ?>
                 <input type="checkbox" name="agree" value="1" checked="checked" style="float:none;" />
                 <?php } else { ?>
                 <input type="checkbox" name="agree" value="1" style="float:none;" /> <br>
                 <br />
                 <?php } ?>
                 <input class="button confirmButton" onclick="validateme();" type="button" value="<?php echo $button_confirm; ?>">
                 <div class="payment" align="right"><?php echo $payment; ?></div>                                     <!-- TO RAVI - $_['button_confirm'] - Text for confirm button -->
                 </div>
                 </div>
                 <?php } else { ?>
                 <div class="buttons">
                 <div class="right">
                 </div>
                 </div>
                 <?php } ?>
<!-- ENDE 1 - Checkbox and Terms & Conditions which moved from step 5 (payment-method) to step 6 (confirm) -->
Code vor ... einfügen.

Code: Select all

<?php } else { ?>
<script type="text/javascript"><!--
location = '<?php echo $redirect; ?>';
//--></script>
<?php } ?>
Code ganz am Ende einfügen.

Code: Select all

<!-- ANFANG 3 - Checkbox and Terms & Conditions which moved from step 5 (payment-method) to step 6 (confirm) -->
                 <style>
                 .payment{
                 display:none;
                 }
                 </style>
                 <script>
                 function validateme(){
                 var checkbox = $('input[name=\'agree\']')
                 if(checkbox.is(":checked")){
                 $('.payment .button').click();
                 }else {
                 var checkvalidate = '<div class="warning" style=""><?php echo $erroragree; ?></div>';      <!-- TO RAVI - $_['error_agree'] - Text for T&C warning -->
                 $('.checkout-product').before(checkvalidate);
                 /*setTimeout(function(){
                 $('.warning').remove();
                 }, 2000); */
                 }
                 }
                 </script>
<!-- ENDE 3 - Checkbox and Terms & Conditions which moved from step 5 (payment-method) to step 6 (confirm) -->
Schritt 3

Code: Select all

catalog/controller/checkout/payment_method.php
Folgende Codesektion löschen oder wie hier "kommentieren"

Code: Select all

/* ANFANG 1 - Checkbox and Terms & Conditions which moved from step 5 (payment-method) to step 6 (confirm)
                                if ($information_info && !isset($this->request->post['agree'])) {
                                        $json['error']['warning'] = sprintf($this->language->get('error_agree'), $information_info['title']);
                                }
ENDE 1 - Checkbox and Terms & Conditions which moved from step 5 (payment-method) to step 6 (confirm) */
Schritt 4

Code: Select all

catalog/controller/checkout/confirm.php

Code: Select all

// ANFANG - Checkbox and Terms & Conditions which moved from step 5 (payment-method) to step 6 (confirm)
                 if ($this->config->get('config_checkout_id')) {
                 $this->load->model('catalog/information');
                 $information_info = $this->model_catalog_information->getInformation($this->config->get('config_checkout_id'));
                 if ($information_info) {
                 $this->data['text_agree'] = sprintf($this->language->get('text_agree'), $this->url->link('information/information/info', 'information_id=' . $this->config->get('config_checkout_id'), 'SSL'), $information_info['title'], $information_info['title']);
                 } else {
                 $this->data['text_agree'] = '';
                 }
                 } else {
                 $this->data['text_agree'] = '';
                 }
                 if (isset($this->session->data['agree'])) {
                 $this->data['agree'] = $this->session->data['agree'];
                 } else {
                 $this->data['agree'] = '';
                 }
                 $this->data['button_confirm'] = $this->language->get('button_confirm');
                 $this->data['erroragree'] = sprintf($this->language->get('error_agree'), $information_info['title']);
// ENDE - Checkbox and Terms & Conditions which moved from step 5 (payment-method) to step 6 (confirm)
Code vor ... einfügen

Code: Select all

                if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/checkout/confirm.tpl')) {
                        $this->template = $this->config->get('config_template') . '/template/checkout/confirm.tpl';
                } else {
                        $this->template = 'default/template/checkout/confirm.tpl';
                }
So, ich hoffe, ich habe nichts vergessen :drunk:

New member

Posts

Joined
Tue Apr 29, 2014 11:22 pm

Post by cmodt » Mon Nov 02, 2015 1:59 am

Sorry, I don't speak German, and only understand some.
This is the only place I have read someone seeking the same solution as me - moving the checkbox from step 5 to step 6.
I use version 2.0.2, and have tried using your coding as inspiration, but have failed miserably.
Anyone able to help here?

Newbie

Posts

Joined
Tue Jun 02, 2015 3:43 pm

Post by 27eleven » Mon Jan 23, 2017 4:34 am

Ergänzung zum oberen Post: Funktioniert nicht in v2.3.0.2!

For the english friends, follow post viewtopic.php?f=190&t=172517

Probably you need to hide the checkbox, because i don't find the validator.

Working on Opencart Version 2.3.0.2


User avatar
New member

Posts

Joined
Tue Sep 20, 2016 1:05 pm
Location - Switzerland
Who is online

Users browsing this forum: No registered users and 111 guests