Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Converting Points and Rewards system for osC BS


Tsimi

Recommended Posts

48 minutes ago, Tsimi said:

Never tested with the PWA addon. Will install it once and see how it goes.
How do you expect it to work with the PWA addon? Give points to guests?

Never really imagine it working with PWA until I thought about I have @burt key system installed which allows guests to leave reviews. 

By the way, how does the Auto Credit script work @raiwa?

Link to comment
Share on other sites

@discxpress

I am not familiar with burt's key system but I did install the PWA addon from raiwa and I placed a couple of test orders.

Well, the Points and Rewards addon works just fine even with the PWA installed. However it will need some additional modifications to handle certain situations that are only happening with the PWA addon for example;

1.) When placing an order as guest and at the end you refuse to create an account the points should be also deleted from the pending table same with the customer info. This doesn't happen at the moment. So even you don't have that guest's data the points are there on the pending page.

2.) Not sure if it happens because I use the same PC to place the test orders but the Referral part shows only one time in the payment page when going as guest to checkout. Ideally it should show every time a guest goes to checkout. A registered customer sees that Referral part only on the first order.

The good thing is if a guest decides to set a password at the end of the checkout process the points can be written in to that new account and the customer can benefit from the points system even if he initially went as guest to checkout.

Not sure if there are more issues with it though. It will need more thorough testing to be 100% sure. But from what I have seen thus far except those 2 mentioned points all works as it should.

Edited by Tsimi
Link to comment
Share on other sites

@Tsimi, @discxpress, I'll also test it and see if we can add a optional support for PWA in the next update to cover these points you found.

Link to comment
Share on other sites

8 hours ago, CGhoST said:

Edit: If everything is green when installed in Header Tags does that mean i don't have to do manual edits?

Edit: I am getting in product info the point info line listed 3 times underneath each other.

@CGhoST,

It shouldn't matter if you uninstalled the ht module and reinstalled several times if your original file was ok.

If the content call is repeated, it may be your original file had either code from previeous (develop) versions still present or a real unusual modification applied.

Anyway, check this file comparing to the manual edit in the instructions like @Tsimi said.

If you observe any incorrect result, check the files even you got green success messages when you installed the ht module.

Link to comment
Share on other sites

@raiwa

The first fix to delete the pending points if the guest doesn't want to create an account works.

The second fix however shows the referral part every time now. Even as a registered customer which should not happen if you once referred someone already as registered user. As guest it shows now every time as it should be.

Link to comment
Share on other sites

@CGhoST

Sorry another typo was inside the previous code. I just hide that post to not confuse you.

Use this inside the points payment module.

FIND:

    function update_status() {
      global $order, $cart, $max_points;

REPLACE WITH:

    function update_status() {
      global $order, $cart, $max_points, $PHP_SELF;
	  
	  if(basename($PHP_SELF) == 'edit_orders.php') {
		 require_once('../includes/functions/redemptions.php'); 
	  }

That should do it now.

Link to comment
Share on other sites

@Tsimi,

Pushed the PWA Guest Checkout support.

 

1.:

10 hours ago, Tsimi said:

The first fix to delete the pending points if the guest doesn't want to create an account works.

I added some more checks:

  • PWA module enabled?
  • Customer is not guest anymore? (opted in to set password and converted his guest account into regular account) -> points will not be deleted.
  • There is a scenario when the guest customer arrived to checkout success and opts to keep his account -> goes to set password -> until he set the password, his account is still flagged as guest account and if in this time lapse (from order process to set password) the admin opens the pending points page, the points would be deleted. So I added a check for "date_purchased" if less than 15 min ago, the points will not be deleted.
    This gives the guest 15 minutes to set the password. If you feel this is not enough we can increase it.
  • The admin will see during these 15 min the pending points of a guest and can validate them. I believe it is not a problem since a guest account will be deleted on continue from checkout success, or if he doesn't set the password or if the same customer will do a new order, so he never can redeem them.

2.:

10 hours ago, Tsimi said:

The second fix however shows the referral part every time now. Even as a registered customer which should not happen if you once referred someone already as registered user. As guest it shows now every time as it should be.

I believe there is a missunderstanding here. Why should a guest be allowed to refer on all orders and not only the first order like a regular customer?

I changed the coding now to check for existing guest orders with the same e-mail like the actual guest order. This check applies only if PWA checkout is installed and active and the session is guest registered. Otherwise the standard tep_count_customer_orders functions is used like before (uses customer_id to check).

It works for me, please double check.

3. I added a Guest checkout topic to the my_points_help faq. For now I added the english text only, please revise if it's ok. I'll then add the spanish translation and the german is for you as you like it so much :biggrin:

4. The PWA guest checkout needs anyway an update. I'll add info text for points and rewards to the checkout success module. So the guest customer gets encouraged to opt in for a regular account to be able to redeem his shopping points.

rgds

Rainer

PS: I also hide the old code suggestions to avoid confusion

Edited by raiwa
Link to comment
Share on other sites

@raiwa

1. sounds good to me.

2. On my initial test run the referral part was showing every time even as registered customer that has already referred someone already.
    I'll test this again with your new code and report back.

3. :dry: OK, OK I'll do my best. :wink:

 

Link to comment
Share on other sites

2 hours ago, CGhoST said:

If a customer places an order and in admin on orders you have changed status to Delivered. Do the points get added automatically to the customer or do you have to put a tick on que or delete?

As far I know you have to confirm the points manually no matter the order status. Dan Cole mentioned also something like when status is set to delivered or complete the points should be automatically confirmed.

Maybe add something like a status id check? Where a store owner can type in the settings at what status id the points should be confirmed.

@raiwa what you think about that idea?

Link to comment
Share on other sites

@Tsimi

I was thinking something like that also. It would be good if delivered or whatever final transaction is that the points are automatically put into account. Because if you forget to place the tick then no points are awarded. It would be good to have that option.

Link to comment
Share on other sites

First of all, Congrats!!! What a great work!

Now, just installing and testing. On my side, I realize that some minor bugs to be fixed in the Spanish translation. 

Also, I found this when installed:

Fatal error: Cannot redeclare get_pages() (previously declared in C:\wamp\www\TT2TEST\includes\modules\store\st_swcleaner.php:620) in C:\wamp\www\TT2TEST\includes\modules\header_tags\ht_points_rewards.php on line 843

It seems that there is some kind of incompatibility with Sloppy Word Cleaner. First, I disabled SWC with the same result. Then, I uninstalled it and now is working.

Again, many thanks for your work.

Shopowner, not coder, experienced copypaster  :D

Link to comment
Share on other sites

1.

@CGhoST, @Tsimi,

For the order editor fix, I believe this solution would be more generic (admin can be hosted on a different domain/subdomain/directory structure in rare cases):

    function update_status() {
      global $order, $cart, $max_points, $PHP_SELF;
	  
      if( basename($PHP_SELF) == 'edit_orders.php' && !function_exists('check_points_redemtion') ) {
        require_once(DIR_FS_CATALOG . 'includes/functions/redemptions.php'); 
      }

 

2.

@CGhoST, @Tsimi, @LeeFoster, @TITO4,

Status check and auto tick: Confirm Pending Points: and Que and Delete:

sounds good to me too. Should both options be checked?

We could do like this:

  • Add configuration entry to ht point and rewards module: coma separated list of Status ID's. If left empty, no auto tick.
  • If one of these status is selected in orders, both options will be auto ticked.
  • must be done by javascript in orders.php

If you agree, I'll go for it

3.

@TITO4,

Thank you for the reports

  • Can you send me the spanish files with the bug fixes by mail
  • get_pages  error: Yes, this function name needs to be changed. Please find in ht_points_and_rewards all instances of "get_pages" and change them to "get_pages_pr". (3 instances). THis should fix it.

 

Link to comment
Share on other sites

56 minutes ago, raiwa said:

2.

@CGhoST, @Tsimi, @LeeFoster, @TITO4,

Status check and auto tick: Confirm Pending Points: and Que and Delete:

sounds good to me too. Should both options be checked?

We could do like this:

  • Add configuration entry to ht point and rewards module: coma separated list of Status ID's. If left empty, no auto tick.
  • If one of these status is selected in orders, both options will be auto ticked.
  • must be done by javascript in orders.php

If you agree, I'll go for it

 

Sounds ok to me.

Link to comment
Share on other sites

@raiwa

Regarding 1.

Should such fixes for various addons be mentioned inside the install manual?
I don't really want to add code fixes for 265165433818 addons which might clutter up the files. I remember, the Order Editor addon was one of those addons that had various code pieces inside to fix compatibility for addons that maybe a few use.
Mention it inside the install manual however seems to be a good idea don't you think?

Regarding 2.

I thought about a similar approach, add an empty entry inside the HT module where admins/shop owners can doe the following.
Add a Status ID activates that function and confirms the pending points if the order is set to that certain Status ID. If the setting entry is empty then no auto confirmation happens at any Status ID.
Not sure what and Que and Delete do function wise.

and Que means confirm points and add it to the My Account listing? and Delete means confirm points but don't show inside the My Account listing? Is that correct?

If that is the case then maybe if selected Status ID = true  -> and Que only. So that customers can see that their points have been added to their account.

Regarding 3.

Is that fix ( get_pages_pr ) something you gonna implement into the current code base of the addon?
Or is this like case in 1. ?

 

@TITO4

Thanks for your help with the Spanish language files, very appreciate it. :smile::thumbsup:

Edited by Tsimi
Link to comment
Share on other sites

@Tsimi,

1.:

If the fixes do not make harm and do not complicate the code, I believe we can include them. For this example we could even do the following to make it even more generic and ensure the function are available in the payment module. It maybe also needed for other add-ons:

    function update_status() {
      global $order, $cart, $max_points;
	  
      if( !function_exists('check_points_redemtion') ) {
        require_once(DIR_FS_CATALOG . 'includes/functions/redemptions.php'); 
      }

Then I would just mention in the instructions the compatibility or support for add-on xxx included.

The PWA Gust checkout should be also included and mentioned. It maybe needed to explain the details for the 15 min delay in deleting guest shopping points in admin/customer_points_pending.php

2. I will try this and checkout the 2nd option (Delete)

3. This is a required fix, the function should really be renamed to something different than used in another addon. This doesn't make any harm..

Edited by raiwa
Link to comment
Share on other sites

1 hour ago, Tsimi said:

Regarding 2.

Can we not have a pull down setting in the HT Points config from which you can select order status you want for points to automatically go onto customers account?

I also wanted to know what the que and delete function were.

Link to comment
Share on other sites

Just now, Tsimi said:

@raiwa

What is that private before the function for? What does it do?

allows the function to be only available and used inside the own class

Link to comment
Share on other sites

1 minute ago, CGhoST said:

I also wanted to know what the que and delete function were.

My guess,

and Que means confirm points and add it to the My Account listing? and Delete means remove entry in the My Account listing and don't show?

Edited by Tsimi
Link to comment
Share on other sites

4 minutes ago, CGhoST said:

Can we not have a pull down setting in the HT Points config from which you can select order status you want for points to automatically go onto customers account?

I also wanted to know what the que and delete function were.

Pull down would only allow the auto tick for one status. Coma separated list allows to use it for more than one status.

There are store owners using different status (more than one) for final order status. It's just more flexible like this.

Edited by raiwa
Link to comment
Share on other sites

4 minutes ago, raiwa said:

Pull down would only allow the auto tick for one status. Coma separated list allows to use it for more than one status.

There are store owners using different status (more than one) for final order status. It's just more flexible like this.

We could use check boxes, comma separated could result in typos and therefore points not being auto credited.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...