Jump to content

how the cart_order_id or CubeCart_order_sum table is generated


Guest marline

Recommended Posts

Does anybody know's how the cart_order_id in the CubeCart_order_sum table is generated? And/or how i can generate it myself?

The code for this is in;

/admin/sources/products/index.inc.php

(around line 204)

	## Generate product code

	if (empty($_POST['productCode'])) {

		$chars = array("A","B","C","D","E","F","G","H","I","J","K","L","M","N",

				"O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3",

				"4","5","6","7","8","9","0");

		$max_chars = count($chars) - 1;

		srand((double)microtime()*1000000);

		for ($i = 0; $i < 5; $i++) {

			$randChars = ($i == 0) ? $chars[rand(0, $max_chars)] : $randnum . $chars[rand(0, $max_chars)];

		}

		$record["productCode"] = $db->mySQLSafe(strtoupper(substr($_POST['name'],0,3)).$randChars.$_POST['cat_id']);

	} else {

		$record["productCode"] = $db->mySQLSafe($_POST['productCode']);	

	}

	

	$record["productCode"] = preg_replace("/[^a-z0-9-]/i","",$record["productCode"]);

Hope this helps!

Jason

Link to comment
Share on other sites

Does anybody know's how the cart_order_id in the CubeCart_order_sum table is generated? And/or how i can generate it myself?

In the CC version 3 file \includes\content\gateway.inc.php at around line 61, we find the Cart Order Id is the:

two-digit year, two-digit month, two-digit day, a dash, two-digit hour, two-digit minute, two-digit second, a dash, a random four-digit number between 1000 and 9999.

You can generate anything you want as no other feature or function of CC3 is based on any calculation performed on the Cart Order Id code (except list sorting).

On line 92, the cart_order_id is saved with every product sold (order_inv table), and in line 156, the cart_order_id is saved with the order summary (order_sum table).

The cart_order_id is also saved with the downloadable digital file database records.

Link to comment
Share on other sites

Guest marline

Does anybody know's how the cart_order_id in the CubeCart_order_sum table is generated? And/or how i can generate it myself?

In the CC version 3 file \includes\content\gateway.inc.php at around line 61, we find the Cart Order Id is the:

two-digit year, two-digit month, two-digit day, a dash, two-digit hour, two-digit minute, two-digit second, a dash, a random four-digit number between 1000 and 9999.

You can generate anything you want as no other feature or function of CC3 is based on any calculation performed on the Cart Order Id code (except list sorting).

On line 92, the cart_order_id is saved with every product sold (order_inv table), and in line 156, the cart_order_id is saved with the order summary (order_sum table).

The cart_order_id is also saved with the downloadable digital file database records.

Thanks, will give it a try!

Does anybody know's how the cart_order_id in the CubeCart_order_sum table is generated? And/or how i can generate it myself?

The code for this is in;

/admin/sources/products/index.inc.php

(around line 204)

	## Generate product code

	if (empty($_POST['productCode'])) {

		$chars = array("A","B","C","D","E","F","G","H","I","J","K","L","M","N",

				"O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3",

				"4","5","6","7","8","9","0");

		$max_chars = count($chars) - 1;

		srand((double)microtime()*1000000);

		for ($i = 0; $i < 5; $i++) {

			$randChars = ($i == 0) ? $chars[rand(0, $max_chars)] : $randnum . $chars[rand(0, $max_chars)];

		}

		$record["productCode"] = $db->mySQLSafe(strtoupper(substr($_POST['name'],0,3)).$randChars.$_POST['cat_id']);

	} else {

		$record["productCode"] = $db->mySQLSafe($_POST['productCode']);	

	}

	

	$record["productCode"] = preg_replace("/[^a-z0-9-]/i","",$record["productCode"]);

Hope this helps!

Jason

Thanks Jason, will have a look!

Link to comment
Share on other sites

Thanks Jason, will have a look!

Sorry -again, my mistake... My code snipped is the PRODUCT CODE. My excuse, I'd had a long day, a Party to DJ and was feeling ill (and still are!).

Brians post is correct.

Jason

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...