FANDOM


Upsell

UpSell Pop-Up Window


This script prompts the User to Upsell a product for another price - the example given here is "Make it a Large for £0.50"

When the User clicks an 'Upsell' product a popup is produced promting to Upsell a Large for extra 50p.




Add this to the Product Properties pageEdit

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">

<properties>
<entry key="Upsell">0.50</entry>
</properties>

Add this to the event.change scriptEdit

//upsell script
import com.openbravo.format.Formats;
import com.openbravo.pos.ticket.TicketLineInfo;
import com.openbravo.pos.ticket.TicketProductInfo;
index = sales.getSelectedIndex();

if (index >= 0) { 
	line = ticket.getLine(index); 
	if (line.getProperty("Upsell") != null){

		Object[] options = {"Upsell","No",};    
		value = (JOptionPane.showOptionDialog(null,
		"Make it a Large for £" + line.getProperty("Upsell") + "?",
		"Upsell!",
		JOptionPane.YES_NO_OPTION,
		JOptionPane.QUESTION_MESSAGE,
		null,
		options,
		options));
		if (value == JOptionPane.YES_OPTION){
			Double newPrice = new Double(line.getProperty("Upsell"));
			newname = "* make it a large";
				ticket.insertLine(ticket.getLinesCount(),
				new TicketLineInfo(
				line.getProductID(),
				newname,
				line.getProductTaxCategoryID(),
				line.getMultiply(),
				0,
				line.getTaxInfo()));

				sales.setSelectedIndex(ticket.getLinesCount()-1);
				index = sales.getSelectedIndex();
				line = ticket.getLine(index); 
				line.setPriceTax(newPrice);
				sales.setSelectedIndex(ticket.getLinesCount()-2);
				
		}
	}
}
//end of upsell

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.