mysql - magento table "sales_flat_order" field "protect_code" explanation -


we working on magento database , tables. magento seems write code in table sales_flat_order field protect_code define if there invoice or shipment done already. like

01b335 or
a0a243

but there no key understand protection code means. there explanation of meaning of these codes , how generated?

where generated?

if in app/code/core/mage/sales/model/order.php on around line 2052, find following:

$this->setdata('protect_code', substr(md5(uniqid(mt_rand(), true) . ':' . microtime(true)), 5, 6)); 

this protect_code generated order (using combination of md5, uniqid, , random integer.

what used for?

if in app/code/core/mage/sales/helper/guest.php , find loadvalidorder function. see protect_code used in areas ensure order being loaded correct 1 guest's cookie value.

it's used in other areas, such tracking information comparisons. can see several instances of getprotectcode() method being called in shipment models compare order tracking information. example of function uses is:

public function gettrackinginfobytrackid() {     $track = mage::getmodel('sales/order_shipment_track')->load($this->gettrackid());     if ($track->getid() && $this->getprotectcode() == $track->getprotectcode()) {         $this->_trackinginfo = array(array($track->getnumberdetail()));     }     return $this->_trackinginfo; } 

as can see $this->getprotectcode() == $track->getprotectcode(), tracking protect_code must match shipment protect_code.


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -