how to use custom points to pay order partially

  • Posts: 10
  • Thank you received: 1
9 years 1 week ago #220889

-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.4.4
-- Error-message(debug-mod must be tuned on) -- : Nothing

Hi, I'm trying to create a system of loyalty within my E-Commerce. I managed to solve almost everything, but there is a small problem.

When my customers use their points, I would like to enable them to choose the precise amount of points to be used in an order.

How could I do?

SORRY FOR MY ENGLISH BUT I'M USING GOOGLE TRANSLATOR

I await your response as soon as possible.

Best regards,
Marco

Please Log in or Create an account to join the conversation.

  • Posts: 10
  • Thank you received: 1
9 years 1 week ago #221041

As always, i solved my problem by myself creating a new code in your "userpoints.php" file in "plugins/hikashoppayment/userpoints/"

AUTHOR: Marco Cusano
TESTED ON
JOOMLA: 3.4.4
HIKASHOP: 2.6.0
DESCRIPTION: This change will be able you to select custom points of your maximum accumulated points using a variable in the checkout url (For example: yourwebsites.com/checkout/?points=127)
HOW TO: You can use following replace guide to personalize your "userpoints.php" file or use the "userpoints.php" that i have included in this "*.zip".
FILE: root/plugins/hikashoppayment/userpoints/userpoints.php
FUNCTION: checkPoints(&$order, $showWarning = false)
LINE: 1393 || 652
REPLACE THIS:

                if($points < (int)$userPoints)
		
			return (int)$points;

		return (int)$userPoints;

WITH THIS:
                $maxValue = (int)$userPoints;
		
		$usedPoints = 0;
		
		if($_GET['points']) { $usedPoints = $_GET['points']; }
		if($usedPoints > $maxValue) { $usedPoints = $maxValue; }
		
		if($points < (int)$userPoints)
		
			return (int)$points;

		return (int)$usedPoints;

i hope that this guide help you to solve this problem. I have also attached a zip file that contains all lineguide that you need.

File Attachment:

File Name: How_to_pay...mers.zip
File Size:8 KB



Best regards,
Marco

Attachments:
Last edit: 9 years 6 days ago by Syglob. Reason: edit line of replace

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 1 week ago #221064

Hi,

If you wait for our response, just wait ; please do not send a message through the "contact us" form around 5 minutes after your post submission.
Also, please do not send private messages to moderators in order to have an answer to your message.

If you take a look at my signature, you will see:

HikaMarket & HikaSerial developer / HikaShop dev team.
( Also helping the HikaShop support team when having some time or couldn't sleep )

So, there is no need some send me any single private message because it is not my job to answer on the HikaShop forum.
It won't give you a faster answer and receiving such kind of PM does not give me the wish to make a reply at 1AM (and 20min after your post...)

As you might see ; the support team reply to older messages first ; so when I want to help the support team, I start with the older messages. We generally reply under 24 hours.
More than that ; please do not create topic in uppercase, it is consider as shouting and does not give a really good impression.

I hope that I'm clear enough for these points.

Now about your question ; it has been already posted few times in that forum.
And the answer was : that is not currently possible, it requires some modification in the point plugin.

It looks like you found it and I took a look at your modifications proposal.
But regarding the internal code of the plugin ; I'm not sure it will work correctly because there is nothing which will store the value in the user session ; like for the setting "no_virtual_coupon".
As you can see in the function "onAfterCartShippingLoad" of the plugin, the session is read in order to know if the points are used or not. Because customer action can force a reload of the cart and the reprocess of the cart additional ; if you do not keep the custom point value in the session the user will re-use all of his points on next refresh.

Using a specific value of points is already in the HikaShop TODO list ; but such kind of development require time and tests.
It also require a good interface for the customer in the checkout.

And mostly because I'm currently hardly working on HikaShop 3 with the new Cart/Checkout system ; I wanted to wait for the new features in order to perform some improvement on the point system.
Specially because the checkout modules will be able to be "self-sufficient" with ajax submission, etc.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 10
  • Thank you received: 1
9 years 6 days ago #221120

Hi Jerome,
First, send more than one copy of the problem, through the contact section, was, previously, one of your suggestions, in order to ensure a more rapid response to our problems, so do not understand why you explanation about it!

Second, there is a little difference in waiting five minutes instead of that 24 + h. Via private message was just a message wondering where your help, because you were online, nothing more!

Third, the solution offered by me, works perfectly, using the "virtual coupon = true", calculating the use of the points via URL variable and, in the case in which the URL points correspond to points greater than those which a user, the use of points will correspond to the maximum number of points accumulated.

Before opening this discussion I had checked on your forum if there was some solution, but nothing! In fact, on the only I had found, I posted my comment where I explained that I had found a solution!

Moreover, sifting through your forum, the same issue there was placed more than 6 months ago, so seriously mean to tell me that it is better to wait for an update to your HikaShop? To solve this problem (perhaps) in a few years?

If what I have done has created much displeasure then I apologize :(

Sorry again for the English, but I still use Google Translator

Best regards,
Marco

Last edit: 9 years 6 days ago by Syglob. Reason: marking some words

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 6 days ago #221177

Hi,

Each day in this forum, hundred of messages are posted.
And there is also hundred of emails which are sent to the support.
I just want you to understand that if each user send private message when a moderator is "online" in order to have an answer, it won't help (you and the moderators).

About your patch ; I'm afraid that I can't say it is working perfectly for every cases.
During your tests, I am sure that it was working fine, that is not the point.
I'm just saying that if there is the usage of the session for the "no_virtual_coupon", it is for a good reason.

If you take a look at the HikaShop changelog ; you'll see a huge list of improvements and new features for each release.
www.hikashop.com/support/support/documen...ashop-changelog.html

"User Points" has been introduced in HikaShop 2.2.1 (2 years ago) and I personally made that development for free, during my free time.
Since that day, the plugin has been improved several time : with the support of the checkout module, the user choice to not using point, etc etc. That plugin is still evolving and as you can imagine, it requires time for that.
And the "user points" plugin is one of my plugins, my creations.. And that is not a plugin which make me live (once again, I did it for free).

HikaShop is an open-source project, so other developers are free to contribute.
I appreciate (and I'm sure that the rest of the HikaShop dev team appreciate it too) your contribution ; but if we want to integrate it into the HikaShop packages, we have to be sure that the feature is completed, fully tested and provide also settings and user interface.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: Syglob

Please Log in or Create an account to join the conversation.

Time to create page: 0.063 seconds
Powered by Kunena Forum