Hallo zusammen,
ich bastel gerade daran mehr Beschreibungen in die Artikelattribute zu bekommen, um beim Warenkorb etwas mehr Zusatztext einfließen lassen zu können.
Dazu hab ich mir das Feld Artikelnummer des Attributes vorgenommen, also in der DB-Tabelle products_attributes das Feld attributes_model. Diese Tabelle hab ich erst einmal um zwei weitere Felder erweitert, products_add1 und products_add2.
Anschließend hab ich mir die Dateien unter
admin/includes/modules:
- new_attribute_change
$value_model = $_POST[$cv_id . '_model'];
$value_add1 = $_POST[$cv_id . '_add1'];
$value_add2 = $_POST[$cv_id . '_add2'];
xtc_db_query("INSERT INTO ".TABLE_PRODUCTS_ATTRIBUTES." (
products_id, options_id, options_values_id, options_values_price, price_prefix, attributes_model, attributes_add1, attributes_add2,
VALUES ('" . $_POST['current_product_id'] . "', '" . $optionsID . "', '" . $_POST['optionValues'][$i] . "', '" . $value_price . "', '" . $value_prefix . "', '" . $value_model . "', '" . $value_add1 . "', '" . $value_add2 . "', '" .
- new_attribute_functions
global $attribute_value_price,$sortorder, $attribute_value_weight, $attribute_value_weight_prefix, $attribute_value_prefix, $attribute_value_model, $attribute_value_add1, $attribute_value_add2, $attribute_value_stock, $posCheck, $negCheck, $isCheck, $posCheck_weight, $negCheck_weight,$isCheck_weight, $attribute_value_download_count, $attribute_value_download_expire,$attribute_value_download_filename; if ($isFound) { while($line = xtc_db_fetch_array
($result)) { // download function start $dl_sql = xtc_db_query
("SELECT products_attributes_maxdays, products_attributes_filename, products_attributes_maxcount FROM ".TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD
." WHERE products_attributes_id = '" . $line['products_attributes_id'] . "'") or
die(mysql_error()); $dl_res = xtc_db_fetch_array
($dl_sql); $attribute_value_download_filename= $dl_res['products_attributes_filename']; $attribute_value_download_count = $dl_res['products_attributes_maxcount']; $attribute_value_download_expire = $dl_res['products_attributes_maxdays']; // download function end $attribute_value_price = $line['options_values_price']; $sortorder = $line['sortorder']; $attribute_value_prefix = $line['price_prefix']; $attribute_value_weight_prefix = $line['weight_prefix']; $attribute_value_model = $line['attributes_model']; $attribute_value_add1 = $line['attributes_add1']; $attribute_value_add2 = $line['attributes_add2']; } else { $attribute_value_price = ''; $sortorder = ''; $attribute_value_weight = ''; $attribute_value_prefix = ''; $attribute_value_weight_prefix = ''; $attribute_value_model = ''; $attribute_value_add1 = ''; $attribute_value_add2 = ''; - new_attribute_include
echo "<TD class=\"main\" align=\"left\"><input type=\"text\" name=\"" . $current_value_id . "_model\" value=\"" . $attribute_value_model . "\" size=\"15\"></TD>";
echo "<TD class=\"main\" align=\"left\"><input type=\"text\" name=\"" . $current_value_id . "_add1\" value=\"" . $attribute_value_add1 . "\" size=\"15\"></TD>";
echo "<TD class=\"main\" align=\"left\"><input type=\"text\" name=\"" . $current_value_id . "_add2\" value=\"" . $attribute_value_add2 . "\" size=\"15\"></TD>";
- new_attribute_select
unter
admin/new_attributes.php
$attrib_query = xtc_db_query("SELECT
products_id,
options_id,
options_values_id,
options_values_price,
price_prefix,
attributes_model,
attributes_add1,
attributes_add2,
while ($attrib_res = xtc_db_fetch_array($attrib_query)) {
xtc_db_query("INSERT into ".TABLE_PRODUCTS_ATTRIBUTES." (
products_id,
options_id,
options_values_id,
options_values_price,
price_prefix,
attributes_model,
attributes_add1,
attributes_add2,
VALUES ('" . $_POST['current_product_id'] . "', '" .
$attrib_res['options_id'] . "', '" .
$attrib_res['options_values_id'] . "', '" .
$attrib_res['options_values_price'] . "', '" .
$attrib_res['price_prefix'] . "', '" .
$attrib_res['attributes_model'] . "', '" .
$attrib_res['attributes_add1'] . "', '" .
$attrib_res['attributes_add2'] . "', '" .
vorgenommen und die entsprechenden Verweise überarbeitet. Jetzt kann ich die zusätzlichen Beschreibungen im Backend einfügen und sie werden auch in die DB übernommen.
Nun versuche ich die Daten im Warenkorb auszugeben. Dies gelingt mir leider noch nicht.
Ich habe die Daten in der Datei includes/modules/order_details_cart.php wie folgt angepasst:
$model = xtc_get_attributes_model
(xtc_get_prid
($products[$i]['id']), $products[$i][$option]['products_options_values_name'], $products[$i][$option]['products_options_name']); $module_content[$i]['ATTRIBUTES'][] = array ( 'ID' => $products[$i][$option]['products_attributes_id'], 'MODEL' => $model, 'ADD1' => $add1, 'ADD2' => $add2, 'NAME' => $products[$i][$option]['products_options_name'], 'VALUE_NAME' => $products[$i][$option]['products_options_values_name'].$attribute_stock_check, 'IS_NUMERIC_MODEL' => is_numeric($model) und in der Datei templates/MYTEMPLATE/module/oder_details.html die Datei folgendermaßen den Aufruf gegeben:
{if $module_data.ATTRIBUTES
!=''} <table
class="productattributes" width
="100%" border
="0" cellspacing
="0" cellpadding
="0"> {foreach key=key_data item
=item_data from
=$module_data.ATTRIBUTES
} <tr
> <td
class="attribute"><strong
>{$item_data.NAME
}:</strong
></td
> <td
class="value">{$item_data.VALUE_NAME
}</td
> <td
class="value">{$item_data.ADD1
}</td
> <td
class="value">{$item_data.MODEL
}</td
> </tr
> {/foreach} </table
> {/if} Leider werden die neuen Angaben im Warenkorb nicht mit angezeigt. Aber immerhin sind die alten Angaben weiterhin vorhanden
Hab ich bei meinen Bemühungen eine wichtige Datei vergessen? Oder hat jemand eine andere Idee, warum das Ganze nicht zum Laufen kommt?
Vielen Dank für euren Response,
webtre
Linkback: https://www.modified-shop.org/forum/index.php?topic=11710.0