Jump to content

Php tag whmcs 6


mydatacenter

Recommended Posts

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

Link to comment
Share on other sites

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 by mydatacenter
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

oh i've just taken a look at your cart template - it looks surprisingly good... not how I had imagined it would. :idea:

 

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.... :)

 

LXCelZ8.png

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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}"

Link to comment
Share on other sites

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 by mydatacenter
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated