How to count number of unique item options in cart?
Shopping cart is working as required but I need a tweak.
I have a user modifiable text box for selecting an option in ecart. I need to be able to count these items to determine the charges to be applied, I can count the total number but but not the number of unique option values. tried code below but it only gives the count of all options, not the count of unique entries. Any suggestions as I have tried a range of ideas but could do with some inspiration?
'rider' is the unique text field. 'ur2' was an attempt to filter out duplicate rider entries with 'riders' being the final count of unique enties but the filtereing is not working and it counts duplicates as new items.
$itmObj->uniquerider = array($itmObj->rider);//t
$itmObj->ur2 = array_unique($itmObj->uniquerider);//t
$itmObj->riders = count($itmObj->ur2);//n
return $itmObj;
}