[Skip to main content](#vessel-content)

#   Userpoints payment in percentage

##

- **[pepecortez](/forum/user/31475-pepecortez "View pepecortez's Profile")**
- [![pepecortez's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/31475-pepecortez "View pepecortez's Profile") Topic Author
- [ Offline](/forum/user/31475-pepecortez)

Less More

- Posts: 171
- Thank you received: 9
-
-

10 years 8 months ago [\#233094](#233094) by [pepecortez](/forum/user/31475-pepecortez "View pepecortez's Profile")  *[Userpoints payment in percentage](/forum/29-payment-methods/883032-userpoints-payment-in-percentage#233094 "-- HikaShop version -- : 2.6.1.  Hi!  We're using our current points payment system in the following way: there are 2 ways to use the users points: 100 points for a 5% coupon and 200 points for a 10%.  In Hikashop's userpoints payment settings now there's no option to change fix point-ratio to using it in percent. But if I set the parameters like the attached one (System: AUP, 1 point = 0.05 €, group points: 100, max. points: 200, partial payment is enabled) the current plugin is counting like we need, just only showing fix currency (5 € or 10 €) and not the wanted (5% or 10%).  Could anyone be so kind to help me in /plugins/hikashoppayment/userpoints/userpoints.php which lines should be edited and how to reach our goals?  Thanks in advance, PePe")* was created by *[pepecortez](/forum/user/31475-pepecortez "View pepecortez's Profile")*

-- HikaShop version -- : 2.6.1.

Hi!

We're using our current points payment system in the following way: there are 2 ways to use the users points: 100 points for a 5% coupon and 200 points for a 10%.

In Hikashop's userpoints payment settings now there's no option to change fix point-ratio to using it in percent. But if I set the parameters like the attached one (System: AUP, 1 point = 0.05 €, group points: 100, max. points: 200, partial payment is enabled) the current plugin is counting like we need, just only showing fix currency (5 € or 10 €) and not the wanted (5% or 10%).

Could anyone be so kind to help me in /plugins/hikashoppayment/userpoints/userpoints.php which lines should be edited and how to reach our goals?

Thanks in advance,
PePe

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI5LXBheW1lbnQtbWV0aG9kcy84ODMwMzItdXNlcnBvaW50cy1wYXltZW50LWluLXBlcmNlbnRhZ2U/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86593
- Thank you received: 14334
-
-

10 years 8 months ago [\#233108](#233108) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Userpoints payment in percentage](/forum/29-payment-methods/883032-userpoints-payment-in-percentage#233108 "-- HikaShop version -- : 2.6.1.  Hi!  We're using our current points payment system in the following way: there are 2 ways to use the users points: 100 points for a 5% coupon and 200 points for a 10%.  In Hikashop's userpoints payment settings now there's no option to change fix point-ratio to using it in percent. But if I set the parameters like the attached one (System: AUP, 1 point = 0.05 €, group points: 100, max. points: 200, partial payment is enabled) the current plugin is counting like we need, just only showing fix currency (5 € or 10 €) and not the wanted (5% or 10%).  Could anyone be so kind to help me in /plugins/hikashoppayment/userpoints/userpoints.php which lines should be edited and how to reach our goals?  Thanks in advance, PePe")*

Hi,

Hard to say. The code is quite complex and I think it requires modifications in several places in the file, especially that the case you want isn't obvious.

The points to be used 100 or 200 is calculated with the function:
$check = $this-&gt;checkPoints($order);
You'll find it at several places in the file.
In each place, there is something like that:
$check * $method-&gt;payment_params-&gt;value
to multiply the number of points by the rate.
So you need to change the rate $method-&gt;payment_params-&gt;value by the percentage of the order value.
The total of the order will also be in different variables each time. For some, it will be in $order-&gt;order_full_price, for others it will be in Code:

$cart-&gt;full_total-&gt;prices[0]-&gt;price_value_with_tax

.

The following user(s) said Thank You: [pepecortez](/forum/user/31475-pepecortez "View pepecortez's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI5LXBheW1lbnQtbWV0aG9kcy84ODMwMzItdXNlcnBvaW50cy1wYXltZW50LWluLXBlcmNlbnRhZ2U/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[pepecortez](/forum/user/31475-pepecortez "View pepecortez's Profile")**
- [![pepecortez's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/31475-pepecortez "View pepecortez's Profile") Topic Author
- [ Offline](/forum/user/31475-pepecortez)

Less More

- Posts: 171
- Thank you received: 9
-
-

10 years 8 months ago [\#233226](#233226) by [pepecortez](/forum/user/31475-pepecortez "View pepecortez's Profile")  Replied by *[pepecortez](/forum/user/31475-pepecortez "View pepecortez's Profile")* on topic *[Userpoints payment in percentage](/forum/29-payment-methods/883032-userpoints-payment-in-percentage#233226 "-- HikaShop version -- : 2.6.1.  Hi!  We're using our current points payment system in the following way: there are 2 ways to use the users points: 100 points for a 5% coupon and 200 points for a 10%.  In Hikashop's userpoints payment settings now there's no option to change fix point-ratio to using it in percent. But if I set the parameters like the attached one (System: AUP, 1 point = 0.05 €, group points: 100, max. points: 200, partial payment is enabled) the current plugin is counting like we need, just only showing fix currency (5 € or 10 €) and not the wanted (5% or 10%).  Could anyone be so kind to help me in /plugins/hikashoppayment/userpoints/userpoints.php which lines should be edited and how to reach our goals?  Thanks in advance, PePe")*

I tried modifying the paramteres you mentioned, but with no luck.
Also tried modifying around line 339: Code:

$newCoupon-&gt;discount_flat_amount = $check * $this-&gt;payment_params-&gt;value;

to Code:

$newCoupon-&gt;discount_percent_amount = $check * $this-&gt;payment_params-&gt;value;

it also do not helped me as both modifications worked like it hasn't been changed anything.
So I tried to set the parameters you mentioned to a fix parameter, but it's still working like it hasn't been changed. Maybe I'm editing wrong lines?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI5LXBheW1lbnQtbWV0aG9kcy84ODMwMzItdXNlcnBvaW50cy1wYXltZW50LWluLXBlcmNlbnRhZ2U/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86593
- Thank you received: 14334
-
-

10 years 8 months ago [\#233236](#233236) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Userpoints payment in percentage](/forum/29-payment-methods/883032-userpoints-payment-in-percentage#233236 "-- HikaShop version -- : 2.6.1.  Hi!  We're using our current points payment system in the following way: there are 2 ways to use the users points: 100 points for a 5% coupon and 200 points for a 10%.  In Hikashop's userpoints payment settings now there's no option to change fix point-ratio to using it in percent. But if I set the parameters like the attached one (System: AUP, 1 point = 0.05 €, group points: 100, max. points: 200, partial payment is enabled) the current plugin is counting like we need, just only showing fix currency (5 € or 10 €) and not the wanted (5% or 10%).  Could anyone be so kind to help me in /plugins/hikashoppayment/userpoints/userpoints.php which lines should be edited and how to reach our goals?  Thanks in advance, PePe")*

Hi,

As I said in my previous message, you'll find the checkPoints function at several places in the file.
So if you modified the code in one place and it didn't do anything, it means that you need to modify it somewhere else.

The following user(s) said Thank You: [pepecortez](/forum/user/31475-pepecortez "View pepecortez's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI5LXBheW1lbnQtbWV0aG9kcy84ODMwMzItdXNlcnBvaW50cy1wYXltZW50LWluLXBlcmNlbnRhZ2U/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[pepecortez](/forum/user/31475-pepecortez "View pepecortez's Profile")**
- [![pepecortez's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/31475-pepecortez "View pepecortez's Profile") Topic Author
- [ Offline](/forum/user/31475-pepecortez)

Less More

- Posts: 171
- Thank you received: 9
-
-

10 years 8 months ago -  10 years 8 months ago [\#233384](#233384) by [pepecortez](/forum/user/31475-pepecortez "View pepecortez's Profile")  Replied by *[pepecortez](/forum/user/31475-pepecortez "View pepecortez's Profile")* on topic *[Userpoints payment in percentage](/forum/29-payment-methods/883032-userpoints-payment-in-percentage#233384 "-- HikaShop version -- : 2.6.1.  Hi!  We're using our current points payment system in the following way: there are 2 ways to use the users points: 100 points for a 5% coupon and 200 points for a 10%.  In Hikashop's userpoints payment settings now there's no option to change fix point-ratio to using it in percent. But if I set the parameters like the attached one (System: AUP, 1 point = 0.05 €, group points: 100, max. points: 200, partial payment is enabled) the current plugin is counting like we need, just only showing fix currency (5 € or 10 €) and not the wanted (5% or 10%).  Could anyone be so kind to help me in /plugins/hikashoppayment/userpoints/userpoints.php which lines should be edited and how to reach our goals?  Thanks in advance, PePe")*

Hi Nicolas,

Thanks for the guidelines, it helped finally a lot. It was a long play, as there were several problems. I don't know wether these emerges in fix point discount as well, but I run in a few things.

I write these lines for a memo for myself, but hopefully it helps for someone else as well.
Firstly I modified the file /plugins/hikashoppayment/userpoints/userpoints.php around line 285. the $coupon variable:
Code:

if($check !== false &amp;&amp; $check &gt; 0) { if(isset($cart-&gt;order_currency_id)) $currency_id = $cart-&gt;order_currency_id; else $currency_id = hikashop_getCurrency(); $coupon = $check * $this-&gt;payment_params-&gt;value /100 * $cart-&gt;full_total-&gt;prices[0]-&gt;price_value_without_shipping_with_tax; if (empty($cart-&gt;full_total-&gt;prices[0]-&gt;price_value_without_shipping_with_tax)){ $coupon = $check * $this-&gt;payment_params-&gt;value /100 * $cart-&gt;full_total-&gt;prices[0]-&gt;price_value_with_tax; }

After a few hours I also noticed, that as I use the plugin to let user to use the Point payment as partial payment, it does not able to count the other payment option's price, so finally I decided to write out to users that discount can be used for the product price but not for payment and shipping price.

After that I had to modify the /plugins/hikashop/userpoints/userpoints.php around line 870., because it used to show the price_value_without_payment_with_tax variable's fix percentage always, but it was not the same amount depending on wether the user pushed yes or no on the radio buttons.
Code:

if(!empty($consume)) { if(isset($cart-&gt;order_currency_id)) $currency_id = $cart-&gt;order_currency_id; else $currency_id = hikashop_getCurrency(); $br_fizetes_ara = $cart-&gt;full_total-&gt;prices[0]-&gt;price_value_without_shipping_with_tax * ($consume['points']/20/100); if (empty($cart-&gt;full_total-&gt;prices[0]-&gt;price_value_without_shipping_with_tax)){ $br_fizetes_ara = $cart-&gt;full_total-&gt;prices[0]-&gt;price_value_with_tax * ($consume['points']/20/100); } if ($use_coupon == 1) { if (empty($cart-&gt;full_total-&gt;prices[0]-&gt;price_value_without_shipping_with_tax)){ $regikedvezmenyertek = $br_fizetes_ara / (1-($consume['points']/20/100)); } else{ $regikedvezmenyertek = $br_fizetes_ara; } $discount = $currencyClass-&gt;format($regikedvezmenyertek, $currency_id); } else { $discount = $currencyClass-&gt;format($br_fizetes_ara, $currency_id);} }

Last edit: 10 years 8 months ago by [pepecortez](/forum/user/31475-pepecortez "View pepecortez's Profile").

The following user(s) said Thank You: [nicolas](/forum/user/63-nicolas "View nicolas's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI5LXBheW1lbnQtbWV0aG9kcy84ODMwMzItdXNlcnBvaW50cy1wYXltZW50LWluLXBlcmNlbnRhZ2U/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.055 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
