1
Hallo
Ich möchte in meinem Shop die Preise der spanischen Produkte ändern, da sich das im Shop selbst nicht machen lässt..habe ich mir gedacht..ich versuche es über die PHP Datei.
Da ich in PHP, allerdings auch nicht so bewandert bin...dachte ich das ich meinen Ansatz erst mal hier poste bevor ich ihn umsetze...da ich nicht weiß ob ich nicht vielleicht was unwiederbringlich zerstöre.
Also ich dachte mir das ich folgende PHP Datei bearbeite: product_price.php
und das ich dann an dieser Stelle:
folgenden Befehl einfüge
Ziel ist es dabei das sämtliche spanische Preise um 10 € erhöht werden...würde das so funktionieren?
[Edit Jörg: Zitat-Block in Code-Block geändert]
Ich möchte in meinem Shop die Preise der spanischen Produkte ändern, da sich das im Shop selbst nicht machen lässt..habe ich mir gedacht..ich versuche es über die PHP Datei.
Da ich in PHP, allerdings auch nicht so bewandert bin...dachte ich das ich meinen Ansatz erst mal hier poste bevor ich ihn umsetze...da ich nicht weiß ob ich nicht vielleicht was unwiederbringlich zerstöre.
Also ich dachte mir das ich folgende PHP Datei bearbeite: product_price.php
<?php
/* --------------------------------------------------------------
$Id: product_price.php 3569 2010-01-21 14:43:47Z hhgag $
H.H.G. multistore
http://www.hhg-multistore.com/
Copyright (c) 2005-2010 H.H.G. group
-----------------------------------------------------------------------------------------
based on:
(c) 2003-2005 xt:Commerce (product_price.php 1344 2005-11-14); www.xt-commerce.com
Released under the GNU General Public License
---------------------------------------------------------------------------------------*/
defined('_VALID_HHG_MS') or die('Direct Access to this location is not allowed.');
require_once (DIR_WS_CORE_INC . 'get_proddata.inc.php');
$module_theme = new hhg_theme;
// Get Adminrights for this File:
$file_id = 30; // Rights ID from Database
$rights = $access->getFileAccess($file_id, $access->access['admin_class_id'], $access->access['admin_group_id']);
if (!$rights['admin_view']) {
$module = $module_theme->fetch(CURRENT_THEME . '/admin/modules/error.html');
} else {
$r_view = $rights['admin_view'];
$r_edit = $rights['admin_edit'];
$r_delete = $rights['admin_delete'];
$r_new = $rights['admin_new'];
// Admin Rights End
if (($_GET['pID']) && (!$_POST)) {
$product = hhg_db_query("select p.products_id, pd.products_name
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
where p.products_id = '" . (int)$_GET['pID'] . "'
and p.products_id = pd.products_id
and pd.language_id = '" . $_SESSION['languages_id'] . "'");
$pInfo = new object_Info($product->fields);
} elseif ($_POST) {
$pInfo = new object_Info($_POST);
$products_name = $_POST['products_name'];
} else {
$pInfo = new object_Info(array());
}
$pprice = hhg_db_query("select products_price, products_quantity, products_model, products_shippingtime, products_calculated, products_calculated_by, products_price_ek, products_tax_class_id, products_discount_allowed from " . TABLE_PRODUCTS_PRICE . " where products_id = '" . $pInfo->products_id . "' and store_id = '" . $_SESSION['actual_store'] . "'");
$org_products_price = $pInfo->products_price;
$org_products_price_ek = $pInfo->products_price_ek;
$org_products_tax_class_id = $pInfo->products_tax_class_id;
$org_products_discount_allowed = $pInfo->products_discount_allowed;
$pInfo->products_price = $pprice->fields['products_price'];
$pInfo->products_price_ek = $pprice->fields['products_price_ek'];
$pInfo->products_quantity = $pprice->fields['products_quantity'];
$pInfo->products_tax_class_id = $pprice->fields['products_tax_class_id'];
$pInfo->products_discount_allowed = $pprice->fields['products_discount_allowed'];
$pInfo->products_model = $pprice->fields['products_model'];
$pInfo->products_shippingtime = $pprice->fields['products_shippingtime'];
$pInfo->products_calculated = $pprice->fields['products_calculated'];
$pInfo->products_calculated_by = $pprice->fields['products_calculated_by'];
$tax_class_array = get_tax_classes();
$shipping_statuses = get_shipping_status();
$pcb_array = array(
array(
'id' => 'none',
'text' => NONE
) ,
array(
'id' => 'p',
'text' => PRODUCT
) ,
array(
'id' => 'm',
'text' => MANUFACTURER
) ,
array(
'id' => 'g',
'text' => PRODUCT_GROUP
)
);
$form_action = 'insert_product_price';
$module_theme->assign('FORM_ACTION', hhg_draw_form('new_product', hhg_href_link(FILENAME_CATEGORIES, 'cPath=' . $_GET['cPath'] . '&pID=' . $_GET['pID'] . '&action=' . $form_action) , 'post', 'enctype="multipart/form-data"'));
$module_theme->assign('FORM_HEADING', sprintf(TEXT_NEW_PRODUCT, xtc_output_generated_category_path($current_category_id)));
$module_theme->assign('FORM_END', '</form>');
$module_theme->assign('FORM_SUBMIT', '<input type="submit" class="button" onClick="this.blur();" value="' . BUTTON_SAVE . '"/>');
$module_theme->assign('FORM_CANCEL', '<a class="button" href="' . hhg_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $_GET['pID']) . '">' . BUTTON_CANCEL . '</a>');
$module_theme->assign('PRODUCTS_ID', hhg_draw_input_field('products_id', $pInfo->products_id));
$module_theme->assign('PRODUCTS_QUANTITY', hhg_draw_input_field('products_quantity', $pInfo->products_quantity, 'size=5'));
$module_theme->assign('PRODUCTS_MODEL', hhg_draw_input_field('products_model', $pInfo->products_model));
$module_theme->assign('PRODUCTS_SHIPPING', hhg_draw_pull_down_menu('shipping_status', $shipping_statuses, $pInfo->products_shippingtime));
$module_theme->assign('PRODUCTS_CB', hhg_draw_pull_down_menu('products_calculated_by', $pcb_array, $pInfo->products_calculated_by));
// Price & Groupprice Anfang
require_once (DIR_FS_CORE_INC . 'inc.hhg_get_tax_rate.php');
$xtPrice = new xtcPrice(DEFAULT_CURRENCY, $_SESSION['customers_status']['customers_status_id']);
$i = 0;
$group_values = hhg_db_query("SELECT customers_status_image,
customers_status_id,
customers_status_name
FROM
" . TABLE_CUSTOMERS_STATUS . "
WHERE
language_id = '" . $_SESSION['languages_id'] . "' AND customers_status_id != '0'");
while (!$group_values->EOF) {
// load data into array
$i++;
$group_data[$i] = array(
'STATUS_NAME' => $group_value->fields['customers_status_name'],
'STATUS_IMAGE' => $group_value->fields['customers_status_image'],
'STATUS_ID' => $group_value->fields['customers_status_id']
);
$group_values->MoveNext();
}
// Multiplier
$multi = hhg_db_query("select multiplier from " . TABLE_PRODUCTS_CALCULATION . " where products_id = '" . $pInfo->products_id . "' and store_id = '" . $_SESSION['actual_store'] . "' ");
$module_theme->assign('PRODUCTS_MULTIPLIER', hhg_draw_input_field('multiplier', $multi->fields['multiplier']));
$customers_status = new customers_status();
$customers_statuses_array = $customers_status->customersStatusList($_SESSION['actual_store']);
foreach($customers_statuses_array as $customers_statuses) {
$mmulti = hhg_db_query("select multiplier_" . $customers_statuses['id'] . " from " . TABLE_PRODUCTS_CALCULATION . " where products_id = '" . $pInfo->products_id . "' and store_id = '" . $_SESSION['actual_store'] . "' ");
$module_multi_content.= hhg_draw_input_field('multiplier_' . $customers_statuses['id'], $mmulti->fields['multiplier_' . $customers_statuses['id'] . '']) . ' ' . $customers_statuses['text'] . '<br /><br />';
}
$module_theme->assign('SHOW_CALCULATION', true);
// Multiplier
// Products Price EK Start
$module_price_content.= '<tr class="dataTableRow">';
$module_price_content.= '<td class="dataTableContent" align="left" width="20%">' . TEXT_PRODUCTS_PRICE_EK . '</td>';
$module_price_content.= '<td class="dataTableContent" align="left" width="80%">';
if (PRICE_IS_BRUTTO == 'true') {
$products_price_ek = hhg_round($pInfo->products_price_ek * ((100 + hhg_get_tax_rate($pInfo->products_tax_class_id)) / 100) , PRICE_PRECISION);
} else {
$products_price_ek = hhg_round($pInfo->products_price_ek, PRICE_PRECISION);
}
$module_price_content.= hhg_draw_input_field('products_price_ek', $products_price_ek) . ' ';
if (PRICE_IS_BRUTTO == 'true') {
$module_price_content.= TEXT_NETTO . ' <b>' . $xtPrice->xtcFormat($pInfo->products_price_ek, true) . '</b>';
}
$module_price_content.= '</td>';
$module_price_content.= '</tr>';
// Products Price EK END
// Products Price
$module_price_content.= '<tr class="dataTableRow">';
$module_price_content.= '<td class="dataTableContent" align="left" width="20%">' . TEXT_PRODUCTS_PRICE . '</td>';
$module_price_content.= '<td class="dataTableContent" align="left" width="80%">';
if (PRICE_IS_BRUTTO == 'true') {
$products_price = hhg_round($pInfo->products_price * ((100 + hhg_get_tax_rate($pInfo->products_tax_class_id)) / 100) , PRICE_PRECISION);
} else {
$products_price = hhg_round($pInfo->products_price, PRICE_PRECISION);
}
$module_price_content.= hhg_draw_input_field('products_price', $products_price) . ' ';
if (PRICE_IS_BRUTTO == 'true') {
$module_price_content.= TEXT_NETTO . ' <b>' . $xtPrice->xtcFormat($pInfo->products_price, true) . '</b>';
}
$module_price_content.= '</td>';
$module_price_content.= '</tr>';
// Products Price END
// Group Price
for ($col = 0, $n = sizeof($group_data); $col < $n + 1; $col++) {
if ($group_data[$col]['STATUS_NAME'] != '') {
$module_price_content.= '<tr class="dataTableRow">';
$module_price_content.= '<td class="dataTableContent" align="left" width="20%">' . $group_data[$col]['STATUS_NAME'] . '</td>';
$module_price_content.= '<td class="dataTableContent" align="left" width="80%">';
if (PRICE_IS_BRUTTO == 'true') {
$products_price = hhg_round(get_group_price($group_data[$col]['STATUS_ID'], $pInfo->products_id, $pInfo->products_owner) * ((100 + hhg_get_tax_rate($pInfo->products_tax_class_id)) / 100) , PRICE_PRECISION);
} else {
$products_price = hhg_round(get_group_price($group_data[$col]['STATUS_ID'], $pInfo->products_id, $pInfo->products_owner) , PRICE_PRECISION);
}
$module_price_content.= hhg_draw_input_field('products_price_' . $group_data[$col]['STATUS_ID'], $products_price);
if (PRICE_IS_BRUTTO == 'true' && get_group_price($group_data[$col]['STATUS_ID'], $pInfo->products_id, $pInfo->products_owner) != '0') {
$module_price_content.= TEXT_NETTO . '<b>' . $xtPrice->xtcFormat(get_group_price($group_data[$col]['STATUS_ID'], $pInfo->products_id) , true) . '</b> ';
}
$module_price_content.= '</td>';
$module_price_content.= '</tr>';
}
}
// Group Price END
// Tax
$module_price_content.= '<tr class="dataTableRow">';
$module_price_content.= '<td class="dataTableContent" align="left" width="20%">' . TEXT_PRODUCTS_TAX_CLASS . '</td>';
$module_price_content.= '<td class="dataTableContent" align="left" width="80%">' . hhg_draw_pull_down_menu('products_tax_class_id', $tax_class_array, $pInfo->products_tax_class_id) . '</td>';
$module_price_content.= '</tr>';
// Tax End
// Discount
$module_price_content.= '<tr class="dataTableRow">';
$module_price_content.= '<td class="dataTableContent" align="left" width="20%">' . TEXT_PRODUCTS_DISCOUNT_ALLOWED . '</td>';
$module_price_content.= '<td class="dataTableContent" align="left" width="80%">' . hhg_draw_input_field('products_discount_allowed', $pInfo->products_discount_allowed) . '</td>';
$module_price_content.= '</tr>';
// Discount End
require_once (DIR_WS_CORE_INC . 'get_special_price.inc.php');
$products_special = get_special_price($_SESSION['actual_store'], $pInfo->products_id);
if (PRICE_IS_BRUTTO == 'true') {
$products_special_price = hhg_round($products_special['specials_new_products_price'] * ((100 + hhg_get_tax_rate($pInfo->products_tax_class_id)) / 100) , PRICE_PRECISION);
} else {
$products_special_price = hhg_round($products_special['specials_new_products_price'], PRICE_PRECISION);
}
$module_theme->assign('PRODUCTS_SPECIAL_PRICE', hhg_draw_input_field('products_special_price', $products_special_price, 'size="10"'));
$module_theme->assign('PRODUCTS_SPECIAL_QTY', hhg_draw_input_field('products_special_qty', $products_special['specials_quantity'], 'size="3"'));
$module_theme->assign('PRODUCTS_SPECIAL_DATE', hhg_draw_input_field('products_special_date', $products_special['expires_date'], 'size="10"'));
if (isset($products_special['status'])) {
$spcheck = 'checked';
}
$module_theme->assign('PRODUCTS_SPECIAL_STATUS', hhg_draw_checkbox_field('products_special_status', '1', $spcheck));
// Price & Groupprice END
$module_theme->assign('HIDDEN_DATE', hhg_draw_hidden_field('products_date_added', (($pInfo->products_date_added) ? $pInfo->products_date_added : date('Y-m-d'))));
$module_theme->assign('HIDDEN_ID', hhg_draw_hidden_field('products_id', $pInfo->products_id));
if ((SHOPPING_MALLS) && (STORE_KEY == 'b2788e1ab6be65f1c38bf7d23cd081f1')) {
$module_theme->assign('SHOW_MALL', true);
require_once (DIR_FS_CORE_INC . 'inc.hhg_get_store_name.php');
$malls = explode(';', SHOPPING_MALLS);
for ($i = 0; $n = sizeof($malls) , $i < $n; $i++) {
$cat = hhg_db_query("SELECT categories_id FROM " . TABLE_PRODUCTS_TO_CATEGORIES . " WHERE products_id = '" . $pInfo->products_id . "' and mall = '" . $malls[$i] . "'");
$mall_name = hhg_get_store_name($malls[$i]);
$module_mall_content.= '<b>' . $mall_name . ':</b> ' . hhg_draw_input_field('mall_cat_' . $malls[$i] . '', $cat->fields['categories_id'], 'size="10"') . '<br>';
}
}
$module_theme->assign('module_price_content', $module_price_content);
$module_theme->assign('module_multi_content', $module_multi_content);
$module_theme->assign('module_content', $module_content);
$module = $module_theme->fetch(CURRENT_THEME . '/admin/modules/categories/product_price.html');
}
$theme->assign('main_content', $module);
?>
und das ich dann an dieser Stelle:
// Products Price
$module_price_content.= '<tr class="dataTableRow">';
$module_price_content.= '<td class="dataTableContent" align="left" width="20%">' . TEXT_PRODUCTS_PRICE . '</td>';
$module_price_content.= '<td class="dataTableContent" align="left" width="80%">';
if (PRICE_IS_BRUTTO == 'true') {
$products_price = hhg_round($pInfo->products_price * ((100 + hhg_get_tax_rate($pInfo->products_tax_class_id)) / 100) , PRICE_PRECISION);
} else {
$products_price = hhg_round($pInfo->products_price, PRICE_PRECISION);
}
$module_price_content.= hhg_draw_input_field('products_price', $products_price) . ' ';
if (PRICE_IS_BRUTTO == 'true') {
$module_price_content.= TEXT_NETTO . ' <b>' . $xtPrice->xtcFormat($pInfo->products_price, true) . '</b>';
}
$module_price_content.= '</td>';
$module_price_content.= '</tr>';
// Products Price END
folgenden Befehl einfüge
if (lang == 'es'){
$products_price = products_price + 10;
}
Ziel ist es dabei das sämtliche spanische Preise um 10 € erhöht werden...würde das so funktionieren?
[Edit Jörg: Zitat-Block in Code-Block geändert]