Jump to content
xt:Commerce Community Forum

Ajax Add Cart


Andreas123

Recommended Posts

Hallo,

Ich habe das modul ajax add cart eingebaut mein problem ist das wenn ich auf bestellen klicke der gesammte Warenkorb verschwindet und erst wieder auftaucht wenn ich auf eine andere Seite gehe oder Aktualisiere.

Der Artikel ist dann jedoch zugefügt worden.

Wär echt super wenn mir jemand weiter helfen könnte ich habe das modul jetz schon das 3mal eingebaut doch es taucht jedes mal der selbe Fehler auf.

Die Installationsanleitung habe ich beigefügt.

Danke & Gruss

Andreas

QUELLTEXT

Ajax Add Cart

© 2008 Estelco

(no warranty) released under GPL

1. BACKUP MACHEN!!!

2. Datenbank


INSERT INTO `configuration` VALUES(null, 'ADD_CART_ENABLED', 'false', 25, 1, NULL, now(), NULL, 'xtc_cfg_select_option(array(\'true\', \'false\'),');

INSERT INTO `configuration` VALUES(null, 'ADD_CART_BOX_ID', 'box_cart', 25, 2, NULL, now(), NULL, NULL);

INSERT INTO `configuration` VALUES(null, 'ADD_CART_COLOR_FADE', 'true', 25, 3, NULL, now(), NULL, 'xtc_cfg_select_option(array(\'true\', \'false\'),');

INSERT INTO `configuration` VALUES(null, 'ADD_CART_FROM_COLOR', 'FFFF00', 25, 4, NULL, now(), NULL, NULL);

INSERT INTO `configuration` VALUES(null, 'ADD_CART_TO_COLOR', 'CCCCCC', 25, 5, NULL, now(), NULL, NULL);

INSERT INTO `configuration` VALUES(null, 'ADD_CART_STEPS', '50', 25, 6, NULL, now(), NULL, NULL);

INSERT INTO `configuration` VALUES(null, 'ADD_CART_DELAY', '2000', 25, 7, NULL, now(), NULL, NULL);


3. Dateien kopieren


includes/addCart.js.php

ajaxAddCart.php

4. Anpassungen an Dateien


admin/includes/column_left.php


Am Ende (vor dem ?>) anfügen


if (($_SESSION['customers_status']['customers_status_id'] == '0') && ($admin_access['configuration'] == '1')) echo '<a href="' . xtc_href_link(FILENAME_CONFIGURATION, 'gID=25', 'NONSSL') . '" class="menuBoxContentLink"> -' . BOX_CONFIGURATION_25 . '</a><br>';


includes/classes/product.php


sofern gewünscht, suche Funktion getBuyNowButton ca. Zeile 348


    function getBuyNowButton($id, $name) {

        global $PHP_SELF;

        return '<a href="'.xtc_href_link(basename($PHP_SELF), 'action=buy_now&BUYproducts_id='.$id.'&'.xtc_get_all_get_params(array ('action')), 'NONSSL').'">'.xtc_image_button('button_buy_now.gif', TEXT_BUY.$name.TEXT_NOW).'</a>';

    }


ändern in


    function getBuyNowButton($id, $name) {

        global $PHP_SELF;

        $attrib_check = xtDBquery("SELECT COUNT(*) as count FROM " . TABLE_PRODUCTS_ATTRIBUTES . " WHERE products_id=" . (int)$id);

        $result = xtc_db_fetch_array($attrib_check, true);

        if ($result['count'] == 0) {

            $ajax = 'onclick="return addCart(this.form);" ';

        } else {

            $ajax = '';

        }

        return '<a ' . $ajax . 'href="'.xtc_href_link(basename($PHP_SELF), 'action=buy_now&BUYproducts_id='.$id.'&'.xtc_get_all_get_params(array ('action')), 'NONSSL').'">'.xtc_image_button('button_buy_now.gif', TEXT_BUY.$name.TEXT_NOW).'</a>';

    }


includes/modules/product_info.php


ca. Zeile 58 + 62


$info_smarty->assign('ADD_CART_BUTTON', xtc_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART));


ändern in


$info_smarty->assign('ADD_CART_BUTTON', xtc_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART, ADD_CART_ENABLED == 'true' ? 'onclick="return addCart(this.form);"' : ''));


includes/header.php


ca. Zeile 59


<link rel="stylesheet" type="text/css" href="<?php echo 'templates/'.CURRENT_TEMPLATE.'/stylesheet.css'; ?>" />


danach einfügen


<?php if (ADD_CART_ENABLED == 'true') include('includes/addCart.js.php'); ?>


lang/german/admin/configuration.php


Am Ende (vor dem ?>) anfügen


// Ajax Add Cart

define('ADD_CART_ENABLED_TITLE', 'Funktion aktiv');

define('ADD_CART_ENABLED_DESC', 'Soll die Funktion genutzt werden?');

define('ADD_CART_BOX_ID_TITLE', 'Warenkorb-DIV');

define('ADD_CART_BOX_ID_DESC', 'ID des Warenkorb-DIVs');

define('ADD_CART_COLOR_FADE_TITLE', 'Farbige Markierung');

define('ADD_CART_COLOR_FADE_DESC', 'Soll der neue Artikel mittels Farbverlauf markiert werden?');

define('ADD_CART_FROM_COLOR_TITLE', 'Anfangsfarbe');

define('ADD_CART_FROM_COLOR_DESC', 'Anfangsfarbe (hexadezimal, z.B. F9D312)');

define('ADD_CART_TO_COLOR_TITLE', 'Endfarbe');

define('ADD_CART_TO_COLOR_DESC', 'Endfarbe (hexadezimal)');

define('ADD_CART_STEPS_TITLE', 'Verlauf');

define('ADD_CART_STEPS_DESC', 'Anzahl Schritte für den Verlauf. Je höher, desto länger dauert die Darstellung. Standard = 50');

define('ADD_CART_DELAY_TITLE', 'Verzögerung');

define('ADD_CART_DELAY_DESC', 'Anfängliche Verzögerung in Millisekunden vor Beginn des Verlaufs, wobei die Anfangsfarbe sofort gesetzt wird. Standard = 2000');


lang/german/admin/german.php


ca. Zeile 99


define('BOX_CONFIGURATION_22', 'Such-Optionen');


danach einfügen


define('BOX_CONFIGURATION_25', 'Ajax Add Cart');


templates/TEMPLATE/boxes/box_cart.html


suchen nach


<a href="{$products_data.LINK}">{$products_data.NAME|truncate:25:"...":true}</a>


ändern in


<a {if $products_data.NEW}id="new_in_cart" {/if}href="{$products_data.LINK}">{$products_data.NAME|truncate:25:"...":true}</a>


templates/TEMPLATE/source/boxes/shopping_cart.php


ca. Zeile 36


                                     'NAME' => $products[$i]['name']);


ändern in


                                     'NAME' => $products[$i]['name'],

                                     'NEW' => $products[$i]['id'] == $_SESSION['new_products_id_in_cart']);


templates/TEMPLATE/index.html


suchen nach


{$box_CART}


ändern in


<div id="box_cart">{$box_CART}</div>


Sollte die ID "box_cart" schon in Gebrauch sein, so kann eine eigene ID verwendet und im Adminbereich in der Konfiguration eingetragenw erden.

5. Viel Spass damit...

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...

Nettes Teil, aber wäre noch netter, wenn das auch mit der product_listing funktionieren würde. Tut es aber leider nicht. Hat jemand einen Lösungsansatz? Irgendetwas muß ja noch in die product_listing.php und nicht nur etwas in die product_info.php. Hilfe :-) Danke.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
  • Create New...