IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

afficher une valeur [PHP 7]


Sujet :

Langage PHP

  1. #1
    Nouveau membre du Club
    Homme Profil pro
    Technicien réseau
    Inscrit en
    Février 2022
    Messages
    58
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Technicien réseau

    Informations forums :
    Inscription : Février 2022
    Messages : 58
    Points : 37
    Points
    37
    Par défaut afficher une valeur
    Bonjour
    pouvez vous me dire comment je peux afficher le nom de la catégorie et la sous catégorie choisi dans ce code svp :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    <?php
    if( get_transient( 'classified_product_terms_vendor'. get_current_user_id() ) ){
                    $classified_terms = get_transient( 'classified_product_terms_vendor' . get_current_user_id() );
                    if( isset( $classified_terms['term_id'] ) && isset( $classified_terms['taxonomy'] ) ){
                        echo '<input type="hidden" name="_default_cat_hierarchy_term_id" id="_default_cat_hierarchy_term_id_' . esc_attr( $classified_terms['term_id'] ) . '" value="' . esc_attr( $classified_terms['term_id'] ) . '" data-label="' . esc_attr( $classified_terms['term_id'] ) . '" />';
                        wcmp_generate_term_breadcrumb_html( array(
                            'term_id' => $classified_terms['term_id'], 
                            'taxonomy' => $classified_terms['taxonomy'],
                            'delimiter' => '',
                            'echo' => true) );
     
                        // save terms for post save handler 
                        $hierarchy = get_ancestors( $classified_terms['term_id'], $classified_terms['taxonomy'] );
                        $hierarchy[] = $classified_terms['term_id'];
                        foreach ( $hierarchy as $term_id ) {
                            echo '<input type="hidden" name="tax_input[' . $classified_terms['taxonomy'] . '][]" value="' . $term_id . '" />';
                        }
                    }
                }elseif( ($self->is_spmv() && $post) || $is_update ){
                    $term_tax = 'product_cat';
                    $terms = wp_get_post_terms( $post->ID, $term_tax, array( 'fields' => 'ids' ) );
                    $default_cat_hierarchy = get_post_meta( $post->ID, '_default_cat_hierarchy_term_id', true );
                    $get_different_terms_hierarchy = get_wcmp_different_terms_hierarchy( $terms );
                    if( $get_different_terms_hierarchy ){
                        $nos_hierarchy = count( $get_different_terms_hierarchy );
                        $class = ( $nos_hierarchy > 1 ) ? "has-multiple-cat" : "";
                        $flag = 0;
                        foreach ( $get_different_terms_hierarchy as $term_id ) {
                            if( $flag >= 1 ) continue;
                            $term_id = ($default_cat_hierarchy) ? $default_cat_hierarchy : $term_id;
                            wcmp_generate_term_breadcrumb_html( array(
                            'term_id' => $term_id, 
                            'taxonomy' => $term_tax,
                            'wrap_before' => '<ul class="wcmp-breadcrumb breadcrumb '.$class.'">',
                            'delimiter' => '',
                            'echo' => true) );
                            $flag++;
                        }
                        // give option to set default terms hierarchy
                        if( $nos_hierarchy > 1 && ( get_wcmp_vendor_settings('is_disable_marketplace_plisting', 'general') != 'Enable' ) ){ ?>
                        <p class="pull-right multiple-cat-hierarchy"><?php esc_html_e( 'Select a different category :', 'dc-woocommerce-multi-vendor' );?>
                            <strong id="multiple-cat-hierarchy-lbl" class="primary-color">
                                <button type="button" class="multi-cat-choose-dflt-btn editabble-button" data-toggle="collapse" data-target="#multi_cat_hierarchy_visiblity"><u><?php esc_html_e( 'Choose default', 'dc-woocommerce-multi-vendor' );?></u> <i class="wcmp-font ico-downarrow-2-icon"></i></button>
                            </strong>
                        </p> 
                        <div id="multi_cat_hierarchy_visiblity" class="wcmp-clps collapse dropdown-panel">
                            <div class="product-visibility-toggle-inner">
                                <?php 
                                foreach ( $get_different_terms_hierarchy as $term_id ) {
                                    echo '<div class="form-group">' 
                                        . '<label>'
                                        . '<input type="radio" name="_default_cat_hierarchy_term_id" id="_default_cat_hierarchy_term_id_' . esc_attr( $term_id ) . '" value="' . esc_attr( $term_id ) . '" ' . checked( $default_cat_hierarchy, $term_id, false ) . ' data-label="' . esc_attr( $term_id ) . '" data-hierarchy="' . esc_attr(wcmp_generate_term_breadcrumb_html( array( 'term_id' => $term_id, 
                                            'taxonomy' => $term_tax,
                                            'wrap_before'           => '',
                                            'wrap_after'            => '',
                                            'wrap_child_before'     => '<li>',
                                            'wrap_child_after'      => '</li>',
                                            'delimiter'             => ''
                                            ) )) . '" /> '
                                        . '<div for="_visibility_hierarchy_' . esc_attr( $term_id ) . '" class="selectit cat-breadcrumb">'.wcmp_generate_term_breadcrumb_html( array( 'term_id' => $term_id, 
                                            'taxonomy' => $term_tax,
                                            'wrap_before'           => '',
                                            'wrap_after'            => '',
                                            'wrap_child_before'     => '',
                                            'wrap_child_after'      => '',
                                            ) ).'</div>' 
                                        . '</label>'
                                        . '</div>';
                                }
                                ?>
                                <div class="form-group mb-0">
                                    <button type="button" class="btn btn-default btn-sm set-default-cat-hierarchy-btn" ><?php _e( 'Ok', 'dc-woocommerce-multi-vendor' ); ?></button>
                                    <a href="javascript:void(0)" data-toggle="collapse" data-target="#multi_cat_hierarchy_visiblity"><?php _e( 'Cancel', 'dc-woocommerce-multi-vendor' ); ?></a>
                                </div>
                            </div>
                        </div>
                        <?php }
                        if( get_wcmp_vendor_settings('is_disable_marketplace_plisting', 'general') != 'Enable' ) :
                        // save terms for post save handler 
                        if( $terms ){
                            foreach ( $terms as $term_id ) {
                                echo '<input type="hidden" name="tax_input[' . $term_tax . '][]" value="' . $term_id . '" />';
                            }
                        }
                        endif;
    que dois-je écrire sur cette ligne a la place des xxxxx pour que sa fonctionne svp

    <input type="text" class="form-control" name="post_title" id="post_title" value="<?php echo $xxxxxxx ?>">.

    je vous remercie beaucoup

  2. #2
    Nouveau membre du Club
    Homme Profil pro
    Technicien réseau
    Inscrit en
    Février 2022
    Messages
    58
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Technicien réseau

    Informations forums :
    Inscription : Février 2022
    Messages : 58
    Points : 37
    Points
    37
    Par défaut
    re bonjour
    si je tape
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <input type="text" class="form-control" name="post_title" id="post_title" value="<?php echo $term_id ?>
    sa m'affiche bien le numéro de la catégorie genre 71 mai j'aimerai que le nom et non le numéro soit afficher si quelqu'un peux m'aider sil vous plais

  3. #3
    Membre émérite
    Avatar de cavo789
    Homme Profil pro
    Développeur Web
    Inscrit en
    Mai 2004
    Messages
    1 758
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Mai 2004
    Messages : 1 758
    Points : 2 995
    Points
    2 995
    Par défaut
    Bonjour

    Il te faudrait un term_name ou quelque chose du genre mais tu n'as pas cette variable dans le code que tu as posté.

    Tu sembles utiliser WordPress, peut-être voir avec des développeurs wp ?
    Christophe (cavo789)
    Mon blog, on y parle Docker, PHP, WSL, Markdown et plein d'autres choses : https://www.avonture.be

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [dblookup] afficher une valeur par programmation
    Par let_me_in dans le forum Bases de données
    Réponses: 1
    Dernier message: 11/05/2005, 14h42
  2. [TMS320C31] Afficher une valeur à l'écran
    Par miminou dans le forum Autres architectures
    Réponses: 3
    Dernier message: 17/04/2005, 18h48
  3. [TP] Afficher une valeur avec outtext
    Par Bouilla dans le forum Turbo Pascal
    Réponses: 4
    Dernier message: 06/03/2005, 09h57
  4. Réponses: 3
    Dernier message: 28/01/2004, 14h55
  5. Afficher une valeur du context
    Par [DreaMs] dans le forum XMLRAD
    Réponses: 13
    Dernier message: 28/04/2003, 13h49

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo