Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Converting Points and Rewards system for osC BS


Tsimi

Recommended Posts

Points and Rewards BS v1.1 released!

https://apps.oscommerce.com/G5ep5&points-and-rewards-bs

Change log
-----------------

Version 1.1

  •  Added PWA (Purchase Without Account) support
  •  Added Order Editor support to points payment module
  •  Added SWC (Sloppy Words Cleaner) support by renaming function names and converted functions to private (HT module)
  •  Added auto tick checkbox by order status feature (multiple choices possible, use comma to spearate ID numbers)
  • Bug fix for wrong order total calculation when product total value is over $1000

For those of you with older versions please follow the update manual which is included with this package.

Edited by Tsimi
Link to comment
Share on other sites

Hi @Tsimi

is this meant to function with paypal express? I get nothing happening after I select points to redeem and click the Continue button which is meant to take you tot he paypal page. Again this is on a clean copy of latest EDGE.

to be more precise, i get a white page as per below. I also tried this on a live page just to make sure its not something to do with local copy being tested. works fine if you select payments like "cash on delivery"

Link to comment
Share on other sites

30 minutes ago, igorb said:

Hi @Tsimi

is this meant to function with paypal express?

As far I know yes it should work with PP Express.
WRONG STATEMENT REMOVED

I don't have a online store anymore so I cannot simulate any live shop environment. Maybe @raiwa knows more?

 

Edited by Tsimi
Link to comment
Share on other sites

@igorb,

It should work with PayPal express. Can you please try first if PayPal express works without points and rewards to be sure it is correct set up. It is possible to test paypal express on a local test installation in sandbox and live mode, always if you have a internet connection.

Link to comment
Share on other sites

@igorb, can you please set error reporting to true or check your error log so we can see which exact error is thrown on the blank page.

Link to comment
Share on other sites

@raiwa

didnt even realise this could be done :)

this pops up on the previously blank page


Fatal error: Uncaught Error: Call to undefined function tep_calc_shopping_pvalue() in C:\MAMP\htdocs\bootstrap2\includes\modules\order_total\ot_redemptions.php:57 Stack trace: #0 C:\MAMP\htdocs\bootstrap2\includes\classes\order_total.php(42): ot_redemptions->process() #1 C:\MAMP\htdocs\bootstrap2\ext\modules\payment\paypal\express.php(961): order_total->process() #2 {main} thrown in C:\MAMP\htdocs\bootstrap2\includes\modules\order_total\ot_redemptions.php on line 57

Link to comment
Share on other sites

@igorb,

then please try this:

in: includes/modules/order_total/ot_redemptions.php

find:

    function process() {
	    global $order, $currencies, $customer_shopping_points_spending;

// if customer is using points to pay   
        if (isset($customer_shopping_points_spending) && is_numeric($customer_shopping_points_spending) && ($customer_shopping_points_spending > 0)) {

replace with:

    function process() {
	    global $order, $currencies, $customer_shopping_points_spending;

	    require_once('includes/functions/redemptions.php');

// if customer is using points to pay   
        if (isset($customer_shopping_points_spending) && is_numeric($customer_shopping_points_spending) && ($customer_shopping_points_spending > 0)) {

 

Link to comment
Share on other sites

@raiwa

adding that line seems to make paypal go to IN CONTEXT checkout flow regardless of the option selected. hence it does work but not as expected.

 

i found a bug with paypal as well. if you go though paypal, authorise transaction for lets say $100, (i do authorize rather than debit right away. ) then in osc you go and change your purchase, change quantity or add new items. go back to cart and select paypal as payment now showing an amount other than $100, it will no longer take you to paypal but it will automatically authorise the new amount.

to make things worse, if you log out of your OSC account and log back in. The paypal transaction will still be authorised. and it shows up in the paypal developer account as authorised as well, so OSC is sending back paypal information of complete order. that shouldn't be happening. if you close and reopen the browser then it seems to clear wherever it was storing the authorisation and takes you back to paypal to confirm transaction.

Link to comment
Share on other sites

8 hours ago, igorb said:

adding that line seems to make paypal go to IN CONTEXT checkout flow regardless of the option selected. hence it does work but not as expected.

@igorb, I can't confirm this, for me it stays in classic mode using points and rewards.

 

8 hours ago, igorb said:

i found a bug with paypal as well. if you go though paypal, authorise transaction for lets say $100, (i do authorize rather than debit right away. ) then in osc you go and change your purchase, change quantity or add new items. go back to cart and select paypal as payment now showing an amount other than $100, it will no longer take you to paypal but it will automatically authorise the new amount.

to make things worse, if you log out of your OSC account and log back in. The paypal transaction will still be authorised. and it shows up in the paypal developer account as authorised as well, so OSC is sending back paypal information of complete order. that shouldn't be happening. if you close and reopen the browser then it seems to clear wherever it was storing the authorisation and takes you back to paypal to confirm transaction.

Is this points and rewards related, can you please double check without points and rewards installed.

Edited by raiwa
Link to comment
Share on other sites

@igorb,

I checked more detailed the paypal payments and found the following:

1. PayPal standard has a bug and needs to be fixed. Please do not use it together with paypal express. It can produce issues. You should uninstall it.

2. PayPal express works for me fine even without the fix I posted for the function inclusion. Can you please ensure that you have all points and rewards modules properly installed. Especifically the header tag module. The points and rewards function should be included there for all pages.

3. Please double check also by the installation manual instructions if all the hook calls are properly included in your files. Especially check the checkout files.

Link to comment
Share on other sites

@Tsimi,

1. Checking PayPal for the reported bugs, I found that paypal standard modifications are in the wrong section. It added the earned points for the actual order already in checkout confirmation. If going back to checkout payment, the points were already added to the points balance if auto credit is enabled. I fixed it moving the points code to the correct section. See GitHub.

2. I could not recreate and confirm the bugs posted by @igorb. So we'll await what he reports.

3. We should add a module for shiopping cart like the one used in checkout payment. This would allow to redeem points with PayPal express checkout button.
I can go for it.

Please have a look on GitHub, I updated the to do list for version 1.2.

 

rgds

Rainer

Link to comment
Share on other sites

Just now, Tsimi said:

I won't release any new version though. 

Not right now, but paypal standard is a serious bug, it  needs to be fixed.

Link to comment
Share on other sites

Link to comment
Share on other sites

10 hours ago, raiwa said:

@igorb,

I checked more detailed the paypal payments and found the following:

1. PayPal standard has a bug and needs to be fixed. Please do not use it together with paypal express. It can produce issues. You should uninstall it.

2. PayPal express works for me fine even without the fix I posted for the function inclusion. Can you please ensure that you have all points and rewards modules properly installed. Especifically the header tag module. The points and rewards function should be included there for all pages.

3. Please double check also by the installation manual instructions if all the hook calls are properly included in your files. Especially check the checkout files.

@raiwa

Here is what i did

1. on a clean installation of edge without any other addons or settings changes other than what comes out standard installed. uninstalled points and rewards

2. paypal exhibits same behavior previously noted. ie keeps the authorization regardless of cart changing. Even when changing the transaction method to SALE  from AUTHORIZE i get the same issue. this could be totally unrelated to points and rewards.

3. reinstalled points and rewards. manually checked every modified file for hooks.

-all is ok except the admin/orders.php file has "echo $OSCOM_Hooks->call('orders', 'PointsOrderRemovePoints');" added after "tep_redirect(tep_href_link('orders.php', tep_get_all_get_params(array('oID', 'action'))));" not after "tep_remove_order($oID, $_POST['restock']);" as is in the manual.

4. observation, i dont know if it matters. i use a different name for admin directory. does "catalog\includes\hooks\admin\orders\points.php" path need to be amended accordingly. ie change admin folder to whatever my admin is called?

5. i am still having issues with the express checkout and that functions fix does make it go to IN CONTEXT checkout.

6. I don't use paypal standard so i never did modify or use that file.

7.changed my admin dir to admin. made no difference. so i guess point 4 does not matter.

8. i just downloaded the module again (in v1 and v1.1) in case i changed something by accident. extracted overwriting old files. still same issue with paypal express in both versions.

i cant think of anything else to try here. im getting the same thing on a clean edge version. and on an edge version modified to suit my live website. and on the live website as i had this running. im still running it with IN CONTEXT checkout.

hopefully somebody else can reproduce the error to confirm this is an issue as I cant think what it is that I am doing wrong.

 

Link to comment
Share on other sites

@igorb,

Point 2: not related to points and rewards, please post this bug in the official PayPalApp support forum.

Point 3: Yes, confirmed. This is a bug which will be addresses in the next update. The correct place is after "tep_remove_order($oID, $_POST['restock']);" .
Allthough this is not related to PayPal

Point 4: admin directory name is not hardcoded. It is retrieved from the configuration constant. no issue.

Point 5: I checked again and it works for me with both versions stable in classic mode. There is no logical reason why points and rewards should have any influence on IN_CONTENT or CLASSIC.

Without the fix in ot module, do you still get always the blank/error page and where exact do you get ti. After click on continue button in checkout_payment.php?

I PM my e-mail so you could send me a zipped copy of your test store and database.

 

Link to comment
Share on other sites

@igorb, @Tsimi,

I checked all the PayPAl express on a new fresh installation and can confirm the error for the redemption function.

The change in ot_redemptions.php is required.

The good code is this:

    function process() {
	    global $order, $currencies, $customer_shopping_points_spending;

// if customer is using points to pay   
        if (isset($customer_shopping_points_spending) && is_numeric($customer_shopping_points_spending) && ($customer_shopping_points_spending > 0)) {
	      
          if( !function_exists('check_points_redemtion') ) {
            require_once(DIR_FS_CATALOG . 'includes/functions/redemptions.php'); 
          }

Added it as bug 13 and fix to GitHub.

I can not confirm the IN_CONTENT - CLASSIC problem.

On my test store all works stable as it should.

Link to comment
Share on other sites

@Tsimi, @LeeFoster, @igorb, @TITO4 and other interested users.

Version 1.2 prepared for error check and tests.

- added points redeem shopping cart module which allows using points with PayPAl express checkout button.

Requires: Ship In Cart BS reloaded
https://apps.oscommerce.com/YLYGm&ship-in-cart-bs-reloaded

-  fixed ot module wrong order total calculation if total amount is paid by points

- points redeem and referral can be untoggled and removed in shopping cart module and checkout payment

- selected redeem and referral option will be stored now in session. If ticked or filled in in shopping cart it will be also ticked and filled in on checkout payment and applied on checkout confirmation. (this is required for PyaPal express to work)

- update instructions added for version 1.1 to 1.2

Please download from GitHub and see README.md and update 1.1 to 1.2 doc:

https://github.com/raiwa/Points_Rewards_BS_BETA_GIT/archive/master.zip

 

Thanks for testing and feedback

Rainer

Edited by raiwa
Link to comment
Share on other sites

Forgot to mention: you can try and test all new features and functionality without the need to have PayPal Express installed and configured.

Of course except for the payment process itself. :smile:

Edited by raiwa
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...