-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
southshorepizza
Originally Posted by southshorepizza
Okay so I have done all of these things. I also have gone back in and found post 441-451 in this thread about my last attempt at the upgrade. I have the same results!
At the risk of pissing you off.. No you haven't "done all of these things" or if you think you did, it's clear from the information you provided that you've not done them correctly..
I say this based on the error message you posted you are getting.. if you followed the steps in this post, you would not be getting the error you are getting and you would have a "\YOUR_ADMIN\includes\functions\extra_functions\reward_points_functions.php" file in your store.. By your own admission this file does NOT exist in your store's admin area, so I'm not sure how you followed the instructions in this post if you don't have the file that this post says you need to modify.. You appear to have an INCOMPLETE Rewards Points install.. Which is WHY YOU ARE GETTING THE ERROR..
Quote:
Originally Posted by
southshorepizza
Log says
[28-Mar-2014 14:24:44] PHP Fatal error: Call to undefined function getrewardpoints() in /home4/w57dsjmm/public_html/order/includes/modules/order_total/ot_reward_points_display.php on line 40
however line 40 of said file is $reward_points=GetRewardPoints($order->products);
You are MISINTERPRETING what this error message ACTUALLY means.. so let me interpret here..
Line 40 in the "includes/modules/order_total/ot_reward_points_display.php" file makes a call to a function that DOES NOT EXIST.. Because it does not exist, the error log tells you where this call was made (line 40 of the ot_reward_points_display.php file), and the name of the function being called ( getrewardpoints() ).
The error says that a function called "getrewardpoints()" has not been defined in your functions file.. This means either
A. The functions file does not exist (hence why the error log says it's MISSING)
B. The functions file exists and the function is not DEFINED in it (hence why the error log says it's MISSING)
This post you say you followed provides instructions for adding this function to the ADMIN function file so Edit Orders will NOT throw this error..
Quote:
Originally Posted by
southshorepizza
Diva Vocals or anyone else,
I don't have anything here:
\admin\includes\functions\extra_functions\reward_points_functions.php.
Then you do not have Rewards Points fully installed. this file is part of the install package.. If you are MISSING this file then you have an INCOMPLETE install.. UNDO everything you say you've done.. Copy over the Rewards Points files again.. DO NOT run the SQL install file.. Let me say that again.. COPY OVER THE MISSING FILES, but DO NOT RE-RUN THE SQL!!
Quote:
Originally Posted by
southshorepizza
I do have the file indicated in the log at:
/order/includes/modules/order_total/ot_reward_points_display.php
Already explained this above.. This file is making a call to a file/function that DOES NOT EXIST..
Quote:
Originally Posted by
southshorepizza
My file at /order/includes/modules/order_total/ot_reward_points_display.php I will put line 40 in red text but the file looks like this:
Code:
class ot_reward_points_display
{
var $title, $output;
function ot_reward_points_display()
{
$this->code = 'ot_reward_points_display';
$this->title = MODULE_ORDER_TOTAL_REWARD_POINTS_DISPLAY_TITLE;
$this->description = MODULE_ORDER_TOTAL_REWARD_POINTS_DISPLAY_DESCRIPTION;
$this->sort_order = MODULE_ORDER_TOTAL_REWARD_POINTS_DISPLAY_SORT_ORDER;
$this->output = array();
}
function process()
{
global $order;
$reward_points=GetRewardPoints($order->products);
$GlobalRewardPointRatio=GetGlobalRewardPointRatio();
$AdjustValue=GetRewardPointAdvancedCalculateValue();
$reward_points+=$AdjustValue*$GlobalRewardPointRatio;
if(isset($_SESSION['redeem_value']))
{
/*
$redeem_ratio=GetRedeemRatio($_SESSION['customer_id']);
$reward_points=$reward_points/$redeem_ratio;
$reward_points=$reward_points-$_SESSION['redeem_value'];
$reward_points=$reward_points*$redeem_ratio;
*/
$reward_points=$reward_points-($GlobalRewardPointRatio*$_SESSION['redeem_value']);
}
if($reward_points<0)
$reward_points=0;
$reward_points=zen_round($reward_points,0);
$_SESSION['REWARD_POINTS_EARNED']=$reward_points;
$this->output[] = array('title' => $this->title . ':',
'text' => $reward_points,
'value' => 0);
}
function check()
{
global $db;
if (!isset($this->_check))
{
$check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_REWARD_POINTS_DISPLAY_STATUS'");
$this->_check = $check_query->RecordCount();
}
return $this->_check;
}
function keys()
{
return array('MODULE_ORDER_TOTAL_REWARD_POINTS_DISPLAY_STATUS', 'MODULE_ORDER_TOTAL_REWARD_POINTS_DISPLAY_SORT_ORDER');
}
function install()
{
global $db;
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('This module is installed', 'MODULE_ORDER_TOTAL_REWARD_POINTS_DISPLAY_STATUS', 'true', '', '6', '1','zen_cfg_select_option(array(\'true\',\'false\'), ', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_ORDER_TOTAL_REWARD_POINTS_DISPLAY_SORT_ORDER', '1000', 'Sort order of display.', '6', '2', now())");
}
function remove()
{
global $db;
$db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
}
?>
WHY??? this is this is not the change you should be making!!!!! This file IS NOT THE ISSUE.. this post is the change you should be making..
Quote:
Originally Posted by
southshorepizza
If I am supposed to have this file in the Admin root as well that could be my problem.
It IS your problem.. You are missing the functions file referenced in this post!!! If you do not have this file in your admin, you have an INCOMPLETE install of Rewards Points.. If you do not add the function file referenced in this post, you will continue to get this error..
Quote:
Originally Posted by
southshorepizza
But I don't think I'm missing a file there or the log would have given me that address wouldn't it?
You are missing the file.. The error log tells us CLEARLY that:
A. The functions file does not exist (hence why the error log says it's MISSING)
B. The functions file exists and the function is not DEFINED in it (hence why the error log says it's MISSING)
Now I apologize for all the caps and such, but it is CLEAR to those of us trying to help you that you have an incomplete Rewards Points install and you have NOT followed the steps in this post to fix the Edit Orders/Reward Points issue.. Throwing everything at the wall to see what sticks instead of just simply TRYING what we are suggesting in this post isn't getting this resolved for you.. So here's the summary of what you DO need to do to fix this:
A. DOUBLE CHECK your Rewards Points installation. Based on the error logs you have posted and the information you have shared you are MISSING files in your install. If you really DO NOT have a "\YOUR_ADMIN\includes\functions\extra_functions\reward_points_functions.php" file then this is a BIG problem in the overall functionality of the Reward Points module
B. Once you compare your store to the Rewards Points fileset and make sure you have ALL the Rewards Points files in place then PLEASE follow the instructions in this post.
After you do ONLY these things and NOTHING ELSE this should resolve the issue..:smile: If it doesn't then report the issue/error you get and we will all continue to try and help you resolve it..:smile:
-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
southshorepizza
I looked at the upgrade folder for v1.5.0 it doesn't have a functions or extra functions folder. That is where part of my error is.
Okay so I renamed the admin folder. Filezilla uploaded the new installation files. Tried to load the new install SQL and received the white page error message. The error log showed:
28-Mar-2014 23:47:33] PHP Fatal error: 1062:Duplicate entry '0-0' for key 'unique_id' :: INSERT INTO zen_reward_master (rewards_products_id ,scope ,scope_id ,point_ratio ,bonus_points, redeem_ratio, redeem_points) VALUES (NULL , '0', '0', '1.0000', NULL, 0.01, NULL); in /home4/w57dsjmm/public_html/order/includes/classes/db/mysql/query_factory.php on line 120
So I went back to the instal sql patch page and uploaded the upgrade sql file and ran it. 9 statements processed so every thing looked good.
Now when giving out points I get the following error log:
[28-Mar-2014 23:48:11] PHP Fatal error: 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 status=0 ORDER BY date DESC LIMIT 12' at line 1 :: SELECT rewards_id, orders_id, date, reward_points, status FROM zen_reward_status_track WHERE customers_id= AND status=0 ORDER BY date DESC LIMIT 12; in /home4/w57dsjmm/public_html/order/includes/classes/db/mysql/query_factory.php on line 120
I had the problem before and never received an answer. Diva Vocals said she could see the problem by the log but not where or how to fix it which left me with no answer. Shortly thereafter I went ahead and uploaded my backup files to my earlier version. I'd really like to get this fixed!
The error log was generated when I transferred points from pending to earned.
Please help me
Thank you,
David
If you have downloaded Reward Points Version: 2.1b, you will see that inside the new_installation folder is the admin folder. Inside the admin folder is includes/functions/extra_functions folder.
If you are using the Reward Points Full Suite Version: 2.1b admin/includes/functions/extra_functions folder will be there.
Now if your using Store Credits and Rewards Points Module that module don't use the admin/includes/functions folder.
-
1 Attachment(s)
Re: Reward Points Module- Live Release now available.
Ok lets start from scratch. Friday 11pm I downloaded from http://www.zen-cart.com/downloads.php?do=file&id=704
The folder called reward_point_full_suite_2.1b
I renamed the admin folders in the following directory
reward_point_full_suite_2.1b/reward_point_full_suite_2.1b/zen_1.5.0/new_installation
I then used filezilla to upload them to my site 3/28/14 at 11:45pm. And have already posted the rest of that adventure at 3/29/14 12:05am.
Now I just finished using cpanel to check every one of those files to make sure they made it to my site. Each one is there and was last modified 3/28/14 at 11:45pm. So I am good there.
So let me follow Diva Vocals post line by line.
1) if you followed the steps in this post. Done now and verified.(I had done this but overwritten it with my ftp upload) ☹
2) By my own admission this file does not exist. That was at 4:45 pm. My last post at 12:05 am explained that the upgrade folder for v1.5.0 doesn’t have that folder and that was an initial error.. I did not explain that at 5pm I had found the “missing folder” uploaded it and made the changes in step one before giving up. My mistake as you surely wouldn’t know this you just thought I didn’t do it still. But my 11:45 upload overwrote it. It’s fixed now.
3) Same link. I just verified that the changes were there just to be sure. ☺ I searched for the whole addition as one big piece and have 1 match. So we are good there.
4) I don't have anything here: \admin\includes\functions\extra_functions\reward_points_functions.php. Again going back before the complete reinstall that happened before giving up at 5 and then reuploading everything at 11:45
Here is a pic of cpanel showing the file in this post
Attachment 13927
Just to make sure I place the code from "this post" In the right spot I am including the code just before and formatting the beginning of the added code in red.
Code:
/*
function SetRewardPointDiscountTypeFunction($value,$key='')
{
require('includes/javascript/reward_points.js');
$content='<br />';
$content.='<strong>'.TEXT_NEW_ACCOUNT_AWARD_PROMPT.'</strong> '.zen_draw_checkbox_field('allow_award','',$value!=0,0,'onchange="UpdateAward()"');
$content.=zen_draw_input_field('award_points',($value==0?'':abs($value)),'onchange="UpdateAward()"').' '.zen_draw_pull_down_menu('award_id',array(array('id'=>'0','text'=>TEXT_NEW_ACCOUNT_PENDING_AWARD),array('id'=>'1','text'=>TEXT_NEW_ACCOUNT_EARNED_AWARD)),($value<0?'0':$value>0?'1':''),'onchange="UpdateAward()"').'<br />';
$content.=zen_draw_hidden_field('configuration_value',$value);
return $content;
}
function GetRewardPoints($products)
{
$reward_points=0;
if(REWARD_POINT_MODE=='0')
{
foreach($products as $product)
if(isset($product['qty']))
$reward_points+=GetProductRewardPoints($product['id'],$product['attributes'])*$product['qty'];
else
if(isset($product['quantity']))
$reward_points+=GetProductRewardPoints($product['id'],$product['attributes'])*$product['quantity'];
else
if(isset($product['quantityField']))
$reward_points+=GetProductRewardPoints($product['id'],$product['attributes'])*$product['quantityField'];
else
$reward_points="RP Error";
}
blah blah blah here is the end of the file to make sure I didn't screw up the ending.
//print_r($GLOBALS[$module]->output);
//$output_backup=$GLOBALS[$module]->output;
//$order_info_backup=$order->info;
//if(sizeof($GLOBALS[$module]->output)==0)
//$GLOBALS[$module]->process();
for($loop=0;$loop<sizeof($GLOBALS[$module]->output);$loop++)
if(zen_not_null($GLOBALS[$module]->output[$loop]['value']))
$value+=$GLOBALS[$module]->output[$loop]['value'];
//$GLOBALS[$module]->output=$output_backup;
//$order->info=$order_info_backup;
}
return $value;
}
*/
?>
So with all of this done.
If it has been done right.
I go into reward points admin. Transfer 35 points from pending to earned.
I generate this log:
[29-Mar-2014 12:33:00] PHP Fatal error: 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 status=0 ORDER BY date DESC LIMIT 12' at line 1 :: SELECT rewards_id, orders_id, date, reward_points, status FROM zen_reward_status_track WHERE customers_id= AND status=0 ORDER BY date DESC LIMIT 12; in /home4/w57dsjmm/public_html/order/includes/classes/db/mysql/query_factory.php on line 120
Now I know I'm not the most computer literate person. But I downloaded a fresh version yesterday. So if my copy was bad I had the newest version available. I have confirmed files located in the correct spot. Made and confirmed the change to the function file. Yet I'm still getting this error. If someone is willing to look at my actual files and confirm I'm not crazy please let me know. I know you all are frustrated and I am as well.
Thank you for all your help Diva Vocals. I didn't mind the caps or bold text or anything else you throw my way if it fixes the problem! I'm a big boy and can take a few capitalized words. :)
-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
southshorepizza
Ok lets start from scratch. Friday 11pm I downloaded from
http://www.zen-cart.com/downloads.php?do=file&id=704
The folder called reward_point_full_suite_2.1b
I renamed the admin folders in the following directory
reward_point_full_suite_2.1b/reward_point_full_suite_2.1b/zen_1.5.0/new_installation
I then used filezilla to upload them to my site 3/28/14 at 11:45pm. And have already posted the rest of that adventure at 3/29/14 12:05am.
Now I just finished using cpanel to check every one of those files to make sure they made it to my site. Each one is there and was last modified 3/28/14 at 11:45pm. So I am good there.
So let me follow Diva Vocals post line by line.
1) if you followed the steps in this post. Done now and verified.(I had done this but overwritten it with my ftp upload) ☹
2) By my own admission this file does not exist. That was at 4:45 pm. My last post at 12:05 am explained that the upgrade folder for v1.5.0 doesn’t have that folder and that was an initial error.. I did not explain that at 5pm I had found the “missing folder” uploaded it and made the changes in step one before giving up. My mistake as you surely wouldn’t know this you just thought I didn’t do it still. But my 11:45 upload overwrote it. It’s fixed now.
3) Same link. I just verified that the changes were there just to be sure. ☺ I searched for the whole addition as one big piece and have 1 match. So we are good there.
4) I don't have anything here: \admin\includes\functions\extra_functions\reward_points_functions.php. Again going back before the complete reinstall that happened before giving up at 5 and then reuploading everything at 11:45
Here is a pic of cpanel showing the file in
this post
Attachment 13927
Just to make sure I place the code from "this post" In the right spot I am including the code just before and formatting the beginning of the added code in red.
Code:
/*
function SetRewardPointDiscountTypeFunction($value,$key='')
{
require('includes/javascript/reward_points.js');
$content='<br />';
$content.='<strong>'.TEXT_NEW_ACCOUNT_AWARD_PROMPT.'</strong> '.zen_draw_checkbox_field('allow_award','',$value!=0,0,'onchange="UpdateAward()"');
$content.=zen_draw_input_field('award_points',($value==0?'':abs($value)),'onchange="UpdateAward()"').' '.zen_draw_pull_down_menu('award_id',array(array('id'=>'0','text'=>TEXT_NEW_ACCOUNT_PENDING_AWARD),array('id'=>'1','text'=>TEXT_NEW_ACCOUNT_EARNED_AWARD)),($value<0?'0':$value>0?'1':''),'onchange="UpdateAward()"').'<br />';
$content.=zen_draw_hidden_field('configuration_value',$value);
return $content;
}
function GetRewardPoints($products)
{
$reward_points=0;
if(REWARD_POINT_MODE=='0')
{
foreach($products as $product)
if(isset($product['qty']))
$reward_points+=GetProductRewardPoints($product['id'],$product['attributes'])*$product['qty'];
else
if(isset($product['quantity']))
$reward_points+=GetProductRewardPoints($product['id'],$product['attributes'])*$product['quantity'];
else
if(isset($product['quantityField']))
$reward_points+=GetProductRewardPoints($product['id'],$product['attributes'])*$product['quantityField'];
else
$reward_points="RP Error";
}
blah blah blah here is the end of the file to make sure I didn't screw up the ending.
//print_r($GLOBALS[$module]->output);
//$output_backup=$GLOBALS[$module]->output;
//$order_info_backup=$order->info;
//if(sizeof($GLOBALS[$module]->output)==0)
//$GLOBALS[$module]->process();
for($loop=0;$loop<sizeof($GLOBALS[$module]->output);$loop++)
if(zen_not_null($GLOBALS[$module]->output[$loop]['value']))
$value+=$GLOBALS[$module]->output[$loop]['value'];
//$GLOBALS[$module]->output=$output_backup;
//$order->info=$order_info_backup;
}
return $value;
}
*/
?>
So with all of this done.
If it has been done right.
I go into reward points admin. Transfer 35 points from pending to earned.
I generate this log:
[29-Mar-2014 12:33:00] PHP Fatal error: 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 status=0 ORDER BY date DESC LIMIT 12' at line 1 :: SELECT rewards_id, orders_id, date, reward_points, status FROM zen_reward_status_track WHERE customers_id= AND status=0 ORDER BY date DESC LIMIT 12; in /home4/w57dsjmm/public_html/order/includes/classes/db/mysql/query_factory.php on line 120
Now I know I'm not the most computer literate person. But I downloaded a fresh version yesterday. So if my copy was bad I had the newest version available. I have confirmed files located in the correct spot. Made and confirmed the change to the function file. Yet I'm still getting this error. If someone is willing to look at my actual files and confirm I'm not crazy please let me know. I know you all are frustrated and I am as well.
Thank you for all your help Diva Vocals. I didn't mind the caps or bold text or anything else you throw my way if it fixes the problem! I'm a big boy and can take a few capitalized words. :)
You've added the right code to the WRONG spot in the file.. and hence created a BRAND NEW error.. :smile:
You need to add the required code BELOW the LAST section of the original code. The last section looks like this:
Code:
/*
function SetRewardPointDiscountTypeFunction($value,$key='')
{
require('includes/javascript/reward_points.js');
$content='<br />';
$content.='<strong>'.TEXT_NEW_ACCOUNT_AWARD_PROMPT.'</strong> '.zen_draw_checkbox_field('allow_award','',$value!=0,0,'onchange="UpdateAward()"');
$content.=zen_draw_input_field('award_points',($value==0?'':abs($value)),'onchange="UpdateAward()"').' '.zen_draw_pull_down_menu('award_id',array(array('id'=>'0','text'=>TEXT_NEW_ACCOUNT_PENDING_AWARD),array('id'=>'1','text'=>TEXT_NEW_ACCOUNT_EARNED_AWARD)),($value<0?'0':$value>0?'1':''),'onchange="UpdateAward()"').'<br />';
$content.=zen_draw_hidden_field('configuration_value',$value);
return $content;
}
*/
You added the code JUST ABOVE the and that is the issue..
The last section of the original code is commented out, and by adding the new code WHERE you added it you inadvertently UN-COMMENTED it..
upload a fresh copy of the admin file and make your edits again.. Remember to add the code between the and the BTW, you can remove the
from the end of the file..
Feels like you are almost there..
-
1 Attachment(s)
Re: Reward Points Module- Live Release now available.
Here is a copy of my admin folder that I compressed in cpanel then downloaded and removed the extra files. So this is how my online website directory actually looks and the contents of each of those files.
Attachment 13928
-
Re: Reward Points Module- Live Release now available.
Thank you so much!!!! I just downloaded my whole admin sit and posted it. As it turns out it's just a silly mistake from my misunderstanding where to post! Thank you! I will make those changes in about 30 minutes and cross my fingers it works! I'm sure it will though.
thank you again!!!
-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
southshorepizza
Thank you for all your help Diva Vocals. I didn't mind the caps or bold text or anything else you throw my way if it fixes the problem! I'm a big boy and can take a few capitalized words. :)
and thanks for reading my WORDS and not assuming I FELT a particular way when I posted them.. It's NEVER personal here.. just business! :smile:
Quote:
Originally Posted by
southshorepizza
Thank you so much!!!! I just downloaded my whole admin sit and posted it. As it turns out it's just a silly mistake from my misunderstanding where to post! Thank you! I will make those changes in about 30 minutes and cross my fingers it works! I'm sure it will though.
thank you again!!!
Yep.. placing the right code in the wrong place can lead to some ugly results.. :) Thanks for sticking with this, and for providing DETAILED information.. that's the best way you can help us help you.. :smile: feels like you're almost there on this one though.. You should have a slice to celebrate!
I'll take a meatballs and mushrooms pie with extra cheese and a pitcher of cold beer to wash it down.. :laugh:
-
Re: Reward Points Module- Live Release now available.
I changed the file to read:
Code:
/*
function SetRewardPointDiscountTypeFunction($value,$key='')
{
require('includes/javascript/reward_points.js');
$content='<br />';
$content.='<strong>'.TEXT_NEW_ACCOUNT_AWARD_PROMPT.'</strong> '.zen_draw_checkbox_field('allow_award','',$value!=0,0,'onchange="UpdateAward()"');
$content.=zen_draw_input_field('award_points',($value==0?'':abs($value)),'onchange="UpdateAward()"').' '.zen_draw_pull_down_menu('award_id',array(array('id'=>'0','text'=>TEXT_NEW_ACCOUNT_PENDING_AWARD),array('id'=>'1','text'=>TEXT_NEW_ACCOUNT_EARNED_AWARD)),($value<0?'0':$value>0?'1':''),'onchange="UpdateAward()"').'<br />';
$content.=zen_draw_hidden_field('configuration_value',$value);
return $content;
}
*/
function GetRewardPoints($products)
{
$reward_points=0;
if(REWARD_POINT_MODE=='0')
{
foreach($products as $product)
if(isset($product['qty']))
$reward_points+=GetProductRewardPoints($product['id'],$product['attributes'])*$product['qty'];
else
if(isset($product['quantity']))
$reward_points+=GetProductRewardPoints($product['id'],$product['attributes'])*$product['quantity'];
else
if(isset($product['quantityField']))
$reward_points+=GetProductRewardPoints($product['id'],$product['attributes'])*$product['quantityField'];
else
$reward_points="RP Error";
}
else
{
global $order;
$GlobalRewardPointRatio=GetGlobalRewardPointRatio();
if(isset($_SESSION['cart']))
$reward_points=zen_round($_SESSION['cart']->show_total()*$GlobalRewardPointRatio-REWARD_POINTS_ROUNDING,0);
if(isset($order) && isset($order->info))
if(REWARD_POINTS_ALLOW_TOTAL=='0' && isset($order->info['subtotal']))
$reward_points=zen_round($order->info['subtotal']*$GlobalRewardPointRatio-REWARD_POINTS_ROUNDING,0);
else
if(isset($order->info['total']))
$reward_points=zen_round($order->info['total']*$GlobalRewardPointRatio-REWARD_POINTS_ROUNDING,0);
}
return $reward_points;
}
function GetProductRewardPoints($products_id,$attributes=null)
{
global $db;
$reward_price=0;
if(zen_get_products_price_is_free($products_id)==false || REWARD_POINTS_ALLOW_ON_FREE=='1') // Allow RP on free items (Admin settable)
{
$sql = "SELECT prp.point_ratio*p.products_price AS reward_points, prp.point_ratio, p.products_price, p.products_priced_by_attribute
FROM ".TABLE_REWARD_MASTER." prp, ".TABLE_PRODUCTS." p, ".TABLE_PRODUCTS_TO_CATEGORIES." p2c
WHERE p.products_id='" . $products_id . "'
AND p2c.products_id='" . $products_id . "'
AND ((prp.scope_id=p.products_id AND prp.scope='".SCOPE_PRODUCT."')
OR (p.products_id=p2c.products_id AND prp.scope_id=p2c.categories_id AND prp.scope='".SCOPE_CATEGORY."')
OR (prp.scope='".SCOPE_GLOBAL."'))
ORDER BY prp.scope DESC LIMIT 1;";
$result=$db->Execute($sql);
if($result)
{
if(zen_has_product_attributes($products_id,'false') && !$attributes)
$reward_price=zen_get_products_base_price($products_id);
else
$reward_price=$result->fields['products_price'];
//echo '['.$reward_price.'=';
//print_r($attributes);
//echo ']';
$special_price=zen_get_products_special_price($products_id);
if(REWARD_POINTS_SPECIAL_ADJUST=='1' && $special_price && !$attributes)
$reward_price=$special_price;
// Calculate attribute pricing
//if($result->fields['products_priced_by_attribute']=='1' && $attributes!=null)
if($attributes!=null)
if(isset($attributes[0]['option_id']))
foreach($attributes as $attribute)
$reward_price+=CalculateRewardPointsOnAttribute($products_id,$attribute['option_id'],$attribute['value_id']);
else
foreach($attributes as $option_id => $value_id)
$reward_price+=CalculateRewardPointsOnAttribute($products_id,$option_id,$value_id);
}
}
//echo '::'.$reward_price.', '.$result->fields['point_ratio'].', '.REWARD_POINTS_ROUNDING.'::';
$reward_points=($reward_price*$result->fields['point_ratio'])-REWARD_POINTS_ROUNDING;
if($reward_points<0)
$reward_points=0;
return zen_round($reward_points,0);
}
function CalculateRewardPointsOnAttribute($products_id,$option_id,$value_id)
{
global $db;
if($attribute=$db->Execute("SELECT products_attributes_id, attributes_discounted, options_values_price, price_prefix FROM ".TABLE_PRODUCTS_ATTRIBUTES." WHERE products_id='".$products_id."' AND options_id='".$option_id."' AND options_values_id='".$value_id."';"))
if(REWARD_POINTS_SPECIAL_ADJUST=='1' && $attribute->fields['attributes_discounted']=='1')
$new_attributes_price=zen_get_discount_calc($products_id,$attribute->fields['products_attributes_id'],$attribute->fields['options_values_price'],1);
else
$new_attributes_price=$attribute->fields['options_values_price'];
return ($attribute->fields['price_prefix']=='-'?-$new_attributes_price:$new_attributes_price);
}
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='".(int)$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);
if($result)
return $result->fields['redeem_ratio'];
else
return 0;
}
function GetRewardPointsRedeemMaximum($order_total)
{
$redeem_ratio=GetRedeemRatio($_SESSION['customer_id']);
$order_total_points=zen_round($order_total/$redeem_ratio,0);
if((double)REWARD_POINTS_REDEEM_MAXIMUM>0)
if(strpos(REWARD_POINTS_REDEEM_MAXIMUM,"%")!==false)
return zen_round($order_total_points*((double)REWARD_POINTS_REDEEM_MAXIMUM/100),0);
else
if($order_total_points>REWARD_POINTS_REDEEM_MAXIMUM)
return zen_round(REWARD_POINTS_REDEEM_MAXIMUM,0);
return zen_round($order_total_points,0);
}
function GetCustomersRewardPoints($customers_id)
{
$result=GetCustomerRewardPointsRecord($customers_id);
if($result)
return (int)$result->fields['reward_points'];
else
return 0;
}
function GetCustomersPendingPoints($customers_id)
{
$result=GetCustomerRewardPointsRecord($customers_id);
if($result)
return (int)$result->fields['pending_points'];
else
return 0;
}
function GetCustomersLastOrderID($customers_id)
{
global $db;
$orders_lookup_query="SELECT orders_id FROM ".TABLE_ORDERS." WHERE customers_id = '".(int)$customers_id."' ORDER BY orders_id DESC LIMIT 1";
$orders_lookup = $db->Execute($orders_lookup_query);
if(isset($orders_lookup->fields))
return $orders_lookup->fields['orders_id'];
else
return 0;
}
function ExtractNumber($str)
{
if(preg_match("/^[0-9]*[\.]{1}[0-9-]+$/",$str,$match))
return floatval($match[0]);
else
return floatval($str);
}
function GetOrderTotalsArray($called_by)
{
global $order_total_modules;
$order_total_array = array();
$modules=$order_total_modules->modules;
if(is_array($modules))
{
reset($modules);
while (list(,$value)=each($modules))
{
$class=substr($value, 0, strrpos($value, '.'));
if($class!=$called_by && isset($GLOBALS[$class]))
{
$output_backup=$GLOBALS[$class]->output;
if(sizeof($GLOBALS[$class]->output)==0)
$GLOBALS[$class]->process();
for ($i=0, $n=sizeof($GLOBALS[$class]->output); $i<$n; $i++)
if(zen_not_null($GLOBALS[$class]->output[$i]['title']) && zen_not_null($GLOBALS[$class]->output[$i]['text']))
$order_total_array[]=array('code' => $GLOBALS[$class]->code,'title' => $GLOBALS[$class]->output[$i]['title'],'text' => $GLOBALS[$class]->output[$i]['text'],'value' => $GLOBALS[$class]->output[$i]['value'],'sort_order' => $GLOBALS[$class]->sort_order);
$GLOBALS[$class]->output=$output_backup;
}
}
}
return $order_total_array;
}
function GetRewardPointAdvancedCalculateValue()
{
$value=0;
$module_list=GetRewardPointAdvancedCalculateTable();
foreach($module_list as $module)
if($module['action']=="Subtract")
$value-=GetOrderTotalValue($module['module']);
else
$value+=GetOrderTotalValue($module['module']);
return $value;
}
function GetOrderTotalValue($module)
{
global $order;
$value=0;
if(isset($GLOBALS[$module]) && isset($order->info))
{
//print_r($GLOBALS[$module]->output);
//$output_backup=$GLOBALS[$module]->output;
//$order_info_backup=$order->info;
//if(sizeof($GLOBALS[$module]->output)==0)
//$GLOBALS[$module]->process();
for($loop=0;$loop<sizeof($GLOBALS[$module]->output);$loop++)
if(zen_not_null($GLOBALS[$module]->output[$loop]['value']))
$value+=$GLOBALS[$module]->output[$loop]['value'];
//$GLOBALS[$module]->output=$output_backup;
//$order->info=$order_info_backup;
}
return $value;
}
?>
I still get the error:
[29-Mar-2014 14:05:38] PHP Fatal error: 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 status=0 ORDER BY date DESC LIMIT 12' at line 1 :: SELECT rewards_id, orders_id, date, reward_points, status FROM zen_reward_status_track WHERE customers_id= AND status=0 ORDER BY date DESC LIMIT 12; in /home4/w57dsjmm/public_html/order/includes/classes/db/mysql/query_factory.php on line 120
Perhaps you could just attach the file with changes?? I lost my patience on this hours ago! I'm sure your ready to know some sense into me! :bangin:
-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
southshorepizza
I changed the file to read:
Code:
/*
function SetRewardPointDiscountTypeFunction($value,$key='')
{
require('includes/javascript/reward_points.js');
$content='<br />';
$content.='<strong>'.TEXT_NEW_ACCOUNT_AWARD_PROMPT.'</strong> '.zen_draw_checkbox_field('allow_award','',$value!=0,0,'onchange="UpdateAward()"');
$content.=zen_draw_input_field('award_points',($value==0?'':abs($value)),'onchange="UpdateAward()"').' '.zen_draw_pull_down_menu('award_id',array(array('id'=>'0','text'=>TEXT_NEW_ACCOUNT_PENDING_AWARD),array('id'=>'1','text'=>TEXT_NEW_ACCOUNT_EARNED_AWARD)),($value<0?'0':$value>0?'1':''),'onchange="UpdateAward()"').'<br />';
$content.=zen_draw_hidden_field('configuration_value',$value);
return $content;
}
*/
function GetRewardPoints($products)
{
$reward_points=0;
if(REWARD_POINT_MODE=='0')
{
foreach($products as $product)
if(isset($product['qty']))
$reward_points+=GetProductRewardPoints($product['id'],$product['attributes'])*$product['qty'];
else
if(isset($product['quantity']))
$reward_points+=GetProductRewardPoints($product['id'],$product['attributes'])*$product['quantity'];
else
if(isset($product['quantityField']))
$reward_points+=GetProductRewardPoints($product['id'],$product['attributes'])*$product['quantityField'];
else
$reward_points="RP Error";
}
else
{
global $order;
$GlobalRewardPointRatio=GetGlobalRewardPointRatio();
if(isset($_SESSION['cart']))
$reward_points=zen_round($_SESSION['cart']->show_total()*$GlobalRewardPointRatio-REWARD_POINTS_ROUNDING,0);
if(isset($order) && isset($order->info))
if(REWARD_POINTS_ALLOW_TOTAL=='0' && isset($order->info['subtotal']))
$reward_points=zen_round($order->info['subtotal']*$GlobalRewardPointRatio-REWARD_POINTS_ROUNDING,0);
else
if(isset($order->info['total']))
$reward_points=zen_round($order->info['total']*$GlobalRewardPointRatio-REWARD_POINTS_ROUNDING,0);
}
return $reward_points;
}
function GetProductRewardPoints($products_id,$attributes=null)
{
global $db;
$reward_price=0;
if(zen_get_products_price_is_free($products_id)==false || REWARD_POINTS_ALLOW_ON_FREE=='1') // Allow RP on free items (Admin settable)
{
$sql = "SELECT prp.point_ratio*p.products_price AS reward_points, prp.point_ratio, p.products_price, p.products_priced_by_attribute
FROM ".TABLE_REWARD_MASTER." prp, ".TABLE_PRODUCTS." p, ".TABLE_PRODUCTS_TO_CATEGORIES." p2c
WHERE p.products_id='" . $products_id . "'
AND p2c.products_id='" . $products_id . "'
AND ((prp.scope_id=p.products_id AND prp.scope='".SCOPE_PRODUCT."')
OR (p.products_id=p2c.products_id AND prp.scope_id=p2c.categories_id AND prp.scope='".SCOPE_CATEGORY."')
OR (prp.scope='".SCOPE_GLOBAL."'))
ORDER BY prp.scope DESC LIMIT 1;";
$result=$db->Execute($sql);
if($result)
{
if(zen_has_product_attributes($products_id,'false') && !$attributes)
$reward_price=zen_get_products_base_price($products_id);
else
$reward_price=$result->fields['products_price'];
//echo '['.$reward_price.'=';
//print_r($attributes);
//echo ']';
$special_price=zen_get_products_special_price($products_id);
if(REWARD_POINTS_SPECIAL_ADJUST=='1' && $special_price && !$attributes)
$reward_price=$special_price;
// Calculate attribute pricing
//if($result->fields['products_priced_by_attribute']=='1' && $attributes!=null)
if($attributes!=null)
if(isset($attributes[0]['option_id']))
foreach($attributes as $attribute)
$reward_price+=CalculateRewardPointsOnAttribute($products_id,$attribute['option_id'],$attribute['value_id']);
else
foreach($attributes as $option_id => $value_id)
$reward_price+=CalculateRewardPointsOnAttribute($products_id,$option_id,$value_id);
}
}
//echo '::'.$reward_price.', '.$result->fields['point_ratio'].', '.REWARD_POINTS_ROUNDING.'::';
$reward_points=($reward_price*$result->fields['point_ratio'])-REWARD_POINTS_ROUNDING;
if($reward_points<0)
$reward_points=0;
return zen_round($reward_points,0);
}
function CalculateRewardPointsOnAttribute($products_id,$option_id,$value_id)
{
global $db;
if($attribute=$db->Execute("SELECT products_attributes_id, attributes_discounted, options_values_price, price_prefix FROM ".TABLE_PRODUCTS_ATTRIBUTES." WHERE products_id='".$products_id."' AND options_id='".$option_id."' AND options_values_id='".$value_id."';"))
if(REWARD_POINTS_SPECIAL_ADJUST=='1' && $attribute->fields['attributes_discounted']=='1')
$new_attributes_price=zen_get_discount_calc($products_id,$attribute->fields['products_attributes_id'],$attribute->fields['options_values_price'],1);
else
$new_attributes_price=$attribute->fields['options_values_price'];
return ($attribute->fields['price_prefix']=='-'?-$new_attributes_price:$new_attributes_price);
}
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='".(int)$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);
if($result)
return $result->fields['redeem_ratio'];
else
return 0;
}
function GetRewardPointsRedeemMaximum($order_total)
{
$redeem_ratio=GetRedeemRatio($_SESSION['customer_id']);
$order_total_points=zen_round($order_total/$redeem_ratio,0);
if((double)REWARD_POINTS_REDEEM_MAXIMUM>0)
if(strpos(REWARD_POINTS_REDEEM_MAXIMUM,"%")!==false)
return zen_round($order_total_points*((double)REWARD_POINTS_REDEEM_MAXIMUM/100),0);
else
if($order_total_points>REWARD_POINTS_REDEEM_MAXIMUM)
return zen_round(REWARD_POINTS_REDEEM_MAXIMUM,0);
return zen_round($order_total_points,0);
}
function GetCustomersRewardPoints($customers_id)
{
$result=GetCustomerRewardPointsRecord($customers_id);
if($result)
return (int)$result->fields['reward_points'];
else
return 0;
}
function GetCustomersPendingPoints($customers_id)
{
$result=GetCustomerRewardPointsRecord($customers_id);
if($result)
return (int)$result->fields['pending_points'];
else
return 0;
}
function GetCustomersLastOrderID($customers_id)
{
global $db;
$orders_lookup_query="SELECT orders_id FROM ".TABLE_ORDERS." WHERE customers_id = '".(int)$customers_id."' ORDER BY orders_id DESC LIMIT 1";
$orders_lookup = $db->Execute($orders_lookup_query);
if(isset($orders_lookup->fields))
return $orders_lookup->fields['orders_id'];
else
return 0;
}
function ExtractNumber($str)
{
if(preg_match("/^[0-9]*[\.]{1}[0-9-]+$/",$str,$match))
return floatval($match[0]);
else
return floatval($str);
}
function GetOrderTotalsArray($called_by)
{
global $order_total_modules;
$order_total_array = array();
$modules=$order_total_modules->modules;
if(is_array($modules))
{
reset($modules);
while (list(,$value)=each($modules))
{
$class=substr($value, 0, strrpos($value, '.'));
if($class!=$called_by && isset($GLOBALS[$class]))
{
$output_backup=$GLOBALS[$class]->output;
if(sizeof($GLOBALS[$class]->output)==0)
$GLOBALS[$class]->process();
for ($i=0, $n=sizeof($GLOBALS[$class]->output); $i<$n; $i++)
if(zen_not_null($GLOBALS[$class]->output[$i]['title']) && zen_not_null($GLOBALS[$class]->output[$i]['text']))
$order_total_array[]=array('code' => $GLOBALS[$class]->code,'title' => $GLOBALS[$class]->output[$i]['title'],'text' => $GLOBALS[$class]->output[$i]['text'],'value' => $GLOBALS[$class]->output[$i]['value'],'sort_order' => $GLOBALS[$class]->sort_order);
$GLOBALS[$class]->output=$output_backup;
}
}
}
return $order_total_array;
}
function GetRewardPointAdvancedCalculateValue()
{
$value=0;
$module_list=GetRewardPointAdvancedCalculateTable();
foreach($module_list as $module)
if($module['action']=="Subtract")
$value-=GetOrderTotalValue($module['module']);
else
$value+=GetOrderTotalValue($module['module']);
return $value;
}
function GetOrderTotalValue($module)
{
global $order;
$value=0;
if(isset($GLOBALS[$module]) && isset($order->info))
{
//print_r($GLOBALS[$module]->output);
//$output_backup=$GLOBALS[$module]->output;
//$order_info_backup=$order->info;
//if(sizeof($GLOBALS[$module]->output)==0)
//$GLOBALS[$module]->process();
for($loop=0;$loop<sizeof($GLOBALS[$module]->output);$loop++)
if(zen_not_null($GLOBALS[$module]->output[$loop]['value']))
$value+=$GLOBALS[$module]->output[$loop]['value'];
//$GLOBALS[$module]->output=$output_backup;
//$order->info=$order_info_backup;
}
return $value;
}
?>
I still get the error:
[29-Mar-2014 14:05:38] PHP Fatal error: 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 status=0 ORDER BY date DESC LIMIT 12' at line 1 :: SELECT rewards_id, orders_id, date, reward_points, status FROM zen_reward_status_track WHERE customers_id= AND status=0 ORDER BY date DESC LIMIT 12; in /home4/w57dsjmm/public_html/order/includes/classes/db/mysql/query_factory.php on line 120
Perhaps you could just attach the file with changes?? I lost my patience on this hours ago! I'm sure your ready to know some sense into me! :bangin:
You are right, in the upgrade folder there is no includes/functions/extra_functions folder. The upgrade folder is only for if you are upgrading from zen cart version 1.3.9.
Why are you adding any code in the first place. Do you have edit orders installed on your site? If you don't have edit orders installed then then reward points will work right out of the box. The code modification is only if you have edit orders installed a long with this module.
-
Re: Reward Points Module- Live Release now available.
Yes I have edited orders. But I don't know why that affects when I change points from pending to earned.
I am having problems upgrading to Edit orders 4.0 from 3.1 because the rewards points module isn't working properly. But again the error log I keep posting is from changing points pending to points earned! Something I would imagine I could do with or without edited orders module.
-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
southshorepizza
Yes I have edited orders. But I don't know why that affects when I change points from pending to earned.
I am having problems upgrading to Edit orders 4.0 from 3.1 because the rewards points module isn't working properly. But again the error log I keep posting is from changing points pending to points earned! Something I would imagine I could do with or without edited orders module.
Here just download the functions/extra_functions/reward_points_functions.php zip, unzip it and upload it to your admin/includes/functions/extra_functions folder. I think it will be much easier for you.
-
Re: Reward Points Module- Live Release now available.
I don't think that is the issue. I just downloaded that file and uploaded it to the site.
I got this:
[29-Mar-2014 17:36:59] PHP Fatal error: 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 status=0 ORDER BY date DESC LIMIT 12' at line 1 :: SELECT rewards_id, orders_id, date, reward_points, status FROM zen_reward_status_track WHERE customers_id= AND status=0 ORDER BY date DESC LIMIT 12; in /home4/w57dsjmm/public_html/order/includes/classes/db/mysql/query_factory.php on line 120
Sorry it didn't work.
-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
southshorepizza
... PHP Fatal error: 1064:You have an error in your SQL syntax; ... SELECT rewards_id, orders_id, date, reward_points, status FROM zen_reward_status_track WHERE customers_id= AND status=0 ORDER BY date DESC LIMIT 12; ...
I believe an issue with a missing customer_id in the SQL statement has been reported before in this thread... Not sure if a solution was posted... If you install this modification by lat9, you can track down where in the reward points module the problematic SQL query is being built.
Hopefully once we all know where the SQL statement causing the error is being created, someone will be able to help further diagnose and fix the issue.
-
Re: Reward Points Module- Live Release now available.
hi there
I have the 1.3.9. version of reward points.
Now I updgraded from zen cart 1.3.9. to 1.5.1 and used the 1.5.0 upgrade sql.
So I have the 1.3.9 version of reward points with 1.5.0 upgrade, which I think is not quite right.
When I go to Customer>Reward Points and try to edit anything all I get is a blank page.
What should I do?
-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
mnitescu
What should I do?
Blank page = ERROR LOG
Go to your error log and tell us what the error log says..
-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
lhungil
I believe an issue with a
missing customer_id in the SQL statement has been reported before in this thread... Not sure if a solution was posted... If you install
this modification by lat9, you can track down where in the reward points module the problematic SQL query is being built.
Hopefully once we all know where the SQL statement causing the error is being created, someone will be able to help further diagnose and fix the issue.
I have installed it and will report back soon. Thank you for this tip!
-
Re: Reward Points Module- Live Release now available.
I installed the modification by lat9 as suggested. Now my error log reads:
Code:
[05-Apr-2014 04:20:36] PHP Fatal error: 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 status=0 ORDER BY date DESC LIMIT 12' at line 1 :: SELECT rewards_id, orders_id, date, reward_points, status FROM zen_reward_status_track WHERE customers_id= AND status=0 ORDER BY date DESC LIMIT 12; ==> (as called by) /home4/xxxx/public_html/order/admin/customers_reward_points.php on line 358 <== in /home4/xxxx/public_html/order/includes/classes/db/mysql/query_factory.php on line 130
Any help would be greatly appreciated!
-
Re: Reward Points Module- Live Release now available.
I can't figure out why the reward points aren't applying to my customers orders. I went through every section of the Reward Points configuration in my admin panel under Configuration. The reward point value is showing up correctly next to each product but in my Customers/Reward Points section they are not showing any totals. Any help is appreciated! Thank you!
-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
southshorepizza
... PHP Fatal error: 1064:You have an error in your SQL syntax; ... /admin/customers_reward_points.php on line 358 ...
Any help would be greatly appreciated!
Looks like the code in that file ASSUMES a valid customer id will be passed in the URL when certain actions are performed. If the customer id is not valid when trying to edit, update, or process reward points this error will occur.
As a temporary way to avoid this error, one "could" wrap the entire switch statement (performing the action - starts around line 318) with something similar to:
Code:
if(zen_not_null($current_customer)) {
Closing the if statement after the switch (around line 381) using something similar to:
Code:
} else { echo '<div class="alert">No Customer (or invalid customer) selected. No action performed!</div>'; }
-
Re: Reward Points Module- Live Release now available.
Hi lhungil,
thanks for the advice. I sometimes got the error but dunno where it was generated. Just to be sure not to do stupid changes could you please confirm that the following code is correct:
Unmodified file customers_reward_points.php
PHP Code:
switch ($action) //line 317
{ //line 318
case 'edit': //line 319
case 'update':
Modified:
PHP Code:
if(zen_not_null($current_customer)) { //line 316 added by lhungil
switch ($action) //line 317
{ //line 318
case 'edit': //line 319
case 'update':
Then in the end:
Unmodified
PHP Code:
if((zen_not_null($heading)) && (zen_not_null($contents))) //line 381
{ //line 382
echo ' <td width="25%" valign="top">' . "\n"; //line 383
modified:
PHP Code:
} else { echo '<div class="alert">No Customer (or invalid customer) selected. No action performed!</div>'; } //line 380
if((zen_not_null($heading)) && (zen_not_null($contents))) //line 381
{ //line 382
echo ' <td width="25%" valign="top">' . "\n"; //line 383
Sorry but that "around line xxx" put me in danger zone, i prefer to be sure before making any modification :P (i know it for dummy but be patient :blink:)
-
Re: Reward Points Module- Live Release now available.
Hi,
I would like to show the reward points below product price on the main page, categories, featured items, new products, etc., but not for "call for price" items. Do you think that this is possible?
Thank you,
-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
izar74
... could you please confirm that the following code is correct: ...
"/admin/customers_reward_points.php" (changes in red):
Code:
315: $contents = array();
316:
if(zen_not_null($current_customer)) {
317: switch ($action) { // Combined w/ line 318
319: case 'edit':
320: case 'update':
321: case 'handle_point_list':
...
376: $record_contents[]=array('text' => '</form>');
377: }
378: break;
379: } // End of switch statement
} else {
echo '<div class="alert">No Customer (or invalid customer) selected. No action performed!</div>';
}
380:
381: if((zen_not_null($heading)) && (zen_not_null($contents)))
-
Re: Reward Points Module- Live Release now available.
Is there a way to store the total points to be earned as dollars and cents (or rather whole and part numbers) instead of the rounding to the nearest whole number?
-
Re: Reward Points Module- Live Release now available.
I am new to all of this and have a question regarding the installation of the Rewards Points Module.
The instructions state to install all files with a path "custom" to my custom folder. I have no custom folders, and use a plug-in theme other than Classic. \\Can you please elaborate on what "custom" really refers to? I want to be sure that these files get in the right folders.
Thanks for the feedback and clarification.
-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
DonRichardsonNH
I am new to all of this and have a question regarding the installation of the Rewards Points Module.
The instructions state to install all files with a path "custom" to my custom folder. I have no custom folders, and use a plug-in theme other than Classic. \\Can you please elaborate on what "custom" really refers to? I want to be sure that these files get in the right folders.
Thanks for the feedback and clarification.
Change the name of the custom folder to the name of the template you are using and then ftp upload it to your server.
-
Re: Reward Points Module- Live Release now available.
Is it possible to make a reward points unusable on a particular item?
-
Re: Reward Points Module- Live Release now available.
I am using V1.5.0
Reward Points sidebox not showing in my web store. Even after a purchase, it only show in Payment into step 2/3. When I turned it on under Configuration Reward Point Sidebox Display = 1 or 2, it doesn't show as a sidebox. I have checked, everything seems to be there in the server. Reward Points system works well, except that it is not display on sidebox, can anyone advise? Many thanks in advance.
-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
Pxtures
I am using V1.5.0
Reward Points sidebox not showing in my web store. Even after a purchase, it only show in Payment into step 2/3. When I turned it on under Configuration Reward Point Sidebox Display = 1 or 2, it doesn't show as a sidebox. I have checked, everything seems to be there in the server. Reward Points system works well, except that it is not display on sidebox, can anyone advise? Many thanks in advance.
GO back check your installation files. Check and make sure the sidebox files uploaded to there correct place.
Always show a link to your site so someone can help,
-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
Joe Robot
Is it possible to make a reward points unusable on a particular item?
Hmm...let's try again.
I have some pre-order items that I would like to make "cash only", so they can't be purchased with rewards points. Is there a way to do this from the Admin?
If not the admin, any other ideas about this can be achieved? I am using v1.3.9h
-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
Joe Robot
Hmm...let's try again.
I have some pre-order items that I would like to make "cash only", so they can't be purchased with rewards points. Is there a way to do this from the Admin?
If not the admin, any other ideas about this can be achieved? I am using v1.3.9h
That would require custom coding to get reward points to do what you are asking. It can be done.... but if it was me I would upgrade my store if I was still using zen cart 1.3.9. Zen cart 1.5.3 is hopefully coming out pretty soon.
-
Re: Reward Points Module- Live Release now available.
Thanks for responding :)
An upgrade is in the works, thanks again.
-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
Joe Robot
Thanks for responding :)
An upgrade is in the works, thanks again.
No problem
-
1 Attachment(s)
Re: Reward Points Module- Live Release now available.
Hi..
I have just installed this module and I'm trying to set the global points ratio in the section "Customers >Group Reward Redeem". By default it is 0.0100 but I want it as 0.1000. Every time I alter it (and then go back to that page) it still says 0.0100. Can anyone tell me what I'm doing wrong please? Thank you in advance!
Attachment 14237
-
Re: Reward Points Module- Live Release now available.
Ok I got this one...after tearing my hair out, it was a very simple case of hitting the enter key. In hindsight, very obvious and basic.
-
1 Attachment(s)
Re: Reward Points Module- Live Release now available.
Hello group.. I am having a problem and I don't know how to fix it.. see attached.
I have check the files in the lnaguage files and under the templates and sideboxes and I can figure out why it is doing as attachecd.
what do you need from my my website is below
thank you for reading.
noppie
-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
Cameron14
Ok I got this one...after tearing my hair out, it was a very simple case of hitting the enter key. In hindsight, very obvious and basic.
Make sure when you edited the files you didn't miss anything. I think that error would come from one of these files.
\includes\languages\english\extra_definitions\custom\reward_points.php or
\includes\templates\custom\sideboxes\tpl_reward_points.php
-
1 Attachment(s)
Re: Reward Points Module- Live Release now available.
I have been to both files
\includes\languages\english\extra_definitions\custom\reward_points.php
here is the code
"<?php
define('BOX_REWARD_POINTS', 'Magic Bucks');
define('PRODUCT_REWARD_POINT_TAG', 'magic bucks');
define('REWARD_POINTS_IN_CART_TAG', 'magic bucksin cart');
define('CUSTOMER_EARNED_POINT_TAG', 'magic bucks earned');
define('CUSTOMER_PENDING_POINT_TAG', 'magic bucks pending');
define('MINIMUM_POINT_LEVEL_TAG', 'magic bucks minimum');
define('MAXIMUM_POINT_LEVEL_TAG', 'magic bucks maximum');
define('CUSTOMER_TOTAL_POINT_TAG', 'magic bucks total');
define('NO_REWARD_magic bucks_IN_CART_TAG','No rewards earned.');
define('CUSTOMER_NOT_LOGGED_IN_TAG','Log in to see rewards earned');
define('REWARD_POINT_TITLE','Reward magic bucks');
define('REWARD_POINT_PROMPT','Total magic bucks: ');
define('REWARD_POINT_VALUE_PROMPT','Total Magic Bucks Value: ');
?>
and here is the \includes\templates\custom\sideboxes\tpl_reward_points.php
<?php
/**
* Side Box Template for 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
*/
$reward_points=GetRewardPoints($_SESSION['cart']->get_products());
$warning='';
$content='<div id="'.str_replace('_', '-', $box_id . 'Content').'" class="sideBoxContent">';
/*
foreach($_SESSION['cart']->get_products() as $product)
// if($products[$i]['products_priced_by_attribute'])
$reward_points+=GetRewardPoints($product['id'],$product['attributes'])*$product['quantity'];
// else
// $reward_points+=GetRewardPoints($product['id'])*$product['quantity'];
*/
if($reward_points>0)
$content.='<div class="cartBoxRewardPoints">'.(int)$reward_points.' '.REWARD_POINTS_IN_CART _TAG.'</div>';
else
$warning.=NO_REWARD_POINTS_IN_CART_TAG;
if(isset($_SESSION['customer_id']))
$content.='<div class="cartBoxEarnedPoints">'.GetCustomersRewardPoints($_SESSION['customer_id']).' '.CUSTOMER_EARNED_POINT_TAG.'</div><div class="cartBoxPendingPoints">'.GetCustomersPendingPoints($_SESSION['customer_id']).' '.CUSTOMER_PENDING_POINT_TAG.'</div>';
else
$warning.=($warning?'<br />':'').CUSTOMER_NOT_LOGGED_IN_TAG;
if($warning)
$content.='<div id="cartBoxEmpty">'.$warning.'</div>';
$content.='</div>';
?>
can anyone help
-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
noppie
I have been to both files
\includes\languages\english\extra_definitions\custom\reward_points.php
here is the code
"<?php
define('BOX_REWARD_POINTS', 'Magic Bucks');
define('PRODUCT_REWARD_POINT_TAG', 'magic bucks');
define('REWARD_POINTS_IN_CART_TAG', 'magic bucksin cart');
define('CUSTOMER_EARNED_POINT_TAG', 'magic bucks earned');
define('CUSTOMER_PENDING_POINT_TAG', 'magic bucks pending');
define('MINIMUM_POINT_LEVEL_TAG', 'magic bucks minimum');
define('MAXIMUM_POINT_LEVEL_TAG', 'magic bucks maximum');
define('CUSTOMER_TOTAL_POINT_TAG', 'magic bucks total');
define('NO_REWARD_
magic bucks_IN_CART_TAG','No rewards earned.');
define('CUSTOMER_NOT_LOGGED_IN_TAG','Log in to see rewards earned');
define('REWARD_POINT_TITLE','Reward magic bucks');
define('REWARD_POINT_PROMPT','Total magic bucks: ');
define('REWARD_POINT_VALUE_PROMPT','Total Magic Bucks Value: ');
?>
and here is the \includes\templates\custom\sideboxes\tpl_reward_points.php
<?php
/**
* Side Box Template for 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
*/
$reward_points=GetRewardPoints($_SESSION['cart']->get_products());
$warning='';
$content='<div id="'.str_replace('_', '-', $box_id . 'Content').'" class="sideBoxContent">';
/*
foreach($_SESSION['cart']->get_products() as $product)
// if($products[$i]['products_priced_by_attribute'])
$reward_points+=GetRewardPoints($product['id'],$product['attributes'])*$product['quantity'];
// else
// $reward_points+=GetRewardPoints($product['id'])*$product['quantity'];
*/
if($reward_points>0)
$content.='<div class="cartBoxRewardPoints">'.(int)$reward_points.' '.REWARD_POINTS_IN_CART _TAG.'</div>';
else
$warning.=NO_REWARD_POINTS_IN_CART_TAG;
if(isset($_SESSION['customer_id']))
$content.='<div class="cartBoxEarnedPoints">'.GetCustomersRewardPoints($_SESSION['customer_id']).' '.CUSTOMER_EARNED_POINT_TAG.'</div><div class="cartBoxPendingPoints">'.GetCustomersPendingPoints($_SESSION['customer_id']).' '.CUSTOMER_PENDING_POINT_TAG.'</div>';
else
$warning.=($warning?'<br />':'').CUSTOMER_NOT_LOGGED_IN_TAG;
if($warning)
$content.='<div id="cartBoxEmpty">'.$warning.'</div>';
$content.='</div>';
?>
can anyone help
Quote:
<?php
define('BOX_REWARD_POINTS', 'Magic Bucks');
define('PRODUCT_REWARD_POINT_TAG', 'magic bucks');
define('REWARD_POINTS_IN_CART_TAG', 'magic bucksin cart');
define('CUSTOMER_EARNED_POINT_TAG', 'magic bucks earned');
define('CUSTOMER_PENDING_POINT_TAG', 'magic bucks pending');
define('MINIMUM_POINT_LEVEL_TAG', 'magic bucks minimum');
define('MAXIMUM_POINT_LEVEL_TAG', 'magic bucks maximum');
define('CUSTOMER_TOTAL_POINT_TAG', 'magic bucks total');
define('NO_REWARD_magic bucks_IN_CART_TAG','No rewards earned.');
define('CUSTOMER_NOT_LOGGED_IN_TAG','Log in to see rewards earned');
define('REWARD_POINT_TITLE','Reward magic bucks');
define('REWARD_POINT_PROMPT','Total magic bucks: ');
define('REWARD_POINT_VALUE_PROMPT','Total Magic Bucks Value: ');
?>
Your problem is with the line in red. Fix the line and things should work.
-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
countrycharm
Your problem is with the line in red. Fix the line and things should work.
thank you so much.. duh.. No I reaLLY FEEL STUPID.
THANK YOU SO MUCH.
-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
noppie
thank you so much.. duh.. No I reaLLY FEEL STUPID.
THANK YOU SO MUCH.
Your very welcome glad to help...
-
Re: Reward Points Module- Live Release now available.
Because issue when change status when click "detail" it's not move the points to earn ( i have super order mod ) . just if i edit the order move the points to earn . i see that only now after 300 orders .
how can now move all 1 time all customers points from pending to earn ?
thank you.
-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
dmagic
Because issue when change status when click "detail" it's not move the points to earn ( i have super order mod ) . just if i edit the order move the points to earn . i see that only now after 300 orders .
how can now move all 1 time all customers points from pending to earn ?
thank you.
You would need to make some kind of SQL statement to reflect this. Is this for all orders before a certain date or specific orders in general?
-
Re: Reward Points Module- Live Release now available.
Ok i really like this module. I just have a few questions i need help with. I am testing this module with a POS module but any purchases made through the POS doesn't add any of my reward points. If a purchase is made through the website, these purchases doesn't show on the POS customer History, but everything shows under the customer purchase history. My question...is there a way i can combine the POS with the Rewards? I want to allow rewards to be sent to customers accounts if they make a online purchase or if a pos purchase is done (store).
-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
islandboii242
Ok i really like this module. I just have a few questions i need help with. I am testing this module with a POS module but any purchases made through the POS doesn't add any of my reward points. If a purchase is made through the website, these purchases doesn't show on the POS customer History, but everything shows under the customer purchase history. My question...is there a way i can combine the POS with the Rewards? I want to allow rewards to be sent to customers accounts if they make a online purchase or if a pos purchase is done (store).
This will require modification of the module that is adding the order in the backend. This is because when your module (in the admin backpanel) runs, it is not triggering normal order total mods like reward points since there is no call to it. You would have to modify that module to call the necessary parts of reward points suite and run as normal. Which POS module is this?
-
Re: Reward Points Module- Live Release now available.
ZenCart POS by Magnetic One
I spoke to them and they told me there is a database table that the pos is using, but their entire module code is encrypted.
-
Re: Reward Points Module- Live Release now available.
Is there a solution that allows reward points to be added to an account if i installed a POS Module into Zencart?
-
1 Attachment(s)
Re: Reward Points Module- Live Release now available.
Hi everyone,
this thread is sooo long :blink:
Anyways, does someone know (or can someone point me to the right direction?) how to show the amount of the reward points instead of the points itself?
For example, I want to show '$5 Earned' instead of '500 points earned' (as 500 points are worth $5). Any help would be appreciated. Thank you :) *photo attached below*
Attachment 14410
-
Re: Reward Points Module- Live Release now available.
Can anyone assist me with converting a order total that was completed by a POS module into Reward Points? For example, i place a order to a customer account in the POS Module, the order goes through but no points gets transferred. If i place an order through that customer account to the store front end, reward points is then added. Can anyone assist me with creating a tweak or code that allows me to turn POS Orders into Reward Points...perhaps using a click button and some php calculation codes?
Please help me.. :(
-
Re: Reward Points Module- Live Release now available.
I installed the Rewards Point module, and it works fine but does not issue the correct amount of point when using Quantity Discounts. It still give the points of a single price. Example:
qty 1 @ $8.58 = 9 reward points
qty 10 @ 7.03 gives 90 reward points which should be only 70 reward points awarded
-
Re: Reward Points Module- Live Release now available.
How can i combine Reward Points Module with Edit Orders Module?
-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
islandboii242
How can i combine Reward Points Module with Edit Orders Module?
Reward Points already work with Edit Orders. The only thing is when looking or editing a order reward points does not show. The reward points changes from pending to earn when a order status is change. The reward point will show on the invoice and order emails.
The reason the reward points in admin/customers/orders/edit order will not show is because, the reward points is different with the total of,
100 points = $1 so the reward points can not save the points value in database so you see it's 0.00
Check the orders_totals table and you will understand whats going on.
I know it is hard to understand but that's the best I can explain it.
-
Re: Reward Points Module- Live Release now available.
Did anyone get any other additional modules to work with Reward Points? I have tried Edit Orders just by itself and i am having trouble with this. Can anyone explain to me how can i get a third party module that is used to "Place Orders" to be recognized by Reward Points Module? Does RPM pulls orders from the database? Can i make adjustments to RPM to calculate points from the third party module? If i installed Admin New Order..will placing an order then be recognized by RPM?
-
Re: Reward Points Module- Live Release now available.
I don't think most would want it to issue additional points every time you edit an order. If you add to an order why don't you just add additional points? You shouldn't be adding to that many orders. If you are there is something wrong. I run a pizza delivery company off Zen-cart and out of approximately 75 orders a day we may only change 1 or 2 orders max.
-
Re: Reward Points Module- Live Release now available.
Hello Everyone, Just wanted to suggest an improvement and let everyone know how to fix an issue.
The Problem:
You have a lot of orders and a lot of customers using the system and one day you get a 500 error trying to log into your admin system.
Why is this happening?!:
After a couple hours of trying to figure out which script was the problem I found it was the update mechanism in the store/admin/includes/extra_functions/reward_points_functions.php file. The query that updates the points was taking ~a minute to execute. Whew - I found the problem.
Great now how do I fix it?:
Simple actually. Add an index to the reward_status_track table. My table prefix is zen_ so your query may differ - here's mine
ALTER TABLE `zen_reward_status_track` ADD INDEX ( `customers_id` )
Now the query takes ~.003 seconds - Hooray!
Thanks again for this awesome zen cart add on and I hope my frustrations help someone else avoid a trip down the rabbit hole to debug this.
-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
bryan22
Hello Everyone, Just wanted to suggest an improvement and let everyone know how to fix an issue.
The Problem:
You have a lot of orders and a lot of customers using the system and one day you get a 500 error trying to log into your admin system.
Why is this happening?!:
After a couple hours of trying to figure out which script was the problem I found it was the update mechanism in the store/admin/includes/extra_functions/reward_points_functions.php file. The query that updates the points was taking ~a minute to execute. Whew - I found the problem.
Great now how do I fix it?:
Simple actually. Add an index to the reward_status_track table. My table prefix is zen_ so your query may differ - here's mine
ALTER TABLE `zen_reward_status_track` ADD INDEX ( `customers_id` )
Now the query takes ~.003 seconds - Hooray!
Thanks again for this awesome zen cart add on and I hope my frustrations help someone else avoid a trip down the rabbit hole to debug this.
Thank you for your fixed. Maybe it will be useful to some who are having trouble.
-
Re: Reward Points Module- Live Release now available.
Hi, everyone, got some question here,
1. how to not allow given reward point out when customer use the in their account point to pay the order? Example, if customer have 10 dollar value reward point, and he make a 30 dollar order, after use the points he pay the rest 20 dollar for his new order. the new purchase 20 dollar will have reward, but not the 10 dollar he use the point to pay. Can we make a setting like that?
2. any function allow customer control how many points he can choose to use for each order?
Thanks for this great module and your help
-
Re: Reward Points Module- Live Release now available.
I figure out question 2 is in> Order Total Modules, but still cannot find anything on question, please help.
Thanks,
-
Re: Reward Points Module- Live Release now available.
ok, ....I test the mod carefully, all function I need is already there! thx
-
Re: Reward Points Module- Live Release now available.
Hello,
Great module but have 2 issues:
1: looks like the module didn't load up correctly. Shouldn't it be written "Reward Point" instead of PRODUCT_REWARD_POINT_TAG on each product reward title?
Did 2 clean install, yet with the same issue. Don't mind to edit it manually if someone can tell me which file pls.
#point PRODUCT_REWARD_POINT_TAG (underneath each product title) :lookaroun
2: when an order is made, Reward point are set to zero on the admin order page, however, when I load the invoice, rewards appear as well as in the reward pending/earned page. Missing something?
all files have been uploaded correctly to my FTP even twice.
All comments appreciated
Thanks,
Dan
-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
dix30simulation
Hello,
Great module but have 2 issues:
1: looks like the module didn't load up correctly. Shouldn't it be written "Reward Point" instead of PRODUCT_REWARD_POINT_TAG on each product reward title?
Did 2 clean install, yet with the same issue. Don't mind to edit it manually if someone can tell me which file pls.
#point PRODUCT_REWARD_POINT_TAG (underneath each product title) :lookaroun
2: when an order is made, Reward point are set to zero on the admin order page, however, when I load the invoice, rewards appear as well as in the reward pending/earned page. Missing something?
all files have been uploaded correctly to my FTP even twice.
All comments appreciated
Thanks,
Dan
1.) A link to your site would be nice....
2.) When looking or editing a order reward points does not show the points. It shows 0. The reward points changes from pending to earn when a order status is change. The reward point will show on the invoice and order emails.
The reason the reward points in admin/customers/orders/edit order will not show is because, the reward points is different with the total of,
100 points = $1 so the reward points can not save the points value in database so you see it's 0.00
Check the orders_totals table and you will understand whats going on.
I know it is hard to understand but that's the best I can explain it.
-
Re: Reward Points Module- Live Release now available.
Thanks for your prompt return,
feel free to browse any article on www.dix30simulation.com, Module works well, just the "title" that does not load. File missing or not loaded I can guess.
Also I do not see the any Layout Box Controller in my list to activate, yet all the files have been loaded carefully...
-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
dix30simulation
Thanks for your prompt return,
feel free to browse any article on
www.dix30simulation.com, Module works well, just the "title" that does not load. File missing or not loaded I can guess.
Also I do not see the any Layout Box Controller in my list to activate, yet all the files have been loaded carefully...
Check and make sure the custom folder name is changed to the template name you are using o_canada. Check to make sure includes\languages\english\extra_definitions\custom folder is change to your template name o_canada. Your problem is you haven't change the custom folder reward points uses to o_canada your template name. Once you change the name re-upload reward points.
This is why there is no sideboxes to activate.
You have to change all folders with the name custom on them to your template name.
-
Re: Reward Points Module- Live Release now available.
All good with the title, thank you! although the side box still not show even after a fresh new uninstall/install of files + .sql, not a big deal.
-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
dix30simulation
All good with the title, thank you! although the side box still not show even after a fresh new uninstall/install of files + .sql, not a big deal.
It's a big deal if you want your customers to know what points they have earned.
Did you change the custom sideboxes folder name includes\modules\sideboxes\custom to o_canada. That is the reason they are not showing unless you haven't activated them in admin/tools/layout boxes.
-
1 Attachment(s)
Re: Reward Points Module- Live Release now available.
Hi I was wondering if some one can help with an issue I am having
Have install mod & works great except issue I am having with redeeming points.
Issue is this: customer purchases product & gets 100 points for product purchased. On same transaction uses points earned ($ value $10) which I am findinding deducts of the purchase price so they end up only earning 90 points EG: see attached file
Attachment 14853
As we claim on the site (test site at moment) that they always get full $value on their purchases this doesn't work. Having no issues with the mod at all except for this issue
I would appreciate it if anyone would advise if they have had a similar problem and how they resolved it.
-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
Winchees
Hi I was wondering if some one can help with an issue I am having
Have install mod & works great except issue I am having with redeeming points.
Issue is this: customer purchases product & gets 100 points for product purchased. On same transaction uses points earned ($ value $10) which I am findinding deducts of the purchase price so they end up only earning 90 points EG: see attached file
Attachment 14853
As we claim on the site (test site at moment) that they always get full $value on their purchases this doesn't work. Having no issues with the mod at all except for this issue
I would appreciate it if anyone would advise if they have had a similar problem and how they resolved it.
go into your admin and click on configuration, scroll down to reward point configuration and click on it. Look at reward point mode the first option and make sure that you have option 0 checked, That should fix it.
-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
MadPricerSales
go into your admin and click on configuration, scroll down to reward point configuration and click on it. Look at reward point mode the first option and make sure that you have option 0 checked, That should fix it.
Hi, thanks for the help.
I have tried this & issue is still happening - would appreciate it if anyone has any other ideas
-
Re: Reward Points Module- Live Release now available.
Quote:
Originally Posted by
abcisme
Ok, I am not a programmer, so I am taking a stab in the dark at this.. but looking at the housekeeping function, if I create a subset for housekeeping which specifies earned points instead of pending points.. then switched the housekeeping function to reflect rewards_points instead of pending_points, it should work to remove any earned points instead of pending points. Right?
So pending points will switch to earned after the sunrise period, then be removed after the housekeeping period... Does this look correct?
Code:
function CleanupRewardPointHistory()
{
global $db,$messageStack;
$subset="IFNULL((SELECT SUM(rp.reward_points) FROM ".TABLE_REWARD_STATUS_TRACK." rp WHERE cp.customers_id=rp.customers_id AND rp.status='".STATUS_PENDING."' AND rp.date<NOW()-INTERVAL %s DAY),0)";
$subset2="IFNULL((SELECT SUM(rp.reward_points) FROM ".TABLE_REWARD_STATUS_TRACK." rp WHERE cp.customers_id=rp.customers_id AND rp.status='".STATUS_PROCESSED."' AND rp.date<NOW()-INTERVAL %s DAY),0)";
$sunrise_subset=sprintf($subset,REWARD_POINTS_SUNRISE_PERIOD);
$housekeeping_subset=sprintf($subset2,REWARD_POINTS_HOUSEKEEPING);
if(REWARD_POINTS_SUNRISE_PERIOD>0)
if($db->Execute("UPDATE ".TABLE_REWARD_CUSTOMER_POINTS." cp, ".TABLE_REWARD_STATUS_TRACK." rp SET cp.reward_points=cp.reward_points+".$sunrise_subset.",cp.pending_points=cp.pending_points-".$sunrise_subset." WHERE cp.customers_id=rp.customers_id;"))
$db->Execute("UPDATE ".TABLE_REWARD_STATUS_TRACK." SET status=".STATUS_PROCESSED." WHERE status=".STATUS_PENDING." AND date<NOW()-INTERVAL ".REWARD_POINTS_SUNRISE_PERIOD." DAY;");
if(REWARD_POINTS_HOUSEKEEPING>0)
if($db->Execute("UPDATE ".TABLE_REWARD_CUSTOMER_POINTS." cp, ".TABLE_REWARD_STATUS_TRACK." rp SET cp.reward_points=cp.reward_points-".$housekeeping_subset." WHERE cp.customers_id=rp.customers_id;"))
$db->Execute("DELETE FROM ".TABLE_REWARD_STATUS_TRACK." WHERE date<NOW()-INTERVAL ".(int)REWARD_POINTS_HOUSEKEEPING." DAY;");
}
So I guess I've messed up somewhere here. I'm hoping someone can help me figure this out.
I want to:
zen_reward_customer_points.reward_points - zen_reward_status_track.reward_points
WHEN
zen_reward_status_track date > 104 days ago
AND
zen_reward_status_track.customer_id = zen_reward_customer_points.customer_id
Then, I want to delete the record from zen_reward_status_track
Here's what I currently have:
Code:
$subset2="IFNULL((SELECT SUM(rp.reward_points) FROM ".TABLE_REWARD_STATUS_TRACK." rp WHERE cp.customers_id=rp.customers_id AND rp.status='1' AND rp.date<NOW()-INTERVAL 104 DAY),0)";
$housekeeping_subset=sprintf($subset2,REWARD_POINTS_HOUSEKEEPING);
if(REWARD_POINTS_HOUSEKEEPING>0)
if($db->Execute("UPDATE ".TABLE_REWARD_CUSTOMER_POINTS." cp, ".TABLE_REWARD_STATUS_TRACK." rp SET cp.reward_points=cp.reward_points-".$housekeeping_subset." WHERE cp.customers_id=rp.customers_id;"))
$db->Execute("DELETE FROM ".TABLE_REWARD_STATUS_TRACK." WHERE date<NOW()-INTERVAL 104 DAY;");
}
This deletes the record from zen_reward_status_track, but doesn't delete the points from zen_reward_customer_points.reward_points
Can anyone help?
-
ReReward Points Module does not update with paypal
Hello everyone, I installed the module works all regularly, but when I go to update the order to give the points to the customer, those performed with payment paypla not update, while those made with bank payment or payment types eltri updates all , is there any change to do for payments with paypal? Thank you
-
ReReward Points Module does not update with paypal
I find solution in oscommerce forum, as would fit in zen cart?
Open catalog/includes/modules/payment/paypal_standard.php
----------------------------------------------------------
Find:
-----
global $cartID, $cart_PayPal_Standard_ID, $customer_id, $languages_id, $order, $order_total_modules;
Replace with this:
------------------
#### Points/Rewards Module V2.00 balance customer points BOF ####
// global $cartID, $cart_PayPal_Standard_ID, $customer_id, $languages_id, $order, $order_total_modules;
global $cartID, $cart_PayPal_Standard_ID, $customer_id, $languages_id, $order, $customer_shopping_points, $customer_shopping_points_spending, $order_total_modules;
#### Points/Rewards Module V2.00 balance customer points EOF ####*/
----------------------------------------------------------
Find:
-----
tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array);
}
Add after:
----------
#### Points/Rewards Module V2.1rc2a balance customer points BOF ####
if ((USE_POINTS_SYSTEM == 'true') && (USE_REDEEM_SYSTEM == 'true')) {
// customer pending points added
if ($order->info['total'] > 0) {
$points_toadd = get_points_toadd($order);
$points_comment = 'TEXT_DEFAULT_COMMENT';
$points_type = 'SP';
if ((get_redemption_awards($customer_shopping_points_spending) == true) && ($points_toadd >0)) {
tep_add_pending_points($customer_id, $insert_id, $points_toadd, $points_comment, $points_type);
}
}
// customer referral points added
if ((tep_session_is_registered('customer_referral')) && (tep_not_null(USE_REFERRAL_SYSTEM))) {
$referral_twice_query = tep_db_query("select unique_id from " . TABLE_CUSTOMERS_POINTS_PENDING . " where orders_id = '". (int)$insert_id ."' and points_type = 'RF' limit 1");
if (!tep_db_num_rows($referral_twice_query)) {
$points_toadd = USE_REFERRAL_SYSTEM;
$points_comment = 'TEXT_DEFAULT_REFERRAL';
$points_type = 'RF';
tep_add_pending_points($customer_referral, $insert_id, $points_toadd, $points_comment, $points_type);
}
}
// customer shoppping points account balanced
if ($customer_shopping_points_spending) {
tep_redeemed_points($customer_id, $insert_id, $customer_shopping_points_spending);
}
}
#### Points/Rewards Module V2.1rc2a balance customer points EOF ####*/
----------------------------------------------------------
Find:
-----
tep_session_unregister('shipping');
tep_session_unregister('payment');
tep_session_unregister('comments');
Add after:
----------
tep_session_unregister('customer_shopping_points');// Points/Rewards Module v1.10
tep_session_unregister('customer_shopping_points_spending');// Points/Rewards Module v1.10
tep_session_unregister('customer_referral');// Points/Rewards Module V2.00
----------------------------------------------------------
That's all
----------
-
Re: ReReward Points Module does not update with paypal
Two points..
1. All those "tep_db_*" functions are OS Commerce functions.. (as is this code..) I hope you are aware that you can't just drop this into the Zen Cart module..
2. If the issue you are having is with PayPal Standard, disable it, and activate PayPal Express, and see if the issue persists..
-
Reward Points Module does not update with paypal
Thanks for the answer, but I had asked if there was a solution for zen cart, and or adapt the query to the DB zen, and I will not turn paypal express. Thank you
-
Re: Reward Points Module does not update with paypal
Quote:
Originally Posted by
giancalr
Thanks for the answer, but I had asked if there was a solution for zen cart, and or adapt the query to the DB zen, and I will not turn paypal express. Thank you
Right.. so let me put it another way.. Outside of Rewards Points, the PayPal Standard module has ISSUES in general.. and the recommended solution for all of those issues is to NOT use PayPal Standard ever, and use PayPal Express module.. So, it is possible that your issue will go away if you simply turn on the PayPal Express module.. If you choose not to that is certainly your choice.. but you should know the issue you report is not a known issue with Rewards Points, which leads me to believe that the issue could be resolved by simply using PayPal Express vs PayPal Standard..
As for the code you posted, if a community member knows how to convert that osCommerce code, hopefully they will share their solution.. otherwise you could look for a developer to help you with that..
Happy Zenning..
-
Re: Reward Points Module does not update with paypal
I have a question on customization. Not confident enough to through this up on a live site. Unfortunately we are in a slow move from one server to the next. But with free migration I can't complain.
Anyways I want to not write points to the table_reward_customer_points if the email address contains a certain domain. I'm pretty sure I would change the catalog/includes/functions/extra_functions/reward_points_functions.php file. Specifically
Code:
function UpdateCustomerRewardPoints($customer_id,$reward_points,$pending_points)
{
global $db;
$sql="INSERT INTO ".TABLE_REWARD_CUSTOMER_POINTS." VALUES ('".$customer_id."', '".$reward_points."', '".$pending_points."') ON DUPLICATE KEY UPDATE reward_points=reward_points+".$reward_points.", pending_points=pending_points+".$pending_points.";";
$db->Execute($sql);
}
I'm thinking something like
Code:
function UpdateCustomerRewardPoints($customer_id,$reward_points,$pending_points)
{
global $db;
if (strpos($order->info['customer_email_address'],'@domain.com') == false) {
$sql="INSERT INTO ".TABLE_REWARD_CUSTOMER_POINTS." VALUES ('".$customer_id."', '".$reward_points."', '".$pending_points."') ON DUPLICATE KEY UPDATE reward_points=reward_points+".$reward_points.", pending_points=pending_points+".$pending_points.";";
$db->Execute($sql);
}
}
Can someone verify my logic here and let me know if I'm on the right track? Is the variable "$order->info['customer_email_address']" even available at this point? Thank you.
-
Re: Reward Points Module does not update with paypal
Quote:
Originally Posted by
southshorepizza
I have a question on customization. Not confident enough to through this up on a live site. Unfortunately we are in a slow move from one server to the next. But with free migration I can't complain.
Anyways I want to not write points to the table_reward_customer_points if the email address contains a certain domain. I'm pretty sure I would change the catalog/includes/functions/extra_functions/reward_points_functions.php file. Specifically
Code:
function UpdateCustomerRewardPoints($customer_id,$reward_points,$pending_points)
{
global $db;
$sql="INSERT INTO ".TABLE_REWARD_CUSTOMER_POINTS." VALUES ('".$customer_id."', '".$reward_points."', '".$pending_points."') ON DUPLICATE KEY UPDATE reward_points=reward_points+".$reward_points.", pending_points=pending_points+".$pending_points.";";
$db->Execute($sql);
}
I'm thinking something like
Code:
function UpdateCustomerRewardPoints($customer_id,$reward_points,$pending_points)
{
global $db;
if (strpos($order->info['customer_email_address'],'@domain.com') == false) {
$sql="INSERT INTO ".TABLE_REWARD_CUSTOMER_POINTS." VALUES ('".$customer_id."', '".$reward_points."', '".$pending_points."') ON DUPLICATE KEY UPDATE reward_points=reward_points+".$reward_points.", pending_points=pending_points+".$pending_points.";";
$db->Execute($sql);
}
}
Can someone verify my logic here and let me know if I'm on the right track? Is the variable "$order->info['customer_email_address']" even available at this point? Thank you.
I don't have an answer as much as a suggestion which has helped me get answers to things.. Create a clone of your live site to use as your test bed.. That way you can test your code and if it works, you share..:laugh: and if it doesn't, then you can say, "this is what I tried".. "this is the result"..