{"id":15351,"date":"2018-07-13T08:27:13","date_gmt":"2018-07-13T08:27:13","guid":{"rendered":"https:\/\/kb.sambapos.com\/?p=15351"},"modified":"2018-10-31T14:44:05","modified_gmt":"2018-10-31T14:44:05","slug":"4-19-how-to-select-portions-and-order-tags-by-popup","status":"publish","type":"post","link":"https:\/\/kb.sambapos.com\/en\/4-19-how-to-select-portions-and-order-tags-by-popup\/","title":{"rendered":"4.19. How to Select Portions and Order Tags By Popup?"},"content":{"rendered":"<p>In this document, it will be explained how to select\u00a0<strong>Portions<\/strong>\u00a0and <strong>Order Tags<\/strong>\u00a0from a\u00a0<strong>Popup Screen. <\/strong><\/p>\n<p>This example, doesn&#8217;t allow you to make multiple selections at the same time from the Popup Screen. If you want to select multiple features, then, click on that product and make the selection from the right side of the screen.<\/p>\n<p><span style=\"font-size: 14pt;\"><strong>Requirements;<\/strong><\/span><\/p>\n<ul>\n<li>Version 5.1+<\/li>\n<li>SQL Server Express<\/li>\n<li>GraphQL &#8211; make sure you can access to http:\/\/your_server_name_or_ip_or_localhost:9000<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><span style=\"font-size: 14pt;\"><strong>How it works;<\/strong><\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-15364\" src=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Order_.Tag_.Popup_.gif\" alt=\"\" width=\"640\" height=\"333\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-size: 14pt;\"><strong>1. Adding Script<\/strong><\/span><\/p>\n<p>Go to <strong>Main Menu &gt; Manage &gt; Automation Commands &gt; Scripts &gt;<\/strong> in here click on <strong>Add Script<\/strong> link.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-15372 size-large\" src=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-01-1-1024x576.jpg\" alt=\"\" width=\"640\" height=\"360\" srcset=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-01-1-1024x576.jpg 1024w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-01-1-300x169.jpg 300w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-01-1-768x432.jpg 768w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-01-1.jpg 1366w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p><strong>Name:<\/strong> Order Modifiers<\/p>\n<p><strong>Handler:<\/strong> order<\/p>\n<p><strong>Script:<\/strong> Copy below code group and paste it into script field.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<table style=\"height: 453px; border-color: #dedede; background-color: #dedede; width: 827px;\">\n<tbody>\n<tr>\n<td style=\"width: 821px;\"><code>function\u00a0getOrderTag(product,portion,returnType,key) {<\/code><\/p>\n<p><code>var\u00a0qs =\u00a0'{getOrderTagGroups(productName:\"'\u00a0+ product +\u00a0'\",portion:\"'\u00a0+ portion +\u00a0'\"){name,min,max,tags{name}}}';<\/code><\/p>\n<p><code>var\u00a0data = JSON.parse(gql.Exec(qs));<\/code><\/p>\n<p><code>data = data.data.getOrderTagGroups;<\/code><\/p>\n<p><code>key = key.toLowerCase();<\/code><\/p>\n<p><code>for\u00a0(i =\u00a00; i &lt; data.length; i++)<\/code><\/p>\n<p><code>{\u00a0if\u00a0(data[i].name.toLowerCase().indexOf(key) &gt; -1) {\u00a0if\u00a0(returnType ==\u00a0'name') {\u00a0return\u00a0data[i].name; }\u00a0var\u00a0tagList=[];<\/code><\/p>\n<p><code>for\u00a0(j =\u00a00; j &lt; data[i].tags.length; j++) { tagList.push(data[i].tags[j].name); }\u00a0return\u00a0tagList.toString(); } }\u00a0return\u00a0''; }<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>After completing necessary editings, click on <strong>Save<\/strong> button.<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-size: 14pt;\"><strong>2. Adding Order Tag<\/strong><\/span><\/p>\n<p>Go to Main Menu &gt; Manage &gt; Tickets &gt; Order Tags &gt; in here <strong>Add Order Tag<\/strong> link.<\/p>\n<p><strong>General Settings Section;<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-15369 size-large\" src=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-02-1024x576.jpg\" alt=\"\" width=\"640\" height=\"360\" srcset=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-02-1024x576.jpg 1024w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-02-300x169.jpg 300w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-02-768x432.jpg 768w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-02.jpg 1366w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Name:<\/strong> Choice of Sauces and Spices<\/p>\n<p><strong>Min Selected Items:<\/strong> 1 (It forces you to select at least 1 feature)<\/p>\n<p><strong>Max Selected Items:<\/strong> 0 (You can restrict max selection by typing any number here, if you write 0, you can select as much as you want.)<\/p>\n<p><strong>Add Tag Price To Order Price:<\/strong> Select this box if you want to add order tag&#8217;s price to order&#8217;s price.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Order Tag List Section;<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-15374 size-large\" src=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-03-1024x576.jpg\" alt=\"\" width=\"640\" height=\"360\" srcset=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-03-1024x576.jpg 1024w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-03-300x169.jpg 300w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-03-768x432.jpg 768w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-03.jpg 1366w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>Add as many order tag as you need by clicking on <strong>Add Order Tag<\/strong> link.<\/p>\n<p><strong><span style=\"font-size: 14pt;\">Important Note:<\/span> <\/strong><\/p>\n<p>The name of tag group will be used in the rule\u00a0to find the match (In the example \u201c<strong>Choice Of<\/strong>\u201d)<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Mappings Section;<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-15378 size-large\" src=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-04-1-1024x576.jpg\" alt=\"\" width=\"640\" height=\"360\" srcset=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-04-1-1024x576.jpg 1024w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-04-1-300x169.jpg 300w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-04-1-768x432.jpg 768w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-04-1.jpg 1366w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>Add a row by clicking o<strong> Add<\/strong> link and select the <strong>Product Group<\/strong> that you want to use <strong>Order Tags. <\/strong>In the example product group is selected as<strong> Salads.<\/strong><\/p>\n<p>After completing necessary editings, click on <strong>Save<\/strong> button.<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-size: 14pt;\"><strong>3. Adding Actions<\/strong><\/span><\/p>\n<p><strong>3.1. Order Modifier-Ask Question Action<\/strong><\/p>\n<p>Go to <strong>Main Menu &gt; Manage &gt; Automation &gt; Actions &gt;\u00a0<\/strong>in here click on <strong>Add Action<\/strong> link.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-15380 size-large\" src=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-05-1024x576.jpg\" alt=\"\" width=\"640\" height=\"360\" srcset=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-05-1024x576.jpg 1024w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-05-300x169.jpg 300w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-05-768x432.jpg 768w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-05.jpg 1366w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p><strong>Action Name:<\/strong>\u00a0OM-Order Modifier-Ask Question<\/p>\n<p><strong>Action Type:<\/strong> Ask Question<\/p>\n<p><strong>Parameters:<\/strong><\/p>\n<p><strong>Question:<\/strong> [:Question]<\/p>\n<p><strong>Buttons:<\/strong> [:Buttons]<\/p>\n<p><strong>Description:<\/strong> [:Description]<\/p>\n<p><strong>Automation Command Name:<\/strong> [:Command Name]<\/p>\n<p><strong>Execute Command In Background:<\/strong> [:Exec in Background]<\/p>\n<p><strong>Background Color:<\/strong> [:Color]<\/p>\n<p><strong>Transparent Color:<\/strong> [:Transparent Color]<\/p>\n<p>After completing necessary editings, click on <strong>Save<\/strong> button.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>3.2.\u00a0Order Modifier-Update Order Action<\/strong><\/p>\n<p>Go to <strong>Main Menu &gt; Manage &gt; Automation &gt; Actions &gt;\u00a0<\/strong>in here click on <strong>Add Action<\/strong> link.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-15382 size-large\" src=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-06-1024x576.jpg\" alt=\"\" width=\"640\" height=\"360\" srcset=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-06-1024x576.jpg 1024w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-06-300x169.jpg 300w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-06-768x432.jpg 768w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-06.jpg 1366w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p><strong>Action Name:<\/strong> OM-Order Modifier-Update Order<\/p>\n<p><strong>Action Type:<\/strong> Update Order<\/p>\n<p><strong>Parameters:<\/strong><\/p>\n<p><strong>Name:\u00a0<\/strong>[:Name]<\/p>\n<p><strong>Quantity:<\/strong> [:Quantity]<\/p>\n<p><strong>Price: <\/strong>[:Price]<\/p>\n<p><strong>Portion Name: <\/strong>[:Portion Name]<\/p>\n<p><strong>Price Tag: <\/strong>[:Price Tag]<\/p>\n<p><strong>Increase Inventory: <\/strong>[:Increase Inventory]<\/p>\n<p><strong>Decrease Inventory: <\/strong>[:Decrease Inventory]<\/p>\n<p><strong>Calculate Price: <\/strong>[:Calculate Price]<\/p>\n<p><strong>Locked: <\/strong>[:Locked]<\/p>\n<p><strong>Disable Portion Selection: <\/strong>[:Disable Portion Selection]<strong><br \/>\n<\/strong><\/p>\n<p><strong>Tax Template: <\/strong>[:Tax Template]<\/p>\n<p><strong>Account Transaction Type: <\/strong>[:Account Transaction Type]<\/p>\n<p><strong>Warehouse: <\/strong>[:Warehouse]<\/p>\n<p><strong>Update All Orders: <\/strong>[:Update All Orders]<\/p>\n<p>After completing necessary editings, click on <strong>Save<\/strong> button.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>3.3.\u00a0Order Modifier-Tag Order Action<\/strong><\/p>\n<p>Go to <strong>Main Menu &gt; Manage &gt; Automation &gt; Actions &gt;\u00a0<\/strong>in here click on <strong>Add Action<\/strong> link.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-15384 size-large\" src=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-07-1024x576.jpg\" alt=\"\" width=\"640\" height=\"360\" srcset=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-07-1024x576.jpg 1024w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-07-300x169.jpg 300w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-07-768x432.jpg 768w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-07.jpg 1366w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p><strong>Action Name:<\/strong> OM-Order Modifier-Tag Order<\/p>\n<p><strong>Action Type:<\/strong>\u00a0Tag Order<\/p>\n<p><strong>Parameters:<\/strong><\/p>\n<p><strong>Order Tag Name:<\/strong> [:Tag Name]<\/p>\n<p><strong>Order Tag Value:<\/strong> [:Tag Value]<\/p>\n<p>After completing necessary editings, click on <strong>Save<\/strong> button.<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-size: 14pt;\"><strong>4. Adding Rules<\/strong><\/span><\/p>\n<p><strong>4.1.\u00a0Order Modifier-Ask For Portion Rule<\/strong><\/p>\n<p>Go to <strong>Main Menu &gt; Manage &gt; Automation &gt; Rules &gt;<\/strong> in here click on <strong>Add Rule<\/strong> link.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-15386 size-large\" src=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-08-1024x576.jpg\" alt=\"\" width=\"640\" height=\"360\" srcset=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-08-1024x576.jpg 1024w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-08-300x169.jpg 300w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-08-768x432.jpg 768w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-08.jpg 1366w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p><strong>Rule Name:<\/strong>\u00a0OM-Order Modifier-Ask For Portion<\/p>\n<p><strong>Event Name:<\/strong> Order Added to Ticket<\/p>\n<p><strong>Execute Rule If:<\/strong> Matches<\/p>\n<p><strong>Add Custom Constraints:<\/strong><\/p>\n<p>{PORTION COUNT} | Greater | 1<\/p>\n<p><strong>Select Actions:<\/strong><\/p>\n<p><strong>Action 1:\u00a0OM-Order Modifier-Ask Question<\/strong><\/p>\n<p><strong>Question:<\/strong> Please Select a Portion<\/p>\n<p><strong>Buttons:<\/strong> {PORTION BUTTONS}<\/p>\n<p><strong>Command Name:<\/strong> none<\/p>\n<p><strong>Color:<\/strong> Firebrick<\/p>\n<p><strong>Action 2:\u00a0OM-Order Modifier-Update Order<\/strong><\/p>\n<p><strong>Name:<\/strong>\u00a0[:MenuItemName]<\/p>\n<p><strong>Portion Name:\u00a0<\/strong>[:CommandValue]<\/p>\n<p><strong>Update All Orders:<\/strong> False<\/p>\n<p>After completing necessary editings, click on <strong>Save<\/strong> button.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>4.2.\u00a0Ask for Modifiers Rule<\/strong><\/p>\n<p>Go to <strong>Main Menu &gt; Manage &gt; Automation &gt; Rules &gt;<\/strong> in here click on <strong>Add Rule<\/strong> link.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-15391 size-large\" src=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-09-1-1024x576.jpg\" alt=\"\" width=\"640\" height=\"360\" srcset=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-09-1-1024x576.jpg 1024w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-09-1-300x169.jpg 300w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-09-1-768x432.jpg 768w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/07\/Portion.Tags_.Popup-09-1.jpg 1366w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p><strong>Rule Name:<\/strong> OM-Order Modifier-Ask for Modifiers<\/p>\n<p><strong>Event Name:<\/strong> Order Added to Ticket<\/p>\n<p><strong>Execute Rule If:<\/strong> Matches<\/p>\n<p><strong>Select Actions:<\/strong><\/p>\n<p><strong>Action 1:<\/strong> <strong>OM-Order Modifier-Ask Question<\/strong><\/p>\n<p><strong>Question:<\/strong>\u00a0<code>{CALL:order.getOrderTag('[:MenuItemName]','{PORTION}','name','Choice Of')}<\/code><\/p>\n<p><strong>Buttons:<\/strong>\u00a0<code>{CALL:order.getOrderTag('[:MenuItemName]','{PORTION}','tag','Choice Of')}<\/code><\/p>\n<p><strong>Command Name:<\/strong> none<\/p>\n<p><strong>Color:<\/strong> Firebrick<\/p>\n<p><strong>Action 2: OM-Order Modifier-Tag Order<\/strong><\/p>\n<p><strong>Tag Name:<\/strong>\u00a0<code>{CALL:order.getOrderTag('[:MenuItemName]','{PORTION}','name','Choice Of')}<\/code><\/p>\n<p><strong>Tag Value:<\/strong> [:CommandValue]<\/p>\n<p>After completing necessary editings, click on <strong>Save<\/strong> button.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this document, it will be explained how to select\u00a0Portions\u00a0and Order Tags\u00a0from a\u00a0Popup Screen. This example, doesn&#8217;t allow you to make multiple selections at the same time from the Popup Screen. If you want to select multiple features, then, click on that product and make the selection from the right side of the screen. Requirements; [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-15351","post","type-post","status-publish","format-standard","hentry","category-customization"],"_links":{"self":[{"href":"https:\/\/kb.sambapos.com\/en\/wp-json\/wp\/v2\/posts\/15351","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kb.sambapos.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kb.sambapos.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kb.sambapos.com\/en\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/kb.sambapos.com\/en\/wp-json\/wp\/v2\/comments?post=15351"}],"version-history":[{"count":9,"href":"https:\/\/kb.sambapos.com\/en\/wp-json\/wp\/v2\/posts\/15351\/revisions"}],"predecessor-version":[{"id":16712,"href":"https:\/\/kb.sambapos.com\/en\/wp-json\/wp\/v2\/posts\/15351\/revisions\/16712"}],"wp:attachment":[{"href":"https:\/\/kb.sambapos.com\/en\/wp-json\/wp\/v2\/media?parent=15351"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kb.sambapos.com\/en\/wp-json\/wp\/v2\/categories?post=15351"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kb.sambapos.com\/en\/wp-json\/wp\/v2\/tags?post=15351"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}