Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class BoardOrderMultiForm extends MultiForm {
- protected static $start_step = 'BoardOrderAcceptTermsStep';
- public function finish($data, $form) {
- parent::finish($data, $form);
- $body = "<h1>Online Order</h1>";
- $steps = DataObject::get('MultiFormStep', "SessionID = {$this->session->ID}");
- if($steps) {
- foreach($steps as $step) {
- $data = $step->loadData();
- if($step->class == 'BoardOrderAcceptTermsStep') {
- $data = $step->loadData();
- if($data) {
- }
- }
- if($step->class == 'BoardOrderShaping1Step') {
- $data = $step->loadData();
- if($data) {
- $basic_type = $data['basic_type'];
- $body .= "<h2>Shaping 1</h2>";
- $body .= "<table style=\"width:500px;\"><tr>";
- $body .= "<th>Basic type</th><td>" . $data['basic_type'] . "</td>";
- $body .= "</tr><tr>";
- $body .= "<th>Length</th><td>" . $data['length'] . "</td>";
- $body .= "</tr><tr>";
- $body .= "<th>Width</th><td>" . $data['width'] . "</td>";
- $body .= "</tr><tr>";
- $body .= "<th>Thickness</th><td>" . $data['thickness'] . "</td>";
- $body .= "</tr></table>";
- }
- }
- if($step->class == 'BoardOrderShaping2Step') {
- $data = $step->loadData();
- if($data) {
- $body .= "<h2>Shaping 2</h2>";
- $body .= "<table><tr>";
- $body .= "<th>Rails type</th><td>" . $data['rails_type'] . "</td>";
- $body .= "</tr><tr>";
- $body .= "<th>Bottom shape</th><td>" . $data['bottom_shape'] . "</td>";
- $body .= "</tr><tr>";
- $body .= "<th>Bottom shape (other)</th><td>" . $data['bottom_shape_other'] . "</td>";
- $body .= "</tr><tr>";
- $body .= "<th>Tail shape</th><td>" . $data['tail_shape'] . "</td>";
- $body .= "</tr><tr>";
- $body .= "<th>Tail shape (other)</th><td>" . $data['tail_shape_other'] . "</td>";
- $body .= "</tr><tr>";
- $body .= "</dl>";
- }
- }
- if($step->class == 'BoardOrderFinal') {
- $data = $step->loadData();
- if($data) {
- }
- }
- Debug::show($step->loadData()); // Shows the step data (unserialized by loadData)
- }
- }
- // Get email address from page or send to admin
- $sendto = ($this->ContactEmail!='' ? $this->ContactEmail : Email::getAdminEmail());
- // Send email to Item Contact
- $email = new Email('blah@gmail.com', 'blah@gmail.com', "Website Order: " . $basic_type, $body);
- $email->send();
- //Director::redirect("orders");
- //$response = array("Success" => "Success");
- // Send email to User who enquired
- //$email = new Email('blah@gmail.com', $data['email'], 'Receipt of website enquiry from Chapman Surfboards: '.$data['Title'], "Thankyou for your enquiry.\n\n".$body);
- //$email->sendPlain();
- //$this->customise($response)->renderWith(array('Page', 'Page'));
- }
- }
- ?>
Add Comment
Please, Sign In to add comment