Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Converting Points and Rewards system for osC BS


Tsimi

Recommended Posts

@raiwa

Just did a quick test run on your new package.
All looks good to me. I didn't know that the total was wrong calculated when paying the whole order via points. It always worked for me.
I didn't test the PayPal Express stuff though. I don't have the will to setup PayPal now. I trust in your skills. :smile:

I slightly adjusted the button position of the shopping cart module.

            if ($order->info['total'] > tep_calc_shopping_pvalue($max_points)) {
              $note = '<br><small>' . MODULE_CONTENT_SC_POINTS_REDEEM_NOTE .'</small>';
              $points_redeem_output .= '    <div class="col-xs-12">';
              $points_redeem_output .= sprintf(MODULE_CONTENT_SC_POINTS_REDEEM_START, $currencies->format(tep_calc_shopping_pvalue($customer_shopping_points)), $currencies->format($order->info['total']). $note) . '<br>';
              $points_redeem_output .= sprintf(MODULE_CONTENT_SC_POINTS_REDEEM_SPENDING, number_format($max_points,MODULE_HEADER_TAGS_POINTS_REWARDS_POINTS_POINTS_DECIMAL_PLACES), '/&nbsp;' . $currencies->format(tep_calc_shopping_pvalue($max_points)));
              $points_redeem_output .= '&nbsp;&nbsp;<i class="fa fa-arrow-right"></i>&nbsp;&nbsp;' . tep_draw_checkbox_field('customer_shopping_points_input', $customer_shopping_points_to_spent, isset($customer_shopping_points_spending));
              $points_redeem_output .= '    </div>';	
              $points_redeem_output .= '    <div class="clearfix"></div><br>';	
              $points_redeem_output .= '    <div class="col-xs-12 text-right">';
              $points_redeem_output .= tep_draw_button(MODULE_CONTENT_SC_POINTS_REDEEM_IMAGE_BUTTON_APPLY, 'fa fa-refresh') . tep_draw_hidden_field('points_action', 'update_points');
              $points_redeem_output .= '    </div>';
            } else {
              $customer_shopping_points_to_spent = isset($customer_shopping_points_spending)? $customer_shopping_points_spending : $max_points;
              $points_redeem_output .= '    <div class="col-xs-12">';
              $points_redeem_output .= sprintf(MODULE_CONTENT_SC_POINTS_REDEEM_START, $currencies->format(tep_calc_shopping_pvalue($customer_shopping_points)), $currencies->format(tep_calc_shopping_pvalue($customer_shopping_points_to_spent)). $note) . '<br>';
              $points_redeem_output .= sprintf(MODULE_CONTENT_SC_POINTS_REDEEM_PAYING, number_format($customer_shopping_points_to_spent, MODULE_HEADER_TAGS_POINTS_REWARDS_POINTS_POINTS_DECIMAL_PLACES), '/&nbsp;' . $currencies->format(tep_calc_shopping_pvalue($customer_shopping_points_to_spent)));
              $points_redeem_output .= '&nbsp;&nbsp;<i class="fa fa-arrow-right"></i>&nbsp;&nbsp;' . tep_draw_checkbox_field('customer_shopping_points_input', $customer_shopping_points_to_spent, isset($customer_shopping_points_spending));
              $points_redeem_output .= '    </div>';	
              $points_redeem_output .= '    <div class="clearfix"></div><br>';		
              $points_redeem_output .= '    <div class="col-xs-12 text-right">';
              $points_redeem_output .= tep_draw_button(MODULE_CONTENT_SC_POINTS_REDEEM_IMAGE_BUTTON_APPLY, 'fa fa-refresh') . tep_draw_hidden_field('points_action', 'update_points');
              $points_redeem_output .= '    </div>';
            }

So what's the next step? Are you gonna release this?

Edited by Tsimi
Link to comment
Share on other sites

Hello @Tsimi,

20 minutes ago, Tsimi said:

@raiwa

I didn't know that the total was wrong calculated when paying the whole order via points. It always worked for me.
I didn't test the PayPal Express stuff though. I don't have the will to setup PayPal now. I trust in your skills. :smile:

I got a wrong total (negative ot) for one test order with a very high price (7.0000) and it was very little, so  guess it could be because of different rounding for points and order total. With my mod it got fixed to show the correct ot.

22 minutes ago, Tsimi said:

I slightly adjusted the button position of the shopping cart module.

OK, I trust in your design skills :smile:

23 minutes ago, Tsimi said:

So what's the next step? Are you gonna release this?

If there are no other testers abroad, it can be released. Can you please?

 

thanks and best regards

Rainer

Link to comment
Share on other sites

@Tsimi, can you please check the update doc and the instructions need to be updated.

Link to comment
Share on other sites

@raiwa

OK, I will go through the manuals and also check the files to make sure the version numbers are correct.
Not sure the new release will make it today. I have to do some other work first, but I try to do it asap.

Edited by Tsimi
Link to comment
Share on other sites

On 10/23/2017 at 10:27 PM, dnbvinyl said:

Hi,

First off wanted to say great work on making this module happen BS Osc has been crying out for this kind of thing.

Did a few tests on my site and came across the following issues, I am using the version uploaded to the apps on 10th October 2017 by Tsimi

Image 1) (delete_points_adjust_admin.jpg) whilst attempting to delete /adjust points in the admin section of a customers points allocation I had the error in the image appear if i tried to delete all of the points the customer had it did however let me delete / adjust points if i only attempted to remove so many points eg. delete 50 out of 100 points

Image 2) (caheckout_paying_cash_all_points) whilst attempting to check out a cash in store checkout option and using all available points as part payment e.g £10 cost of product - (£2 points) £8 to pay the error was shown also has same error when trying to do the same with a paypal payment

with Image 2 by editing the code below i am able to checkout fully and i don't have the 1048 error. However this seemed to have stopped the payment methods from working as a partial checkout. part points / part paypal

i edited the following code on or around Line 203 to line 210 

**FROM THIS

// balance customer points account & record the customers redeemed_points

  function tep_redeemed_points($customer_id, $insert_id, $customer_shopping_points_spending) {

      

      if ((tep_get_shopping_points($customer_id) - $customer_shopping_points_spending) > 0) {

          tep_db_query("update customers set customers_shopping_points = customers_shopping_points - '". $customer_shopping_points_spending ."' where customers_id = '". (int)$customer_id ."' limit 1");

      } else {

          tep_db_query("update customers set customers_shopping_points = null, customers_points_expires = null where customers_id = '". (int)$customer_id ."' limit 1");

      }

 

**TO THIS**

// balance customer points account & record the customers redeemed_points
  function tep_redeemed_points($customer_id, $insert_id, $customer_shopping_points_spending) {
      
      if ((tep_get_shopping_points($customer_id) - $customer_shopping_points_spending) > 0) {
          tep_db_query("update customers set customers_shopping_points = customers_shopping_points - '". $customer_shopping_points_spending ."' where customers_id = '". (int)$customer_id ."' limit 1");
      } else {
          tep_db_query("update customers set customers_shopping_points = '0.00', customers_points_expires = null where customers_id = '". (int)$customer_id ."' limit 1");
      }

found the above almost fix from the old points / rewards module

 

Any questions about the above or  any help with a fix will be greatly appreciated thanks again

 

 

caheckout_paying_cash_all_points.thumb.jpg.fe7ea36fdbca6778c73038cdda48f370.jpg

delete_points_adjust_admin.jpg

Just wanted to get back to everyone on this issue i had, turned out was an issue with my old hosting company now on a new host and have it all working fine for me 

cheers

Link to comment
Share on other sites

@discxpress

You could link to a info page that explains more about the referral system. Advertising it is always a good thing that might benefit your store.
Adding a link into the product page shouldn't be difficult at all. The question is would it be overkill? To advertise on the main page (index.php) or some social media site OK but on every single product page?

Link to comment
Share on other sites

2 hours ago, discxpress said:

Someone suggested to me that I should use a Refer-a Friend program to gain customers.

@discxpress,

There is already a referral feature included which allows a new customer during his first order to refer an existing customer who referenced the store to him.

Giving referral points to a customer just for sending info to another mail like the old "Tell a Friend" box would open the door to abuse, hence you have no control/confirmation to whom a customer sends the referral.

2 hours ago, discxpress said:

I was thinking that a link/button from the product page to a page explaining the referral program would be great.

There is already a link to the "Point Program FAQ" page included in the product info content module:

"Buy this item and earn 100 points valued at $10.00. Please check the Point Program FAQ for more information. "

It shouldn't be difficult to enhance the link by a button if you feel it should be more visible.

Link to comment
Share on other sites

3 hours ago, Tsimi said:

@discxpress

You could link to a info page that explains more about the referral system. Advertising it is always a good thing that might benefit your store.
Adding a link into the product page shouldn't be difficult at all. The question is would it be overkill? To advertise on the main page (index.php) or some social media site OK but on every single product page?

@Tsimi My goal is to build a customer base naturally. Maybe on every product page could be overkill. So I'm left with the question I'm left that I'm asking myself. What is a great referral program and what is the best way to promote it?

@raiwa I didn't think about the abuse. Maybe a Tell-a-Friend feature could be added to your program. 

My idea: Place a Tell-a-Friend button somewhere on the product page. Once clicked a small box pops up with a message "Suggest this product to a friend and receive X amount of points toward your next purchase if they buy. Learn more."

Once they click the Learn more link they could be taken to the FAQ page. 

Don't mind me just exploring possibilities 😉😀

Link to comment
Share on other sites

  • 3 weeks later...

@Tsimi @raiwa

I was just wondering if there was anyway of stopping the points value being deducted from shipping costs on the order total eg

Products total = £15  - point value can only be deducted against this

Postage Costs = £5  - points excluded for this

Order Total £20

Customer has 2000 points with a  value of £20 but max available to deduct from order total will be £15 total amount of the products costs excluding postage costs

 

Link to comment
Share on other sites

Hello Neil @dnbvinyl,

It's not so easy.

All the calculations are done in: includes/functions/redemptions.php

there you need to sustract shipping from the max point calculations so the max points to redeem show without shipping.

and the order redemption is calculated in includes/modules/order_total/ot_redemptions.ph:

in line 61 you should subtract $order->info['shipping'] from $order->info['total'].

rgds

Rainer

Edited by raiwa
Link to comment
Share on other sites

@dnbvinyl,

sorry, you do not need to apply the mod in ot_redemptions.php if you apply the correction already in the "tep_calc_shopping_pvalue" function.

Link to comment
Share on other sites

  • 5 months later...

Hi,

Thanks for putting together such a great addition to osc bs.

I've just updated to v1.2 and note that once the Shopping Points Redemptions checkbox is ticked I can no longer choose to not use points as partial payment, even though I uncheck the tickbox.

For example, I choose Cash on Delivery and Points and go to the Order Confirmation page but decide to edit the Payment Method to be only be CoD the points are still active.

Any suggestions why this is? Are changes to the Admin / Configuration / Sessions required?

Thanks in advance

Link to comment
Share on other sites

Link to comment
Share on other sites

  • 3 weeks later...

@Tsimi, hope you are well.

I'm working on the updates to 2.3.4.1 CE Frozen of my add-ons. One of the next in the list is Points and Rewards.

Would you like to do a part. I would go for the installation script update (hooks register is now automatic done in application_top.php), would you like to do other parts (modules/hooks update)?

If you have no time left, I can go for all.

Link to comment
Share on other sites

Hi @raiwa

I am absolutely not up to date regarding the Edge or Frozen version. And i am also currently working night shifts for at least another 2 weeks and won't have any spare time left. I would be grateful if you could take over this time. Hope it is not too much work for you.

Link to comment
Share on other sites

Link to comment
Share on other sites

  • 2 weeks later...

Uploaded v. 2.0 for 2.3.4.1 CE Frozen:

Points and Rewards BS v2.0

Compatibility:
Responsive 2.3.4.1 BS CE Frozen
PHP 7.0-7.2
-------------------------------------------------------------------------------------------------------------
2.3.4.(1.) EDGE versions and GOLD, please use Points and Rewards BS v1.2
-------------------------------------------------------------------------------------------------------------

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

Version 2.0

 - Updated for 2.3.4.1. CE Frozen
 - Replaced checkout payment hook by content module
 - Moved checkout payment output from functions/redemptions.php into new content module
 - Updated installation scripts for 2.3.4.1 CE Frozen and checkout payment content module
 - Updated template naming and auto inclusion in all content modules
 - Added support for core modular product info
 - Added support for Modular Checkout
 - Replaced modified core template files by complete alternative box and footer content modules

Only one manual core file change left: (optional if using) paypal_standard.php

Edited by raiwa
Link to comment
Share on other sites

Hello, what can it be, if the customer has selected to pay with points but wants later to use cash. The module can no longer switch to cash. you have to log out first and log in again so that the payment method can be changed

 

Here I still have a module for delivery surcharge but in spite of payment with points is not included and is to be paid at the end total. did temand have a tip for me?

 

<?php
/*
  $Id: ot_inselzuschlag.php,v 2.07 2008/02/19 19:24:11 dabri Exp $
  erstellt von: dabri - Daniel Brinkmann
  Forum: http://forums.oscommerce.de/index.php?showtopic=18397

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/

  class ot_inselzuschlag {
    var $title, $output;

    function ot_inselzuschlag() {
      $this->code = 'ot_inselzuschlag';
      $this->title = MODULE_ORDER_TOTAL_INSELZUSCHLAG_TITLE;
      $this->description = MODULE_ORDER_TOTAL_INSELZUSCHLAG_DESCRIPTION;
      $this->enabled = ((MODULE_ORDER_TOTAL_INSELZUSCHLAG_STATUS == 'true') ? true : false);
      $this->sort_order = MODULE_ORDER_TOTAL_INSELZUSCHLAG_SORT_ORDER;

      $this->output = array();
    }

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

        switch (MODULE_ORDER_TOTAL_INSELZUSCHLAG_DESTINATION) {
          case 'national':
            if ($order->delivery['country_id'] == STORE_COUNTRY) $pass = true; break;
          case 'international':
            if ($order->delivery['country_id'] != STORE_COUNTRY) $pass = true; break;
          case 'both':
            $pass = true; break;
          default:
            $pass = false; break;
        }

// Variable f?r die Postleitzahl (PLZ)
  $qResult = tep_db_query("select insel_plz, insel_name, insel_country, insel_fee, insel_step from " . TABLE_INSELPLZ . " WHERE '" . $order->delivery['postcode'] . "' BETWEEN insel_plz AND insel_plz_end AND insel_country = '" . $order->delivery['country_id'] . "'");

      $rec = tep_db_fetch_array($qResult); // get the first row of the result
      $plz_id = $rec['insel_plz'];
       
/*
      if ( $plz_id == '' ){
      $pass = false;
	  }
*/

if (( $plz_id == '' ) || ($GLOBALS['shipping']['id'] == 'pickup_pickup')) {
	  $pass = false;
	  }

        if ( $pass == true ) {

// Preis fuer Gewicht ermitteln
      $insel_cost = preg_split("/[:,]/" , $rec['insel_fee']);

      if ($cart->show_weight() > $insel_cost[count ($insel_cost)-2]) {
          $inselfee = ($cart->show_weight()-$insel_cost[count ($insel_cost)-2])* $rec['insel_step'] +$insel_cost[count ($insel_cost)-1];
      }
      for ($i = 0; $i < count($insel_cost); $i+=2) {
        if ($cart->show_weight() <= $insel_cost[$i]) {
            $inselfee = $insel_cost[$i+1];
            break;
        }
      }


          $tax = tep_get_tax_rate(MODULE_ORDER_TOTAL_INSELZUSCHLAG_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
          $tax_description = tep_get_tax_description(MODULE_ORDER_TOTAL_INSELZUSCHLAG_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);

          $order->info['tax'] += tep_calculate_tax($inselfee, $tax);
          $order->info['tax_groups']["$tax_description"] += tep_calculate_tax($inselfee, $tax);
          $order->info['total'] += $inselfee + tep_calculate_tax($inselfee, $tax);

          $this->output[] = array('title' => $this->title . ':',
                                  'text' => $currencies->format(tep_add_tax($inselfee, $tax), true, $order->info['currency'], $order->info['currency_value']),
                                  'value' => tep_add_tax($inselfee, $tax));
      }
    }

    function check() {
      if (!isset($this->_check)) {
        $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_INSELZUSCHLAG_STATUS'");
        $this->_check = tep_db_num_rows($check_query);
      }

      return $this->_check;
    }

    function keys() {
      return array('MODULE_ORDER_TOTAL_INSELZUSCHLAG_STATUS', 'MODULE_ORDER_TOTAL_INSELZUSCHLAG_SORT_ORDER', 'MODULE_ORDER_TOTAL_INSELZUSCHLAG_DESTINATION', 'MODULE_ORDER_TOTAL_INSELZUSCHLAG_TAX_CLASS');
    }

    function install() {
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Inselzuschlag anzeigen', 'MODULE_ORDER_TOTAL_INSELZUSCHLAG_STATUS', 'true', 'Wollen Sie den Inselzuschlag anzeigen lassen?', '6', '1','tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Reihenfolge', 'MODULE_ORDER_TOTAL_INSELZUSCHLAG_SORT_ORDER', '4', 'Reihenfolge bei den Order-Total Modulen.', '6', '2', now())");
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Inselzuschlag f?r Bestellungen aus folgenden Regionen', 'MODULE_ORDER_TOTAL_INSELZUSCHLAG_DESTINATION', 'both', 'Berechnung des Inselzuschlages bei folgenden Gebieten.', '6', '6', 'tep_cfg_select_option(array(\'national\', \'international\', \'both\'), ', now())");
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Steuerklasse', 'MODULE_ORDER_TOTAL_INSELZUSCHLAG_TAX_CLASS', '0', 'Folgende Steuerklasse fuer Inselzuschlag verwenden.', '6', '7', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())");
    }

    function remove() {
      tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
    }
  }
?>

 

Link to comment
Share on other sites

12 minutes ago, Yepi said:

Hello, what can it be, if the customer has selected to pay with points but wants later to use cash. The module can no longer switch to cash. you have to log out first and log in again so that the payment method can be changed

This is normal behaviour and has been discussed already

12 minutes ago, Yepi said:

Here I still have a module for delivery surcharge but in spite of payment with points is not included and is to be paid at the end total. did temand have a tip for me?

Sorry, I do not understand, can you please explain better.

Link to comment
Share on other sites

Ok, thanks Reiner that makes sense, too.

This module is for island surcharges. That is, should this surcharge be calculated because the customer lives in a certain place where an extra flat rate is calculated so this flat rate will not be charged with points but remains on the bill as a cash payment

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