Yes, this is how it works. If A is product 10 and B is product 20, and you do

$this->add_prod_to_prod(10, 20, "%", 50);

You only get 50% off every product 20 for every product 10 you buy.