How-To

Extras starting from non-zero

ABPro 2.0.3

Objective: In ABPro the Extras dropdown lists start a 0 to support the customer's ability to select 0 or none. This How-To will show how to change that so you can hard code a minimum or starting value for the dropdown lists.

#EDIT#
This is a configurable setting starting with ABPro 3.0.3
 

Edit file:
\components\com_rsappt_pro2\getSlots.php

 

Option 1 - set ALL Extras to start at some value other than 0. 

Around line 512 look for:

for($i=0; $i<=$extras_row->max_quantity; $i++){
    $out .= "<option value=".$i.($i==$extras_row->default_quantity?" selected":"").">".$i."</option>\n"; 
}

 

Change the loop start as required:

for($i=5; $i<=$extras_row->max_quantity; $i++){
    $out .= "<option value=".$i.($i==$extras_row->default_quantity?" selected":"").">".$i."</option>\n"; 
}

 

Setting to 5 will mean the least the customer can pick is 5.

 

 

Option 2 - set start number for a specific Extra only

Around line 512 look for:

for($i=0; $i<=$extras_row->max_quantity; $i++){
    $out .= "<option value=".$i.($i==$extras_row->default_quantity?" selected":"").">".$i."</option>\n"; 
}

 

Create a variable for the loop starting value. 
Set it to 0 except for the specific Extra you want different. You will need to hard code the id of the Extra you want different.

$loopstart = 0;
if($extras_row->id_extras == 123){
    $loopstart = 5;
}
for($i=$loopstart; $i<=$extras_row->max_quantity; $i++){
    $out .= "<option value=".$i.($i==$extras_row->default_quantity?" selected":"").">".$i."</option>\n"; 
}

The above example sets that start to 5 only for Extra ID 123

Note: The value you set for $loopstart must be less than you have set as the 'Maximum Number' for the Extra in the Extras setup screen.