Guest DSKMike Posted December 7, 2011 Share Posted December 7, 2011 I'm having an issue with Gift Certificates on the site: When a customer purchases a gift certificate, it defaults to a Coupon Code already in use, rendering it unusable. Example: Cust buys 100$ Gift Cert & receives it by email with Claim Code XMAS2011 which is assigned to a 13% discount Coupon Code. Is there a way for Gift Certificates to generate a unique claim code or to set a claim code manually for each individual certificate? Thanks, Mike Quote Link to comment Share on other sites More sharing options...
Guest Courty Posted December 8, 2011 Share Posted December 8, 2011 I'm having an issue with Gift Certificates on the site: When a customer purchases a gift certificate, it defaults to a Coupon Code already in use, rendering it unusable. Example: Cust buys 100$ Gift Cert & receives it by email with Claim Code XMAS2011 which is assigned to a 13% discount Coupon Code. Is there a way for Gift Certificates to generate a unique claim code or to set a claim code manually for each individual certificate? Thanks, Mike your right, its doesn't send the cert num in the email it sends the 1st coupon code it is generating the unique, mine was 514F-D6FF-9F5B-C813-5AF7 but that's not what's sent - Certs / coupons is VERY buggy and the guys have promised a proper fix in the next version (that say they said that for 5.0.5, lol Courty Quote Link to comment Share on other sites More sharing options...
Guest beautyie Posted February 7, 2012 Share Posted February 7, 2012 I'm using 5.0.5 and still have this issue, when will it be fixed Quote Link to comment Share on other sites More sharing options...
Toucan Web Design Posted February 8, 2012 Share Posted February 8, 2012 Hmm, the code for that section is a little odd, it's not actually confirming it's created the coupon properly, but I think I know why it's not working, it's always converting the coupon_id to 1 as it's being cast as a bool In classes/order.class.php FIND: private function _createCertificate($value, $blocks = 5, $bsize = 4, $glue = '-') { // Create Certificate Code $length = ($blocks*$bsize)+($blocks-1); $seed = hash('whirlpool', time().rand().microtime()); $code = ''; for ($i = 1; $i <= $length; ++$i) { $code .= ($i%($bsize+1)) ? substr($seed, rand(0, strlen($seed)-1), 1) : trim($glue); } $gc = $GLOBALS['config']->get('gift_certs'); ## Insert the Certificate Record $record = array( 'cart_order_id' => $this->_order_id, 'discount_price' => $value, 'code' => strtoupper($code), ); if (isset($gc['expires']) && (int)$gc['expires'] > 0) { $record['expires'] = date('Y-m-d', strtotime((int)$gc['expires'].' months')); } return (bool)$GLOBALS['db']->insert('CubeCart_coupons', $record); } And try just getting rid of the (bool) in the return, so: return $GLOBALS['db']->insert('CubeCart_coupons', $record); That should hopefully have it be returning and storing the id properly Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.