Jump to content

How to disable displaying tax labels?


Recommended Posts

  • 8 months later...

Hi,

 

I was wondering if it is possible to display the "tax" labels in the product list.

I've tried to change the code in product-list.tpl, but it doesn't seem to work.

 

 

I found the code that i tink is the key to success... :

 

{if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}<span class="price">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span>{/if}
{/if}

 

And added :

 

{if $tax_enabled && ((isset($display_tax_label) && $display_tax_label == 1) OR !isset($display_tax_label))}
	{if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}
   {/if}

 

 

But nothing happened on the front office. It could be the css.

Can anybody help me ?

 

Thanks in advance for the help !

Kind regards,

Marc

Edited by Marcwales (see edit history)
Link to comment
Share on other sites

I found the following variable in the product.tpl:$display_tax_label How can I cange it? Somewhere in the backend? I would like to disable the tax label. I'm on Prestashop 1.4.3. Thanks.

 

I know that is a old post, but since the solution isn't here, i will post the solution.

 

In prestashop v1482, you have to go to back-office:

  • shipping > country
  • choose your country from the list and click to edit.
  • scroll down and the last option is related with $display_tax_label . Enable or disable it as you like more.

I hope that will help somebody ;)

 

In my case i found what seems to be a bug related with this and enable or disable tax in back-office in Payment > Taxes, that i reported in http://forge.prestas...owse/PSCFI-5932

  • Like 3
Link to comment
Share on other sites

Hi,

 

I was wondering if it is possible to display the "tax" labels in the product list.

I've tried to change the code in product-list.tpl, but it doesn't seem to work.

 

 

I found the code that i tink is the key to success... :

 

{if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}<span class="price">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span>{/if}
{/if}

 

And added :

 

{if $tax_enabled && ((isset($display_tax_label) && $display_tax_label == 1) OR !isset($display_tax_label))}
	{if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}
   {/if}

 

 

But nothing happened on the front office. It could be the css.

Can anybody help me ?

 

Thanks in advance for the help !

Kind regards,

Marc

 

Open FrontController.php and look at line 251 for this code:

$smarty->assign(array(
  'link' => $link,
  'cart' => $cart,
  'currency' => $currency,
  'cookie' => $cookie,
  'page_name' => $page_name,
  'base_dir' => _PS_BASE_URL_.__PS_BASE_URI__,
  'base_dir_ssl' => $protocol_link.Tools::getShopDomainSsl().__PS_BASE_URI__,
  'content_dir' => $protocol_content.Tools::getHttpHost().__PS_BASE_URI__,
  'tpl_dir' => _PS_THEME_DIR_,
  'modules_dir' => _MODULE_DIR_,
  'mail_dir' => _MAIL_DIR_,
  'lang_iso' => $ps_language->iso_code,
  'come_from' => Tools::getHttpHost(true, true).Tools::htmlentitiesUTF8(str_replace('\'', '', urldecode($_SERVER['REQUEST_URI']))),
  'cart_qties' => (int)$cart->nbProducts(),
  'currencies' => Currency::getCurrencies(),
  'languages' => Language::getLanguages(),
  'priceDisplay' => Product::getTaxCalculationMethod(),
  'add_prod_display' => (int)Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
  'shop_name' => Configuration::get('PS_SHOP_NAME'),
  'roundMode' => (int)Configuration::get('PS_PRICE_ROUND_MODE'),
  'use_taxes' => (int)Configuration::get('PS_TAX'),
  'display_tax_label' => (bool)$display_tax_label,
  'vat_management' => (int)Configuration::get('VATNUMBER_MANAGEMENT'),
  'opc' => (bool)Configuration::get('PS_ORDER_PROCESS_TYPE'),
  'PS_CATALOG_MODE' => (bool)Configuration::get('PS_CATALOG_MODE'),
 ));

 

Now replace by this one:

$smarty->assign(array(
  'link' => $link,
  'cart' => $cart,
  'currency' => $currency,
  'cookie' => $cookie,
  'page_name' => $page_name,
  'base_dir' => _PS_BASE_URL_.__PS_BASE_URI__,
  'base_dir_ssl' => $protocol_link.Tools::getShopDomainSsl().__PS_BASE_URI__,
  'content_dir' => $protocol_content.Tools::getHttpHost().__PS_BASE_URI__,
  'tpl_dir' => _PS_THEME_DIR_,
  'modules_dir' => _MODULE_DIR_,
  'mail_dir' => _MAIL_DIR_,
  'lang_iso' => $ps_language->iso_code,
  'come_from' => Tools::getHttpHost(true, true).Tools::htmlentitiesUTF8(str_replace('\'', '', urldecode($_SERVER['REQUEST_URI']))),
  'cart_qties' => (int)$cart->nbProducts(),
  'currencies' => Currency::getCurrencies(),
  'languages' => Language::getLanguages(),
  'priceDisplay' => Product::getTaxCalculationMethod(),
  'add_prod_display' => (int)Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
  'shop_name' => Configuration::get('PS_SHOP_NAME'),
  'roundMode' => (int)Configuration::get('PS_PRICE_ROUND_MODE'),
  'use_taxes' => (int)Configuration::get('PS_TAX'),
  'display_tax_label' => (bool)$display_tax_label,
  'vat_management' => (int)Configuration::get('VATNUMBER_MANAGEMENT'),
  'opc' => (bool)Configuration::get('PS_ORDER_PROCESS_TYPE'),
  'PS_CATALOG_MODE' => (bool)Configuration::get('PS_CATALOG_MODE'),
  'tax_enabled' => Configuration::get('PS_TAX'),
 ));

the difference is in last line, where you have to pass to product-list.tpl if tax is enable or not.

 

Now open product-list.tpl and look at line 42 for this code:

<div>
 {if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}<span class="price" style="display: inline;">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span><br />{/if}
 {if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}<span class="availability">{if ($product.allow_oosp || $product.quantity > 0)}{l s='Available'}{elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}{l s='Product available with different options'}{else}{l s='Out of stock'}{/if}</span>{/if}
</div>

 

Now replace for this one :

<div>
 {if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
  <span class="price" style="display: inline;"> tax_enabled = {$tax_enabled}<br/>
   {if !$priceDisplay}{convertPrice price=$product.price}
	{if $tax_enabled  && ((isset($display_tax_label) && $display_tax_label == 1))}
	 {l s='Tax Incl.'}
	{else}
	 {l s='Tax Excl.'}
	{/if}
   {else}{convertPrice price=$product.price_tax_exc}
	{l s='Tax Excl.'}{/if}
  </span><br/>
 {/if}
 {if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}<span class="availability">{if ($product.allow_oosp || $product.quantity > 0)}{l s='Available'}{elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}{l s='Product available with different options'}{else}{l s='Out of stock'}{/if}</span>{/if}
</div>

 

The differences are between line 46 and 52 of the new file .

 

Now should work fine ;)

 

If you like, give me a like :rolleyes:

Link to comment
Share on other sites

For the bug mentioned in previous post, and that was related in bug tracker, hi make some changes to file product.tpl ... this works for me, but i still want to know from bug tracker if the bug is here or in core files.

 

If you have the same bug, feel free to use this workaround...

 

Find this code at line 254:

<span class="our_price_display">
 {if $priceDisplay >= 0 && $priceDisplay <= 2}
  <span id="our_price_display">{convertPrice price=$productPrice}</span>
   {if $tax_enabled  && ((isset($display_tax_label) && $display_tax_label == 1) OR !isset($display_tax_label))}
	{if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}
   {/if}
 {/if}
 </span>

 

Replace by this one:

<span class="our_price_display">
 {if $priceDisplay >= 0 && $priceDisplay <= 2}
  <span id="our_price_display">{convertPrice price=$productPrice}</span>
   <!-- {if $tax_enabled  && ((isset($display_tax_label) && $display_tax_label == 1) OR !isset($display_tax_label))}
	{if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}
   {/if} -->
   {if $tax_enabled == 1  && ((isset($display_tax_label) && $display_tax_label == 1))}
	 {l s='tax incl.'}
   {elseif $tax_enabled == 0  && ((isset($display_tax_label) && $display_tax_label == 1))}
	{l s='tax excl.'}
   {/if}
 {/if}
 </span>

 

Found at line 268:

{if $product->specificPrice AND $product->specificPrice.reduction}
 <p id="old_price"><span class="bold">
 {if $priceDisplay >= 0 && $priceDisplay <= 2}
  {if $productPriceWithoutRedution > $productPrice}
   <span id="old_price_display">{convertPrice price=$productPriceWithoutRedution}</span>
	{if $tax_enabled && $display_tax_label == 1}
	 {if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}
	{/if}
  {/if}
 {/if}
 </span>
 </p>
{/if}

 

And replace by this one:

{if $product->specificPrice AND $product->specificPrice.reduction}
 <p id="old_price"><span class="bold">
 {if $priceDisplay >= 0 && $priceDisplay <= 2}
  {if $productPriceWithoutRedution > $productPrice}
   <span id="old_price_display">{convertPrice price=$productPriceWithoutRedution}</span>
	<!-- {if $tax_enabled && $display_tax_label == 1}
	 {if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}
	{/if} -->
	{if $tax_enabled == 1  && ((isset($display_tax_label) && $display_tax_label == 1))}
	 {l s='tax incl.'}
   {elseif $tax_enabled == 0  && ((isset($display_tax_label) && $display_tax_label == 1))}
	{l s='tax excl.'}
   {/if}
  {/if}
 {/if}
 </span>
 </p>
{/if}

 

If you pay attention hi let old code commented, so that will be easy to revert ;)

 

If you like this solution, please give me a like B)

Link to comment
Share on other sites

  • 1 month later...

Hi exadra37,

 

Thank you so much for helping me, i was almost giving up.

I've searched for this code in FrontController.php, but was enable to find it. The fill is in override/classes/FrontController.php right ?

 

Here is the code :

 

class FrontController extends FrontControllerCore
{
public function preProcess()
{
 self::$smarty->assign('HOOK_AW_PRODUCT',Module::hookExec('awProduct'));
 parent::preProcess();
}
}
?>

 

 

I also have a _FrontController.php file but has a lot of code that does not look at all as your code.

 

For the product-list.tpl,

I've changed anyway the code and this is what i get :

 

4.png

 

 

And here is the code :

 

{if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
 {if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}<span class="price">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span>{/if}
		{/if}

	  {if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.minimal_quantity <= 1 && $product.customizable != 2 && !$PS_CATALOG_MODE}
 {if ($product.allow_oosp || $product.quantity > 0)}
  <a class="exclusive ajax_add_to_cart_button" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart.php')}?add&id_product={$product.id_product|intval}{if isset($static_token)}&token={$static_token}{/if}" title="{l s='Add to cart'}">{l s='Add to cart'}</a>
 {else}
  <span class="exclusive">{l s='Add to cart'}</span>
 {/if}
{/if}

 

 

 

Again, thank you some much for the time your putting in, and i will activate the "notification by email" so that my response wont be that long anymore....

 

Kind regards,

Marc

 

 

ps : i work on prestashop 1.4.4.

Here are the files of directory :

Archive.zip

Edited by Marcwales (see edit history)
Link to comment
Share on other sites

FrontController.php is in root/classes, not in root/override/classes .

 

Without change this file or using the file in override/classes with the correct code you will not be able to get this work as you want.

 

To change the code in override/classes/frontcontroller.php, you will need to copy all the code from the function where the line that i add is placed.

 

The function name is "public function init()" .

 

In this function you have to find some code like this:

$smarty->assign(array(
  'link' => $link,
  'cart' => $cart,
  'currency' => $currency,
  'cookie' => $cookie,
  'page_name' => $page_name,
  'base_dir' => _PS_BASE_URL_.__PS_BASE_URI__,
  'base_dir_ssl' => $protocol_link.Tools::getShopDomainSsl().__PS_BASE_URI__,
  'content_dir' => $protocol_content.Tools::getHttpHost().__PS_BASE_URI__,
  'tpl_dir' => _PS_THEME_DIR_,
  'modules_dir' => _MODULE_DIR_,
  'mail_dir' => _MAIL_DIR_,
  'lang_iso' => $ps_language->iso_code,
  'come_from' => Tools::getHttpHost(true, true).Tools::htmlentitiesUTF8(str_replace('\'', '', urldecode($_SERVER['REQUEST_URI']))),
  'cart_qties' => (int)$cart->nbProducts(),
  'currencies' => Currency::getCurrencies(),
  'languages' => Language::getLanguages(),
  'priceDisplay' => Product::getTaxCalculationMethod(),
  'add_prod_display' => (int)Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
  'shop_name' => Configuration::get('PS_SHOP_NAME'),
  'roundMode' => (int)Configuration::get('PS_PRICE_ROUND_MODE'),
  'use_taxes' => (int)Configuration::get('PS_TAX'),
  'display_tax_label' => (bool)$display_tax_label,
  'vat_management' => (int)Configuration::get('VATNUMBER_MANAGEMENT'),
  'opc' => (bool)Configuration::get('PS_ORDER_PROCESS_TYPE'),
 ));

 

Now you have to add this line of code after the last assign, before "));" :

'PS_CATALOG_MODE' => (bool)Configuration::get('PS_CATALOG_MODE'),

 

Don't forget that you have to copy all your entire function and add the above line of code.

 

For people that use Prestashop Version 1.4.8.3, add this code to your frontcontroller.php in override/classes:

public function init()
{blic
 global $useSSL, $cookie, $smarty, $cart, $iso, $defaultCountry, $protocol_link, $protocol_content, $link, $css_files, $js_files;
 if (self::$initialized)
  return;
 self::$initialized = true;
 // If current URL use SSL, set it true (used a lot for module redirect)
 if (Tools::usingSecureMode())
  $useSSL = $this->ssl = true;
 $css_files = array();
 $js_files = array();
 if ($this->ssl AND !Tools::usingSecureMode() AND Configuration::get('PS_SSL_ENABLED'))
 {
  header('HTTP/1.1 301 Moved Permanently');
  header('Cache-Control: no-cache');
  header('Location: '.Tools::getShopDomainSsl(true).$_SERVER['REQUEST_URI']);
  exit();
 }
 else if (Configuration::get('PS_SSL_ENABLED') AND Tools::usingSecureMode() AND !($this->ssl))
 {
  header('HTTP/1.1 301 Moved Permanently');
  header('Cache-Control: no-cache');
  header('Location: '.Tools::getShopDomain(true).$_SERVER['REQUEST_URI']);
  exit();
 }
 ob_start();
 /* Loading default country */
 $defaultCountry = new Country((int)Configuration::get('PS_COUNTRY_DEFAULT'), Configuration::get('PS_LANG_DEFAULT'));
 $cookieLifetime = (time() + (((int)Configuration::get('PS_COOKIE_LIFETIME_FO') > 0 ? (int)Configuration::get('PS_COOKIE_LIFETIME_FO') : 1)* 3600));
 $cookie = new Cookie('ps', '', $cookieLifetime);
 $link = new Link();
 if ($this->auth AND !$cookie->isLogged($this->guestAllowed))
  Tools::redirect('authentication.php'.($this->authRedirection ? '?back='.$this->authRedirection : ''));
 /* Theme is missing or maintenance */
 if (!is_dir(_PS_THEME_DIR_))
  die(Tools::displayError('Current theme unavailable. Please check your theme directory name and permissions.'));
 elseif (basename($_SERVER['PHP_SELF']) != 'disabled.php' AND !(int)(Configuration::get('PS_SHOP_ENABLE')))
  $this->maintenance = true;
 elseif (Configuration::get('PS_GEOLOCATION_ENABLED'))
  $this->geolocationManagement();
 // Switch language if needed and init cookie language
 if ($iso = Tools::getValue('isolang') AND Validate::isLanguageIsoCode($iso) AND ($id_lang = (int)(Language::getIdByIso($iso))))
  $_GET['id_lang'] = $id_lang;
 Tools::switchLanguage();
 Tools::setCookieLanguage();
 /* attribute id_lang is often needed, so we create a constant for performance reasons */
 if (!defined('_USER_ID_LANG_'))
  define('_USER_ID_LANG_', (int)$cookie->id_lang);
 if (isset($_GET['logout']) OR ($cookie->logged AND Customer::isBanned((int)$cookie->id_customer)))
 {
  $cookie->logout();
  Tools::redirect(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : NULL);
 }
 elseif (isset($_GET['mylogout']))
 {
  $cookie->mylogout();
  Tools::redirect(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : NULL);
 }
 global $currency;
 $currency = Tools::setCurrency();
 /* Cart already exists */
 if ((int)$cookie->id_cart)
 {
  $cart = new Cart((int)$cookie->id_cart);
  if ($cart->OrderExists())
unset($cookie->id_cart, $cart, $cookie->checkedTOS);
  /* Delete product of cart, if user can't make an order from his country */
  elseif (intval(Configuration::get('PS_GEOLOCATION_ENABLED')) AND
 !in_array(strtoupper($cookie->iso_code_country), explode(';', Configuration::get('PS_ALLOWED_COUNTRIES'))) AND
 $cart->nbProducts() AND intval(Configuration::get('PS_GEOLOCATION_NA_BEHAVIOR')) != -1 AND
 !self::isInWhitelistForGeolocation())
unset($cookie->id_cart, $cart);
  elseif ($cookie->id_customer != $cart->id_customer OR $cookie->id_lang != $cart->id_lang OR $cookie->id_currency != $cart->id_currency)
  {
if ($cookie->id_customer)
 $cart->id_customer = (int)($cookie->id_customer);
$cart->id_lang = (int)($cookie->id_lang);
$cart->id_currency = (int)($cookie->id_currency);
$cart->update();
  }
  /* Select an address if not set */
  if (isset($cart) && (!isset($cart->id_address_delivery) || $cart->id_address_delivery == 0 ||
!isset($cart->id_address_invoice) || $cart->id_address_invoice == 0) && $cookie->id_customer)
  {
$to_update = false;
if (!isset($cart->id_address_delivery) || $cart->id_address_delivery == 0)
{
 $to_update = true;
 $cart->id_address_delivery = (int)Address::getFirstCustomerAddressId($cart->id_customer);
}
if (!isset($cart->id_address_invoice) || $cart->id_address_invoice == 0)
{
 $to_update = true;
 $cart->id_address_invoice = (int)Address::getFirstCustomerAddressId($cart->id_customer);
}
if ($to_update)
 $cart->update();
  }
 }
 if (!isset($cart) OR !$cart->id)
 {
  $cart = new Cart();
  $cart->id_lang = (int)($cookie->id_lang);
  $cart->id_currency = (int)($cookie->id_currency);
  $cart->id_guest = (int)($cookie->id_guest);
  if ($cookie->id_customer)
  {
$cart->id_customer = (int)($cookie->id_customer);
$cart->id_address_delivery = (int)(Address::getFirstCustomerAddressId($cart->id_customer));
$cart->id_address_invoice = $cart->id_address_delivery;
  }
  else
  {
$cart->id_address_delivery = 0;
$cart->id_address_invoice = 0;
  }
 }
 if (!$cart->nbProducts())
  $cart->id_carrier = NULL;
 $locale = strtolower(Configuration::get('PS_LOCALE_LANGUAGE')).'_'.strtoupper(Configuration::get('PS_LOCALE_COUNTRY').'.UTF-8');
 setlocale(LC_COLLATE, $locale);
 setlocale(LC_CTYPE, $locale);
 setlocale(LC_TIME, $locale);
 setlocale(LC_NUMERIC, 'en_US.UTF-8');
 if (Validate::isLoadedObject($currency))
  $smarty->ps_currency = $currency;
 if (Validate::isLoadedObject($ps_language = new Language((int)$cookie->id_lang)))
  $smarty->ps_language = $ps_language;
 /* get page name to display it in body id */
 $page_name = (isset($this->php_self) ? preg_replace('/\.php$/', '', $this->php_self) : '');
 if (preg_match('#^'.__PS_BASE_URI__.'modules/([a-zA-Z0-9_-]+?)/(.*)$#', $_SERVER['REQUEST_URI'], $m))
  $page_name = 'module-'.$m[1].'-'.str_replace(array('.php', '/'), array('', '-'), $m[2]);
 $smarty->assign(Tools::getMetaTags($cookie->id_lang, $page_name));
 $smarty->assign('request_uri', Tools::safeOutput(urldecode($_SERVER['REQUEST_URI'])));
 /* Breadcrumb */
 $navigationPipe = (Configuration::get('PS_NAVIGATION_PIPE') ? Configuration::get('PS_NAVIGATION_PIPE') : '>');
 $smarty->assign('navigationPipe', $navigationPipe);
 $protocol_link = (Configuration::get('PS_SSL_ENABLED') OR Tools::usingSecureMode()) ? 'https://' : 'http://';
 $useSSL = ((isset($this->ssl) AND $this->ssl AND Configuration::get('PS_SSL_ENABLED')) OR Tools::usingSecureMode()) ? true : false;
 $protocol_content = ($useSSL) ? 'https://' : 'http://';
 if (!defined('_PS_BASE_URL_'))
  define('_PS_BASE_URL_', Tools::getShopDomain(true));
 if (!defined('_PS_BASE_URL_SSL_'))
  define('_PS_BASE_URL_SSL_', Tools::getShopDomainSsl(true));
 $link->preloadPageLinks();
 $this->canonicalRedirection();
 Product::initPricesComputation();
 $display_tax_label = $defaultCountry->display_tax_label;
 if ($cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')})
 {
  $infos = Address::getCountryAndState((int)($cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));
  $country = new Country((int)$infos['id_country']);
  if (Validate::isLoadedObject($country))
$display_tax_label = $country->display_tax_label;
 }
 $smarty->assign(array(
  'link' => $link,
  'cart' => $cart,
  'currency' => $currency,
  'cookie' => $cookie,
  'page_name' => $page_name,
  'base_dir' => _PS_BASE_URL_.__PS_BASE_URI__,
  'base_dir_ssl' => $protocol_link.Tools::getShopDomainSsl().__PS_BASE_URI__,
  'content_dir' => $protocol_content.Tools::getHttpHost().__PS_BASE_URI__,
  'tpl_dir' => _PS_THEME_DIR_,
  'modules_dir' => _MODULE_DIR_,
  'mail_dir' => _MAIL_DIR_,
  'lang_iso' => $ps_language->iso_code,
  'come_from' => Tools::getHttpHost(true, true).Tools::htmlentitiesUTF8(str_replace('\'', '', urldecode($_SERVER['REQUEST_URI']))),
  'cart_qties' => (int)$cart->nbProducts(),
  'currencies' => Currency::getCurrencies(),
  'languages' => Language::getLanguages(),
  'priceDisplay' => Product::getTaxCalculationMethod(),
  'add_prod_display' => (int)Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
  'shop_name' => Configuration::get('PS_SHOP_NAME'),
  'roundMode' => (int)Configuration::get('PS_PRICE_ROUND_MODE'),
  'use_taxes' => (int)Configuration::get('PS_TAX'),
  'display_tax_label' => (bool)$display_tax_label,
  'vat_management' => (int)Configuration::get('VATNUMBER_MANAGEMENT'),
  'opc' => (bool)Configuration::get('PS_ORDER_PROCESS_TYPE'),
  'PS_CATALOG_MODE' => (bool)Configuration::get('PS_CATALOG_MODE'),
 ));
 // Deprecated
 $smarty->assign(array(
  'id_currency_cookie' => (int)$currency->id,
  'logged' => $cookie->isLogged(),
  'customerName' => ($cookie->logged ? $cookie->customer_firstname.' '.$cookie->customer_lastname : false)
 ));
 // TODO for better performances (cache usage), remove these assign and use a smarty function to get the right media server in relation to the full ressource name
 $assignArray = array(
  'img_ps_dir' => _PS_IMG_,
  'img_cat_dir' => _THEME_CAT_DIR_,
  'img_lang_dir' => _THEME_LANG_DIR_,
  'img_prod_dir' => _THEME_PROD_DIR_,
  'img_manu_dir' => _THEME_MANU_DIR_,
  'img_sup_dir' => _THEME_SUP_DIR_,
  'img_ship_dir' => _THEME_SHIP_DIR_,
  'img_store_dir' => _THEME_STORE_DIR_,
  'img_col_dir' => _THEME_COL_DIR_,
  'img_dir' => _THEME_IMG_DIR_,
  'css_dir' => _THEME_CSS_DIR_,
  'js_dir' => _THEME_JS_DIR_,
  'pic_dir' => _THEME_PROD_PIC_DIR_
 );
 foreach ($assignArray as $assignKey => $assignValue)
  if (substr($assignValue, 0, 1) == '/' OR $protocol_content == 'https://')
$smarty->assign($assignKey, $protocol_content.Tools::getMediaServer($assignValue).$assignValue);
  else
$smarty->assign($assignKey, $assignValue);
 // setting properties from global var
 self::$cookie = $cookie;
 self::$cart = $cart;
 self::$smarty = $smarty;
 self::$link = $link;
 if ($this->maintenance)
  $this->displayMaintenancePage();
 if ($this->restrictedCountry)
  $this->displayRestrictedCountryPage();
 //live edit
 if (Tools::isSubmit('live_edit') AND $ad = Tools::getValue('ad') AND (Tools::getValue('liveToken') == sha1(Tools::getValue('ad')._COOKIE_KEY_)))
  if (!is_dir(_PS_ROOT_DIR_.DIRECTORY_SEPARATOR.$ad))
die(Tools::displayError());

 $this->iso = $iso;
 $this->setMedia();
}

Link to comment
Share on other sites

Hi exadra37,

 

I'm sorry for the late response, i still don't receive any mail from prestahsop that there is a response on the topic.... sending

shit advertising they can but notifie me of a response is impossible.... haha.

 

I've found the code in root/classes/frontcontroller.php and added the line of code.

 

Then i went to product-list.tpl, but still have the problem with the code that seems to be modified by my theme. I don't have the same code as you, here is my code from "right_block" :

 

<div class="right_block">

   {if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
 {if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}<span class="price">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span>{/if}
   {/if}
   {if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.minimal_quantity <= 1 && $product.customizable != 2 && !$PS_CATALOG_MODE}
 {if ($product.allow_oosp || $product.quantity > 0)}
  <a class="exclusive ajax_add_to_cart_button" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart.php')}?add&id_product={$product.id_product|intval}{if isset($static_token)}&token={$static_token}{/if}" title="{l s='Add to cart'}">{l s='Add to cart'}</a>
 {else}
  <span class="exclusive">{l s='Add to cart'}</span>
 {/if}
   {/if}
   <a class="button" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{l s='View'}">{l s='View'}</a>
   {if isset($comparator_max_item) && $comparator_max_item}
 <p class="compare checkbox"><input type="checkbox" onclick="checkForComparison({$comparator_max_item})" class="comparator" id="comparator_item_{$product.id_product}" value="{$product.id_product}" /> <label for="comparator_item_{$product.id_product}">{l s='Select to compare'}</label></p>
   {/if}   
  </div>

 

 

As you can see the "product.available_for_order" is behind a "product.id_product_attribute"... even if i paste your code, i get a fatal error :

 

5.png

 

 

Thanks again for helping me,

I will check every day this topic (not being able to trust presta emailing... :) )

 

Kind regards,

Marc

Link to comment
Share on other sites

You must activate the notifications in your profile... after that you have to subscribe this topic.

 

The Fatal error is because you have some IF condition in your code that is not closed. The IF condition start with {if} and end with {/if}.

 

It says that the condition IF is in line 50. With the changes you made, maybe you have deleted by mistake the end of the condition {/if}.

 

Try to change the code from your last post by this one:

<div class="right_block">
{if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
	<!-- {if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
	<span class="price">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span>
	{/if} -->
	{if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
		<span class="price" style="display: inline;"> tax_enabled = {$tax_enabled}<br/>
		{if !$priceDisplay}{convertPrice price=$product.price}
			{if $tax_enabled  && ((isset($display_tax_label) && $display_tax_label == 1))}
				{l s='Tax Incl.'}
			{else}
				{l s='Tax Excl.'}
			{/if}
		{else}
			{convertPrice price=$product.price_tax_exc}
			{l s='Tax Excl.'}
		{/if}
		</span><br/>
	{/if}
{/if}
{if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.minimal_quantity <= 1 && $product.customizable != 2 && !$PS_CATALOG_MODE}
	 {if ($product.allow_oosp || $product.quantity > 0)}
	  <a class="exclusive ajax_add_to_cart_button" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart.php')}?add&id_product={$product.id_product|intval}{if isset($static_token)}&token={$static_token}{/if}" title="{l s='Add to cart'}">{l s='Add to cart'}</a>
	 {else}
	  <span class="exclusive">{l s='Add to cart'}</span>
	 {/if}
{/if}
<a class="button" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{l s='View'}">{l s='View'}</a>
{if isset($comparator_max_item) && $comparator_max_item}
	 <p class="compare checkbox"><input type="checkbox" onclick="checkForComparison({$comparator_max_item})" class="comparator" id="comparator_item_{$product.id_product}" value="{$product.id_product}" /> <label for="comparator_item_{$product.id_product}">{l s='Select to compare'}</label></p>
{/if}
</div>

 

If you have any problem again, please attach your product-list.tpl to your message or paste all the code.

Link to comment
Share on other sites

As i can see you give me a product-list.tpl without any change... the original one.

 

I changed the file and you can download and try it... if will not work is because your prestashop version do not use this variables:

  • $display_tax_label
  • $tax_enabled

I do not have your prestashop version to look in code if it uses the aboves variables.

product-list.tpl.zip

Link to comment
Share on other sites

Hi exadra37,

 

It is still the same, the "HT" label doesn't show up.... instead i have the "display_tax_label" back.

When i take a look at "product.tpl (which show the "HT" label), i see that it has both variables in it :

 

 

<span class="our_price_display">
 {if $priceDisplay >= 0 && $priceDisplay <= 2}
  <span id="our_price_display">{convertPrice price=$productPrice}</span>
   {if $tax_enabled && ((isset($display_tax_label) && $display_tax_label == 1) OR !isset($display_tax_label))}
    {if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}
   {/if}
 {/if}
 </span>
 {if $priceDisplay == 2}
  <span id="pretaxe_price"><span id="pretaxe_price_display">{convertPrice price=$product->getPrice(false, $smarty.const.NULL)}</span> {l s='tax excl.'}</span>
 {/if}

Link to comment
Share on other sites

  • 7 months later...

the simplest and most primitive method would be to add:

 

{assign var="display_tax_label" value="0"}

 

on the top of the product.tpl template

 

you can repeat this crude method in every template where you do not desire to display the tax label ("tax incl.")

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...