Formbuilder flat file problem

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
User avatar
Nettie
Forum Members
Forum Members
Posts: 53
Joined: Tue Oct 03, 2006 11:42 pm

Formbuilder flat file problem

Post by Nettie »

I have a form where you can select an item via a checkbox and type in a textfield how many of that item you wish to order.

My problem is a bit difficult to explain and I simpy can't wrap my head around it.

I need to write the result to a flat text file. But insteadt of having the file look like this:

Item name
Amount 3

I need to duplicate the result so it ends up like this

Item name
Item name
Item name

If of course the amount is 1 it shouldnt duplicate at all.

My fields looks like this:

Code: Select all

<Item name:>{$TAB}{$TAB}{if $itemname != "" && $itemname != "[mangler]" }{$itemname}{/if}
{if $amount != "" && $amount!= "[mangler]" }{$amount}{/if}
Any help is highly appreciated :)
mcDavid
Power Poster
Power Poster
Posts: 377
Joined: Tue Mar 31, 2009 8:45 pm

Re: Formbuilder flat file problem

Post by mcDavid »

I think you will have to make a user defined tag for that. Something like this:

Code: Select all

$i=0;
while ($i < params['amount'])
{
  echo $params['name'];
  $i++;
}
and then call it with {item name=$itemname amount=$amount}

Smarty 3 will have native support for while-loops so you might be able to do this with only smarty if you can wait for Smarty 3 to appear in CMS MS (maybe in CMS 1.11)
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Formbuilder flat file problem

Post by calguy1000 »

Uhm... see the 'repeat' command in the tags menu?
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
User avatar
Nettie
Forum Members
Forum Members
Posts: 53
Joined: Tue Oct 03, 2006 11:42 pm

Re: Formbuilder flat file problem

Post by Nettie »

Calguy1000 I saw that one but it doesnt help. If the customer types 10 it has to repeat 10 times etc.

And btw ty for all the good work you have done with cmsms :)
mcDavid
Power Poster
Power Poster
Posts: 377
Joined: Tue Mar 31, 2009 8:45 pm

Re: Formbuilder flat file problem

Post by mcDavid »

calguy1000 wrote:Uhm... see the 'repeat' command in the tags menu?
Ah. Good one, seems to do exactly that!
Post Reply

Return to “Modules/Add-Ons”