X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Show $$ value for BCSE's Reward Points Mod (https://forum.x-cart.com/showthread.php?t=39976)

Jon 05-22-2008 12:33 PM

Show $$ value for BCSE's Reward Points Mod
 
To display the $$ value anywhere, make sure that you have installed the reward points mod to display the points in the location of which you want to show the dollar value. Then:

Open auth.php and before ?> put:

Code:

// WCM - Pass the points payment rate to the template for $$ display
$payment_rate = func_query_first_cell("select value from points_config where name='payment_rate'");
$smarty->assign("wcmPaymentRate",$payment_rate);



In your template file:

Code:

{math x=$points.total y=$wcmPaymentRate equation="x / y" format="%.2f" assign="wcmPointsDollars"}
{include file="currency.tpl" value=$wcmPointsDollars}


Voila.

Nadeem 05-22-2008 05:12 PM

Re: Show $$ value for BCSE's Reward Points Mod
 
nice :)

paul@dimoda.com.au 05-22-2008 06:00 PM

Re: Show $$ value for BCSE's Reward Points Mod
 
You Champion

Ok, so here is the modified code a side bar menu item reward_points.tpl for the Customer rewards mod to show

Line 1 - link to Points System Explanation ( your static page )
Line 2 - Link to Customer Referral programme ( the crp_referral.php )
Line 3 - if logged in show current points balance
Line 4 - if logged in show current points equivilent $ Value

{capture name=menu}
<table border="0" cellpadding="3" cellspacing="0" width="100%">
<tr><td>Earn Points</td><td><a href="/store/pages.php?pageid=30" title="Coffee Shrine's Customer Reward Points Programme">{include file="buttons/search_head.tpl"}</a>
</td></tr>
<tr><td colspan="2"><hr class="VertMenuHr" size="1"/></td></tr>
<tr><td>Refer a Friend</td><td><a href="/store/crp_referral.php" title="Refer a Friend and receive Bonus Points">{include file="buttons/search_head.tpl"}</a></td></tr>
{if $login eq "" }
<tr><td colspan="2"><hr class="VertMenuHr" size="1"/></td></tr>
<tr><td colspan="2>">(User must be logged in)</td></tr>
{else}
{* Points Added*}
<tr><td colspan="2"><hr class="VertMenuHr" size="1"/></td></tr>
<tr>
<td>Points Balance:</td>
<td><b>{$points.total}</b></td>
</tr>
<tr>
<td>Points Value:</td>
<td>{math x=$points.total y=$wcmPaymentRate equation="x / y" format="%.2f" assign="wcmPointsDollars"}
{include file="currency.tpl" value=$wcmPointsDollars}</td>
</tr>
{/if}

{* End Points added*}</table>
{/capture}
{ include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_reward_points menu_content=$smarty.capture.menu }

Enjoy - comments welcome

pcarcare 06-11-2008 07:56 PM

Re: Show $$ value for BCSE's Reward Points Mod
 
Hi there-

Great mod, however I notice a bug on my end. Everything seems to be working great when a user is logged in, but when a user registers from the first time on the register page the "point value" script give me this error...

Points Value:FPRIVATE "TYPE=PICT;ALT=" Warning: Smarty error: math ``x / y'' in ``modules/Special_Offers/customer/new_offers_short_list.tpl'': parameter ``x'' is empty in /home/professi/public_html/upgrade/Smarty-2.6.19/Smarty.class.php on line 1092
$

It seems the error comes from the Special Offers module, but is present where the points value mod is.

anybody have any ideas?

paul@dimoda.com.au 06-11-2008 08:10 PM

Re: Show $$ value for BCSE's Reward Points Mod
 
Hmmm, I do not get the same error but I also do not use the special offers module...

It may be a version thing.

Way out of my leauge - I am just an agregator of other peoples code...

paul@dimoda.com.au 06-11-2008 08:18 PM

Re: Show $$ value for BCSE's Reward Points Mod
 
Quote:

Originally Posted by pcarcare
Hi there-

Great mod, however I notice a bug on my end. Everything seems to be working great when a user is logged in, but when a user registers from the first time on the register page the "point value" script give me this error...

Points Value:FPRIVATE "TYPE=PICT;ALT=" Warning: Smarty error: math ``x / y'' in ``modules/Special_Offers/customer/new_offers_short_list.tpl'': parameter ``x'' is empty in /home/professi/public_html/upgrade/Smarty-2.6.19/Smarty.class.php on line 1092
$

It seems the error comes from the Special Offers module, but is present where the points value mod is.

anybody have any ideas?



Maybe try an if else statement. if points =0 then 0 otherwise use the formula...

paul@dimoda.com.au 06-11-2008 08:23 PM

Re: Show $$ value for BCSE's Reward Points Mod
 
Try this - it includes an if else statement that doesnt seem to break anything

{capture name=menu}
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td colspan="2"><a href="/reward-points.html" title="Coffee Shrine's Customer Reward Points Programme"><b>&nbsp;Earn Points</b></a></td></tr>
<tr><td colspan="2"><hr class="VertMenuHr" size="1"/></td></tr>
<tr><td colspan="2"><a href="/crp_referral.php" title="Refer a Friend and receive Bonus Points"><b>&nbsp;Refer a Friend</b></a></td></tr>
{if $login eq "" }
<tr><td colspan="2"><hr class="VertMenuHr" size="1"/></td></tr>
<tr><td colspan="2>">(User must be logged in)</td></tr>
{else}
{* Points Added*}
<tr><td colspan="2"><hr class="VertMenuHr" size="1"/></td></tr>
<tr>
<td>Points Balance:</td>
<td><b>{$points.total}</b></td>
</tr>
<tr>
<td>Points Value:</td>
<td>{if $points.total ne ""}{math x=$points.total y=$wcmPaymentRate equation="x / y" format="%.2f" assign="wcmPointsDollars"}
{include file="currency.tpl" value=$wcmPointsDollars}{else}0{/if}</td>
</tr>
{/if}

{* End Points added*}</table>
{/capture}
{ include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_reward_points menu_content=$smarty.capture.menu }


regards

pcarcare 06-13-2008 03:15 PM

Re: Show $$ value for BCSE's Reward Points Mod
 
Paul-

That seems to work. Thanks for your help.

tqualizerman 02-20-2009 01:04 AM

Re: Show $$ value for BCSE's Reward Points Mod
 
Has anyone figured out a way to get a customer's point count to show on a static page?

carpeperdiem 03-13-2009 10:37 AM

Re: Show $$ value for BCSE's Reward Points Mod
 
I have a hunch that {$points.total} has become {$points} in vers 2 of this mod.

Confirmed by Carrie. Vers 2 is slightly different, and uses {$points} instead of {$points.total}


All times are GMT -8. The time now is 03:22 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.