working on it ...

Filters

Explore Public Snippets

Sort by

Found 4 snippets

    public by John93  2807  1  4  0

    add functional to file types

    php
      /********** FILE TYPE **********/
        } else if($row->type == 'file'){
    
            if ($request->hasFile($row->field)) {
    
                $storage_disk = 'local';
    
                $file = $request->file($row->field);
                $filename = str_random(20);
    
                $path =  $slug . '/' . date('F') . date('Y') . '/';
                $full_path = $path . $filename . '.' . $file->getClientOriginalExtension();
    
    //            $files = File::make($file)->encode($file->getClientOriginalExtension(), 75);
    
                Storage::put(config('voyager.storage.subfolder') . $full_path, (string)$file, 'public');
    
                $content = $full_path;
    
            } else {
    
                $content = NULL;
    
            }
    
          /********** IMAGE TYPE **********/
        } else if($row->type == 'image'){

    public by John93  2850  1  4  0

    Function add meta-boxes

    add_filter( 'rwmb_meta_boxes', 'locations_products' );
    function locations_products( $meta_boxes ) {
        $prefix = 'crsites_';
        $meta_boxes[] = array(
            'title'      => __( 'Дополнительная информация', 'createsites' ),
            'post_types' => 'product',
            'fields'     => array(
                array(
                    'name'       => esc_html__( 'Местоположение', 'createsites' ),
                    'id'         => "{$prefix}locations",
                    'type'       => 'taxonomy',
                    // Taxonomy name
                    'taxonomy'   => 'locations_product',
                    // How to show taxonomy: 'checkbox_list' (default) or 'checkbox_tree', 'select_tree', select_advanced or 'select'. Optional
                    'field_type' => 'select_tree',
                    // Additional arguments for get_terms() function. Optional
                    'query_args' => array(),
                ),
                array(
                    'name'       => esc_html__( 'Состояние продукта', 'createsites' ),
                    'id'         => "{$prefix}sostoyanie",
                    'type'       => 'taxonomy',
                    // Taxonomy name
                    'taxonomy'   => 'sostoyanie_producta',
                    // How to show taxonomy: 'checkbox_list' (default) or 'checkbox_tree', 'select_tree', select_advanced or 'select'. Optional
                    'field_type' => 'select',
                    // Additional arguments for get_terms() function. Optional
                    'query_args' => array(),
                ),
                array(
                    'name'       => esc_html__( 'Кто оплачивает доставку', 'createsites' ),
                    'id'         => "{$prefix}oplata",
                    'type'       => 'taxonomy',
                    // Taxonomy name
                    'taxonomy'   => 'oplata_producta',
                    // How to show taxonomy: 'checkbox_list' (default) or 'checkbox_tree', 'select_tree', select_advanced or 'select'. Optional
                    'field_type' => 'select',
                    // Additional arguments for get_terms() function. Optional
                    'query_args' => array(),
                ),
            ),
        );
        return $meta_boxes;
    }

    public by John93  3483  1  4  0

    update_post_meta

    if ( isset($_POST['crsites_sostoyanie']) ) { 
            $values = $_POST['crsites_sostoyanie'];
            update_post_meta( $post_id, 'crsites_sostoyanie', $values );
    } 

    public by John93  2944  0  4  0

    HTML form view product sostoyanie

    <?php 
        $sostoyanies = get_terms("sostoyanie_producta", "orderby=name&hide_empty=0&parent=0");
        foreach ($sostoyanies as $sost) {
          if ($sostoyanie->name == $sost->name) {
            $chk = 'checked';
          } else {
            $chk = '';
          }
          $option_sostoyanie .= "<p><label for='".$sost->slug."'><input type='radio' id='".$sost->slug."' name='crsites_sostoyanie' value='".$sost->term_id."' ".$chk."> ".$sost->name."</label></p>";
        }
      ?>
      <label for="crsites_sostoyanie" class="form-label"><?php _e( 'Состояние', 'dokan' ); ?></label>
      <?php echo $option_sostoyanie; ?>

    List Complete ( 4 snippets total )

    • Public Snippets
    • Channels Snippets