Again thank you very much for your suggestion. Finally, I could
figure it out with some improvement from your code in the while loop.
set subtotal [expr [lindex
[ec_lowest_price_and_price_name_for_an_item $product_id $user_id] 0]*
$quantity + $subtotal]
I replaced this part,[ec_lowest_price_and_price_name_for_an_item
$product_id $user_id], like this.
set subtotal [expr [lindex [ec_price_line $db_sub $product_id
$user_id $offer_code] 0]*$quantity + $subtotal]
Then it worked. Thanks a lot!