Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Converting Points and Rewards system for osC BS


Tsimi

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.

Link to comment
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.

Link to comment
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??

Link to comment
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;
				      }
			      }
		      }
	      }
      }

 

Link to comment
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
Link to comment
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
Link to comment
Share on other sites

  • 3 months later...

@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
Link to comment
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 .

Link to comment
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

 

Link to comment
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.
 

Link to comment
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);
        }

 

Link to comment
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:

Link to comment
Share on other sites

  • 4 months later...

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.

Link to comment
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).

Link to comment
Share on other sites

  • 2 weeks later...

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.

 

Link to comment
Share on other sites

  • 2 weeks later...
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.

Link to comment
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

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...