mydatacenter Posted February 18, 2016 Share Posted February 18, 2016 Hello, I come to you because I need your help. I have to change: {php} $query = mysql_query("select * from tblpricing where relid='" .$this->_tpl_vars['products'][$sd]['pid']. "'"); $row = mysql_fetch_array($query); {/php} For : {php} $query = mysql_query("select * from tblpricing where relid='" .$template->getVariable ( $products[$sd]['pid'] ). "'"); $row = mysql_fetch_array($query); {/php} And yet I have the following error: Parse error: syntax error, unexpected end of file in /home/whmcs/public_html/v6/vendor/smarty/smarty/libs/SmartyBC.class.php(464) : eval()'d code on line 3 Thank you for your help 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 18, 2016 Share Posted February 18, 2016 if I add the code to a template in v6, I don't get any such error... but there has to be a better way of doing whatever you're trying to do than using {php} tags in the template. what are you trying to use this for - and where are you putting the code ?? 0 Quote Link to comment Share on other sites More sharing options...
mydatacenter Posted February 18, 2016 Author Share Posted February 18, 2016 (edited) Hello, A big thank you for your return, I am trying to adapt to ajaxcart whmcs v6 it work well, however I have a problem with putting the domain in cart. The code I would like to add the products.tpl in for the display of prices. thank you in advance Edited February 18, 2016 by mydatacenter 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 18, 2016 Share Posted February 18, 2016 Hi, it's probably worth mentioning again that WHMCS v6 does not include the "ajaxcart" order-form template - it has been removed and will no longer be updated.... the recommended advice is to use another cart template... so even if you could make it work now, there is no guarantee that it will continue to work in the future with WHMCS updates - in fact, it probably won't. however, you seem determined to try to make it work - so if all you want to do is add pricing to the products.tpl page, you don't need a {php} block of code or any other method to get the pricing, the template already has access to the pricing array and you can use... {$product.pricing.minprice.price} put it somewhere in the {foreach} loop and it should show the price for each product. 0 Quote Link to comment Share on other sites More sharing options...
mydatacenter Posted February 18, 2016 Author Share Posted February 18, 2016 Thanks for your feedback, I already try, it works well with your solution, the problem that these will show me a single price view screen prints (http://hpics.li/f4501d1). I try to have a complete price list, which updates the basket depending on the duration. (Screen prints http://hpics.li/5df0e7f) thank you in advance 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 18, 2016 Share Posted February 18, 2016 oh i've just taken a look at your cart template - it looks surprisingly good... not how I had imagined it would. however, you seem to be trying to use a very complicated method to show your billing cycle prices - there is no need for all of your {php} tags in the billing cycle... all that you should need to do is replace your code... {php} $query = mysql_query("select * from tblpricing where relid='" .$template->getVariable('products'[$sd]['pid']). "'"); $row = mysql_fetch_array($query); {/php} <select class="billingcycle02" id="billpid{$product.pid}" name="billingcycle02" onchange="prodconfrecalcsummary01(this.value, '{$product.pid}')"> {php}$products = $template->getVariable( 'products' ); if ( $products[$sd]['paytype'] == 'recurring' ) { {/php} {php} $products = $template->getVariable( 'products' ); if ( $products[$sd][pricing][rawpricing][monthly] > 0 ) { {/php} <option value="monthly">{php}echo $products[$sd][pricing][monthly];{/php} </option> {php} } {/php} {php} $products = $template->getVariable( 'products' ); if ( $products[$sd][pricing][rawpricing][quarterly] > 0 ) { {/php} <option value="quarterly">{php}echo $products[$sd][pricing][quarterly];{/php} </option> {php} } {/php} {php} $products = $template->getVariable( 'products' ); if ( $products[$sd][pricing][rawpricing][semiannually] > 0 ) { {/php} <option value="semiannually">{php}echo $products[$sd][pricing][semiannually];{/php} </option> {php} } {/php} {php} $products = $template->getVariable( 'products' ); if ( $products[$sd][pricing][rawpricing][annually] > 0 ) { {/php} <option value="annually">{php}echo $products[$sd][pricing][annually];{/php} </option> {php} } {/php} {php} $products = $template->getVariable( 'products' ); if ( $products[$sd][pricing][rawpricing][biennially] > 0 ) { {/php} <option value="biennially">{php}echo $products[$sd][pricing][biennially];{/php} </option> {php} } {/php} {php} $products = $template->getVariable( 'products' ); if ( $products[$sd][pricing][rawpricing][triennially] > 0 ) { {/php} <option value="triennially">{php}echo $products[$sd][pricing][triennially];{/php} </option> {php} } {/php} {php} } {/php} {php} $products = $template->getVariable( 'products' ); if ( $products[$sd][pricing][rawpricing][triennially] > 0 ) { {/php} <option value="triennially">{php}echo $products[$sd][pricing][triennially];{/php} </option> {php} } {/php} {php} $products = $template->getVariable( 'products' ); if ( $products[$sd]['paytype'] == 'onetime' ) { {/php} <option value="onetime">{php}echo $products[$sd][pricing][onetime];{/php} </option> {php} } {/php} {php} $products = $template->getVariable( 'products' ); if ( $products[$sd][pricing][rawpricing][free] > 0 ) { {/php} <option value="free">{php}echo $products[$sd][pricing][free];{/php} </option> {php} } {/php} </select> with my Smarty code... <select class="billingcycle02" id="billpid{$product.pid}" name="billingcycle02" onchange="prodconfrecalcsummary01(this.value, '{$product.pid}')"> {if $product.pricing.monthly}<option value="monthly">{$product.pricing.monthly}</option>{/if} {if $product.pricing.quarterly}<option value="quarterly">{$product.pricing.quarterly}</option>{/if} {if $product.pricing.semiannually}<option value="semiannually">{$product.pricing.semiannually}</option>{/if} {if $product.pricing.annually}<option value="annually">{$product.pricing.annually}</option>{/if} {if $product.pricing.biennially}<option value="biennially">{$product.pricing.biennially}</option>{/if} {if $product.pricing.triennially}<option value="triennially">{$product.pricing.triennially}</option>{/if} {if $product.paytype eq 'onetime'}<option value="onetime">{$product.pricing.onetime}</option>{/if} {if $product.paytype eq 'free'}<option value="free">{$product.paytype}</option>{/if} </select> if you do that, then it should start to work.... 0 Quote Link to comment Share on other sites More sharing options...
mydatacenter Posted February 18, 2016 Author Share Posted February 18, 2016 Hello, A big thank you to you, you are really strong and I see that you love challenges. This one does not work, I think the php tag is not working on the ajaxcart. {php} $query = mysql_query("select * from tblpricing where relid='" .$template->getVariable('products'[$sd]['pid']). "'"); $row = mysql_fetch_array($query); {/php} <select class="billingcycle02" id="billpid{$product.pid}" name="billingcycle02" onchange="prodconfrecalcsummary01(this.value, '{$product.pid}')"> {php}$products = $template->getVariable( 'products' ); if ( $products[$sd]['paytype'] == 'recurring' ) { {/php} {php} $products = $template->getVariable( 'products' ); if ( $products[$sd][pricing][rawpricing][monthly] > 0 ) { {/php} <option value="monthly">{php}echo $products[$sd][pricing][monthly];{/php} </option> {php} } {/php} {php} $products = $template->getVariable( 'products' ); if ( $products[$sd][pricing][rawpricing][quarterly] > 0 ) { {/php} <option value="quarterly">{php}echo $products[$sd][pricing][quarterly];{/php} </option> {php} } {/php} {php} $products = $template->getVariable( 'products' ); if ( $products[$sd][pricing][rawpricing][semiannually] > 0 ) { {/php} <option value="semiannually">{php}echo $products[$sd][pricing][semiannually];{/php} </option> {php} } {/php} {php} $products = $template->getVariable( 'products' ); if ( $products[$sd][pricing][rawpricing][annually] > 0 ) { {/php} <option value="annually">{php}echo $products[$sd][pricing][annually];{/php} </option> {php} } {/php} {php} $products = $template->getVariable( 'products' ); if ( $products[$sd][pricing][rawpricing][biennially] > 0 ) { {/php} <option value="biennially">{php}echo $products[$sd][pricing][biennially];{/php} </option> {php} } {/php} {php} $products = $template->getVariable( 'products' ); if ( $products[$sd][pricing][rawpricing][triennially] > 0 ) { {/php} <option value="triennially">{php}echo $products[$sd][pricing][triennially];{/php} </option> {php} } {/php} {php} } {/php} {php} $products = $template->getVariable( 'products' ); if ( $products[$sd][pricing][rawpricing][triennially] > 0 ) { {/php} <option value="triennially">{php}echo $products[$sd][pricing][triennially];{/php} </option> {php} } {/php} {php} $products = $template->getVariable( 'products' ); if ( $products[$sd]['paytype'] == 'onetime' ) { {/php} <option value="onetime">{php}echo $products[$sd][pricing][onetime];{/php} </option> {php} } {/php} {php} $products = $template->getVariable( 'products' ); if ( $products[$sd][pricing][rawpricing][free] > 0 ) { {/php} <option value="free">{php}echo $products[$sd][pricing][free];{/php} </option> {php} } {/php} </select> with my Smarty code... ok perfect jobs I have a problem with php tag, it not work, and even whmcs support, failed to find a solution, you may be yes Code domainoptions.tpl: <div class="domainregperiod">{$LANG.cartregisterhowlong} <select onchange="{php} if($_REQUEST['adddomaincustom']=='1'){ {/php} adddomain(); {php} }else{ {/php} completedomain(); {php} } {/php}" name="domainsregperiod[{$domain}]" id="regperiod">{foreach key=period item=regoption from=$regoptions}{if $regoption.register}<option value="{$period}">{$period} {$LANG.orderyears} @ {$regoption.register}</option>{/if}{/foreach}</select></div> Code firebug: <select id="regperiod" name="domainsregperiod[essai.aaa.pro]" onchange="adddomain(); completedomain(); "> As you can see it not work, it only takes the information in the tag. thank you in advance 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 18, 2016 Share Posted February 18, 2016 instead of using {php} tags... onchange="{php} if($_REQUEST['adddomaincustom']=='1'){ {/php} adddomain(); {php} }else{ {/php} completedomain(); {php} } {/php}" what happens if you use Smarty and change it to...? onchange="{if $smarty.request.adddomaincustom eq '1'} adddomain(); {else} completedomain();{/if}" 0 Quote Link to comment Share on other sites More sharing options...
mydatacenter Posted February 18, 2016 Author Share Posted February 18, 2016 (edited) Hello, A big thank you to you, I say bravo. Congratulations to you, and above all, a thousand thank you. Can you just tell me if this is right {if $smarty.request.adddomaincustom eq '1'} {if $status eq "available" && $checktype=="register"} <script language="javascript"> adddomain(); </script> {elseif $status eq "unavailable" && $checktype=="transfer"} <script language="javascript"> adddomain(); </script> {/if} {else} <script language="javascript"> completedomain(); </script> {/if} Edited February 18, 2016 by mydatacenter 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 18, 2016 Share Posted February 18, 2016 if it works, yes! 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.