Add an item automatically to the ticket, when a primary item is selected.
Tag along items are items automatically added to the ticket when a primary item is selected. It can be a product, an additional charge or a special discount.
1. Add the below property for the product that needs tag-along item:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
    <entry key="tacode">123</entry>
</properties>
Administrator Menu > Maintenance > Resources
2. Enable the event ticket.change in the resource Ticket.Buttons
3. Create a new resource event.change and add the below code:
This code add tag along item to the ticket:
import com.posics.pos.ticket.TicketLineInfo;
index = sales.getSelectedIndex();
if (index >= 0) {  
    line = ticket.getLine(index);
    if(line.getProperty("tacode")!=null)
    {
        sales.addItemByQuantity(line.getProperty("tacode"),1);
        sales.setSelectedIndex(index + 1);
    }
}
Save & restart
 
								
Leave a Reply