Пример #1
0
 function getAttributes()
 {
     global $toC_Json, $osC_Database;
     $attributes_groups_id = null;
     $products_id = null;
     if (isset($_REQUEST['products_id']) && !empty($_REQUEST['products_id'])) {
         $products_id = $_REQUEST['products_id'];
         $Qattributes = $osC_Database->query('select products_attributes_groups_id from :table_products where products_id = :products_id');
         $Qattributes->bindTable(':table_products', TABLE_PRODUCTS);
         $Qattributes->bindInt(':products_id', $products_id);
         $Qattributes->execute();
         $attributes_groups_id = $Qattributes->valueInt('products_attributes_groups_id');
         $Qattributes->freeResult();
     } else {
         $attributes_groups_id = $_REQUEST['products_attributes_groups_id'];
     }
     $attributes = osC_Products_Admin::getAttributes($attributes_groups_id, $products_id);
     if ($attributes !== false) {
         $response = array('success' => true, 'attributes' => $attributes);
     } else {
         $response = array('success' => false);
     }
     echo $toC_Json->encode($response);
 }