PDA

Shop Support News Archive - Shopbetreiber News -> Forum : xt eCommerce Templates Module SEO Support: GPL Shop: Dhtml Menü Mit Javascript Erkennung


jpx10
16.02.2006, 14:21
Hallo zusammen

Ich habe unter www.ecombase.biz folgendes Posting platziert:

http://www.ecombase.biz/component/option,c...,0/topic,2156.0 (http://anonym.to/?http://www.ecombase.biz/component/option,com_smf/Itemid,35/expv,0/topic,2156.0)

Dabei riet mir der Moderator HarryBoo dieses Posting hier im neuen Forum zu publizieren.

Ich würde mich sehr freuen, wenn mir hier jemand weiterhelfen könnte.

Beste Grüsse
jpx10


EDIT:// Wir wollen doch die User nicht auf eb.biz abgleiten lassen oder? ;)
Darum hier der Post aus ecombase.biz.

Gruß Alucard

Hallo zusammen

Ich habe in meinen Shop das XTC 2er Modul Coolmenue eingebaut. Dieses funktioniert auch in der Version 3.4 ohne jegliche Probleme.

Nun wollte ich zusätzlich eine Funktion einbauen, bei welcher Kunden die javascript deaktiviert haben, auf das Konventionelle Menü umgeleitet werden. Dabei entdeckte ich eine OSC Contribution von Marc Zacher. Um diese einzubauen muss man einige Modifikationen an der catalog/includes/classes/boxes.php vornehmen. Die für die Modifikation benötigten Änderungen befinden sich auch in XTC etwa an der selben stelle. Einzig die zusätzliche Datei coolmenue.php soll unter catalog/includes/boxes abgelegt werden, was es bei XTC ja nicht gibt (Das Verzeichnis). Da ich kein Programmierer bin, stehe ich nun etwas verloren da. Wer kennt sich damit aus?

Ich publiziere hier mal die Contribution, möglicherweise ist es nur eine kleine Modifikation und jemand könnte mir einen Tipp geben, was ich anders machen muss.


''>ZITAT</div>
Instructions:
1. Backup your files

2. Replace the original coolmenu.php in catalog/includes/boxes by the
coolmenu.php included in this package.
DO NOT REPLACE catalog/includes/coolmenu.php !!!

3. Edit catalog/includes/classes/boxes.php
Perform the following changes (A to F):

A) in class tableBox
After line 20 between
Â* Â* var $table_data_parameters = '';
and
// class constructor
add the line
Â* Â* var $table_string = '';
so that it looks like:
Â* Â* var $table_data_parameters = '';
Â* Â* var $table_string = '';

// class constructor

B) in class tableBox
After around line 72 before
Â* Â* Â* return $tableBox_string;
add the line
Â* Â* Â* $this->table_string = $tableBox_string;
so that it looks like
Â* Â* Â* if ($direct_output == true) echo $tableBox_string;
Â* Â* Â* $this->table_string = $tableBox_string;
Â* Â* Â* return $tableBox_string;

C) in class infoBox
At around line 78 change the constructor from originally
Â* Â* function infoBox($contents) {
to
Â* Â* function infoBox($contents, $direct_output = true) {

D) class infoBox
Around line 83 at the end of the constructor change from
Â* Â* Â* $this->tableBox($info_box_contents, true);
Â* Â* }
to
Â* Â* Â* $this->tableBox($info_box_contents, $direct_output);
Â* Â* }

E) in class infoBoxHeading
At around line 103 change the constructor from originally
Â* Â* function infoBoxHeading($contents, $left_corner = true, $right_corner = true, $right_arrow = false) {
to
Â* Â* function infoBoxHeading($contents, $left_corner = true, $right_corner = true, $right_arrow = false, $direct_output = true) {

F) in class infoBoxHeading
Around line 130 at the end of the constructor change from
Â* Â* Â* $this->tableBox($info_box_contents, true);
Â* Â* }
to
Â* Â* Â* $this->tableBox($info_box_contents, $direct_output);
Â* Â* }

4. Enjoy

[/b]


Nun die Datei welche bei OSC unter: catalog/includes/boxes abgelegt werden soll.


<?php
/ ------------------------------------------------

coolMenu for osCommerce

author: Andreas Kothe
url:Â* http://www.oddbyte.de
copyright: 2003 Andreas Kothe
modified: 2003-07-28 Marc Zacher

extended to work for javascript enanbled and disabled
with javascript disabled, the conventional categories box is shown
this extension is provided by Marc Zacher

The copyright notice of Andreas Kothe in the html output
has been removed and put in this header
since it would cause problems in javascript context.

Released under the GNU General Public License

------------------------------------------------
/

?>
<script type="text/javascript">
<!--
document.write(" <TR> <TD> ");
<?php
$info_box_contents = array();
$info_box_contents[] = array('align' => 'left',
Â* Â* Â* Â* Â*'text'Â* => BOX_HEADING_CATEGORIES
Â* Â* Â* Â* );
$coolmenuinfoboxheading = new infoBoxHeading($info_box_contents, true, false, false, false);
$output_string = $coolmenuinfoboxheading->table_string;


$info_box_contents = array();
if (MAX_MANUFACTURERS_LIST < 2) {
$cat_choose = array(array('id' => '', 'text' => BOX_CATEGORIES_CHOOSE));
} else {
$cat_choose = '';
}



$info_box_contents[] = array('text'Â* => '
images/trans.gif');

$coolmenuinfobox = new infoBox($info_box_contents, false);
$output_string .= $coolmenuinfobox->table_string;
//remove all html commments
$output_string = preg_replace("//", "", $output_string);
//escape all occurences of "
$output_string = preg_replace('/"/', '\"', $output_string);
//escape all occurences of /
$output_string = preg_replace('/\//', '\/', $output_string);
//remove trailing \n
$output_string = preg_replace('/\\n+$/', '', $output_string);
//replace all \n with ");\ndocument.write("
$output_string = preg_replace('/\\n/', "\");\ndocument.write(\"", $output_string);
//prepend document.write at the beginning and append ");\n
$output_string = "document.write(\"" . $output_string . "\");\n";
echo $output_string;
?>
document.write(" <\/TD> <\/TR> ");
//--> </script>
<noscript>
<?php
include(DIR_WS_BOXES . 'categories.php');
?>
</noscript>



Was müsste man da genau ändern?

Für jede noch so kleine Hilfe ein grosses DANKESCHÖN

jpx10
17.02.2006, 10:45
Hallo Alucard

Klaro, sorry!

Nebenbei... du weisst auch nicht wie man dieses Problemchen löst? :rolleyes:

Gruss
jpx10

Alucard
17.02.2006, 13:38
Würdest du dich auch mit der Variante "standart xtc menu" und einmal "Super special dhtml menü" abgeben.

Das wäre einfacher

man muss in der boxes.php

templates/dein_template/source/boxes.php

prüfen ob javascript aktiv ist.


$javascript_active = ...;

if ($javascript_active == 1) {
**** include(DIR_WS_BOXES . 'dhtml.php');
}
else {
****include(DIR_WS_BOXES . 'categories.php');
}


Wie man allerdings auf ein aktives Javascript prüft weiß ich auch nicht.

Gast
17.02.2006, 14:20
Selbstverständlich gebe ich mich damit zufrieden!

Recht herzlichen Dank für Deine Lösung!

Beste Grüsse
jpx10

Lisa
28.02.2006, 20:53
Hallo

Ich würde gerne eine solche Abfrage in mein dhtml Menü einbauen. Leider verstehe ich nicht sehr viel vom Programmieren. Bin total auf copy / paste angewiesen. :)

Renicht es wirklich diesen code 1:1 in die boxes.php reinzukopieren, oder fehlt da noch was :mellow:

''>ZITAT</div>$javascript_active = ...;

if ($javascript_active == 1) {
include(DIR_WS_BOXES . 'dhtml.php');
}
else {
include(DIR_WS_BOXES . 'categories.php');
}
[/b]

Beste Grüsse
Lisa

Alucard
28.02.2006, 21:09
''>ZITAT(Lisa @ Feb 28 2006, 20:53) 820
Hallo

Ich würde gerne eine solche Abfrage in mein dhtml Menü einbauen. Leider verstehe ich nicht sehr viel vom Programmieren. Bin total auf copy / paste angewiesen. :)

Renicht es wirklich diesen code 1:1 in die boxes.php reinzukopieren, oder fehlt da noch was :mellow:
Beste Grüsse
Lisa
[/b]

Ja, da fehlt die Javascript erkennung. Da ich nicht weiß wie man eine solche Programmiert, hab ich an deren stelle einfach 3 Punkte ... gemacht.

Das Grundlegende stimmt schon. :)

Lisa
28.02.2006, 21:27
Hallo Alucard

Danke für Deine Antwort.

Viellenicht kann mir ja jemand anderer hier einen Tipp geben?

Gruss
Lisa

HarryBoo
28.02.2006, 22:04
Habe folgenden Link gefunden:

http://www.selfhtml.de/forum/zeigebeitrag_...32_101132_0.php (http://anonym.to/?http://www.selfhtml.de/forum/zeigebeitrag_2_101132_101132_0.php)

Dort wird folgender Tipp gegeben:

''>ZITAT</div> Autor: wkaiser
Datum: 10.02.2006 07:10:45

Für eine Javascript-Erkennung verwende ich die folgende Vorschalt-Routine, die vom IE und Firefox auch anstandslos ausgeführt wird.

================================================== ===
<html>
<head>
<noscript>
<meta http-equiv="refresh" content="0; URL=http://www.ol-commerce.de/olcommerceshop/ajax/ajax_error.php?reason=no_javascript">
</noscript>
</head>
<script><!--
window.location.href("http://www.ol-commerce.de/olcommerceshop/ajax/index.php?javascript=true");
--></script>

</html>
================================================== ===

Evtl. kann jemand schreiben wie man das im Shop umsetzen kann.

jpx10
01.03.2006, 10:46
<html>
<head>
<noscript>
<meta http-equiv="refresh" content="0; URL=http://www.ol-commerce.de/olcommerceshop/ajax/ajax_error.php?reason=no_javascript">
</noscript>
</head>
<script><!--
window.location.href("http://www.ol-commerce.de/olcommerceshop/ajax/index.php?javascript=true");
--></script>

</html>


Hallo zusammen

Da ich auch noch keine Lösung für dieses Problem gefunden habe, wäre ich natürlich ebenfalls sehr interessiert. Was genau ist ajax?


Frage an die, die Programmieren können. Wäre es nicht viel einfacher, die bereits bestehende Abfrage-Routine von Marc Zacher (siehe oben) an XTC anzupassen?

Beste Grüsse
jpx10

Alucard
01.03.2006, 11:59
''>ZITAT</div>Was genau ist ajax? [/b]

Ajax ist ein Schnittstelle welche es erlaubt dynamisch daten vom Browser nachladen zu lassen.

Das Forum hier verwendet ajax im hohen maße.

z.B. kommt es bei der Userregistration hier auf dem Board zum Einsatz.
Der Browser fragt die DB ab ohne die Seite neu zu laden oder das der User das Formualr abschicken muss.