
Originally Posted by
ilmarchez
That is not viable... We are working with all prives with Tax included, so to avoid mistakes there should be the possibility to set price with tax even in this field..
Understand... Was looking for a "quick" fix, that was quick, not elegant, not desirable, but would allow say a single product to be so entered.
Alright, so put this together instead. Thinking it will still apply even for an old version of ZC such as 1.3.9h like you are using, but was generated from ZC 1.5.4. code, so there may be some differences.
Find this or similar code in admin/products_price_manager.php:
Code:
if ($_POST['specials_id'] != '') {
$specials_id = zen_db_prepare_input($_POST['specials_id']);
if ($_POST['products_priced_by_attribute'] == '1') {
$products_price = zen_get_products_base_price($products_filter);
} else {
$products_price = zen_db_prepare_input($_POST['products_price']);
}
$specials_price = zen_db_prepare_input($_POST['specials_price']);
if (substr($specials_price, -1) == '%') $specials_price = ($products_price - (($specials_price / 100) * $products_price));
$db->Execute("update " . TABLE_SPECIALS . " set
specials_new_products_price='" . zen_db_input($specials_price) . "',
specials_date_available='" . zen_db_input($specials_date_available) . "',
specials_last_modified=now(),
expires_date='" . zen_db_input($specials_expires_date) . "',
status='" . zen_db_input($_POST['special_status']) . "'
where products_id='" . $products_filter . "'");
}
And make it look like this:
Code:
if ($_POST['specials_id'] != '') {
$specials_id = zen_db_prepare_input($_POST['specials_id']);
if ($_POST['products_priced_by_attribute'] == '1') {
$products_price = zen_get_products_base_price($products_filter);
} else {
$products_price = zen_db_prepare_input($_POST['products_price']);
}
$specials_price = zen_db_prepare_input($_POST['specials_price']);
if (substr($specials_price, -1) == '%') $specials_price = ($products_price - (($specials_price / 100) * $products_price));
if (DISPLAY_PRICE_WITH_TAX == 'true') {
$taxRate = zen_get_tax_rate($_POST['products_tax_class_id']);
if ($taxRate > 0) {
$specials_price = $specials_price / (($taxRate / 100) + 1);
}
}
$db->Execute("update " . TABLE_SPECIALS . " set
specials_new_products_price='" . zen_db_input($specials_price) . "',
specials_date_available='" . zen_db_input($specials_date_available) . "',
specials_last_modified=now(),
expires_date='" . zen_db_input($specials_expires_date) . "',
status='" . zen_db_input($_POST['special_status']) . "'
where products_id='" . $products_filter . "'");
}
Untested, may be buggy, but looks like it might work... Could modify things to be more like the standard product entry field in the product description, but hadn't gone to find all the associated code to do the auto calculations, etc... New code added in blue.