Ejemplo n.º 1
0
             $arrayCount = count($allDataInSheet);
             $column_name = $allDataInSheet[1]["A"];
             $extension = pathinfo($file_location, PATHINFO_EXTENSION);
             if ($extension === "xlsx" || $extension === "xls") {
                 if (strtolower($column_name) === "pincode") {
                     $query = sprintf("SELECT * FROM pos_attributes WHERE attribute_code='%s' LIMIT 1", strtolower($column_name));
                     $result = mysql_query($query);
                     $action = "create";
                     $entity_id = $shop_id;
                     while ($row = mysql_fetch_assoc($result)) {
                         if ($row['backend_type'] === "int") {
                             for ($i = 2; $i <= $arrayCount; $i++) {
                                 $pincode = trim($allDataInSheet[$i]["A"]);
                                 //$c1 = trim($allDataInSheet[$i]["A"]);
                                 //$c2 = trim($allDataInSheet[$i]["B"]);
                                 pos_shop_entity_int($entity_id, $row['attribute_id'], $pincode, $action);
                             }
                         }
                     }
                 }
                 //unlink($file_location);
                 echo $file_id;
             } else {
                 echo 'system_error';
             }
         } else {
             echo 'system_error';
         }
     }
 } else {
     echo 'system_error';
Ejemplo n.º 2
0
                    $query = sprintf("SELECT * FROM pos_attributes WHERE attribute_code='%s' LIMIT 1", mysql_real_escape_string($key));
                    $result = mysql_query($query);
                    $action = "create";
                    while ($row = mysql_fetch_assoc($result)) {
                        switch ($row['backend_type']) {
                            case "varchar":
                                pos_shop_entity_varchar($entity_id, $row['attribute_id'], $value, $action);
                                break;
                            case "text":
                                pos_shop_entity_text($entity_id, $row['attribute_id'], $value, $action);
                                break;
                            case "decimal":
                                pos_shop_entity_decimal($entity_id, $row['attribute_id'], $value, $action);
                                break;
                            case "int":
                                pos_shop_entity_int($entity_id, $row['attribute_id'], $value, $action);
                                break;
                            case "datetime":
                                pos_shop_entity_datetime($entity_id, $row['attribute_id'], $value, $action);
                                break;
                        }
                    }
                    // while end here
                }
                // foreach end hete
            }
        }
    }
} else {
    // To edit or Update shop information.
    parse_str($_SERVER["QUERY_STRING"], $query);
Ejemplo n.º 3
0
 if ($is_dcharge_config) {
     $pin = $data['shop_delivery_pincode'];
     $pincodes = explode(',', $pin);
     $attribute_code = array('pincode', 'delivery_pin_config');
     foreach ($attribute_code as $key) {
         $query = sprintf("SELECT * FROM pos_attributes WHERE attribute_code='%s' LIMIT 1", $key);
         $result = mysql_query($query);
         $action = "create";
         while ($row = mysql_fetch_assoc($result)) {
             if ($key == 'pincode' && $row['backend_type'] === "int") {
                 foreach ($pincodes as $pincode) {
                     pos_shop_entity_int($shop_id, $row['attribute_id'], $pincode, $action);
                 }
             }
             if ($key == 'delivery_pin_config' && $row['backend_type'] === "int") {
                 pos_shop_entity_int($shop_id, $row['attribute_id'], 1, $action);
             }
         }
     }
 }
 // To test pincode configured or not
 $is_pincode_config = 0;
 $query = sprintf("SELECT * FROM pos_attributes WHERE attribute_code='delivery_pin_config' LIMIT 1");
 $result = mysql_query($query);
 if (mysql_num_rows($result)) {
     while ($row = mysql_fetch_assoc($result)) {
         if ($row['backend_type'] == 'int') {
             $id = $row['attribute_id'];
             $query = "SELECT * FROM pos_shop_entity_int where entity_id = {$shop_id} AND attribute_id = {$id}";
             $result = mysql_query($query);
             if (mysql_num_rows($result)) {