Order Tags & Portion Popup Ask Question

Requirements:

  • Version 5.1+
  • SQL Server Express
  • GraphQL - make sure you can access to http://your_server_name_or_ip_or_localhost:9000

How it work:

Script

function getOrderTag(product,portion,returnType,key) {
	var qs = '{getOrderTagGroups(productName:"' + product + '",portion:"' + portion + '"){name,min,max,tags{name}}}';
	var data = JSON.parse(gql.Exec(qs));
	data = data.data.getOrderTagGroups;
	key = key.toLowerCase();
	for (i = 0; i < data.length; i++) {
		if (data[i].name.toLowerCase().indexOf(key) > -1) {
			if (returnType == 'name') {
				return data[i].name;
			}	
			var tagList=[];
			for (j = 0; j < data[i].tags.length; j++) {
				tagList.push(data[i].tags[j].name);
			}
			return tagList.toString();			
		}
	}	
	return '';
}

Order Tag


Note: The name of tag group will be use in the rule (I use “Choice Of” to find the match)

Actions:

1. Ask Question

2. Update Order

3. Tag Order

Rules:

1. Ask for portion


2. Ask for modifiers

The call function need 4 parameters {CALL:order.getOrderTag(PRODUCTNAME,PORTION,RETURN TYPE,KEYWORD)}
Most likely you will have to change only last parameter ‘KEYWORD’ to match the Orger Tag Group.

6 Likes

@GreatShakesBar, Hope it is still useful, It has been long time since you ask for it.
Just start getting in to GQL. It opens more possibilities.

3 Likes

Great stuff . This can be very useful

@sukasem help me i can config Popup portion but order tags it not Popup

This is not helping. Lack of info.

2 Likes

help me









1 Like

Did you map order tag to product?

in script, there is test button on lower right. Try manually type in getOrderTag('YOUR_PRODUCT','YOUR_PORTION','tags','Choice Of')
See what is return.

BTW, It required GraphQL. So, you have to get it working first. And IIRC, GraphQL need SQL Server Express

1 Like

I try it not work

oh I don have sql server Express thank you @sukasem

@sukasem, your script has a forum image embedded in it that needs to be removed.

1 Like

Lol where the heck it came from.

Hey there Awesome Tutorial, How Can I Install graphql in windows ?

It’s part of sambapos newer version 5.1.60 upwards I think it was.
You need to change message server port and auth config etc.
There is an extensive tutorial on setting up.

Thank You JTRech I tought i was doing something wrong, I was trying to make it work on 5.1.58 but never make it to pop up order tags

how can we select multiple order tags on the POP UP SCREEN.

Right now we can select only one and it closes automatically.

Also, can we add a close button to the POP UP ?

Yes you can add the “close button” . In your ask question rule, just put close=close in buttons and thats it.

As for multi selection on popup im not sure but you can always highlight the item and select other order tags.

For multiple select, highlight the item would be better. This is suitable for a mandatory selection. It could be done for sure with more complex JS script.

i am using Pop Up for Credit card payment.
By mistake if i select Credit Card it shows to enter Credit card Number and then Card Type, i am forced to enter number and card type , even though it was a cash payment.

so i need a back button or cancel button to go back to settle screen , instead of it forcing me to select additional information of that payment.