Question

How to edit Order product selection page?

Hi,

I have to add a required field (school year) to the Order selection product page (see pic).

I added it to the detail but it doesn't affect that page.

I see Select fields to display on the page but when I add the field it is not being editable, and also, I can't make it required.

Thanks!

 

Like 0

Like

2 comments

Hello,

 

You can replace ProductSelectionSchema and saveSelectedProducts in particular. Here is the example of logic that prompts notification if Price field is not filled in or equals to 0. 

 

define("ProductSelectionSchema", ["....],
	function(...ProcessModuleUtilities) {
....
....
....
saveSelectedProducts: function() {
					if (this.get("NeedRecalc") === true) {
						this.set("NeedSave", true);
						return;
					}
					this.showBodyMask({timeout: 0});
					var selectedProducts = this.getBasketData();
					if (this.Ext.isEmpty(this.get("MasterEntitySchemaName")) ||
						this.Ext.isEmpty(this.get("MasterRecordId")) ||
						(selectedProducts.getCount() < 1)) {
						this.afterSave();
						return;
					} else if (selectedProducts.getCount() >= 1 && selectedProducts.collection.items[0].$Price==0 || 
							   selectedProducts.collection.items[0].$Price==null || selectedProducts.collection.items[0].$Price==undefined){
						var buttonYes = Terrasoft.MessageBoxButtons.YES;
							buttonYes.caption="OK";
						this.showConfirmationDialog("The price column is not filled in!", function(result){
							if (result==Terrasoft.MessageBoxButtons.YES.returnCode){
								this.hideBodyMask();
								return;
							}
						},[buttonYes.returnCode]);
					} else {
					var batchQuery = this.Ext.create("Terrasoft.BatchQuery");
					var rootSchemaName = this.getMasterEntityProductSchemaName();
					selectedProducts.each(function(item) {
						this._processItemToSave(batchQuery, rootSchemaName, item);
					}, this);
					batchQuery.execute(this.afterSave, this);
					}
				},

Note, it is necessary to indicate ProcessModuleUtilities in the list of functions

 

Here is the result:

 

Note 2. This logic works perfectly if you have 1 product. If you have more products, it is necessary to extend else if condition since the example of the code above works for the 1st raw of the products list.

 

Regards,

Dean

dean parrett,

thanks, will try.

Show all comments