If you have plyr package then use this:
ddply(myvec,~name,summarise,number_of_distinct_orders=length(unique(order_no)))
else use data.table approach
library(data.table)
DT <- data.table(myvec)
DT[, .(number_of_distinct_orders = length(unique(order_no))), by = name]