Jump to content

[SOLVED] Can not change rounding under Preferences>General


Recommended Posts

Hi guys, 

Weird stuff today, I disabled SSL temporarily today under Preferences>General and I noticed that rounding is set to "Round up to the nearest value" instead of recommended one "Round up away from zero, when it is half way there". I tried to change it back to recommended value but since than I am gettin "Property Tab->name is empty" when trying to save any change under Preferences>General (actually, it saves every other change there but it doesnt save rounding)
 
Of cource, some of my product`s prices are now increased by 0,01, see image below

1ee2616269cb427ab869daafb2da8455.png
Is there any other way to change rounding to recommended value "Round up away from zero, when it is half way there" other than in Preferences>General.

Thanks in advance!

Regards, 

Vedran

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

You can directly edit the ps_configuration table using phpMyAdmin. Search for the row with the name PS_PRICE_ROUND_MODE and set the value to 2.

 

Hi @rocky 

 

Thanks for your answer, worked like a charm. Much appreciated  :) 

 

Regards, 

 

Vedran

Link to comment
Share on other sites

Hi @rocky, 

I still seem to have issues with rounding. I tried to add a discount to some products but after clicking Save (or Save and stay) PS just redirects to Catalog-Products without saving any of changes I made. So I was hoping you could help me here again :)

Here are error messages I am getting:

Notice: Constant _PS_PRICE_DISPLAY_PRECISION_ already defined in /home/mydomain/public_html/config/config.inc.php on line 118

Notice: Use of undefined constant PS_ROUND_HALF_DOWN - assumed 'PS_ROUND_HALF_DOWN' in /home/mydomain/public_html/classes/Tools.php on line 1717

Notice: Use of undefined constant PS_ROUND_HALF_EVEN - assumed 'PS_ROUND_HALF_EVEN' in /home/mydomain/public_html/classes/Tools.php on line 1718

Notice: Use of undefined constant PS_ROUND_HALF_ODD - assumed 'PS_ROUND_HALF_ODD' in /home/mydomain/public_html/classes/Tools.php on line 1719

Notice: Use of undefined constant PS_ROUND_HALF_UP - assumed 'PS_ROUND_HALF_UP' in /home/mydomain/public_html/classes/Tools.php on line 1721

Notice: Use of undefined constant PS_ROUND_HALF_UP - assumed 'PS_ROUND_HALF_UP' in /home/mydomain/public_html/classes/Tools.php on line 1723

Also, the other thay when I was editing database, I noticed that my database prefix is PR. Is that a problem?

Regards, 

Vedran

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

It seems your PrestaShop installation is corrupted. You should have the following in config/defines.inc.php (assuming you're using PrestaShop v1.6.1.8):

define('PS_ROUND_UP', 0);
define('PS_ROUND_DOWN', 1);
define('PS_ROUND_HALF_UP', 2);
define('PS_ROUND_HALF_DOWN', 3);
define('PS_ROUND_HALF_EVEN', 4);
define('PS_ROUND_HALF_ODD', 5);

/* Backward compatibility */
define('PS_ROUND_HALF', PS_ROUND_HALF_UP);

Your database prefix shouldn't make any difference. It just means you'll need to edit PR_configuration instead of ps_configuration.

  • Like 1
Link to comment
Share on other sites

It seems your PrestaShop installation is corrupted. You should have the following in config/defines.inc.php (assuming you're using PrestaShop v1.6.1.8):

define('PS_ROUND_UP', 0);
define('PS_ROUND_DOWN', 1);
define('PS_ROUND_HALF_UP', 2);
define('PS_ROUND_HALF_DOWN', 3);
define('PS_ROUND_HALF_EVEN', 4);
define('PS_ROUND_HALF_ODD', 5);

/* Backward compatibility */
define('PS_ROUND_HALF', PS_ROUND_HALF_UP);

Your database prefix shouldn't make any difference. It just means you'll need to edit PR_configuration instead of ps_configuration.

 

First of all, thank you for your quick reply. You are absolutely right, my round defines in config/defines.inc.php were:

define('PS_ROUND_UP', 0);
define('PS_ROUND_DOWN', 1);
define('PS_ROUND_HALF', 2);

It is 1.6.0.14 but I compared the file with 1.6.1.8 one and it is just like you wrote above. So I changed this to default values and all erros except below one are gone:

Notice: Constant _PS_PRICE_DISPLAY_PRECISION_ already defined in /home/mydomain/public_html/config/config.inc.php on line 118

Here are lines 112-129 from my config/config.inc.php:

/* Include all defines related to base uri and theme name */
require_once(dirname(__FILE__).'/defines_uri.inc.php');

global $_MODULES;
$_MODULES = array();

define('_PS_PRICE_DISPLAY_PRECISION_', Configuration::get('PS_PRICE_DISPLAY_PRECISION'));
define('_PS_PRICE_COMPUTE_PRECISION_', _PS_PRICE_DISPLAY_PRECISION_);

if (Configuration::get('PS_USE_HTMLPURIFIER'))
	require_once (_PS_TOOL_DIR_.'htmlpurifier/HTMLPurifier.standalone.php');

/* Load all languages */
Language::loadLanguages();

/* Loading default country */
$default_country = new Country(Configuration::get('PS_COUNTRY_DEFAULT'), Configuration::get('PS_LANG_DEFAULT'));
$context->country = $default_country;

Any change I should make here?

Regards, 

 

Vedran

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

 

That code looks fine to me. For some reason, _PS_PRICE_DISPLAY_PRECISION_ is already defined when it reaches line 118. Check whether config/defines_uri.inc.php defines that constant.

 

 

Nothing similar in config/defines_uri.inc.php, it is actually in config/defines.inc.php, solved it using this post by El Patron so no errors at all now.

 

Thank you very much for your help, I hope this thread will help someone else. I will mark it solved.

 

Regards,

 

Vedran

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...