Jump to content

Gift Certificates


Guest DSKMike

Recommended Posts

Guest DSKMike

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 1 month later...

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...