[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
Re: [ic] using [accessories ...]
Quoting Rasta Man (rasta@optimacy.com):
> Hello all,
>
> I created a table called attr that looks like:
>
> prodid fieldtype fieldname parms
> 1001 text Engraving fieldsize=20
> 1001 radio Size Small, Medium, Large
>
> and I would like to display something similar to the following in the
> basket:
>
> SKU Description Qty Price Ext
> 1001 Engraved ring 1 10.00 10.00
> Engraving(up to 20 characters): ______________
> Size: _x_ Small ___ Medium ____ Large
>
> Is there any way to do this using [item_accessories] or [accessories] ? I
Yes, but you need to know what attributes you want to use and set those
in UseModifier. Using dynamic options is kind of difficult with IC 4.6.x,
but is made a bit easier in 4.7.x.
The fieldsize=20 isn't going to help you; you would need to have a size_limit
field to do something there. I will show use of that below.
Don't you have a unique key in attr? If you don't you don't even need to make
it a database. I tested the below with an attr.txt file of:
prodid fieldtype fieldname parms size_limit
1001 text_20 Engraving 20
1001 radio Size Small, Medium, Large
<FORM>
[loop search="
fi=attr.txt
st=text
co=yes
sf=prodid
se=1001
rf=fieldtype,fieldname,parms,size_limit
"]
[accessories
attribute="[loop-param fieldname]"
type="[loop-param fieldtype]"
passed="[loop-param parms]"
[if-loop-param size_limit]
filter="[loop-param size_limit]"
extra="MAXLENGTH=[loop-param size_limit]"
[/if-loop-param]
]
[/loop]
</FORM>
Be careful -- this takes advantage of the fact that all of the
[loop-TAG ..] stuff is inserted before the accessories tag is evaluated;
bear in mind you can't do [if type term] [/if] stuff inside the body of
a tag. People often get confused there, and not surprising, I guess. 8-)
--
Red Hat, Inc., 3005 Nichols Rd., Hamilton, OH 45013
phone +1.513.523.7621 <mheins@redhat.com>
Research is what I'm doing when I don't know what I'm doing.
-- Wernher Von Braun