function loadProductsExpected()
 {
     global $toC_Json;
     $data = osC_Products_Admin::getData($_REQUEST['products_id']);
     $data['products_date_available'] = osC_DateTime::getDate($data['products_date_available']);
     $response = array('success' => true, 'data' => $data);
     echo $toC_Json->encode($response);
 }
Пример #2
0
 function loadProduct()
 {
     global $toC_Json, $osC_Database, $osC_Language;
     $data = osC_Products_Admin::getData($_REQUEST['products_id']);
     if (!empty($data['products_date_available'])) {
         $date = explode(' ', $data['products_date_available']);
         $data['products_date_available'] = $date[0];
     }
     if ($data['products_type'] == PRODUCT_TYPE_DOWNLOADABLE) {
         $Qdownloadables = $osC_Database->query('select filename, cache_filename, sample_filename, cache_sample_filename, number_of_downloads, number_of_accessible_days from :table_products_downloadables where products_id = :products_id');
         $Qdownloadables->bindTable(':table_products_downloadables', TABLE_PRODUCTS_DOWNLOADABLES);
         $Qdownloadables->bindInt(':products_id', $_REQUEST['products_id']);
         $Qdownloadables->execute();
         $data['filename'] = $Qdownloadables->value('filename');
         $data['cache_filename_url'] = HTTP_SERVER . DIR_WS_HTTP_CATALOG . FILENAME_DOWNLOAD . '?id=' . $_REQUEST['products_id'] . '&cache_filename=' . $Qdownloadables->value('cache_filename');
         $data['sample_filename'] = $Qdownloadables->value('sample_filename');
         $data['cache_sample_filename_url'] = HTTP_SERVER . DIR_WS_HTTP_CATALOG . FILENAME_DOWNLOAD . '?id=' . $_REQUEST['products_id'] . '&cache_sample_filename=' . $Qdownloadables->value('cache_sample_filename');
         $data['number_of_downloads'] = $Qdownloadables->valueInt('number_of_downloads');
         $data['number_of_accessible_days'] = $Qdownloadables->valueInt('number_of_accessible_days');
         $Qdownloadables->freeResult();
     } else {
         if ($data['products_type'] == PRODUCT_TYPE_GIFT_CERTIFICATE) {
             $Qcertifcate = $osC_Database->query('select gift_certificates_type, gift_certificates_amount_type, open_amount_min_value, open_amount_max_value from :table_products_gift_certificates where products_id = :products_id');
             $Qcertifcate->bindTable(':table_products_gift_certificates', TABLE_PRODUCTS_GIFT_CERTIFICATES);
             $Qcertifcate->bindInt(':products_id', $_REQUEST['products_id']);
             $Qcertifcate->execute();
             $data['gift_certificates_type'] = $Qcertifcate->valueInt('gift_certificates_type');
             $data['gift_certificates_amount_type'] = $Qcertifcate->valueInt('gift_certificates_amount_type');
             $data['open_amount_min_value'] = $Qcertifcate->valueInt('open_amount_min_value');
             $data['open_amount_max_value'] = $Qcertifcate->valueInt('open_amount_max_value');
         }
     }
     $Qpd = $osC_Database->query('select products_name, products_short_description, products_description, products_tags, products_url, products_friendly_url, products_page_title, products_meta_keywords, products_meta_description, language_id from :table_products_description where products_id = :products_id');
     $Qpd->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
     $Qpd->bindInt(':products_id', $_REQUEST['products_id']);
     $Qpd->execute();
     while ($Qpd->next()) {
         $data['products_name[' . $Qpd->valueInt('language_id') . ']'] = $Qpd->value('products_name');
         $data['products_short_description[' . $Qpd->valueInt('language_id') . ']'] = $Qpd->value('products_short_description');
         $data['products_description[' . $Qpd->valueInt('language_id') . ']'] = $Qpd->value('products_description');
         $data['products_tags[' . $Qpd->valueInt('language_id') . ']'] = $Qpd->value('products_tags');
         $data['products_url[' . $Qpd->valueInt('language_id') . ']'] = $Qpd->value('products_url');
         $data['products_friendly_url[' . $Qpd->valueInt('language_id') . ']'] = $Qpd->value('products_friendly_url');
         $data['products_page_title[' . $Qpd->valueInt('language_id') . ']'] = $Qpd->value('products_page_title');
         $data['products_meta_keywords[' . $Qpd->valueInt('language_id') . ']'] = $Qpd->value('products_meta_keywords');
         $data['products_meta_description[' . $Qpd->valueInt('language_id') . ']'] = $Qpd->value('products_meta_description');
     }
     $Qpd->freeResult();
     $Qcategories = $osC_Database->query('select categories_id from :table_products_to_categories where products_id = :products_id');
     $Qcategories->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
     $Qcategories->bindInt(':products_id', $_REQUEST['products_id']);
     $Qcategories->execute();
     $product_categories_array = array();
     while ($Qcategories->next()) {
         $product_categories_array[] = $Qcategories->valueInt('categories_id');
     }
     $Qcategories->freeResult();
     $data['categories_id'] = implode(',', $product_categories_array);
     $response = array('success' => true, 'data' => $data);
     echo $toC_Json->encode($response);
 }