Jump to content

Ajax Order Form


inthanet

Recommended Posts

there is a thread on this but i cant remember where it is. so here is how

 

replace whmcs/order/procuts.tpl with the following

 

<br />
<table width="90%" cellspacing="0" cellpadding="0" align="center">
<tr>
	<div class="orderbox">
		<td>
			{foreach from=$products item=product key=num}
				<input type="radio" name="pid" value="{$product.pid}" id="pid{$product.pid}" onclick="loadproductconfig('{$product.pid}')"{if $product.qty eq "0"} disabled{/if} class="buttongo" /> <label for="pid{$product.pid}"><b>{$product.name}</b></label>
				{if $product.qty!=""}<em>({$product.qty} {$LANG.orderavailable})</em>{/if}<br>
				{if $product.description}<em>{$product.description}</em><br>{/if}
				{if $num % 2}</td></tr><tr><td>{/if}
			{/foreach}
		</td>
	</div>
</tr>
</table>

 

just rename your existing products.tpl and create a new file, that way you have a back up..

 

 

in rereading i am thinking its not what your meaning but if it is glad to help lol.

 

Anyway id your wanting to show the info only after they select then you need to use more ajax with the above template. You need to capture the onclick event and have an invisible element that becomes visible on the capture of the onclick you would also need to make sure it hides the description and opens a new on should another product be clicked

Edited by disgruntled
Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...
there is a thread on this but i cant remember where it is. so here is how

 

replace whmcs/order/procuts.tpl with the following

 

<br />
<table width="90%" cellspacing="0" cellpadding="0" align="center">
   <tr>
       <div class="orderbox">
           <td>
               {foreach from=$products item=product key=num}
                   <input type="radio" name="pid" value="{$product.pid}" id="pid{$product.pid}" onclick="loadproductconfig('{$product.pid}')"{if $product.qty eq "0"} disabled{/if} class="buttongo" /> <label for="pid{$product.pid}"><b>{$product.name}</b></label>
                   {if $product.qty!=""}<em>({$product.qty} {$LANG.orderavailable})</em>{/if}<br>
                   {if $product.description}<em>{$product.description}</em><br>{/if}
                   {if $num % 2}</td></tr><tr><td>{/if}
               {/foreach}
           </td>
       </div>
   </tr>
</table>

just rename your existing products.tpl and create a new file, that way you have a back up..

 

 

in rereading i am thinking its not what your meaning but if it is glad to help lol.

 

Anyway id your wanting to show the info only after they select then you need to use more ajax with the above template. You need to capture the onclick event and have an invisible element that becomes visible on the capture of the onclick you would also need to make sure it hides the description and opens a new on should another product be clicked

 

This will show all descriptions for all products in the list.

 

Is there any way to show the product description after the selection of one product ?

So, only the selected product will show its description right after the list and before the domain options ?

Link to comment
Share on other sites

For everyone who wants to show the description ONLY of the selected product, I have modified the code with a friend, here's the result:

 

Hiding options as you select other:

 

<br />
<table width="90%" cellspacing="0" cellpadding="0" align="center">
 <tr>
{foreach from=$products item=product key=num}
   <td width="50%" valign="top">
	<input type="radio" name="pid" value="{$product.pid}" id="pid{$product.pid}" {if $product.qty!="" && $product.qty<=0}disabled{/if} onclick="loadproductconfig('{$product.pid}');$.each($('.descripcion'),function(k,v){literal}{$(v).hide();}{/literal});$('#descripcion{$product.pid}').show()"><label for="pid{$product.pid}">{$product.name}{if $product.qty!="" && $product.qty<=0} ({$LANG.outofstock}){/if} {if $product.description}<div id="descripcion{$product.pid}" class="descripcion">{$product.description}</div><br>{/if}</label>
</td>
   {if $num % 2}</tr><tr>{/if}
{/foreach}
 </tr>
</table>

 

With no hiding:

 

<br />
<table width="90%" cellspacing="0" cellpadding="0" align="center">
 <tr>
{foreach from=$products item=product key=num}
   <td width="50%" valign="top">
	<input type="radio" name="pid" value="{$product.pid}" id="pid{$product.pid}" {if $product.qty!="" && $product.qty<=0}disabled{/if} onclick="loadproductconfig('{$product.pid}');$('#descripcion{$product.pid}').show()"><label for="pid{$product.pid}">{$product.name}{if $product.qty!="" && $product.qty<=0} ({$LANG.outofstock}){/if} {if $product.description}<div id="descripcion{$product.pid}" class="descripcion">{$product.description}</div><br>{/if}</label>
</td>
   {if $num % 2}</tr><tr>{/if}
{/foreach}
 </tr>
</table>

 

You have to add this to the style.css file:

 

.descripcion{

display:none;

}

Link to comment
Share on other sites

For everyone who wants to show the description ONLY of the selected product, I have modified the code with a friend, here's the result:

 

Hiding options as you select other:

 

<br />
<table width="90%" cellspacing="0" cellpadding="0" align="center">
 <tr>
{foreach from=$products item=product key=num}
   <td width="50%" valign="top">
	<input type="radio" name="pid" value="{$product.pid}" id="pid{$product.pid}" {if $product.qty!="" && $product.qty<=0}disabled{/if} onclick="loadproductconfig('{$product.pid}');$.each($('.descripcion'),function(k,v){literal}{$(v).hide();}{/literal});$('#descripcion{$product.pid}').show()"><label for="pid{$product.pid}">{$product.name}{if $product.qty!="" && $product.qty<=0} ({$LANG.outofstock}){/if} {if $product.description}<div id="descripcion{$product.pid}" class="descripcion">{$product.description}</div><br>{/if}</label>
</td>
   {if $num % 2}</tr><tr>{/if}
{/foreach}
 </tr>
</table>

 

With no hiding:

 

<br />
<table width="90%" cellspacing="0" cellpadding="0" align="center">
 <tr>
{foreach from=$products item=product key=num}
   <td width="50%" valign="top">
	<input type="radio" name="pid" value="{$product.pid}" id="pid{$product.pid}" {if $product.qty!="" && $product.qty<=0}disabled{/if} onclick="loadproductconfig('{$product.pid}');$('#descripcion{$product.pid}').show()"><label for="pid{$product.pid}">{$product.name}{if $product.qty!="" && $product.qty<=0} ({$LANG.outofstock}){/if} {if $product.description}<div id="descripcion{$product.pid}" class="descripcion">{$product.description}</div><br>{/if}</label>
</td>
   {if $num % 2}</tr><tr>{/if}
{/foreach}
 </tr>
</table>

 

You have to add this to the style.css file:

 

.descripcion{

display:none;

}

 

Can you help me with my request?

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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