function output_JSexsArrays()
 {
     $return_js_code = "var POexceptions = new Array();\n" . "var POexistents = new Array();\n";
     $exs = modApiFunc("Product_Options", "getExsForEntity", 'product', $this->product_id);
     $messages = array();
     $sets = modApiFunc("Product_Options", "getOptionsSettingsForEntity", 'product', $this->product_id);
     $ex_message = $sets['EX_MSG'];
     for ($i = 0; $i < count($exs); $i++) {
         $return_js_code .= "PO" . $exs[$i]['ex_type'] . "s[{$i}] = new Array(";
         $cmb = Product_Options::_unserialize_combination($exs[$i]['combination']);
         $elements = array();
         foreach ($cmb as $oid => $vdata) {
             if (is_numeric($vdata)) {
                 $elements[] = "'" . $oid . "_" . $vdata . "'";
             } elseif (is_array($vdata) and !empty($vdata)) {
                 foreach ($vdata as $vid => $val) {
                     $elements[] = "'" . $oid . "_" . $vid . "'";
                 }
             }
         }
         $return_js_code .= implode(",", $elements) . ");\n";
         if ($exs[$i]['ex_type'] == 'exception') {
             $messages[] = $exs[$i]['exception_message'];
         }
     }
     $return_js_code .= "var ExceptionsMessages = new Array('" . implode("','", array_map("addslashes", $messages)) . "');\n";
     $return_js_code .= "var NotExistentMessage = '" . addslashes($ex_message) . "';\n";
     return $return_js_code;
 }
Example #2
0
 function initQuery($params)
 {
     $tables = Product_Options::getTables();
     $value = $tables['po_options']['columns'];
     $option_id = $params['option_id'];
     $this->addSelectTable('po_options');
     $this->addSelectField($value['option_id'], 'option_id');
     $this->WhereValue($value['entity_id'], DB_EQ, $params['entity_id']);
     $this->WhereAND();
     $this->WhereValue($value['option_name'], DB_EQ, $params['option_name']);
 }
 /**
  * Gets the names of entities and their privileges (optionally).
  *
  * @param bool $with_privileges - whether to return privileges for entities or not
  * @return array of names of entities and their privileges
  */
 function _getParentEntities($with_privileges = false)
 {
     if ($with_privileges) {
         return Product_Options::__getInnerVar("_ENTITIES_PRIVILEGES");
     } else {
         return array_keys(Product_Options::__getInnerVar("_ENTITIES_PRIVILEGES"));
     }
 }
Example #4
0
 function initQuery($params)
 {
     $tables = Product_Options::getTables();
     $settings = $tables['po_settings']['columns'];
     $this->addSelectTable('po_settings');
     $this->addSelectField('*');
     $this->WhereValue($settings['parent_entity'], DB_EQ, $params['parent_entity']);
     $this->WhereAND();
     $this->WhereValue($settings['entity_id'], DB_EQ, $params['entity_id']);
 }