You are here:  » Search voucher for same code

Search voucher for same code

Submitted by sirmanu on Fri, 2018-06-22 10:29 in

Hi David.

I have a mercahtn which have two vouchers code actived, however, the are the same with the only different of the min_price (match_value and match_type is the same)
So, when I search for that /search.php?q=voucher:{merchant}:{code}, only the first one is picked as we are taking $voucher = $vouchers[0]; in search.php

Is any way I can "merge" both vouchers? Maybe when code is the same, order by min_price?

Thanks in advance!

Submitted by support on Fri, 2018-06-22 11:17


To merge by min_price at search time - edit search.php and look for the following code at line 179:

          $voucher = $vouchers[0];

...and REPLACE with:

          $voucher = $vouchers[0];
          if (count($vouchers > 1))
            foreach($vouchers as $v)
              if ($v["min_price"] < $voucher["min_price"])
                $voucher["min_price"] = $v["min_price"];

Hope this helps!


Submitted by sirmanu on Sat, 2018-06-23 09:10

Thank you, I love it, just a minor change and it works as expected.