View Categories

Dynamic item pricing based on auxiliary item

< 1 min read

This script can be used to set item options during sales. It also sets the item price based on the chosen option.

Watch below video on how to do this:
https://youtu.be/f9BFX2kIveQ

Administrator Menu > Maintenance > Resources
Use the below code in product properties:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<entry key="SMALL">0</entry>
<entry key="MEDIUM">2</entry>
<entry key="LARGE">4</entry>
</properties>

Use the below clode in event.addline:

if (line.isProductCom() && ticket.getLinesCount() > 0) 
{
    if(ticket.getLine(index).getProperty(line.printName())!=null)
    {
        ticket.getLine(index).setSalePrice(ticket.getLine(index).getSalePrice() +
        ticket.parseDouble(ticket.getLine(index).getProperty(line.printName())));
    }
    ticket.getLine(index).setProperty("product.name", ticket.getLine(index).getProductName() + " " + line.printName());
    return "Cancel";
}

Save

0 Comments

Leave a Reply

Arrow-up