1. BACKUP MACHEN!!!
2. Folgende Dateien kopieren
templates/xtc4/img/alter.gif
3. Anpassungen Stylesheet
Am Ende der stylesheet.css anfügen
.alter {
display: block;
background-image: url(img/alter.gif);
background-repeat: no-repeat;
width: 13px;
height: 13px;
border: 0px;
font-size: 0px;
cursor: pointer;
}
4. Anpassungen für Dateien:
includes/cart_actions.php
ca. Zeile 52
case 'update_product' : if (is_object($econda)) $econda->_emptyCart(); for ($i = 0, $n = sizeof($_POST['products_id']); $i < $n; $i++) { if (in_array($_POST['products_id'][$i], (is_array($_POST['cart_delete']) ? $_POST['cart_delete'] : array ()))) { $_SESSION['cart']->remove($_POST['products_id'][$i]); if (is_object($econda)) $econda->_delArticle($_POST['products_id'][$i], $_POST['cart_quantity'][$i], $_POST['old_qty'][$i]); } else { if ($_POST['cart_quantity'][$i] > MAX_PRODUCTS_QTY) $_POST['cart_quantity'][$i] = MAX_PRODUCTS_QTY; $attributes = ($_POST['id'][$_POST['products_id'][$i]]) ? $_POST['id'][$_POST['products_id'][$i]] : ''; if (is_object($econda)) { $old_quantity = $_SESSION['cart']->get_quantity(xtc_get_uprid($_POST['products_id'][$i], $_POST['id'][$i])); $econda->_updateProduct($_POST['products_id'][$i], $_POST['cart_quantity'][$i], $old_quantity); } $_SESSION['cart']->add_cart($_POST['products_id'][$i], xtc_remove_non_numeric($_POST['cart_quantity'][$i]), $attributes, false); } } xtc_redirect(xtc_href_link($goto, xtc_get_all_get_params($parameters))); break;ersetzen durch
case 'update_product' : $_SESSION['alter'] = false; if (isset ($_POST['alter'])) { $_SESSION['alter'] = true; $_SESSION['alter_prod'] = $_POST['alter']; } elseif (isset ($_POST['attributes'])) { $temp=explode("-",$_POST['attributes']); $prod_id = $temp[0]; $alt = $temp[1]; $neu = $temp[2]; $attr_id = $temp[3]; $attributes = array($attr_id => $neu); //$_POST['id'][$_POST['products_id'][$prod_id]] : ''; $_SESSION['cart']->modify_attributes($_POST['products_id'][$prod_id], xtc_remove_non_numeric($_POST['cart_quantity'][$prod_id]), $attributes, false); } else { for ($i = 0, $n = sizeof($_POST['products_id']); $i < $n; $i++) { if (in_array($_POST['products_id'][$i], (is_array($_POST['cart_delete']) ? $_POST['cart_delete'] : array ()))) { $_SESSION['cart']->remove($_POST['products_id'][$i]); if (is_object($econda)) $econda->_delArticle($_POST['products_id'][$i], $_POST['cart_quantity'][$i], $_POST['old_qty'][$i]); } else { if ($_POST['cart_quantity'][$i] > MAX_PRODUCTS_QTY) $_POST['cart_quantity'][$i] = MAX_PRODUCTS_QTY; $attributes = ($_POST['id'][$_POST['products_id'][$i]]) ? $_POST['id'][$_POST['products_id'][$i]] : ''; if (is_object($econda)) { $old_quantity = $_SESSION['cart']->get_quantity(xtc_get_uprid($_POST['products_id'][$i], $_POST['id'][$i])); $econda->_updateProduct($_POST['products_id'][$i], $_POST['cart_quantity'][$i], $old_quantity); } $_SESSION['cart']->add_cart($_POST['products_id'][$i], xtc_remove_non_numeric($_POST['cart_quantity'][$i]), $attributes, false); } } } xtc_redirect(xtc_href_link($goto, xtc_get_all_get_params($parameters))); break;
includes/classes/class.inputfilter.php sofern das Sicherheitsupdate von xtCommerce noch nicht eingespielt wurde!
ca. Zeile 53
function process($source) { // clean all elements in this array if (is_array($source)) { foreach ($source as $key => $value) // filter element for XSS and other 'bad' code etc. $tmp_key = $key; unset ($source[$key]); $key = $this->remove($this->decode($key)); if ($key != $tmp_key) { return $source; } else { if (is_string($value)) $source[$key] = $this->remove($this->decode($value)); } return $source; // clean this string } else if (is_string($source)) { // filter source for XSS and other 'bad' code etc. return $this->remove($this->decode($source)); // return parameter as given } else return $source; }ersetzen durch
function process($source) { // clean all elements in this array if (is_array($source)) { foreach ($source as $key => $value) { // filter element for XSS and other 'bad' code etc. $tmp_key = $key; unset ($source[$key]); $key = $this->remove($this->decode($key)); if ($key != $tmp_key) { return $source; } else { if (is_string($value)) { $source[$key] = $this->remove($this->decode($value)); } elseif (is_array($value)) { $source[$key] = $this->process($value); } } } return $source; // clean this string } else if (is_string($source)) { // filter source for XSS and other 'bad' code etc. return $this->remove($this->decode($source)); // return parameter as given } else return $source; }
includes/classes/shopping_cart.php
ca. Zeile 136
function update_quantity($products_id, $quantity = '', $attributes = '') {davor einfügen
function modify_attributes($products_id, $qty = '1', $attributes = '', $notify = true) { $contemp = array(); $new_key = ''; while (list ($key, $value) = each($this->contents)) { if ($key === $products_id) { $temp=preg_split("(\{|\})",$products_id); $new_key = $temp[0]; for ($i = 1; $i < sizeof($temp); $i=$i+2) { if ($attributes[$temp[$i+1]]) { $new_key .= "{" . $temp[$i] . "}" . $attributes[$temp[$i+1]]; $changed_key = $temp[$i]; $changed_value = $attributes[$temp[$i+1]]; } else { $new_key .= "{" . $temp[$i] . "}" . $temp[$i+1]; } } if ($contemp[$new_key]['qty']) { $contemp[$new_key]['qty'] += $value['qty']; } else { $contemp[$new_key] = $value; $contemp[$new_key]['attributes'][$changed_key] = $changed_value; } } else { if ($key != $new_key) { $contemp[$key] = $value; } else { $contemp[$key]['qty'] += $value['qty']; } } } $this->contents = $contemp; }
includes/modules/order_details_cart.php
ca. Zeile 69
if (ATTRIBUTE_STOCK_CHECK == 'true' && STOCK_CHECK == 'true') { $attribute_stock_check = xtc_check_stock_attributes($products[$i][$option]['products_attributes_id'], $products[$i]['quantity']); if ($attribute_stock_check) $_SESSION['any_out_of_stock'] = 1; } $module_content[$i]['ATTRIBUTES'][] = array ('ID' => $products[$i][$option]['products_attributes_id'], 'MODEL' => xtc_get_attributes_model(xtc_get_prid($products[$i]['id']), $products[$i][$option]['products_options_values_name']), 'NAME' => $products[$i][$option]['products_options_name'], 'VALUE_NAME' => $products[$i][$option]['products_options_values_name'].$attribute_stock_check);ersetzen durch
if (ATTRIBUTE_STOCK_CHECK == 'true' && STOCK_CHECK == 'true') { $attribute_stock_check = xtc_check_stock_attributes($products[$i][$option]['products_attributes_id'], $products[$i]['quantity']); if ($attribute_stock_check) $_SESSION['any_out_of_stock'] = 1; } if ($_SESSION['alter'] && $_SESSION['alter_prod']==$i."-".$option) { $_SESSION['alter'] = false; unset($_SESSION['alter_prod']); $temp=preg_split("(\{|\})",$products[$i]['id']); $products_id=$temp[0]; for ($j = 1; $j<sizeof($temp); $j=$j+2) { if ($option == (int) $temp[$j]) { $opt = (int) $temp[$j+1]; } } $attr_query=xtc_db_query("SELECT products_options_values_id,products_options_values_name FROM ". TABLE_PRODUCTS_OPTIONS_VALUES." pov, ".TABLE_PRODUCTS_ATTRIBUTES." pa WHERE pa.products_id = ".$products_id." AND pa.options_values_id = pov.products_options_values_id AND pov.language_id = ". $_SESSION['languages_id'] ." AND pa.options_id = " . $option . " ORDER BY pov.products_options_values_id"); $select='<select name="attributes" onChange="this.form.submit()">'; while ($attr_res=xtc_db_fetch_array($attr_query)) { $selected=$products[$i]['attributes'][$option]==$attr_res['products_options_values_id']?' selected="selected"':''; $select.='<option value="'.$i.'-'.$products[$i]['attributes'][$option].'-'.$attr_res['products_options_values_id'].'-'.$opt.'"'.$selected.'>'.$attr_res['products_options_values_name'].'</option>'; } //EOWHILE $select.='</select>'; $module_content[$i]['ATTRIBUTES'][]=array( 'ID' =>$products[$i][$option]['products_attributes_id'], 'MODEL'=>xtc_get_attributes_model(xtc_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' => $select, //$products[$i][$option]['products_options_values_name'].$attribute_stock_check, 'ALTER' => '<input type="submit" name="alter_send" value="' . $i . '-' . $option . '" class="alter">' ); } else { $module_content[$i]['ATTRIBUTES'][]=array( 'ID' =>$products[$i][$option]['products_attributes_id'], 'MODEL'=>xtc_get_attributes_model(xtc_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, 'ALTER' => '<input type="submit" name="alter" value="' . $i . '-' . $option . '" class="alter">' ); }
templates/xtc4/module/order_details.html
ca. Zeile 26
<td class="main">{$item_data.NAME}:</td> <td class="main" align="left">{$item_data.VALUE_NAME}</td>danach anfügen
<td class="main" align="left" width="1%">{$item_data.ALTER}</td>