Full price display.


english 8318
Full price display. The price is incl. and excl. VAT displayed. An icon is also displayed in front of the price as soon as the product is in the shopping cart.

The prerequisite for this extension is the addon "[ajax attribut pricechange 1.3]".

Open the page: catalog/ajax_onchange_price.php and replace the entire source code.
<?php
require('includes/application_top.php');
$oscTemplate->buildBlocks();
    $optionid            = explode(",",$_GET['option_id']);
    $product_id          = $_GET['product_id'];    
    $product_opt         = explode(",",$_GET['product_opt']);
    $modified_price      = $_GET['price'];
    $sp_price            = $_GET['sp_price'];
    $modified_netto_price = isset($_GET['specials_new_products_price']);
    
    $product_info_query = tep_db_query("select p.products_id, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$product_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
    $product_info_ajx = tep_db_fetch_array($product_info_query);
    
    $new_price = tep_get_products_special_price($product_info_ajx['products_id']);
    
    for($k=0; $k<count($optionid); $k++)
    {

    $product_new_price_query = tep_db_query("select * from " .TABLE_PRODUCTS_ATTRIBUTES. " where products_id = '" . (int)$product_id . "' and options_id = '".$optionid[$k]."' AND options_values_id ='" . $product_opt[$k] . "'");    
    $product_new_price = tep_db_fetch_array($product_new_price_query);

    $sp_price = $sp_price + ($product_new_price['price_prefix'] . $product_new_price['options_values_price']); // specials
    $modified_price = $modified_price + ($product_new_price['price_prefix'] . $product_new_price['options_values_price']);

    $modified_netto_price = $modified_netto_price + ($product_new_price['price_prefix'] . $product_new_price['options_values_price']); // specials

$special_products_price_query = tep_db_query("select s.specials_new_products_price, p.products_id from " . TABLE_SPECIALS . " s left join " . TABLE_PRODUCTS . " p on s.products_id = p.products_id where s.products_id = '" . (int)$product_id . "'");
$special_products_price = tep_db_fetch_array($special_products_price_query);

$special_n_price = '';
$special_npp_price = '';

$special_n_price = (isset($special_products_price['specials_new_products_price']) ? $special_products_price['specials_new_products_price'] : '');

if (tep_has_product_attributes((isset($special_products_price['products_id']) ? $special_products_price['products_id'] : '') )) {
$special_npp_price = $special_n_price + $modified_netto_price;
}else{
$special_npp_price = $special_n_price;
}
}

// Item in cart start
if ( SHOW_ITEM_IN_CART == 'True' ) {
$products = $cart->get_products();
$in_cart = '';
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
$first = current(explode("{", $products[$i]['id']));
if ($first == $product_info_ajx['products_id']) {
$in_cart = '<i class="fa fa-cart-plus"></i> ';
}}}
// Item in cart ende

    if ($new_price = tep_get_products_special_price($product_info_ajx['products_id'])) {
if (SHOW_PRODUCT_NETT_PRICE_ABOWE_PRICE == 'True') {
      $products_price = '<div><span class="w3-small w3-text-gray"> ( ';
      $products_price .= $currencies->display_price($special_npp_price, '');
      $products_price .= TAX_INFO_OFF . ' )</span></div>';
      $products_price .= $in_cart . '<s class="w3-text-red">' . $currencies->display_price($modified_price, tep_get_tax_rate($product_info_ajx['products_tax_class_id'])) . '</s>';
      $products_price .= '<span class="productSpecialPrice">' . $currencies->display_price($sp_price, tep_get_tax_rate($product_info_ajx['products_tax_class_id'])) . '</span>';
}else{
      $products_price = $in_cart . '<s class="w3-text-red">' . $currencies->display_price($modified_price, tep_get_tax_rate($product_info_ajx['products_tax_class_id'])) . '</s>';
      $products_price .= '<span class="productSpecialPrice">' . $currencies->display_price($sp_price, tep_get_tax_rate($product_info_ajx['products_tax_class_id'])) . '</span>';
}


    } else {
if (SHOW_PRODUCT_NETT_PRICE_ABOWE_PRICE == 'True') {
      $products_price = '<div><span class="w3-small w3-text-gray"> ( ';
      $products_price .= $currencies->display_price($modified_price, '');
      $products_price .= TAX_INFO_OFF . ' )</span></div>';
      $products_price .= $in_cart . $currencies->display_price($modified_price, tep_get_tax_rate($product_info_ajx['products_tax_class_id']));
}else{
      $products_price = $in_cart . $currencies->display_price($modified_price, tep_get_tax_rate($product_info_ajx['products_tax_class_id']));
}
    }    

    $s_simbol = array("?", "$", "?");
    $s_entidad = array("€", "$", "£");
    
    echo str_replace($s_simbol, $s_entidad, $products_price); // cambia el simbolo por la entidad html.
?>

Add in: catalog/includes/languages/english.php

define('TEXT_INCL_VAT', 'Price incl. %s VAT');
define('TEXT_SC_INCL_VAT', 'Incl. %s VAT');
define('TEXT_EXCL_VAT', 'excl. VAT. § 19 UStG.');
define('TEXT_VAT', 'VAT');
define('TAX_INFO', 'incl. VAT');
define('TAX_INFO_OFF', ' excl. VAT');
define('TAX_LF_INFO', 'incl.');

Import SQL statement using PhpMyAdmin:

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, use_function, set_function)
VALUES ('Show product in shopping cart at price ?', 'SHOW_ITEM_IN_CART', 'True', 'Would you like the note already in the shopping cart to be displayed next to the price?', '1', '205', now(), NULL , 'tep_cfg_select_option(array('True', 'False'),');

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, use_function, set_function)
VALUES ('show net price ?', 'SHOW_PRODUCT_NETT_PRICE_ABOWE_PRICE', 'True', 'Would you like the net price to be displayed above the main price?', '1', '206', now(), NULL , 'tep_cfg_select_option(array('True', 'False'),');

In the administration under Configuration -> My Store you will find now the setting options for the display. 

Why your email address?
If necessary, I will contact you to help you with the implementation.
Your email address will not be made public.
Is this post helpful to you?
There are currently no product reviews.
Information(2)
General information
 Free advertising
 Lazy Loading
Post counter
Current information status:
Categories: 8
Posts: 104
Support pages: 55
Downloads for members: 104
Download counter: 646
Reviews total58
Companies: 26
Support: 25
Information: 7