Jump to content
Tsimi

Converting Points and Rewards system for osC BS

Recommended Posts

If I understand correct, you wants the island surcharge to be excluded from being paid by points.

THis would require some extra custom coding.

Share this post


Link to post
Share on other sites

I'm talking now by memory, but can you try to change sort order so the redemtions ot module is last before order total. I mean that it shows below your extra fee module.

I'll see if I can have a deeper look tomorrow.

Share this post


Link to post
Share on other sites


Unfortunately does not work. could it be that the module is loaded directly from the order_total directory?

Share this post


Link to post
Share on other sites

Hello Peter @Yepi,

I believe you mean this case when there are enough points to cover all order cost and it doesn't apply points on the extra charge:

Sub-Total: $69.99
Flat Rate (): $5.00
Inselzuschlag: $5.00
Points Redeemed: -$74.99
Total: $5.00

 

For this you would need to add coding for the ot _module in: includes/functions/redemptions.php

within the "calculate_max_points" function:

					      $path_points = ($order->products[$i]['price']*$order->products[$i]['qty'])+($order->info['shipping_cost']+$order->info['tax']);

You'll need to add the extra charge similar how it is done with the shipping cost.

I do not know and use this extra charge module, so I can't help with more details, sorry.

On the other hand, do you really think that you'll have real orders which use points to cover ALL order cost??

Share this post


Link to post
Share on other sites

Hello Reiner, that's exactly what it's about.

I looked at the file and this function already exists. I can not say how the additional costs can be paid with points so that the bill is at 0.00
 

if ( tep_not_null(MODULE_HEADER_TAGS_POINTS_REWARDS_POINTS_RESTRICTION_PATH) && !tep_not_null(MODULE_HEADER_TAGS_POINTS_REWARDS_POINTS_RESTRICTION_PID) ) {
	      $path_points = 0;
	      for ($i=0; $i<sizeof($order->products); $i++) {
		      $cat_ids = explode("[,]", MODULE_HEADER_TAGS_POINTS_REWARDS_POINTS_RESTRICTION_PATH);
		      $sub_cat_ids = explode("[_]", tep_get_product_path($order->products[$i]['id']));
		      for ($iii = 0; $iii < count($sub_cat_ids); $iii++) {
			      for ($ii = 0; $ii < count($cat_ids); $ii++) {
				      if ($sub_cat_ids[$iii] == $cat_ids[$ii]) {
					      $path_points = ($order->products[$i]['price']*$order->products[$i]['qty'])+($order->info['shipping_cost']+$order->info['tax']);
					      $max_points =  $path_points/MODULE_HEADER_TAGS_POINTS_REWARDS_POINTS_REDEEM_POINT_VALUE;
				      }
			      }
		      }
	      }
      }

 

Share this post


Link to post
Share on other sites

You could try the following:

in ot_inselfee.php session register the variable with the extra charge and add it to globals list:

    function process() {
      global $order, $currencies, $cart, $inselfee;

......................

    tep_session_register('inselfee');

          $this->output[] = array('title' => $this->title . ':',

If you need to add tax, use another variable name and add tax.

Then in includes/functions/redemptions.php

do this:

  function calculate_max_points($customer_shopping_points) {
	  global $currencies, $order, $inselfee;
	  
	  $max_points = ($order->info['total']+$inselfee)/MODULE_HEADER_TAGS_POINTS_REWARDS_POINTS_REDEEM_POINT_VALUE;

You could code it a bit cleaner checking for tep_not_null($inselfee) and if (!tep_session_is_registered('inselfee')) {, but it should work.

For my example I get this:


Sub-Total: $69.99
Flat Rate (): $5.00
Inselzuschlag: $5.00
Points Redeemed: -$79.99
Total: $0.0
Edited by raiwa

Share this post


Link to post
Share on other sites

You probably need also the ship in cart add on:

https://apps.oscommerce.com/YLYGm&ship-in-cart-bs-reloaded

or some additional code loading the ot modules already on the checkout payment page.

Edited by raiwa

Share this post


Link to post
Share on other sites

@raiwa

Have you looked at this add-on with PHP 7.2 recently?
I get these errors and I know why it happens but I could not find a fix for it.

customers_points_referral.php file

PHP 5.6 and 7.1

Warning: Invalid argument supplied for foreach() in /home/xxx/www/shop/xxx/includes/classes/object_info.php on line 21

PHP 7.2

Warning: Invalid argument supplied for foreach() in /home/xxx/www/shop/xxx/includes/classes/object_info.php on line 21
Warning: sizeof(): Parameter must be an array or an object that implements Countable in /home/xxx/www/shop/xxx/customers_points_referral.php on line 451

All the other points related pages work just fine even with PHP 7.2

Edited by Tsimi

Share this post


Link to post
Share on other sites

Hello @Tsimi   and any one have the same issue
for this

Warning: sizeof(): Parameter must be an array or an object that implements Countable in /home/xxx/www/shop/xxx/customers_points_referral.php on line 451

change this in  customers_points_referral.php on line 451

if (sizeof($reviews) > 0) 

to

 if (is_array($reviews) && sizeof($reviews) > 0)

BR
Omar


Get the latest Responsive osCommerce CE (community edition) here .

Share this post


Link to post
Share on other sites

@Tsimi, I had read your question and forgot to reply. I was very busy today.

I believe @Omar_one's fix is correct, thanks.

rgds
Rainer

 

Share this post


Link to post
Share on other sites

Thanks @Omar_one

That took care of one of the errors.

Now only one error is left

Warning: Invalid argument supplied for foreach() in /home/xxx/www/shop/xxx/includes/classes/object_info.php on line 21

Must have something to do with this code here I guess (around line 455)

if ((!isset($_GET['uID']) || (isset($_GET['uID']) && ($_GET['uID'] == $pending_points['unique_id']))) && !isset($uInfo)) {
  $uInfo = new objectInfo($uInfo_array);
}

I tried to copy code structures from other file which also have the objectInfo code in it but none of my tries worked thus far.
 

Share this post


Link to post
Share on other sites

@Tsimi

I couldn't recreate this error, but try this:

        if ( is_array($uInfo_array) && (!isset($_GET['uID']) || (isset($_GET['uID']) && ($_GET['uID'] == $pending_points['unique_id']))) && !isset($uInfo) ) {
          $uInfo = new objectInfo($uInfo_array);
        }

or this:

        if ( isset($uInfo_array) && (!isset($_GET['uID']) || (isset($_GET['uID']) && ($_GET['uID'] == $pending_points['unique_id']))) && !isset($uInfo) ) {
          $uInfo = new objectInfo($uInfo_array);
        }

 

Share this post


Link to post
Share on other sites

Thanks @raiwa

The error has been corrected I think. I had something mixed up with the data inside the database and the data shown in the shop.
I emptied the database table and now the error is gone and I cannot recreate it either. 🤔

So the only code that needs fixing to be PHP 7.2 compatible is the code fix Omar posted above.

Thanks again for looking into it. :thumbsup:

Share this post


Link to post
Share on other sites

Hello @tttim6575,

It will work with 2.3.4.1 CE FROZEN and pre FROZEN EDGE version based on BS3.

It will not work out of the box with 2.3.4.1 EDGE based on BS4. You would need to update the html output to BS4.

It is not intended to be used with 2.3.4.1. standard. There are older versions available for this.

Share this post


Link to post
Share on other sites
47 minutes ago, tttim6575 said:

so then why isit in the all versions category?

Sorry, I do not understand. What do you mean by "all versions category"?

The add-on title says that it is for BS (Bootstrap).

Share this post


Link to post
Share on other sites

Hi,

When my store has multiple currencies (USD and EUR) the calculation of order total is correct for default (USD). Order total in EUR is incorrect.

This addon v2.0.1 installed on 2.3.4.1 BS CE Frozen. Set default USD as 1.0 and EUR as 0.5

See screen grab below.

Screenshotusd.png.5f0b7f3e3192d3461b800967e0ac0687.png

Screenshoteuro.png.bee3479620179c46cbe516bcc35ccf59.png

Any help is much appreciated.

 

Share this post


Link to post
Share on other sites
On 2/19/2019 at 10:28 AM, raiwa said:

Hello @tttim6575,

It will work with 2.3.4.1 CE FROZEN and pre FROZEN EDGE version based on BS3.

It will not work out of the box with 2.3.4.1 EDGE based on BS4. You would need to update the html output to BS4.

It is not intended to be used with 2.3.4.1. standard. There are older versions available for this.

@tttim6575 you got the answer already. Please search in the Apps Marketplace for the old version.

Share this post


Link to post
Share on other sites

Hello @winfm,

Sorry for the late reply. I was very busy and then forgot for your post.

I checked and yes, you are right. I could reproduce the error.

Please change in includes/modules/order_total/ot_redemptions.php

line 61 to:

          $order->info['total'] = $currencies->format_raw($order->info['total'], false) - $currencies->format_raw(tep_calc_shopping_pvalue($customer_shopping_points_spending), false);

Please confirm and I'll upload the update with this fix.

 

Thanks for reporting it!
Best regards
Rainer

Share this post


Link to post
Share on other sites

@raiwa, Now working fine with multi currencies store. Thanks very much.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×