1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
<?php
class ProductQuestionController extends HttpViewController
{
public function actionDefault()
{
$productQuestion = $this->_getView();
$response = [
'success' => true,
'content' => $productQuestion->get_html()
];
return MainFactory::create('JsonHttpControllerResponse', $response);
}
public function actionSend()
{
$productQuestion = $this->_getView();
$productQuestion->setPost($_POST);
$productQuestion->setName($_POST['name']);
$productQuestion->setEmail($_POST['email']);
$productQuestion->setMessage($_POST['message']);
$response = [
'success' => true,
'content' => $productQuestion->get_html()
];
return MainFactory::create('JsonHttpControllerResponse', $response);
}
protected function _getView()
{
$captcha = MainFactory::create_object('Captcha');
$productQuestion = MainFactory::create_object('TellAFriendContentView');
$productQuestion->set_content_template('module/product_question.html');
$productQuestion->set_flat_assigns(false);
$productQuestion->setProductsId((int)$_GET['productId']);
$productQuestion->setCaptchaObject($_SESSION['captcha_object'] = &$captcha);
$productQuestion->setCustomerId((int)$_SESSION['customer_id']);
$productQuestion->setCustomerFirstName($_SESSION['customer_first_name']);
$productQuestion->setCustomerLastName($_SESSION['customer_last_name']);
$productQuestion->setLanguagesId((int)$_SESSION['languages_id']);
return $productQuestion;
}
}