| Conditions | 2 |
| Paths | 2 |
| Total Lines | 16 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function onBeforeWrite() { |
||
| 18 | parent::onBeforeWrite(); |
||
| 19 | |||
| 20 | // if Member data was imported from FoxyCart, PasswordEncryption will be set to 'none'. |
||
| 21 | // Change to sh1_v2.4 to ensure SilverStripe is using the same hash as FoxyCart API 1.1 |
||
| 22 | $this->owner->PasswordEncryption = 'sha1_v2.4'; |
||
| 23 | |||
| 24 | // Send updated customer data to Foxy Cart via API |
||
| 25 | $response = FoxyCart::putCustomer($this->owner); |
||
| 26 | |||
| 27 | // Grab customer_id record from FoxyCart response, store in Member |
||
| 28 | if($response){ |
||
| 29 | $foxyResponse = new SimpleXMLElement($response); |
||
| 30 | $this->owner->Customer_ID = (int) $foxyResponse->customer_id; |
||
| 31 | } |
||
| 32 | } |
||
| 33 | |||
| 34 | } |