Esempio n. 1
0
         $_data = array('product_id' => $_REQUEST['id'], 'viewed' => 1, 'total' => POPULARITY_VIEW);
         db_query("INSERT INTO ?:product_popularity ?e ON DUPLICATE KEY UPDATE viewed = viewed + 1, total = total + ?i", $_data, POPULARITY_VIEW);
         $_SESSION['products_popularity']['viewed'][$_REQUEST['id']] = true;
     }
 } elseif ($meta['object'] == 'categories') {
     $object = fn_twg_get_api_category_data($_REQUEST['id'], $lang_code);
     $title = 'category';
 } elseif ($meta['object'] == 'order') {
     $order_id = !empty($_REQUEST['id']) ? $_REQUEST['id'] : 0;
     TwigmoOrder::checkIfOrderAllowed($order_id, $_SESSION['auth'], $response);
     $object = TwigmoOrder::getOrderInfo($order_id);
     $title = 'order';
 } elseif ($meta['object'] == 'ga_orders_info') {
     $order_id = !empty($_REQUEST['id']) ? $_REQUEST['id'] : 0;
     TwigmoOrder::checkIfOrderAllowed($order_id, $_SESSION['auth'], $response);
     $order_info = TwigmoOrder::getOrderInfo($order_id);
     if (!empty($order_info['is_parent_order']) && $order_info['is_parent_order'] == 'Y') {
         $order_info['child_ids'] = implode(',', db_get_fields("SELECT order_id FROM ?:orders WHERE parent_order_id = ?i", $order_id));
     }
     $view = fn_twg_get_view_object();
     $view->assign('order_info', $order_info);
     $mode = 'complete';
     include_once Registry::get('config.dir.addons') . 'google_analytics/controllers/frontend/checkout.post.php';
     foreach ($orders_info as &$order_info) {
         if (isset($order_info['products'])) {
             $order_info['items'] = array_values($order_info['products']);
             unset($order_info['products']);
         }
     }
     $response->setData($orders_info);
     $response->returnResponse();
Esempio n. 2
0
     }
     if ($is_paginate) {
         if (empty($pagination_params)) {
             $pagination_params = array('items_per_page' => !empty($items_per_page) ? $items_per_page : TWG_RESPONSE_ITEMS_LIMIT, 'page' => !empty($_REQUEST['page']) ? $_REQUEST['page'] : 1, 'total_items' => !empty($total_items) ? $total_items : 0);
         }
         fn_twg_set_response_pagination($response, $pagination_params);
     }
     $response->returnResponse($object);
 }
 if ($action == 'details') {
     if (empty($_REQUEST['id'])) {
         $response->addError('ERROR_WRONG_OBJECT_DATA', str_replace('[object]', $object, __('twgadmin_wrong_api_object_data')));
         $response->returnResponse();
     }
     if ($object == 'orders') {
         $order = TwigmoOrder::getOrderInfo($_REQUEST['id']);
         if (empty($order)) {
             $response->addError('ERROR_OBJECT_WAS_NOT_FOUND', str_replace('[object]', $object, __('twgadmin_object_was_not_found')));
             $response->returnResponse();
         }
         $response->setData($order);
         $response->returnResponse('order');
     } elseif ($object == 'products') {
         $product = fn_twg_get_api_product_data($_REQUEST['id'], $lang_code);
         if (empty($product)) {
             $response->addError('ERROR_OBJECT_WAS_NOT_FOUND', str_replace('[object]', $object, __('twgadmin_object_was_not_found')));
             $response->returnResponse();
         }
         $response->setData($product);
         $response->returnResponse('product');
     } elseif ($object == 'users') {