Zen Follower
- Join Date:
- Nov 2004
- Posts:
- 355
- Plugin Contributions:
- 0
Your Store Gift Cards (plastic, etc) - not working yet?
kwright:
Greetings,
Hopefully folks are still watching this thread!Successfully installed on 1.5.4 (localhost) using default settings. After running some test orders, I don't see the gift card numbers, masked or unmasked, on the checkout page or admin order invoice as described in the giftcard_README.txt.
4. Allows for masking of numbers on checkout pages and invoices 5. Allows for displaying any number of digits (not just 4) in masksDoes anyone know if this part is working?
Thanks :D
OK, answering my own question!
Yes, it's broke. If you use spaces between the card numbers as mention under the gift card section on the payment page (Hyphens or spaces optional), it breaks the card number masking code and nothing will displayed.
Here's the fix:
FIND IN includes/modules/order_total/ot_giftcard.php
$pattern = '/^([0-9,a-z,A-Z- ]+)([0-9,a-z,A-Z-]{'.$this->mask_reveal.'})$/';
REPLACE WITH (add a space after the second Z-)
$pattern = '/^([0-9,a-z,A-Z- ]+)([0-9,a-z,A-Z- ]{'.$this->mask_reveal.'})$/';
Here's another tip. By default, the code will mask the first digits. If you would rather mask the last digits (our gift cards have cvv numbers as the last digits), make the following code changes.
FIND IN includes/modules/order_total/ot_giftcard.php
$newformat = preg_replace('([0-9,a-z,A-Z])', $this->mask_char, $matches[1]).$matches[2];
REPLACE WITH
$newformat = $matches[1].preg_replace('([0-9,a-z,A-Z])', $this->mask_char, $matches[2]);
That's all for now! :D