public function actionView($productId)
 {
     $categories = array();
     $categories = Platform::getPlatformList();
     $product = Products::getProductById($productId);
     $productId = $product['id'];
     $platform = Platform::getPlatformById($product['platform_id']);
     $comments = Comment::getCommentsByProductId($productId);
     //COMMENTS
     if (isset($_POST['submit'])) {
         $userComment = $_POST['message'];
         $errors = false;
         if (!Comment::validateMessage($userComment)) {
             $errors[] = "Введите собщение";
         }
         if (User::isGuest()) {
             $userName = $_POST['name'];
             $userEmail = $_POST['email'];
             if (!User::validateUsername($userName)) {
                 $errors[] = "Неверное имя";
             }
             if (!User::validateEmail($userEmail)) {
                 $errors[] = "Неверный Email";
             }
             $userId = false;
         } else {
             $userId = User::validateLogged();
             $user = User::getUserById($userId);
             $userName = $user['name'];
         }
         Comment::addComment($userComment, $userId, $userName, $productId);
     }
     require_once ROOT . '/views/product/view.php';
     return true;
 }
Пример #2
0
 public function getResult()
 {
     // Date in the past
     header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
     // always modified
     header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
     // HTTP/1.1
     header("Cache-Control: no-store, no-cache, must-revalidate");
     header("Cache-Control: post-check=0, pre-check=0", false);
     // HTTP/1.0
     header("Pragma: no-cache");
     if (isset($_POST['process'])) {
     } else {
         $products = new Products();
         $this->licenseData['prices2'] = $this->licenseData['prices'];
         $this->licenseData['prices'] = json_encode($this->licenseData['prices']);
         $this->licenseData['licenses'] = json_encode($this->licenseData['lic']);
         $this->licenseData['bundle_prices'] = json_encode(isset($this->licenseData['bundle_prices']) ? $this->licenseData['bundle_prices'] : NULL);
         $this->licenseData['bundle_product_prices'] = json_encode(isset($this->licenseData['bundle_product_prices']) ? $this->licenseData['bundle_product_prices'] : NULL);
         $this->licenseData['offer_prices'] = json_encode($this->licenseData['offer_prices']);
         //	    $this->licenseData['geo_currency'] = json_encode($this->licenseData['geo_currency']);
         $this->licenseData['products'] = $products->getProductsShort(TRUE, FALSE, 3);
         $this->licenseData['product_versions'] = $products->getProductMajorVersions($this->productId);
         $this->licenseData['product'] = $products->getProductById($this->productId);
         $this->licenseData['currencies'] = json_encode($this->licenseData['currencies']);
         return $this->licenseData;
     }
 }
 public function actionUpdate($id)
 {
     self::validateAdmin();
     $platformList = Platform::getPlatformListByAdmin();
     $genreList = Genre::getGenresListByAdmin();
     $product = Products::getProductById($id);
     if (isset($_POST['submit'])) {
         $option['code'] = $_POST['code'];
         $option['name'] = $_POST['name'];
         $option['price'] = $_POST['price'];
         $option['platform_id'] = $_POST['platform_id'];
         $option['genre_id'] = $_POST['genre_id'];
         $option['brand'] = $_POST['brand'];
         $option['description'] = $_POST['description'];
         $option['availability'] = $_POST['availability'];
         $option['is_recomend'] = $_POST['is_recomend'];
         $option['is_new'] = $_POST['is_new'];
         $option['status'] = $_POST['status'];
         $errors = false;
         if (!isset($option['name']) || empty($option['name'])) {
             $errors[] = "Введите имя товара";
         }
         if ($errors == false) {
             Products::updateProduct($id, $option);
             if ($id) {
                 if (is_uploaded_file($_FILES['image']['tmp_name'])) {
                     move_uploaded_file($_FILES['image']['tmp_name'], $_SERVER["DOCUMENT_ROOT"] . "/upload/images/products/(" . $id . ").png");
                 }
             }
         }
         header("Location: /evkazolinAdminka/product/");
     }
     require_once ROOT . '/views/admin_product/update.php';
     return true;
 }
Пример #4
0
 private function registrationProblemsForm()
 {
     $form = new Form();
     if ($form->ParseSettings('registrationProblemsForm.ini')) {
         $this->formData = $form->BuildFormFields($_POST);
         if (empty($this->formData['error'])) {
             include_once ENGINE_PATH . 'class/classProducts.php';
             $products = new Products();
             $product = $products->getProductById($_POST['product']);
             $form->setEmail(isset($_POST['to_email']) ? $_POST['to_email'] : '');
             $msg = 'Contact request from ' . $_SERVER['HTTP_HOST'] . "\n\n" . 'Product: ' . $product['p_title'] . "\n" . $form->__toString();
             $form->SendMail('Registration problems [' . $product['p_title'] . ']', $msg, $this->formData['fields']['name'], $this->formData['fields']['email']);
         }
     }
 }
Пример #5
0
<?php

require_once '../model/products/Products.php';
$productMaster = new Products();
$peticion = json_decode(filter_input(INPUT_POST, 'peticion'));
$carProducts = $peticion->data;
$totalOrder = 0;
$response = array();
for ($i = 0; $i < count($carProducts); $i++) {
    if ($carProducts[$i] != 0) {
        //var_dump($carProducts[$i]);
        $product = $productMaster->getProductById($carProducts[$i]);
        $obj = new stdClass();
        $obj->id = $product->getIdProducto();
        $obj->nombre = $product->getNombre();
        $obj->descripcion = $product->getDescripcion();
        $obj->precio = $product->getPrecio();
        $obj->imagen = $product->getNombreImagen();
        $obj->referencia = $product->getReferencia();
        $obj->unidad_venta = $product->getUnidadVenta();
        $obj->categoria = $product->getCategoria();
        $obj->precio_total = $product->getPrecio();
        $obj->cant = 1;
        $response[] = $obj;
    }
}
//var_dump($response);
die(json_encode($response));
Пример #6
0
 private function sendForm($ini, $subject = null)
 {
     if (!substr_count($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])) {
         return false;
     }
     $form = new Form();
     if ($form->ParseSettings($ini)) {
         $this->formData = $form->BuildFormFields($_POST);
         if (empty($this->formData['error'])) {
             if (isset($_POST['emails'])) {
                 if ($mSettings = $form->getmSettings()) {
                     foreach ($mSettings as $key => $val) {
                         if (1 == substr_count($key, 'mail')) {
                             $form->delmSettings($key);
                         }
                     }
                 }
                 $form->setmSettings(array('emails' => $_POST['emails']));
             }
             $subject = isset($subject) ? $subject : 'Request';
             if (!empty($_POST['product']) && is_numeric($_POST['product'])) {
                 $products = new Products();
                 $product = $products->getProductById($_POST['product']);
                 $subject .= ' [' . $product['p_title'] . ']';
             } elseif (!empty($_POST['product']) && is_string($_POST['product'])) {
                 $subject .= ' [' . $_POST['product'] . ']';
                 $product = null;
             }
             $subject = isset($_POST['subject']) ? $_POST['subject'] : $subject;
             $msg = $subject . ' from ' . $_SERVER['HTTP_REFERER'] . "\n\n" . (isset($product) ? 'Product: ' . $product['p_title'] . "\n" : '') . $form->__toString();
             if (isset($this->formData['AttachFile'])) {
                 $filePath = $this->formData['AttachFile']['filepath'];
                 $fileName = $this->formData['AttachFile']['filename'];
             } else {
                 $filePath = '';
                 $fileName = '';
             }
             if (!empty($_POST['subscribe']) && !empty($_POST['email']) && !empty($_POST['product'])) {
                 $table_name = 'discount_subscribe';
                 $name = isset($_POST['name']) ? $_POST['name'] : '';
                 $q = sprintf("INSERT IGNORE INTO %s.%s (email, product_id, name, date) values('%s',%d, '%s', '%s')", VBox::get('ConstData')->getConst('langsDb'), $table_name, $_POST['email'], $_POST['product'], $name, date('Y-m-d'));
                 DB::executeAlter($q, 'reg');
             }
             if (!empty($_POST['notify']) && !empty($_POST['email']) && !empty($_POST['product'])) {
                 $table_name = 'notify_users';
                 $q = 'SELECT * FROM ' . VBox::get('ConstData')->getConst('langsDb') . '.' . $table_name . ' WHERE nu_product_id = ? AND nu_email = ? LIMIT 1';
                 if (!DB::executeQuery($q, 'selectNotifyUser', array($_POST['product'], trim($_POST['email'])))) {
                     $q = sprintf("INSERT IGNORE INTO %s.%s (nu_email, nu_product_id, nu_name, nu_date) values('%s',%d, '%s', '%s')", VBox::get('ConstData')->getConst('langsDb'), $table_name, trim($_POST['email']), $_POST['product'], $_POST['name'], date('Y-m-d h:i:s', time()));
                     DB::executeAlter($q, 'reg');
                 }
             }
             if (isset($_POST['mail_body'])) {
                 $mail_body = nl2br($_POST['mail_body']);
                 $reply_to = isset($_POST['reply_to']) ? $_POST['reply_to'] : '*****@*****.**';
                 include_once ENGINE_PATH . 'class/classEmailReporter.php';
                 $reporter = new EmailReporter();
                 $reporter->setBody($mail_body);
                 $reporter->send($this->formData['fields']['email'], array($reply_to => 'NetSpot'), $subject);
             }
             if (!empty($_POST['notify_template_stat']) && !empty($_POST['email']) && !empty($_POST['alias'])) {
                 $table_name = 'email_stat';
                 /* add information at stat table */
                 $q = sprintf("INSERT INTO %s.%s (es_email, es_product_id, es_date) values('%s','%s','%s')", VBox::get('ConstData')->getConst('langsDb'), $table_name, $_POST['email'], $_POST['alias'], date('Y-m-d h:i:s', time()));
                 DB::executeAlter($q, 'notify_template_stat');
                 if (!empty($_POST['template'])) {
                     $last_id = DB::getLastInsertId();
                     if ($last_id) {
                         include_once ENGINE_PATH . 'class/classEmailReporter.php';
                         $reporter = new EmailReporter();
                         $_subject = isset($_POST['templateSubject']) ? $_POST['templateSubject'] : 'Thank you for subscription';
                         $args = array();
                         $args['email'] = $_POST['email'];
                         $args['hash'] = hash_hmac('md5', $last_id . $_POST['email'], 'stat');
                         $args['id'] = $last_id;
                         $args['random'] = rand(0, 10000) . chr(rand(65, 90));
                         if (isset($_POST['args'])) {
                             $args = $_POST['args'];
                         }
                         $mail_body = $reporter->renderingTpl($_POST['template']);
                         $reporter->setBody($mail_body, $args);
                         $reply_to = isset($_POST['reply_to']) ? $_POST['reply_to'] : '*****@*****.**';
                         $reporter->send($this->formData['fields']['email'], array($reply_to => 'NetSpot Software'), $_subject);
                     }
                 }
             }
             if (!empty($_POST['mailchimp_u']) && !empty($_POST['mailchimp_id'])) {
                 $mailchimp_post_url = 'http://netspotapp.us12.list-manage.com/subscribe/post';
                 //netspotapp.us12.list-manage.com/subscribe/post?u=49afa3dbcd460871845fac4b8&amp;id=df296d03d7
                 $attributes = array('u' => $_POST['mailchimp_u'], 'id' => $_POST['mailchimp_id'], 'MERGE0' => $_POST['email'], 'MERGE1' => isset($_POST['name']) ? $_POST['name'] : '', 'MERGE2' => '');
                 $errno = $error = false;
                 if ($curl = curl_init()) {
                     curl_setopt($curl, CURLOPT_URL, $mailchimp_post_url);
                     curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
                     curl_setopt($curl, CURLOPT_POST, true);
                     curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($attributes));
                     $out = curl_exec($curl);
                     $info = curl_getinfo($curl);
                     $errno = curl_errno($curl);
                     $tickets_hasError = curl_error($curl);
                     curl_close($curl);
                     //					echo $out;
                     //					var_dump($info);
                     //					var_dump($errno);
                     //var_dump($tickets_hasError);
                 }
             }
             if (empty($_POST['not_send'])) {
                 $fromEmail = empty($this->formData['fields']['email']) ? '*****@*****.**' : $this->formData['fields']['email'];
                 $fromName = empty($this->formData['fields']['name']) ? $fromEmail : $this->formData['fields']['name'];
                 $form->SendMail($subject, $msg, $fromName, $fromName . ' <' . $fromEmail . '>', $filePath, $fileName);
             }
         }
     }
 }
Пример #7
0
<?php

session_start();
require_once '../model/products/Products.php';
$idProd = $_GET["idProducto"];
$productIns = new Products();
$product = $productIns->getProductById($idProd);
$b = $_SESSION["user"][0];
?>

<!DOCTYPE html>
<html lang="es">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">
        <title>Product Details | E-Shopper</title>
        <link href="css/bootstrap.min.css" rel="stylesheet">
        <link href="css/font-awesome.min.css" rel="stylesheet">
        <link href="css/prettyPhoto.css" rel="stylesheet">
        <link href="css/price-range.css" rel="stylesheet">
        <link href="css/animate.css" rel="stylesheet">
        <link href="css/main.css" rel="stylesheet">
        <link href="css/responsive.css" rel="stylesheet">
        <link href="css/zoomy.css" rel="stylesheet">
        <!--[if lt IE 9]>
        <script src="js/html5shiv.js"></script>
        <script src="js/respond.min.js"></script>
        <![endif]-->       
        <link rel="shortcut icon" href="images/ico/favicon.ico">
Пример #8
0
$tag = new Tags();
$member = new Members();
$product = new Products();
$form = new Forms();
$tmp_status = explode(",", L('product_status', 'tpl'));
$viewhelper->setPosition(L("product_center", 'tpl'), 'product/');
$viewhelper->setTitle(L("product_center", 'tpl'));
if (isset($_GET['title'])) {
    $title = rawurldecode(trim($_GET['title']));
    $res = $product->findByName($title);
    $id = $res['id'];
}
if (isset($_GET['id'])) {
    $id = intval($_GET['id']);
}
$info = $product->getProductById($id);
if (empty($info) || !$info) {
    flash("data_not_exists", '', 0);
}
if (isset($info['formattribute_ids'])) {
    $form_vars = $form->getAttributes(explode(",", $info['formattribute_ids']), 2);
    setvar("ObjectParams", $form_vars);
}
if (!empty($info['tag_ids'])) {
    $tag_res = $tag->getTagsByIds($info['tag_ids']);
    if (!empty($tag_res)) {
        $tags = null;
        foreach ($tag_res as $key => $val) {
            $tags .= '<a href="product/list.php?do=search&q=' . urlencode($val) . '" target="_blank">' . $val . '</a>&nbsp;';
        }
        $info['tag'] = $tags;
Пример #9
0
 public function callSendplaceorder()
 {
     include_once ENGINE_PATH . 'class/classForm.php';
     $form = new Form();
     if ($form->ParseSettings('placeOrderForm.ini')) {
         $formData = $form->BuildFormFields($_POST);
         if (!empty($formData['error'])) {
             unset($form);
             return $formData['error'];
         } else {
             include_once ENGINE_PATH . 'class/classProducts.php';
             $productObj = new Products();
             $product = $productObj->getProductById($formData['fields']['place_product']);
             if (empty($product)) {
                 return array('place_product' => '1');
             }
             $msg = 'Contact request from ' . $_SERVER['HTTP_HOST'] . "\n" . 'Details' . "\n\n" . 'Product: ' . $product['p_title'] . "\n" . $form->__toString();
             $form->SendMail('New contact request', $msg);
         }
     }
     return array();
 }