PDA

Shop Support News Archive - Shopbetreiber News -> Forum : Neuer Download.: Imedes / H.Koch - Erweiterung icart 1.1 - fuer xt eCommerce Templates Module SEO Support: Shopommerce 304sp21


SEO-FREAK
07.08.2008, 00:57
<div align="center">http://www.ecombase.de/forum/index.php?automodule=downloads&req=display&code=sst&id=61</div>
File Name: Imedes / H.Koch - Erweiterung icart 1.1 - für xt-Commerce / xt:Commerceommerce 304sp21
File Submitter: SEO (Search Engine Optimizion - Suchmaschinenoptimierung ) seo-FREAK (http://www.ecombase.de/forum/index.php?showuser=10607)
File Submitted: 7 Aug 2008
File Updated: 9 Aug 2008
File Category: Erweiterungen - Module xt:Commerce / xt-Commerce 3.04 - Sp 2.1 (http://www.ecombase.de/forum/index.php?automodule=downloads&showcat=10)

Erweiterung icart für xt-Commerce / xt:Commerceommerce 304sp21
Installataion
----------------------------------------

db_install.sql
--------------
SQL-Kommandodatei mittels phpmyadmin auf die Datenbnak anwenden



shopping_cart.php
-----------------
Suche:
$smarty->assign('BUTTON_RELOAD', xt-Commerce / xt:Commerce_image_submit('button_update_cart.gif', IMAGE_BUTTON_UPDATE_CART));
$smarty->assign('BUTTON_CHECKOUT', ''.xt-Commerce / xt:Commerce_image_button('button_checkout.gif', IMAGE_BUTTON_CHECKOUT).' ('.xt-Commerce / xt:Commerce_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL').')');

Füge danach ein:
// icart begin
$imgdir = 'templates/'.CURRENT_TEMPLATE.'/buttons/' . $_SESSION['language'] . '/';
$del_but = xt-Commerce / xt:Commerce_href_link(FILENAME_SHOPPING_CART, 'action=update_product&delete_cart=1');
$del_img = xt-Commerce / xt:Commerce_image($imgdir.'button_delete_cart.gif' );
$del_lnk = ''.$del_img.' ('.$del_but.')';

$smarty->assign('BUTTON_DELETE_ALL', $del_lnk);
// icart end



admin/includes/classes/categories.php
--------------------------------------
Suche
$sql_data_array = array ('products_quantity' => xt-Commerce / xt:Commerce_db_prepare_input($products_data['products_quantity']),
'products_model' => xt-Commerce / xt:Commerce_db_prepare_input($products_data['products_model']),
'products_ean' => xt-Commerce / xt:Commerce_db_prepare_input($products_data['products_ean']),
'products_price' => xt-Commerce / xt:Commerce_db_prepare_input($products_data['products_price']),
'products_sort' => xt-Commerce / xt:Commerce_db_prepare_input($products_data['products_sort']),
'products_shippingtime' => xt-Commerce / xt:Commerce_db_prepare_input($products_data['shipping_status']),
'products_discount_allowed' => xt-Commerce / xt:Commerce_db_prepare_input($products_data['products_discount_allowed']),
'products_date_available' => $products_date_available,
'products_weight' => xt-Commerce / xt:Commerce_db_prepare_input($products_data['products_weight']),
'products_status' => $products_status,
'products_startpage' => xt-Commerce / xt:Commerce_db_prepare_input($products_data['products_startpage']),
'products_cartspecial' => xt-Commerce / xt:Commerce_db_prepare_input($products_data['products_cartspecial']), // icart
'products_startpage_sort' => xt-Commerce / xt:Commerce_db_prepare_input($products_data['products_startpage_sort']),
'products_tax_class_id' => xt-Commerce / xt:Commerce_db_prepare_input($products_data['products_tax_class_id']),
'product_template' => xt-Commerce / xt:Commerce_db_prepare_input($products_data['info_template']),
'options_template' => xt-Commerce / xt:Commerce_db_prepare_input($products_data['options_template']),
'manufacturers_id' => xt-Commerce / xt:Commerce_db_prepare_input($products_data['manufacturers_id']),
'products_fsk18' => xt-Commerce / xt:Commerce_db_prepare_input($products_data['fsk18']),
'products_vpe_value' => xt-Commerce / xt:Commerce_db_prepare_input($products_data['products_vpe_value']),
'products_vpe_status' => xt-Commerce / xt:Commerce_db_prepare_input($products_data['products_vpe_status']),
'products_vpe' => xt-Commerce / xt:Commerce_db_prepare_input($products_data['products_vpe']));

Füge abgesetzte Zeile 'products_cartspecial' ein. (Zeile im Original unformatiert)





admin/includes/modules/new_product.php
---------------------------------------

Suche:
if ($pInfo->products_startpage == '1') { $startpage_checked = true; } else { $startpage_checked = false; }

Füge danach ein:
if ($pInfo->products_cartspecial == '1') { $cartspecial_checked = true; } else { $cartspecial_checked = false; } // icart


Suche:
<tr>
<td><?php echo TEXT_PRODUCTS_STARTPAGE; ?> <?php echo TEXT_PRODUCTS_STARTPAGE_YES . xt-Commerce / xt:Commerce_draw_radio_field('products_startpage', '1', $startpage_checked) . '' . TEXT_PRODUCTS_STARTPAGE_NO . xt-Commerce / xt:Commerce_draw_radio_field('products_startpage', '0', !$startpage_checked) ?></td>
<td><?php echo TEXT_PRODUCTS_STARTPAGE_SORT; ?><?php echo xt-Commerce / xt:Commerce_draw_input_field('products_startpage_s ort', $pInfo->products_startpage_sort ,'size=3'); ?></td>
</tr>

Füge danach ein:
<tr>
<?php / icart / ?>
<td><?php echo TEXT_PRODUCTS_CART_SPECIALS; ?> <?php echo TEXT_PRODUCTS_STARTPAGE_YES . xt-Commerce / xt:Commerce_draw_radio_field('products_cartspecial ', '1', $cartspecial_checked) . '' . TEXT_PRODUCTS_STARTPAGE_NO . xt-Commerce / xt:Commerce_draw_radio_field('products_cartspecial ', '0', !$cartspecial_checked) ?></td>
<td></td>
</tr>


includes/cart_actions.php
-------------------------
Suche:
case 'update_product' :

if(!is_object( $_SESSION['cart'] ) ){
break;
}

if (is_object($econda))
$econda->_emptyCart();


Füge danach ein:
// ------- icard begin --------------

// delete cart

if( isset( $_GET['delete_cart'] ) ){
$_SESSION['cart']->remove_all();
break;
}

// delete button

if( isset( $_GET['delete_product'] ) ){
$_SESSION['cart']->remove($_GET['delete_product']);
break;
}

// increase/decrease button
if( isset( $_GET['increase_product'] ) ){
$n = $_SESSION['cart']->get_quantity($_GET['increase_product']) + 1;
$attr=$_SESSION['cart']->contents[$_GET['increase_product']]['attributes'];
$_SESSION['cart']->update_quantity($_GET['increase_product'], $n, $attr);
break;
}

if( isset( $_GET['decrease_product'] ) ){
$n = $_SESSION['cart']->get_quantity($_GET['decrease_product']) - 1;
if( $n<1 ) {
$_SESSION['cart']->remove($_GET['decrease_product']);
} else {
$attr=$_SESSION['cart']->contents[$_GET['decrease_product']]['attributes'];
$_SESSION['cart']->update_quantity($_GET['decrease_product'], $n, $attr);
}
break;
}

// ------- icard end --------------



Suche:
if (is_object($econda)) {
$old_quantity = $_SESSION['cart']->get_quantity(xt-Commerce / xt:Commerce_get_uprid($_POST['products_id'][$i], $_POST['id'][$i]));
$econda->_updateProduct($_POST['products_id'][$i], $_POST['cart_quantity'][$i], $old_quantity);
}


Füge danach ein:

// ------- icard begin --------------
$inc=0;
if( isset( $_POST['increase_product_cartindex'] ) ){
if( $i==$_POST['increase_product_cartindex'] ) {
$inc = 1;
}
}
if( isset( $_POST['decrease_product_cartindex'] ) ){
if( $i==$_POST['decrease_product_cartindex'] ) {
$inc = -1;
}
}

$new_qty = xt-Commerce / xt:Commerce_remove_non_numeric($_POST['cart_quantity'][$i]) + $inc;

if( $new_qty < 1 ) {
$_SESSION['cart']->remove($_POST['products_id'][$i]);
} else {
$_SESSION['cart']->add_cart($_POST['products_id'][$i], $new_qty, $attributes, false);
}
// $_SESSION['cart']->add_cart($_POST['products_id'][$i], xt-Commerce / xt:Commerce_remove_non_numeric($_POST['cart_quantity'][$i]), $attributes, false);
// ------- icard end --------------




includes/modules/cart_specials.php
----------------------------------

Diese Datei ist neu hinzugekommen



includes/modules/order_details_cart.php
---------------------------------------
Suche (Zeile im Original unformatiert):
$module_content[$i] = array ('PRODUCTS_ID' => $products[$i]['id'],
'PRODUCTS_NAME' => $products[$i]['name'].$mark_stock,
'PRODUCTS_QTY' => xt-Commerce / xt:Commerce_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="2"').
xt-Commerce / xt:Commerce_draw_hidden_field('products_id[]', $products[$i]['id']).
xt-Commerce / xt:Commerce_draw_hidden_field('old_qty[]', $products[$i]['quantity']),
'PRODUCTS_MODEL' => $products[$i]['model'],
'PRODUCTS_SHIPPING_TIME'=>$products[$i]['shipping_time'],
'PRODUCTS_TAX' => number_format($products[$i]['tax'], TAX_DECIMAL_PLACES),
'PRODUCTS_IMAGE' => $image,
'IMAGE_ALT' => $products[$i]['name'],
'BOX_DELETE' => xt-Commerce / xt:Commerce_draw_checkbox_field('cart_delete[]', $products[$i]['id']),
'PRODUCTS_LINK' => xt-Commerce / xt:Commerce_href_link(FILENAME_PRODUCT_INFO, xt-Commerce / xt:Commerce_product_link($products[$i]['id'], $products[$i]['name'])),
'PRODUCTS_PRICE' => $xtPrice->xt-Commerce / xt:CommerceFormat($products[$i]['price'] $products[$i]['quantity'], true),
'PRODUCTS_SINGLE_PRICE' =>$xtPrice->xt-Commerce / xt:CommerceFormat($products[$i]['price'], true),
'PRODUCTS_SHORT_DESCRIPTION' => xt-Commerce / xt:Commerce_get_short_description($products[$i]['id']),
// ------- icart begin --------------
'BUTTON_INCREASE' => $inc_lnk,
'BUTTON_DECREASE' => $dec_lnk,
'BUTTON_DELETE' => $del_lnk,

// ------- icart end --------------
'ATTRIBUTES' => '' );


Füge markierte Zeilen ein.



Suche:
$module_content[$i]['ATTRIBUTES'][] =
array ('ID' => $products[$i][$option]['products_attributes_id'],
'MODEL' => xt-Commerce / xt:Commerce_get_attributes_model(xt-Commerce / xt:Commerce_get_prid($products[$i]['id']), $products[$i][$option]['products_options_values_name'],$products[$i][$option]['products_options_name']),
'NAME' => $products[$i][$option]['products_options_name'],
'VALUE_NAME' => $products[$i][$option]['products_options_values_name'].$attribute_stock_check
);

}


Füge danach ein:
// ------- icart begin --------------

$module_content[$i]['BUTTON_RELOAD'] = xt-Commerce / xt:Commerce_image_submit('button_update_cart.gif', IMAGE_BUTTON_UPDATE_CART);


$products_options_name_query = xtDBquery(
"select distinct
popt.products_options_id,
popt.products_options_name
from
".TABLE_PRODUCTS_OPTIONS." popt, ".
TABLE_PRODUCTS_ATTRIBUTES." patrib
where
patrib.products_id='".$products[$i]['id']."' and
patrib.options_id = popt.products_options_id and
popt.language_id = '".(int) $_SESSION['languages_id']."'
order by
popt.products_options_name");

$row = 0;
$col = 0;
$products_options_data = array ();
while ($products_options_name = xt-Commerce / xt:Commerce_db_fetch_array($products_options_name_ query,true)) {
$selected = 0;
$products_options_array = array ();

$products_options_data[$row] = array ('NAME' => $products_options_name['products_options_name'],
'ID' => $products_options_name['products_options_id'],
'DATA' => '');
$products_options_query = xtDBquery("select
pov.products_options_values_id,
pov.products_options_values_name,
pa.options_id,
pa.attributes_model,
pa.options_values_price,
pa.price_prefix,
pa.attributes_stock,
pa.attributes_model
from
".TABLE_PRODUCTS_ATTRIBUTES." pa,
".TABLE_PRODUCTS_OPTIONS_VALUES." pov
where
pa.products_id = '".$products[$i]['id']."'
and pa.options_id = '".$products_options_name['products_options_id']."'
and pa.options_values_id = pov.products_options_values_id
and pov.language_id = '".(int) $_SESSION['languages_id']."'
order by pa.sortorder");


$col = 0;
while ($products_options = xt-Commerce / xt:Commerce_db_fetch_array($products_options_query ,true)) {
$price = '';

if( $products[$i][attributes][ $products_options['options_id'] ] == $products_options['products_options_values_id'] ) {
$check='1';
} else {
$check='';
}

if ($_SESSION['customers_status']['customers_status_show_price'] == '0') {
$products_options_data[$row]['DATA'][$col] = array ('ID' => $products_options['products_options_values_id'],
'CHECK' => $check,
'TEXT' => $products_options['products_options_values_name'],
'MODEL' => $products_options['attributes_model'],
'PRICE' => '',
'FULL_PRICE' => '',
'PREFIX' => $products_options['price_prefix']);
} else {
if ($products_options['options_values_price'] != '0.00') {
$price = $xtPrice->xt-Commerce / xt:CommerceFormat($products_options['options_values_price'], false, $product->data['products_tax_class_id']);
}

$products_price = $xtPrice->xt-Commerce / xt:CommerceGetPrice($product->data['products_id'], $format = false, 1, $product->data['products_tax_class_id'], $product->data['products_price']);
if ($_SESSION['customers_status']['customers_status_discount_attributes'] == 1 && $products_options['price_prefix'] == '+')
$price -= $price / 100 $discount;

$attr_price=$price;
if ($products_options['price_prefix']=="-") $attr_price=$price (-1);
$full = $products_price + $attr_price;
$products_options_data[$row]['DATA'][$col] = array ('ID' => $products_options['products_options_values_id'],
'CHECK' => $check,
'TEXT' => $products_options['products_options_values_name'],
'MODEL' => $products_options['attributes_model'],
'PRICE' => $xtPrice->xt-Commerce / xt:CommerceFormat($price, true),
'FULL_PRICE' => $xtPrice->xt-Commerce / xt:CommerceFormat($full, true),
'PREFIX' => $products_options['price_prefix']);

//if PRICE for option is 0 we don't need to display it
if ($price == 0) {
unset ($products_options_data[$row]['DATA'][$col]['PRICE']);
unset ($products_options_data[$row]['DATA'][$col]['PREFIX']);
}

}
$col ++;
}
$row ++;
}
if( sizeof($products_options_data) ) {
$module_content[$i]['OPTIONS'] = $products_options_data;
}

/
echo "<pre>";
print_r($products_options_data);
echo "</pre>";
/
// ------- icart end --------------








lang/german/german.php
----------------------
Füge folgende Zeilen ein:

define('IMAGE_BUTTON_CART_INCREASE', 'Erh&ouml;he um 1'); // icart
define('IMAGE_BUTTON_CART_DECREASE', 'Erniedrige um 1'); // icart
define('IMAGE_BUTTON_DELETE_PRODUCT', 'Diese Poistion aus Warenkorb l&ouml;schen'); // icart
define('IMAGE_BUTTON_DELETE_ALL', 'Warenkorb komplett l&ouml;schen'); // icart



lang/german/lang_german.conf
----------------------------
Füge folgende Zeilen ein:
#includes/modules/cart_specials
# icart
[cart_specials]
heading_text = 'Interessante weitere Artikel'


lang/german/admin/configuration.php
-----------------------------------
Füge folgende Zeilen ein:
define('MAX_DISPLAY_CART_SPECIALS_TITLE' , 'Max. Anzahl Artikel unter Warenkorb'); // icart
define('MAX_DISPLAY_CART_SPECIALS_DESC' , 'Maximum Anzahl Anzeige weitere Artikel unterhalb des Warenkorbes'); // icart


lang/german/admin/categories.php
--------------------------------
Füge folgende Zeile ein:
define('TEXT_PRODUCTS_CART_SPECIALS', 'Unterh. Warenk. Anz.'); // icart


Folgende Dateien hinzufügen
---------------------------
templates/xt-Commerce / xt:Commerce4/buttons/german/button_decrease.gif
templates/xt-Commerce / xt:Commerce4/buttons/german/button_increase.gif
templates/xt-Commerce / xt:Commerce4/buttons/german/button_delete_cart.gif


templates/xt-Commerce / xt:Commerce4/module/order_details.html
----------------------------------------
Suche:
<table width="100%" border="0" cellspacing="0" cellpadding="0">
{foreach key=key_data item=item_data from=$module_data.ATTRIBUTES}
<tr>
<td class="main">{$item_data.NAME}:</td>
<td class="main" align="left">{$item_data.VALUE_NAME}</td>
</tr>
{/foreach}
</table>
{else}
{/if}

Füge danach ein:

{if $module_data.OPTIONS!=''}
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td class="main">

<table style="border: 1px solid;" width="100%" cellpadding="2" cellspacing="0">
{foreach name=outer item=options_data from=$module_data.OPTIONS }
<tr>
<td>{$options_data.NAME}:</td>
<td>
<select name="attr[{$module_data.PRODUCTS_ID}][{$options_data.ID}]" size="1">
{foreach key=key_data item=item_data from=$options_data.DATA}

{if $item_data.CHECK=='1' }
<option value="{$item_data.ID}" selected>
{$item_data.TEXT}

{if $item_data.PRICE}{$item_data.PREFIX}{$item_data.PR ICE}{/if}
</option>
{else}
<option value="{$item_data.ID}">
{$item_data.TEXT}

{if $item_data.PRICE}{$item_data.PREFIX}{$item_data.PR ICE}{/if}
</option>
{/if}
{/foreach}
</select>
</td>
</tr>
{/foreach}
<tr>
<td colspan="2">
{$module_data.BUTTON_RELOAD}
</td>
</tr>
</table>


</td>
</tr>
</table>
{/if}




Suche:
<td width="10" align="center" valign="middle" class="boxTextBGII">{$module_data.BOX_DELETE}</td>

Ersetze durch:
<td width="10" align="center" valign="top" class="boxTextBGII">
{$module_data.BUTTON_DELETE}
</td>




templates/xt-Commerce / xt:Commerce4/module/shopping_cart.html
----------------------------------------
Suche:
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left">{$BUTTON_RELOAD}</td>
<td align="right">{$BUTTON_CHECKOUT}</td>
</tr>
</table>


Ersetze durch:
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top">
{$BUTTON_RELOAD}
</td>
<td align="left" valign="top">
{$BUTTON_DELETE_ALL}
</td>
<td align="right" valign="top">
{$BUTTON_CHECKOUT}
</td>
</tr>
</table>




templates/xt-Commerce / xt:Commerce4/module/cart_specials.html
----------------------------------------
Datei neu hinzugekommen












Installation
------------
Anwendung auf eine unveränderte xt-Commerce / xt:Commerce304sp21-Installation.
Alle Dateien des Moduls in den Shopordner kopieren, gleichnamige Dateien sind zu überschreiben.
Die SQL-Datei db_install ist auf die Datenbank des Shops anzuwenden.


Anwendung
---------
Administration -> Artikeldaten Bearbeiten
Oben rechts befindet sich eine Ja/Nein Einstellung "Unterh. Warenk. Anz."
Dies sagt an, daß der Artikel unter dem Warenkorb gezeigt wird.

Administration -> Konfiguration -> Maximum Werte
Ganz unten befindet sich eine Einstellung wieviele Produkte maximal unterhalb des Warenkorbes
angezeigt werden: "Max. Anzahl Artikel unter Warenkorb"


Umsetzung
---------
Alle neuen Texte sind in den entspr. Language-Dateien hinterlegt.
Sämtliche Codeänderungen sind in den Quelltexten durch Kommentare markiert.
Eine Textsuche nach dem Modulnamen "icart" führt zu allen Programmstellen des Moduls.





© 2007 h.koch (hendrik.koch@gmx.de)

Click here to download this file (http://www.ecombase.de/forum/index.php?automodule=downloads&showfile=61)