Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Converting Points and Rewards system for osC BS


Tsimi

Recommended Posts

4 minutes ago, LeeFoster said:

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

Come on, each table based shipping module is more complicate to fill in. :wink:

EDIT: I recon, I'm also a bit lazy to code check boxes. :biggrin:

Edited by raiwa
Link to comment
Share on other sites

@raiwa

I added the German translation for the FAQ 18 part to my github fork.
You cannot merge everything since I don't have the exact same files as you do. You used older files for your latest changes which included some old minor bugs.
For example; inside the customers_points_pending.php file you have this $uInfo = new objectInfo($pending_points); twice in there which will cause some weird behavior with the table row select feature.

Just download my fork files and take the German language files and upload them to your github.

Link to comment
Share on other sites

3 minutes ago, Tsimi said:

@raiwa

I added the German translation for the FAQ 18 part to my github fork.
You cannot merge everything since I don't have the exact same files as you do. You used older files for your latest changes which included some old minor bugs.
For example; inside the customers_points_pending.php file you have this $uInfo = new objectInfo($pending_points); twice in there which will cause some weird behavior with the table row select feature.

Just download my fork files and take the German language files and upload them to your github.

Sorry for the mess. I'll update my master with the good files from the uploaded add-on.

Link to comment
Share on other sites

2 minutes ago, Tsimi said:

@raiwa

I tested your latest changes for PWA and when I checkout the points part doesn't show at all on the checkout payment page.
Did I miss something?

Can you double check, please, for me it works. Make sure it's the first order. (customer e-mail is the criteria)

Link to comment
Share on other sites

No I mean the points part entirely is not showing. I don't see the checkbox to tick to use my points.
And the referral is also not showing. Created account and went to the first order checkout.

I'll double check the files again.

Edited by Tsimi
Link to comment
Share on other sites

@Tsimi

Pushed the updates to sync to last published version (I found only the difference you mentioned and the install manual)

Pushed the german language file update

Pushed the auto tick update for admin/orders.php

Link to comment
Share on other sites

Thanks @Tsimi, a pleasure.

@raiwa, I'll send it to you as soon as I have it ready. And your fix worked perfectly. Thanks!

Also, I forgot to say that I found a couple of mistakes in the installation instructions. 
STEP = 2.   catalog/languages/english/includes/modules/boxes/bm_information.php

I think it should read:

CATALOG STEP = 2.   catalog/includes/languages/english/modules/boxes/bm_information.php

As you'll see, "includes" is not in the right path. The same happens in CATALOG STEP = 4.

Shopowner, not coder, experienced copypaster  :D

Link to comment
Share on other sites

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

I did some tests in Admin/orders for the checkboxes. I believe it is wrong coded right now:

  • the que checkbox does add the pending points to the customer points -> ok
    and sets the pending points to status 2 -> ok (I guess)
  • the delete checkbox does add the pending points to the customer points -> NOT ok
    and deletes the pending points from the customers_points_pending table -> ok
  • suggested change: the delete checkbox should only delete the pending points from the customers_points_pending table.
    I believe this option is intended to remove shopping points if an order is not completed (unpaid, returned) and NOT add them to the customer points.

 

Edited by raiwa
Link to comment
Share on other sites

14 minutes ago, Tsimi said:

If you can fix it please do so. 

Will do today.

Another point:

Someone asked for the Auto Credit Pending Points option.

It replaces the manual tick boxes in Admin/orders.

If a value is entered there, the points will auto validate after the number of days which are set. Order must be edited therefore. I believe this makes only sense for download only stores (virtual products) with instant payment option.

Maybe we should add a note for this to the instructions.

EDIT: It needs the customers_points_credit.php script which we removed. So we should back these 2 files and the links or remove this option.

 

Edited by raiwa
Link to comment
Share on other sites

2 hours ago, Tsimi said:

If you can fix it please do so. 

@Tsimi,

Pushed the fix and added a script to toggle between both checkboxes. Only one or none makes sense to be checked, not both:wink:

Maybe we should change the labels to be more clear what the checkboxes do:

  • validate pending shopping points for this order
  • delete pending shopping points for this order
Edited by raiwa
Link to comment
Share on other sites

29 minutes ago, raiwa said:

@Tsimi,

Maybe we should change the labels to be more clear what the checkboxes do:

  • validate pending shopping points for this order
  • delete pending shopping points for this order

Yeah, that would definitely be a good idea.

Give me some time to test the latest changes.
I will trash my github fork first and start from scratch by re-forking you latest github.
Then I'll do some testing.

Edited by Tsimi
Link to comment
Share on other sites

@raiwa

Just quickly re-installed the whole addon. Took not longer then 5 min to transfer files and install modules. This addon has come a long way from 30-60min install to a 5 min install.

Regarding the order status thing, you are a damn genius. That works like a charm. Select Delivered from the dropdown and it ticks the "and Que" checkbox then click the update button and points go from pending to confirmed.
I am sure many will love this feature. @Dan Cole

Now shop owners / admins can choose between auto confirm when order is placed, confirm by status, and confirm manually. That should cover most of scenarios. Virtual download products could benefit from the auto confirm feature which was already inside from the start.

Oh and I forgot to mention....if you rename "and Que" and "and Delete" please translate German too. :biggrin:

Edited by Tsimi
Link to comment
Share on other sites

@Tsimi,

1. New labes in orders page (pushed):

  • changed text in all 3 languages
  • improved layout
  • changed language file names of the admin/orders hook from points_hook.php to points.php to match naming standards

2. Auto Credit Pending Points setting in ht points and rewards:

  • left empty -> shopping points added to pending points table -> need to be manually validated in orders page or customer_pending_points.php => OK
  • set to '0' (zero) -> shopping points are immediately added to customer points on checkout. => OK
  • set to '1' or more days -> this setting was only used in the removed "customers_points_credit.php" file. It needed to be run manually using the links we removed or by cron job. => No sense for actual version
    Option A: change the configuration setting to true/false -> "true" acts like "0" zero, "false" acts like empty and forget for the days delay.
    Option B: add back the removed "customers_points_credit.php" and "customers_points_expire.php" files and put back the manual links.
    Question: For which scenario does it make sense to delay several days the auto validation?

3. Pending tasks for new version upload:

  • spanish language fixes (awaiting from @TITO4)
  • write update doc: separate file "update 1.0 to 1.1", including change log.
    I can go for this.
  • Add version info 1.1 to header comments of all updated files. I can go for it
  • Update installation manual @Tsimi could you go for this:
    • add contribution support info
    • check and fix the bug reported here:
      On 16/10/2017 at 8:15 PM, TITO4 said:

      Also, I forgot to say that I found a couple of mistakes in the installation instructions. 

      STEP = 2.   catalog/languages/english/includes/modules/boxes/bm_information.php

      I think it should read:

      CATALOG STEP = 2.   catalog/includes/languages/english/modules/boxes/bm_information.php

      As you'll see, "includes" is not in the right path. The same happens in CATALOG STEP = 4.

       

Link to comment
Share on other sites

@raiwa

Hi Rainer

Regarding 1.)

Merged, thanks.

Regarding 2.)

I personally would like to avoid adding back those two cron files and links.
Option A sounds like a good approach.

So we can now either

A. confirm points automatically right after the order is placed.
B. confirm points manually
C. confirm points by one or multiple status settings.

I think that should suffice for now.

Quote

Question: For which scenario does it make sense to delay several days the auto validation?

I can't think of any scenario that would require the points to be confirmed after X days.

1 hour ago, raiwa said:

Add version info 1.1 to header comments of all updated files. I can go for it

If you want I can do that once you updated all the files, including the Spanish language files from TiTO4.

1 hour ago, raiwa said:

Update installation manual

I'll do that.
You want me to mention the Order Editor and PWA support? Is there any other addon I should mention which I might have forgotten?
And yes, I'll fix the wrong path inside the manual.

Link to comment
Share on other sites

22 minutes ago, Tsimi said:

You want me to mention the Order Editor and PWA support? Is there any other addon I should mention which I might have forgotten?

No other add-ons, the "get_pages" function name change for compatibility with one of my other add.ons (sloppy words cleaner) is not needed to be mentioned. It's just a compatibility fix.

All  points agreed and confirmed.:thumbsup:

 

 

Link to comment
Share on other sites

@raiwa

Just installed the latest github package into a clean, new test store and the points part in the checkout payment page won't show.
Still trying to confirm why since it is a clean shop there is no other addon or code that might interfere.

Is it possible that naming the admin hook "points" causes a conflict with the shop side "points" hook?

Link to comment
Share on other sites

1 minute ago, Tsimi said:

@raiwa

Just installed the latest github package into a clean, new test store and the points part in the checkout payment page won't show.
Still trying to confirm why since it is a clean shop there is no other addon or code that might interfere.

Is it possible that naming the admin hook "points" causes a conflict with the shop side "points" hook?

I do not think so, all other hooks and language files on store side are also called points.php.

I'll check this also on a new clean installation, but I'm busy today. I'll see until tomorrow.

Can you check the basic things:

  • hook registry and call in checkout_payment.php
  • content of hook and language file
  • error messages
  • comment out the conditions in hook
Link to comment
Share on other sites

@raiwa

I think I found it.
I unfortunately deleted all my old files except for the first BETA package of mine and an older package of yours.

So I compared the hook contents for the payment page and in your older package you had this function inside.

echo points_selection($cart_show_total);

If I add that piece of code inside the current hook file the blue box with the points text and checkbox is showing.
This is my current hook file for the payment page

<?php
/*
  $Id: points.php
  $Loc: catalog/includes/hooks/shop/checkout_payment/

   originally coded by Ben Zukrel 
   Improved and converted for osC Bootstrap by
   @Tsimi
   and
   @raiwa Rainer Schmied / [email protected]  / www.oscaddons.com

   Additional credits to @LeeFoster for bug reports and fixes
   German translation by @Tsimi
   German revision by @raiwa
   Spanish translation by @TITO4
   Spanish revision by @PiLLaO 
  
  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2017 osCommerce

  Released under the GNU General Public License
*/

class hook_shop_checkout_payment_points {
  
  function __construct() {
    require_once(DIR_FS_CATALOG . 'includes/functions/redemptions.php');
  }
  
  function listen_CheckoutPaymentPoints() {
    global $cart, $order, $language;
        
    require('includes/languages/' . $language . '/hooks/shop/checkout_payment/points.php');

    if ((MODULE_HEADER_TAGS_POINTS_REWARDS_USE_POINTS_SYSTEM == 'True') && (MODULE_HEADER_TAGS_POINTS_REWARDS_USE_REDEEM_SYSTEM == 'True')) {
      $cart_show_total= $cart->show_total();
		echo points_selection($cart_show_total);
		
      // PWA guest checkout support BEGIN
      if ( defined('MODULE_CONTENT_PWA_LOGIN_STATUS') && MODULE_CONTENT_PWA_LOGIN_STATUS == 'True' && tep_session_is_registered('customer_is_guest') ) {
        $orders_check_query = tep_db_query("select count(*) as total from orders o, orders_status s where o.customers_email_address = '" . $order->customer['email_address'] . "'");
        $orders_check = tep_db_fetch_array($orders_check_query);
        $check_first_order = $orders_check['total'];
      } else {
        $check_first_order = tep_count_customer_orders();
      }
      // PWA guest checkout support END

      if (tep_not_null(MODULE_HEADER_TAGS_POINTS_REWARDS_POINTS_USE_REFERRAL_SYSTEM) && ($check_first_order == 0)) {
        echo referral_input();
      }
    }
  }

} // end class

Maybe that piece of code got accidentally deleted?

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