PDA

View Full Version : Multiple Choice Variables


PaulGrimshaw
02-Dec-2006, 08:13 PM
Hi,

This would be a multiple choice style variable. e.g. you add choices to a varaible and then when it is used you can choose as little or many of the choices as you wish.

This variable would require a new type of "block" being used, an 'for_each' type. For example,

block if multichoicevar <> ""
Block for_each = multichoicevar
echo "multichoicevar"
end for_each block
end block

this code would simply repeat for each option selected (in this example, it would just show the name of each option in a row). You should be able to test the variable to see if it has any options selected so you can ignore the whole block.

Thanks,
Paul.

wjcampbe
03-Dec-2006, 08:34 AM
Where will this loop be processed? Actinic does its processing on your PC when it builds the pages - so is this something you will populate in setup and create multiple layouts from?

If you want to present choices to the customer and repeat an action online based on the customer choices, then you need something that will run on the server - not something in Actinic.

PaulGrimshaw
03-Dec-2006, 12:58 PM
Hi Bill,

This loop would be done on actinic side as it does with other blocks. Here is an example that I would like to use.

I have a varaible called "Awards", in that awards variable I have a list of awards, e.g. Gift Association Best Gift 2006, Gift Association Best Gift 2007 etc etc.

For each product I have, I click on the variable and using check boxes select the ones that that applies to that product.

In actinic code I have an if block which asks if there are any awards selected, and if so, then the block runs. For each award that is ticked, It displays the award name.

Block If vAward <> ""
This product has won the following awards: <br>
Block For vAward
vAward<br>
End For
End If

You could use this for colours, sizes, designs, anything where by you want to show a list to the customer.

I guess you could even use it to create checkboxes or select box for the customer to select from. It could be quite a useful tool and I can think of quite a few things that I could use this for.

Block If vGifttag <> ""
Echo "Select your Gifttag"
<SELECT>
Block For vGifttag
<OPTION vGifttag>
End For
</SELECT>
End If

Thanks,
Paul.

cdicken
04-Dec-2006, 11:50 AM
Hi Paul

I'm afraid I don't really follow how this would work. Could you maybe give an example of how this would improve the customer shopping experience?

PaulGrimshaw
04-Dec-2006, 12:55 PM
Hi Chris, I have two realworld examples. I would like to modify the original description to allow a reference and then text within the variable - When selecting the various choices in the product, you would just see the reference. Its not neccesary, but might make it easier to use.

I have given a couple of examples and gone into as much detail as possible as it seems I can not explain myself properly!

Thanks,
Paul.

Example 1:
1. I configure a new variable vColour.

Variable: vColour
Options:
Ref = Text Used
Red = swatch_red.gif
Yellow = swatch_yellow.gif
Green = swatch_green.gif
Blue = swatch_blue.gif


2. I goto my products and select as many of the colours as I need.
3. I code into Actinic:


If vColour <> "" //If no options are selected, ignore.
Echo "Colour Options:"
Loop vColour //Loop all selected options within this variable.
Echo "<div style='background-image:<vColour>'></div>"
End Loop
End If


This example would create a div containing an image/colour for each colour I have selected.

Example 2.

Same again, I create a new variable called "vNotes". I populate it with:

Ref = Text Used
Heavy = "A special postage surchage applies to this item."
Bulb = "A bulb is supplied FOC"
Special = "This item is made to order".

For my handmade lampshade I select the Special & Bulb options. For my heavy items I select the heavy option.

In my code I have


If vNotes <> "" //If no options are selected, ignore.
Echo "<U>Please Note:</U>"
Loop vNotes //Loop all selected options within this variable.
Echo "<span class="product_notes"><vNotes></span><br>"
End Loop
End If


This example would create:

"Please Note:
This item is made to order.
A bulb is supplied FOC."

To produce the same result now I would need either a single text variable (not an option if you have lots of the same) or a list variable. The list variable though would can get complicated if you have lots of different choices etc. You would need "A bulb is supplied FOC", "This Item is made to order", "A bulb is supplied FOC. This item is made to order". Thats three options for just the two choices.