Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Round Price Rate Topic   - - - - -

 
  • 1210891
  • Advanced Member
  • Trial users
  • Join Date: 14-Mar 16
  • 75 posts

Posted 06 June 2016 - 06:09 AM #1

Hi,

i want to ask about round that work on price

can i make the price's round to below? 

example :

product A have price 8,5 then it will be shown as 8

product B have price 9.8 then it will be shown as 9

 

Thanks



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19161 posts

Posted 06 June 2016 - 07:39 AM #2

Hi,

i want to ask about round that work on price

can i make the price's round to below? 

example :

product A have price 8,5 then it will be shown as 8

product B have price 9.8 then it will be shown as 9

 

Thanks

 

I am afraid, additional code modifications are required to do it. It is not possible to enable this feature on the clean installation


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • 1210891
  • Advanced Member
  • Trial users
  • Join Date: 14-Mar 16
  • 75 posts

Posted 06 June 2016 - 08:15 AM #3

I am afraid, additional code modifications are required to do it. It is not possible to enable this feature on the clean installation

 

well i've been think to use php int type casting, but i don't know if php type casting work on smarty template



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19161 posts

Posted 06 June 2016 - 08:23 AM #4

FYI, you can change the amount of digits after the decimal sign in the currency settings:

 

http://prntscr.com/bcwx73

 

Hope it can help you.


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • 1210891
  • Advanced Member
  • Trial users
  • Join Date: 14-Mar 16
  • 75 posts

Posted 06 June 2016 - 09:32 AM #5

FYI, you can change the amount of digits after the decimal sign in the currency settings:

 

http://prntscr.com/bcwx73

 

Hope it can help you.

 

well right now i use that method, but it only make normal round, which make 0,5 or higher will be 1

actually i found php function that can solve this (floor function), but is this function can work on cs cart?



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19161 posts

Posted 06 June 2016 - 02:39 PM #6

well right now i use that method, but it only make normal round, which make 0,5 or higher will be 1

actually i found php function that can solve this (floor function), but is this function can work on cs cart?

 

A lot of functions are used to calculate different prices/ discounts/ taxes. So it should be tested carefully


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • 1210891
  • Advanced Member
  • Trial users
  • Join Date: 14-Mar 16
  • 75 posts

Posted 07 June 2016 - 01:49 AM #7

A lot of functions are used to calculate different prices/ discounts/ taxes. So it should be tested carefully

 

hmm, what if i only want to change on "Grand Total" value and not on other value ? is this possible ?



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19161 posts

Posted 07 June 2016 - 08:00 AM #8

Yes, please check the fn_calculate_cart_content function in the app/functions/fn.cart.php file

 

You should round the $cart['total'] parameter. It is better to use hooks in this function


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • 1210891
  • Advanced Member
  • Trial users
  • Join Date: 14-Mar 16
  • 75 posts

Posted 13 June 2016 - 06:07 AM #9

Yes, please check the fn_calculate_cart_content function in the app/functions/fn.cart.php file

 

You should round the $cart['total'] parameter. It is better to use hooks in this function

 

Thanks, it works !!!



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11266 posts

Posted 14 June 2016 - 12:22 AM #10

But if you use Paypal express or some other payment methods, they will fail because the order total doesn't sum up to the items + shipping.

 

As Ecom suggested, very careful testing is required if you're just going to modify it in templates or after business rule calculations.

 

You could just change the type of 'price' in the cscart_product_prices and cscart_ult_product_prices tables to be an INT.  But again, very careful testing would be required and may fall apart after option modifiers or other things like discounts that affect price.

 

Just curious, what is the reason to round down (floor)?


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • 1210891
  • Advanced Member
  • Trial users
  • Join Date: 14-Mar 16
  • 75 posts

Posted 14 June 2016 - 01:36 AM #11

But if you use Paypal express or some other payment methods, they will fail because the order total doesn't sum up to the items + shipping.

 

As Ecom suggested, very careful testing is required if you're just going to modify it in templates or after business rule calculations.

 

You could just change the type of 'price' in the cscart_product_prices and cscart_ult_product_prices tables to be an INT.  But again, very careful testing would be required and may fall apart after option modifiers or other things like discounts that affect price.

 

Just curious, what is the reason to round down (floor)?

 

Hi,

just as your statement, after i implement this on my online store, paypal is reject payment of all order

i need to round down just for grand total because my offline store use this method

so i just need to floor grand total price and not for per item price

can i use other method?

i've been thinking about using "global discount" to substract this, but i'm not sure for this one

 

Thanks



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11266 posts

Posted 14 June 2016 - 04:03 AM #12

Sorry, I don't have any suggestions for you.  You might try using a 'product_prices' hook or other means to round down.  But again, unless you store the prices as the values you actually want to use then you're going to run into issues.  And you won't get them to be integers if you use any discounts or otherwise adjust by percentage.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19161 posts

Posted 14 June 2016 - 08:41 AM #13

Hi,

just as your statement, after i implement this on my online store, paypal is reject payment of all order

i need to round down just for grand total because my offline store use this method

so i just need to floor grand total price and not for per item price

can i use other method?

i've been thinking about using "global discount" to substract this, but i'm not sure for this one

 

Thanks

The global discount is a good idea, but there is no ability to achieve it in default CS-Cart. If this functionality is critical for you, we can develop this modification. Please write us in "Quote request" form of our website.

 

Thank you.


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • 1210891
  • Advanced Member
  • Trial users
  • Join Date: 14-Mar 16
  • 75 posts

Posted 20 June 2016 - 01:53 AM #14

The global discount is a good idea, but there is no ability to achieve it in default CS-Cart. If this functionality is critical for you, we can develop this modification. Please write us in "Quote request" form of our website.

 

Thank you.

 

Hi,

Thanks for your information, after i discuss this with my team, looks like my offline store will use same format as cs cart

so it price is not rounded

 

Thanks