Group: Forum Members
Posts: 2,
Visits: 15
|
Hi,
I've been writing a script that can perform in the style of an online shop. This script requires selected stimuli to reappear on a later page (i.e. basket page). I have managed to make most of this work through a surveypage but I can only get the basket page to show one item rather than all items selected. Any help would be much appreciated.
I have also tried to include this feature as a list rather than an item but was not able to present the list on the surveypage.
For each individual item page there is a trial such as:
<picture bbq_melt_item> / items = ("bbq_melt.jpg") / position = (27%, 55%) / size = (62%, 62%) </picture>
<text bbq_melt_text> / items = ("BBQ Chicken Melt with a BBQ Dip") / position = (75%, 37%) / size = (40%, 40%) / fontstyle = ("Arial Black", 4%, false, false, false, false, 5, 1) / txbgcolor = transparent </text>
<text bbq_melt_description> / items = ("A melt loaded with mozzarella cheese and layers of roast chicken and red onion, served with a BBQ sauce for dipping. Comes with dipping sauce. Serves 1.") / position = (75%, 42%) / size = (20%, 20%) / fontstyle = ("Arial", 2.5%, false, false, false, false, 5, 1) / txbgcolor = transparent </text>
<text bbq_melt_kcals> / items = ("766kcal") / fontstyle = ("Arial Black", 3.5%, true, false, false, false, 5, 1) / position = (75%, 72%) / size = (25%, 25%) / txbgcolor = transparent </text>
<text bbq_melt_price> / items = ("£7.99") / position = (75%, 85%) / size = (40%, 40%) / fontstyle = ("Arial Black", 2.59%, true, false, false, false, 5, 1) / txbgcolor = transparent </text>
<button return> / caption = "Return to menu" / position = (10%, 10%) / size = (12%, 8%) / fontstyle = ("Arial", 2.8%, false, false, false, false, 5, 1) </button>
<button add_to_order> / caption = "Add to order" / fontstyle = ("Arial", 3.3%, false, false, false, false, 5, 1) / position = (75%, 93%) / size = (12%, 5%) </button>
<button continue> / caption = "Continue" / fontstyle = ("Arial", 3.3%, false, false, false, false, 5, 1) / position = (93%, 93%) / size = (12%, 5%) </button>
<trial bbq_melt> / stimulusframes = [5=basket, text.basket_count, complete_order, bbq_melt_item, bbq_melt_text, bbq_melt_description, bbq_melt_price, bbq_melt_kcals, picture.PH_logo, return, add_to_order] / validresponse = (basket, complete_order, "add_to_order", "return") / inputdevice = mouse / correctresponse = ("add_to_order") / recorddata = true / ontrialend = [if (trial.bbq_melt.correct == true) values.Basket += 1] / ontrialend = [if (trial.bbq_melt.correct == true) item.ordered_items.appenditem("BBQ Chicken Melt with a BBQ Dip");] / ontrialend = [if (trial.bbq_melt.correct == true) item.item_prices.appenditem("£7.99");] / ontrialend = [if (trial.bbq_melt.correct == true) values.basket_value += 7.99] / branch = [ if (trial.bbq_melt.response == "add_to_order") { return trial.bbq_melt; } else if (trial.bbq_melt.response == "return") { return trial.melts; } else if (trial.bbq_melt.response == "complete_order") { return trial.CompleteSelectionCheck; } else if (trial.bbq_melt.response == "basket") { return trial.CompleteSelectionCheck; }; ] </trial>
The basket script is:
<item ordered_items> </item>
<item prices> </item>
<picture logo_basket> / items = ("pizza_hut_logo.png") / position = (55%, 10%) / size = (20%, 20%) </picture>
<picture basketPic> / items = ("basket.jpg") / position = (95%, 10%) / size = (10%, 10%) </picture>
<text basketText> / items = ("BASKET") / position = (95%, 6%) / size = (20%, 10%) / fontstyle = ("Arial Black", 3%, false, false, false, false, 5, 1) / txbgcolor = transparent </text>
<text basketCount> / items = ("<%format(~"%i~", values.Basket)%>") / txbgcolor = white / fontstyle = ("Arial Black", 2.59%, true, false, false, false, 5, 1) / position = (90%, 10%) </text>
<text basketPrice> / items = ("<%values.currency%> <%format(~"%.2f~", values.basket_value)%> ") / txbgcolor = white / fontstyle = ("Arial Black", 2.59%, true, false, false, false, 5, 1) / position = (90%, 75%) </text>
<text items_basket> / items = ordered_items / fontstyle = ("Arial", 2.5%, false, false, false, false, 5, 1) / txbgcolor = transparent / txcolor = black / position = (70%, 40%) </text>
<text prices_basket> / items = item_prices / fontstyle = ("Arial", 2.5%, false, false, false, false, 5, 1) / txbgcolor = transparent / txcolor = black / position = (90%, 40%) </text>
<radiobuttons continue> / caption = "Are you finished with your order?" / options = ("Confirm order", "Empty basket and start again") / position = (75%, 80%) / fontstyle = ("Arial", 2.50%, false, false, false, false, 5, 1) </radiobuttons>
<surveypage basket> / stimulusframes = [5=prices_basket, basketPrice, logo_basket, basketCount, basketPic, basketText] / showpagenumbers = false / showquestionnumbers = false / questions = [1=radiobuttons.continue; 2] / branch = [ if (radiobuttons.continue.response == "Confirm order") { return surveypage.end; } else if (radiobuttons.continue.response == "Empty basket and start again") { return trial.again; } ] </surveypage>
|