Zen Cart Logo
Forums / All Other Contributions/Addons / Reward Points Module for ZC v13x

Reward Points Module for ZC v13x

Locked

Views: 470,582

Results 161 to 180 of 2,476
This thread is locked. New replies are disabled.
01 May 2008, 17:09
#161
pinetreecandles avatar

pinetreecandles

Zen Follower

Join Date:
Feb 2008
Location:
West Virginia
Posts:
135
Plugin Contributions:
0

Reward Points Module for ZC v13x

hem:

Sorry- I haven't been ignoring you lot- The other side of my job kicked in and I've been out on travels but I'm back now.

Top priority is to get to the bottom of the PayPal issue. I don't understand why the transaction type would affect how PayPal IPN redirects back to checkout_process.php. It's also interesting that GVs are also affected. I'm guessing that what ever the problem is it is affecting all the credit mods- I should have a better read this afternoon- I have just completed setting up my test rig with PayPal's Sandbox...

Watch this space.

Thanks for the update

01 May 2008, 17:33
#162
pinetreecandles avatar

pinetreecandles

Zen Follower

Join Date:
Feb 2008
Location:
West Virginia
Posts:
135
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

Andy-

Here is some good news, at least for those of us who use 2checkout. I just ran a live test using 2checkout and everything worked as it should. Confirmation emails were sent and received and points went to pending. When I updated the order status, the points went to earned as they should.

I then made a purchase using points as well as credit card through 2checkout and again, every went as it should. Emails received and earned points removed as well as new points earned. Worked like a charm :clap:

The next test I'm going to do is pay with a paypal account via 2checkout and see what happens. A new feature they have is paying with your paypal account through 2checkout. I will report back with my results after.

01 May 2008, 21:06
#163
berserker avatar

berserker

Totally Zenned

Join Date:
May 2006
Posts:
712
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

Hello,

No problems here with Protx.

02 May 2008, 06:24
#164
meltdown avatar

meltdown

Totally Zenned

Join Date:
Jun 2006
Location:
My family and I live in Brighton, England
Posts:
947
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

Wow - Very well constructed and complete add-on! Installed and succesfully running it through the hoops on Zen version 1.3.6. (I have a manual credit card POS so no PayPal testing here)

Previously I had the shopping_cart_sidebox_with_checkout_button_and_product_image_1.1 add-on installed and was pleased with it. (It is a 1-page add-on that modifies tpl_shopping_cart.php) Because I didn't want to lose the image and checkout button in the sidebox I merged the modified tpl_shopping_cart.php with the tpl_shopping_cart_with_rewards.php from this add-on. After quite a bit of live-store testing in both IE and FF, the modification doesn't seem to have negatively influenced the Rewards add-on. If anyone is interested, here is the modified tpl_shopping_cart_with_rewards.php:

<?php
/**
 * Side Box Template for a shopping cart with reward points
 *
 * @package templateSystem
 * @copyright Copyright 2008 Andrew Moore
 * @copyright Portions Copyright 2003-2005 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 */
  $content ="";
  $reward_points=0;
  
  $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">';
  if ($_SESSION['cart']->count_contents() > 0) {
  $content .= '<div id="cartBoxListWrapper">' . "\n" . '<ul>' . "\n";
    $products = $_SESSION['cart']->get_products();
    for ($i=0, $n=sizeof($products); $i<$n; $i++) {
      $content .= '<li>';
	  if($products[$i]['products_priced_by_attribute'])
	   $reward_points+=(GetRewardPoints($products[$i]['id'],$products[$i]['attributes'])*$products[$i]['quantity']);
	  else
	   $reward_points+=(GetRewardPoints($products[$i]['id'])*$products[$i]['quantity']);
	  
      if (($_SESSION['new_products_id_in_cart']) && ($_SESSION['new_products_id_in_cart'] == $products[$i]['id'])) {
        $content .= '<span class="cartNewItem">';
      } else {
        $content .= '<span class="cartOldItem">';
      }

      $content .= $products[$i]['quantity'] . BOX_SHOPPING_CART_DIVIDER . '</span><a href="' . zen_href_link(zen_get_info_page($products[$i]['id']), 'products_id=' . $products[$i]['id']) . '">';

      if (($_SESSION['new_products_id_in_cart']) && ($_SESSION['new_products_id_in_cart'] == $products[$i]['id'])) {
        $content .= '<span class="cartNewItem">';
      } else {
        $content .= '<span class="cartOldItem">';
      }

      $content .= zen_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT) . '<br>' . $products[$i]['name'] . '</span></a></li>' . "\n";

      if (($_SESSION['new_products_id_in_cart']) && ($_SESSION['new_products_id_in_cart'] == $products[$i]['id'])) {
        $_SESSION['new_products_id_in_cart'] = '';
      }
    }
    $content .= '</ul>' . "\n" . '</div>';
  } else {
    $content .= '<div id="cartBoxEmpty">' . BOX_SHOPPING_CART_EMPTY . '</div>';
  }

  if ($_SESSION['cart']->count_contents() > 0) {
    $content .= '<hr />';
    $content .= '<div class="cartBoxTotal">' . $currencies->format($_SESSION['cart']->show_total()) . '</div>';
	$content .= '<div class="cartBoxRewardPoints">' . (int)$reward_points . ' ' . PRODUCT_REWARD_POINT_TAG . '</div>';
    $content .= '<br class="clearBoth" />';
	$content .= '<a href="' . zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . zen_image_button(BUTTON_IMAGE_CHECKOUT, BUTTON_CHECKOUT_ALT) . '</a>';
  }

  if (isset($_SESSION['customer_id'])) {
    $gv_query = "select amount
                 from " . TABLE_COUPON_GV_CUSTOMER . "
                 where customer_id = '" . $_SESSION['customer_id'] . "'";
   $gv_result = $db->Execute($gv_query);

    if ($gv_result->RecordCount() && $gv_result->fields['amount'] > 0 ) {
      $content .= '<div id="cartBoxGVButton"><a href="' . zen_href_link(FILENAME_GV_SEND, '', 'SSL') . '">' . zen_image_button(BUTTON_IMAGE_SEND_A_GIFT_CERT , BUTTON_SEND_A_GIFT_CERT_ALT) . '</a></div>';
      $content .= '<div id="cartBoxVoucherBalance">' . VOUCHER_BALANCE . $currencies->format($gv_result->fields['amount']) . '</div>';
    }
  }
  $content .= '</div>';
?>

The store where this is installed is: BeadedLily

Thanks for such a great mod!!

02 May 2008, 08:46
#165
hem avatar

hem

Totally Zenned

Join Date:
Sep 2007
Location:
Dublin, Ireland
Posts:
1,281
Plugin Contributions:
5

Re: Reward Points Module for ZC v13x

MeltDown:

Wow - Very well constructed and complete add-on! Installed and succesfully running it through the hoops on Zen version 1.3.6. (I have a manual credit card POS so no PayPal testing here)

Hey, nice merge. Well done.

02 May 2008, 12:28
#166
meltdown avatar

meltdown

Totally Zenned

Join Date:
Jun 2006
Location:
My family and I live in Brighton, England
Posts:
947
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

hem:

Hey, nice merge. Well done.

You can thank WinMerge for that - Great tool!

2 Questions: How do I make it so that all points automatically move to the earned category? (I have a manual POS so I'll have control over what gets processed )

And: I must have a setting wrong somewhere or something. My test client has earned 255 points. In the Customer Reward Points Admin I transferred all pending points to earned. However, if I login as that test client and attempt to redeem on a new purchase, the points are recognized but they have no value:

You may click to redeem any collected Reward Points. Your redeemed points will be applied to the total and reflected in your cart after to click continue.

Current Reward Points:255 points earned
Value of Redeemed Reward Points:0.00EUR
Redeem Reward Points:

Thanks for your help!

03 May 2008, 07:30
#167
hem avatar

hem

Totally Zenned

Join Date:
Sep 2007
Location:
Dublin, Ireland
Posts:
1,281
Plugin Contributions:
5

Re: Reward Points Module for ZC v13x

Sheesh!!! I've spent nearly a day just trying to set PayPal up in Sandbox mode. I'm rapidly coming to the conclusion that the fault is PayPals.

03 May 2008, 09:03
#168
meltdown avatar

meltdown

Totally Zenned

Join Date:
Jun 2006
Location:
My family and I live in Brighton, England
Posts:
947
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

MeltDown:

And: I must have a setting wrong somewhere or something. My test client has earned 255 points. In the Customer Reward Points Admin I transferred all pending points to earned. However, if I login as that test client and attempt to redeem on a new purchase, the points are recognized but they have no value:

Thanks for your help!

Hello again - Any thoughts on why my earned points have no value if redeemed? I'm hoping it's not an indication of greater issues :(

You may click to redeem any collected Reward Points. Your redeemed points will be applied to the total and reflected in your cart after to click continue.

Current Reward Points:255 points earned
Value of Redeemed Reward Points:0.00EUR
Redeem Reward Points:

Thanks for any comments

03 May 2008, 09:11
#169
hem avatar

hem

Totally Zenned

Join Date:
Sep 2007
Location:
Dublin, Ireland
Posts:
1,281
Plugin Contributions:
5

Re: Reward Points Module for ZC v13x

MeltDown:

Hello again - Any thoughts on why my earned points have no value if redeemed? I'm hoping it's not an indication of greater issues :(

Thanks for any comments

You need to set a Global Redeem Points ratio- Yours is currently set to 0- hence no redeem value.

03 May 2008, 10:36
#170
meltdown avatar

meltdown

Totally Zenned

Join Date:
Jun 2006
Location:
My family and I live in Brighton, England
Posts:
947
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

hem:

You need to set a Global Redeem Points ratio- Yours is currently set to 0- hence no redeem value.

That did the trick - This mod continues to function beautifully, despite its complexities!

03 May 2008, 12:29
#171
hem avatar

hem

Totally Zenned

Join Date:
Sep 2007
Location:
Dublin, Ireland
Posts:
1,281
Plugin Contributions:
5

Re: Reward Points Module for ZC v13x

Is it complex??? I hadn't noticed :blink:

03 May 2008, 12:47
#172
meltdown avatar

meltdown

Totally Zenned

Join Date:
Jun 2006
Location:
My family and I live in Brighton, England
Posts:
947
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

hem:

Is it complex??? I hadn't noticed :blink:

Or is it simple in an elaborately intricate and labyrinthine way? :wink:

05 May 2008, 15:02
#173
kenwahl avatar

kenwahl

New Zenner

Join Date:
Feb 2008
Posts:
32
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

I'm having a problem with this module that I haven't seen anyone post here. My site accepts both Authorize.net and Google Checkout. If they try to checkout via Google Checkout they are being billed for the rewards points they earn on that purchase. If they earn 10 rewards points for the purchase they are billed $10 that shows up in google checkout as a product. The module works fine via Authorize.net.

I've included a picture of it in google checkout.

Thanks
Ken

05 May 2008, 20:49
#174
pinetreecandles avatar

pinetreecandles

Zen Follower

Join Date:
Feb 2008
Location:
West Virginia
Posts:
135
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

pinetreecandles:

Andy-

Here is some good news, at least for those of us who use 2checkout. I just ran a live test using 2checkout and everything worked as it should. Confirmation emails were sent and received and points went to pending. When I updated the order status, the points went to earned as they should.

I then made a purchase using points as well as credit card through 2checkout and again, every went as it should. Emails received and earned points removed as well as new points earned. Worked like a charm :clap:

The next test I'm going to do is pay with a paypal account via 2checkout and see what happens. A new feature they have is paying with your paypal account through 2checkout. I will report back with my results after.

Sorry about the delay in reporting the results. Paypal seems to work with the mod when used through 2checkout. All points are transfered properly and notices are received for admin as well as customer. It's also working when using points to purchase an item.

Guess I will remove paypal option and just make a note that paypal accounts can be used for payment via 2checkout also.

06 May 2008, 03:26
#175
kenwahl avatar

kenwahl

New Zenner

Join Date:
Feb 2008
Posts:
32
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

Here is some added information on the errors with google checkout as described in prior post.

If I don't enable Google Checkout all works fine out of the box. If I enable google checkout I get the following error on the login page and the google checkout button doesn't show up or new sign up fields. Only the login for existing customers shows up:

1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND ((prp.scope_id= AND prp.scope=4) OR (gp.group_id=c.customers_group_pricin' at line 5
in:
[SELECT redeem_ratio FROM zen_reward_master prp, zen_customers as c LEFT JOIN(zen_group_pricing as gp) ON (gp.group_id=c.customers_group_pricing) WHERE c.customers_id= AND ((prp.scope_id= AND prp.scope=4) OR (gp.group_id=c.customers_group_pricing AND prp.scope_id=gp.group_id AND scope=3) OR (prp.scope=0)) ORDER BY prp.scope DESC LIMIT 1;]

If I edit the file reward_points_functions.php as follows the google checkout button shows up and all is well except when you click on google checkout you get the page in the picture shown in the prior post with it charging $10 for the 10 points earned. Normal checkout via authorize.net works fine either way.

original reward_points_functions.php:

function GetRedeemRatio($customers_id)
{
global $db;

$sql = "SELECT redeem_ratio 
        FROM ".TABLE_REWARD_MASTER." prp, ".TABLE_CUSTOMERS." as c
		LEFT JOIN(".TABLE_GROUP_PRICING." as gp) ON (gp.group_id=c.customers_group_pricing)
		WHERE c.customers_id=".$customers_id." 
		AND ((prp.scope_id=".$customers_id." AND prp.scope=".SCOPE_CUSTOMER.")
		OR (gp.group_id=c.customers_group_pricing AND prp.scope_id=gp.group_id AND scope=".SCOPE_GROUP.")
		OR (prp.scope=".SCOPE_GLOBAL."))
		ORDER BY prp.scope DESC LIMIT 1;"; 

$result=$db->Execute($sql);

changed reward_points_functions.php:

function GetRedeemRatio($customers_id)
{
global $db;

$sql = "SELECT redeem_ratio 
        FROM ".TABLE_REWARD_MASTER." prp, ".TABLE_CUSTOMERS." as c
		LEFT JOIN(".TABLE_GROUP_PRICING." as gp) ON (gp.group_id=c.customers_group_pricing)
		WHERE c.customers_id='" . $customers_id . "' 
		AND ((prp.scope_id='" . $customers_id . "' AND prp.scope=".SCOPE_CUSTOMER.")
		OR (gp.group_id=c.customers_group_pricing AND prp.scope_id=gp.group_id AND scope=".SCOPE_GROUP.")
		OR (prp.scope=".SCOPE_GLOBAL."))
		ORDER BY prp.scope DESC LIMIT 1;"; 

$result=$db->Execute($sql);
07 May 2008, 15:13
#176
meltdown avatar

meltdown

Totally Zenned

Join Date:
Jun 2006
Location:
My family and I live in Brighton, England
Posts:
947
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

Does this mod work with attributes?

Thanks

07 May 2008, 20:30
#177
pinetreecandles avatar

pinetreecandles

Zen Follower

Join Date:
Feb 2008
Location:
West Virginia
Posts:
135
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

MeltDown:

Does this mod work with attributes?

Thanks

I don't think so, but I think I read on one of his posts that it's on his list of things to do.

07 May 2008, 20:53
#178
meltdown avatar

meltdown

Totally Zenned

Join Date:
Jun 2006
Location:
My family and I live in Brighton, England
Posts:
947
Plugin Contributions:
0

Re: Reward Points Module for ZC v13x

pinetreecandles:

I don't think so, but I think I read on one of his posts that it's on his list of things to do.

Good, because it wasn't working with one of my few attribute-based products and I was hoping it wasn't a glitch.

07 May 2008, 22:50
#179
hem avatar

hem

Totally Zenned

Join Date:
Sep 2007
Location:
Dublin, Ireland
Posts:
1,281
Plugin Contributions:
5

Re: Reward Points Module for ZC v13x

MeltDown:

Good, because it wasn't working with one of my few attribute-based products and I was hoping it wasn't a glitch.

I have coded in the Attributes function but was not going to go live with it until I resolved the PayPal problem...

One question to those who have been testing the mod with PayPal- Am I right in thinking that the problem only occurs with PayPal IPN? The other two PayPal methods should work okay.

07 May 2008, 22:51
#180
hem avatar

hem

Totally Zenned

Join Date:
Sep 2007
Location:
Dublin, Ireland
Posts:
1,281
Plugin Contributions:
5

Re: Reward Points Module for ZC v13x

kenwahl:

Here is some added information on the errors with google checkout as described in prior post.

If I don't enable Google Checkout all works fine out of the box. If I enable google checkout I get the following error on the login page and the google checkout button doesn't show up or new sign up fields. Only the login for existing customers shows up:

1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND ((prp.scope_id= AND prp.scope=4) OR (gp.group_id=c.customers_group_pricin' at line 5
in:
[SELECT redeem_ratio FROM zen_reward_master prp, zen_customers as c LEFT JOIN(zen_group_pricing as gp) ON (gp.group_id=c.customers_group_pricing) WHERE c.customers_id= AND ((prp.scope_id= AND prp.scope=4) OR (gp.group_id=c.customers_group_pricing AND prp.scope_id=gp.group_id AND scope=3) OR (prp.scope=0)) ORDER BY prp.scope DESC LIMIT 1;]

If I edit the file reward_points_functions.php as follows the google checkout button shows up and all is well except when you click on google checkout you get the page in the picture shown in the prior post with it charging $10 for the 10 points earned. Normal checkout via authorize.net works fine either way.

original reward_points_functions.php:

function GetRedeemRatio($customers_id)
{
global $db;

$sql = "SELECT redeem_ratio
FROM ".TABLE_REWARD_MASTER." prp, ".TABLE_CUSTOMERS." as c
LEFT JOIN(".TABLE_GROUP_PRICING." as gp) ON (gp.group_id=c.customers_group_pricing)
WHERE c.customers_id=".$customers_id."
AND ((prp.scope_id=".$customers_id." AND
prp.scope=".SCOPE_CUSTOMER.")
OR (gp.group_id=c.customers_group_pricing AND prp.scope_id=gp.group_id AND scope=".SCOPE_GROUP.")
OR (prp.scope=".SCOPE_GLOBAL."))
ORDER BY prp.scope DESC LIMIT 1;";

$result=$db->Execute($sql);

changed reward_points_functions.php:

function GetRedeemRatio($customers_id)
{
global $db;

$sql = "SELECT redeem_ratio
FROM ".TABLE_REWARD_MASTER." prp, ".TABLE_CUSTOMERS." as c
LEFT JOIN(".TABLE_GROUP_PRICING." as gp) ON (gp.group_id=c.customers_group_pricing)
WHERE c.customers_id='" . $customers_id . "'
AND ((prp.scope_id='" . $customers_id . "' AND
prp.scope=".SCOPE_CUSTOMER.")
OR (gp.group_id=c.customers_group_pricing AND prp.scope_id=gp.group_id AND scope=".SCOPE_GROUP.")
OR (prp.scope=".SCOPE_GLOBAL."))
ORDER BY prp.scope DESC LIMIT 1;";

$result=$db->Execute($sql);

That will get past the problem but it those not explain how the function got called without a Customer ID. Even when getting the Global Redeem value (Scope=0) 0 should still get passed as the Scope ID.