Jamroom Logo Jamroom 5 Core
is now Open Source!
User Support Forum Archive (Read Only)
User Site Design, Integration and Customization:
Need help with quota if else in cart.php
tettlingen



Joined: 23 Aug 2010
Posts: 2

Posted: 02/26/13 14:59 
Hello
I wonder if someone here can help me with something?

I m modifying cart.php in jamroom 4.
I want to have fixed price control for the cart content and as a quick fix I have made a button list with premade promocodes that updates the sum in the cart after a specific pattern.
This work fine, but now I want to make this quoata based, so that only certain promocodes show up based on what user quota that is logged in and shopping on the site.

I have used the following statement {if $_USER.user_id == 0}



<input type="radio" name="promo_code" value="1DFEF916AE" checked>PRO 1 = <b><font color="#009900"><font size="2"> $20 </b></font color></font size><br>
<input type="radio" name="promo_code" value="C0802AB315" >PRO 2 = <b><font color="#009900"><font size="2">$50</b></font color></font size> <br>
<input type="radio" name="promo_code" value="36CB412011">PRO 3 <b><font color="#009900"><font size="2">$150</b></font color></font size>
<br> <br>

{/if}

but to no effect in cart. I have tried this in the header and on other templates tpl files it works, but when I apply it to cart.php it doesn´t work. I suppose it has somthing to to with my crappy php skills Wink
Or can´t I use smarty? I wonder if anyone has any idéas that might work?

This is what I have tried so far:


// Promo Codes
// Note that Promo codes are APPLIED above to the entire cart - this section just
// shows any promo codes that have been applied, plus form for new promo code


if (isset($_SESSION['JR_PROMO_CODE_APPLIED']) && strlen($_SESSION['JR_PROMO_CODE_APPLIED']) > 0 && isset($_SESSION['jrPaymentApplyPromoCode']['FOUND'])) {
$cid = $_SESSION['JR_PROMO_CODE_APPLIED'];
$_pc = jrPaymentGetPromoCodes($_user);
if (isset($_pc[$cid])) {
$dat[1]['title'] = '<span class="jmFont3">&quot;'. $_pc[$cid]['code_name'] .'&quot;</span> '. $language['cart'][18];
$dat[1]['style'] = 'text-align:right;padding-right:8px;height:25px;" colspan="4';
if (strstr($_pc[$cid]['code_value'],'%')) {
// $show = str_replace('%','',$_pc[$cid]['code_value']);
// $dat[2]['title'] = '-'. $show .'%';
}
else {
// $sym = jrGetCurrencySymbol($config['vault_currency']);
// $dat[2]['title'] = '-'. $sym . $_pc[$cid]['code_value'];
}
$dat[2]['style'] = 'text-align:center;';
$dat[3]['title'] = jrHtmlButtonCode($language['misc'][33],'window.location=\'cart.php?mode=code_remove\'');
$dat[3]['style'] = 'text-align:center;';
htmlPageSelect('row',$dat);
}
}
elseif (!isset($config['vault_promo_codes']) || $config['vault_promo_codes'] == 'yes') {
// invalid or old promo code - reset
unset($_SESSION['JR_PROMO_CODE_APPLIED'],$_SESSION['jrPaymentApplyPromoCode']['FOUND']);
if (isset($_SESSION['jrPaymentApplyPromoCode']['ERROR'])) {
$dat[1]['title'] = '<span class="jmFont3">'. $language['cart'][20] .'</span>&nbsp;&nbsp;&nbsp;'. $language['cart'][17];
unset($_SESSION['jrPaymentApplyPromoCode']['ERROR']);
}
else {
$dat[1]['title'] = $language['cart'][17];
}


$dat[1]['style'] = 'text-align:left;padding-right:8px;height:30px;" colspan="4';
$dat[1]['title'] = '<form method="post" action="cart.php?mode=code_apply">

{if $_USER.user_id == 0}



<input type="radio" name="promo_code" value="1DFEF916AE" checked>PRO 1 = <b><font color="#009900"><font size="2"> $20 </b></font color></font size><br>
<input type="radio" name="promo_code" value="C0802AB315" >PRO 2 = <b><font color="#009900"><font size="2">$50</b></font color></font size> <br>
<input type="radio" name="promo_code" value="36CB412011">PRO 3 <b><font color="#009900"><font size="2">$150</b></font color></font size>
<br> <br>

{else}

<input type="radio" name="promo_code" value="4C55590514">MEDIA 1 <b><font color="#009900"><font size="2"> $100</b></font color></font size><br>
<input type="radio" name="promo_code" value="711570342C">MEDIA 2<b><font color="#009900"><font size="2">$200</b></font color></font size><br>
<input type="radio" name="promo_code" value="A8C93B0A3A">MEDIA 3 <b><font color="#009900"><font size="2">$1000</b></font color></font size>
<br><br>



<input type="radio" name="promo_code" value="F754420A18 ">INDY 1 <b><font color="#009900"><font size="2">$50</b></font color></font size><br>
<input type="radio" name="promo_code" value="216BE929B8 ">INDY 2<b><font color="#009900"><font size="2">$30</b></font color></font size><br>
<input type="radio" name="promo_code" value="FBC15CFE4F ">INDY 3 <b><font color="#009900"><font size="2">$150</b></font color></font size>
<br><br>



<input type="radio" name="promo_code" value="F6CE4C6974">EDU 1 <b><font color="#009900"><font size="2">$70</b></font color></font size><br>
<input type="radio" name="promo_code" value="FC9C02F4F5">EDU 2<b><font color="#009900"><font size="2">$200 </b></font color></font size> <br>
<input type="radio" name="promo_code" value="4FF9B4AE41">EDU 3<b><font color="#009900"><font size="2"> $500</b></font color></font size> <br>
<br><br>



<input type="radio" name="promo_code" value="4BB4E13490">EN 1<b><font color="#009900"><font size="2">$10000</b></font color></font size><br>
<input type="radio" name="promo_code" value="DC456B220F">EN 2 <b><font color="#009900"><font size="2">$5000</b></font color></font size><br>
<input type="radio" name="promo_code" value="67641E6F58">EN 3 <b><font color="#009900"><font size="2">$250</b></font color></font size><br>

';{/if}
$dat[2]['style'] = 'text-align:center;';
$dat[3]['title'] = jrHtmlButtonCode($language['cart'][6],'submit') .'</form>';
$dat[3]['style'] = 'text-align:center;';
htmlPageSelect('row',$dat);
}
$total_t = jrPaymentNumberFormat($total_t);


Any idéas?

I also tried to make a tpl with the cart content and work with it that way, but I have not succeded. Does anyone have functioning tpl code for this?
Thank you!
Kindest regards

Back to top
Display posts from previous:   
User Support Forum Archive (Read Only)
User Site Design, Integration and Customization

 
Solutions
• Social Media Platform
• Social Networking Software
• Musician Website Manager
• Community Builder
Products
• Jamroom Core
• Jamroom Addons
• Jamroom Modules
• Jamroom Marketplace
Support
• Support Forum
• Documentation
• Support Center
• Contact Support
Community
• Community Forum
• Member Sites
• Developers
Company
• About Us
• Contact Us
• Privacy Policy
©2003 - 2010 Talldude Networks, LLC.