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 :

récupérer une valeur d'un tableau


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 récupérer une valeur d'un tableau
    bonjour a tous
    j'ai cet affichage
    {"id":16,"order_id":6000,"name":"monproduitt","product_id":6001,"variation_id":0,"quantity":1,"tax_class":"","subtotal":"12","subtotal_tax":"0","total":"12","total_tax":"0","taxes":{"total":[],"subtotal":[]},"meta_data":[{"id":200,"key":"infos","value":"ma valeur"},{"id":201,"key":"_vendor_id","value":"3"},{"id":228,"key":"_reduced_stock","value":"1"}]}

    quand je tape <?php echo $item->get_id() ;?> il m'affiche la valeur 16 la tout est bon.

    Par contre j'aimerai récupéré l'affichage de ma valeur qui est en rouge
    comment je peux faire sa svp
    je vous remercie pour vos repense

  2. #2
    Expert confirmé
    Avatar de laurentSc
    Homme Profil pro
    Webmaster débutant perpétuel !
    Inscrit en
    Octobre 2006
    Messages
    10 470
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 60
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Webmaster débutant perpétuel !
    Secteur : Industrie

    Informations forums :
    Inscription : Octobre 2006
    Messages : 10 470
    Points : 5 828
    Points
    5 828
    Billets dans le blog
    1
    Par défaut
    Bonjour,
    pour qu'on puisse te répondre, il faudrait en donner un peu plus ; var_dump($variable);...Ces données sont probablement stockées dans une variable.

  3. #3
    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
    je vous remercie de votre repense
    en tapant var_dump($item); j'ai eu un très long affichage et voila la partie où je vois mes variables :

    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
    		["current_class_name":"WC_Data_Store":private] => string(32) "WC_Order_Item_Product_Data_Store"
    		["object_type":"WC_Data_Store":private]=> string(18) "order-item-product"
    	}
    	["meta_data":protected]=> array(3) {
    		[0]=> object(WC_Meta_Data)#24500 (2) {
    			["current_data":protected]=> array(3) {
    				["id"]=> int(238)
    				["key"]=> string(13) "infos "
    				["value"]=> string(5) "ma valeur"
    			}
    			["data":protected]=> array(3) {
    				["id"]=> int(238)
    				["key"]=> string(13) "infos "
    				["value"]=> string(5) "ma valeur"
    			}
    		}
    		[1]=> object(WC_Meta_Data)#24501 (2) {
    			["current_data":protected]=> array(3) {
    				["id"]=> int(239)
    				["key"]=> string(10) "_vendor_id"
    				["value"]=> string(1) "3"
    			}
    			["data":protected]=> array(3) {
    				["id"]=> int(239)
    				["key"]=> string(10) "_vendor_id"
    				["value"]=> string(1) "3"
    			}
    		}
    		[2]=> object(WC_Meta_Data)#24502 (2) {
    			["current_data":protected]=> array(3) {
    				["id"]=> int(266)
    				["key"]=> string(14) "_reduced_stock"
    				["value"]=> string(1) "1"
    			}
    			["data":protected]=> array(3) {
    				["id"]=> int(266)
    				["key"]=> string(14) "_reduced_stock"
    				["value"]=> string(1) "1"
    			}
    		}
    	}
    }

  4. #4
    Membre éprouvé
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Août 2012
    Messages
    631
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Août 2012
    Messages : 631
    Points : 1 220
    Points
    1 220
    Par défaut
    Bonjour,
    c'est un document JSON. Tu peux le convertir en tableau avec json_decode()
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
     
    $data = '
    {"id":16,"order_id":6000,"name":"monproduitt","product_id":6001,"variation_id":0,"quantity":1,"tax_class":"","subtotal":"12","subtotal_tax":"0","total":"12","total_tax":"0","taxes":{"total":[],"subtotal":[]},"meta_data":[{"id":200,"key":"Partag\u00e9 par ","value":"ma valeur"},{"id":201,"key":"_vendor_id","value":"3"},{"id":228,"key":"_reduced_stock","value":"1"}]}
    ';
     
    $data = json_decode($data, true);
     
    var_dump($data['meta_data'][0]['value']);

  5. #5
    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
    je vous remercie beaucoup pour votre repense y a t il un moyen de traiter ce code paque je vois qu'il y a beaucoup plus de valeur que le premier que je doit récupérer pour mon affichage en PHP comme "infos" et "ma valeur".
    après c'est pas une erreur d'affichage mai c'est le résultat du var_dump($item);

  6. #6
    Membre éprouvé
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Août 2012
    Messages
    631
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Août 2012
    Messages : 631
    Points : 1 220
    Points
    1 220
    Par défaut
    si tu veux récupérer plusieurs valeurs tu peux faire une boucle

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    $data = json_decode($item, true);
     
    foreach ($data['meta_data'] as $key => $items) {
    	echo "id: {$items['id']}, key: {$items['key']} , value:{$items['value']}";
     
    }
    Pour les autres valeurs du tableau t'as pas besoin de boucler:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    $data['order_id'] ; 
    $data['name'] ;

  7. #7
    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
    merci pour votre aide malheureusement en faisant sa sa m'affiche :
    id: 238, key:infos , value:ma valeurid: 239, key: _vendor_id , value:3id: 266, key: _reduced_stock , value:1
    
    6000
    produit
    

  8. #8
    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
    Je vous mets l'affichage complet de print_r($item) peut-être ça peut mieux vous aider pour comprendre et je vous remercie pour vos réponses.

    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
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    WC_Order_Item_Product Object (
    		[extra_data:protected] => Array (
    		[product_id] => 0
    		[variation_id] => 0
    		[quantity] => 1
    		[tax_class] =>
    		[subtotal] => 0
    		[subtotal_tax] => 0
    		[total] => 0
    		[total_tax] => 0
    		[taxes] => Array (
    			[subtotal] => Array ()
    			[total] => Array ()
    		)
    	)
    	[data:protected] => Array (
    		[order_id] => 6494
    		[name] => produitt
    		[product_id] => 6000
    		[variation_id] => 0
    		[quantity] => 1
    		[tax_class] =>
    		[subtotal] => 12
    		[subtotal_tax] => 0
    		[total] => 12
    		[total_tax] => 0
    		[taxes] => Array (
    			[total] => Array ()
    			[subtotal] => Array ()
    		)
    	)
    	[cache_group:protected] => order-items
    	[meta_type:protected] => order_item
    	[object_type:protected] => order_item
    	[id:protected] => 19
    	[changes:protected] => Array ()
    	[object_read:protected] => 1
    	[default_data:protected] => Array (
    		[order_id] => 0
    		[name] =>
    		[product_id] => 0
    		[variation_id] => 0
    		[quantity] => 1
    		[tax_class] =>
    		[subtotal] => 0
    		[subtotal_tax] => 0
    		[total] => 0
    		[total_tax] => 0
    		[taxes] => Array (
    			[subtotal] => Array ()
    			[total] => Array ()
    		)
    	)
    	[data_store:protected] => WC_Data_Store Object (
    		[instance:WC_Data_Store:private] => WC_Order_Item_Product_Data_Store Object (
    			[internal_meta_keys:protected] => Array (
    				[0] => _order_id
    				[1] => _name
    				[2] => _product_id
    				[3] => _variation_id
    				[4] => _quantity
    				[5] => _tax_class
    				[6] => _subtotal
    				[7] => _subtotal_tax
    				[8] => _total
    				[9] => _total_tax
    				[10] => _taxes
    				[11] => _product_id
    				[12] => _variation_id
    				[13] => _qty
    				[14] => _tax_class
    				[15] => _line_subtotal
    				[16] => _line_subtotal_tax
    				[17] => _line_total
    				[18] => _line_tax
    				[19] => _line_tax_data
    			)
    			[meta_type:protected] => order_item
    			[object_id_field_for_meta:protected] => order_item_id
    			[must_exist_meta_keys:protected] => Array ()
    		)
    		[stores:WC_Data_Store:private] => Array (
    			[coupon] => WC_Coupon_Data_Store_CPT
    			[customer] => WC_Customer_Data_Store
    			[customer-download] => WC_Customer_Download_Data_Store
    			[customer-download-log] => WC_Customer_Download_Log_Data_Store
    			[customer-session] => WC_Customer_Data_Store_Session
    			[order] => WC_Order_Data_Store_CPT
    			[order-refund] => WC_Order_Refund_Data_Store_CPT
    			[order-item] => WC_Order_Item_Data_Store
    			[order-item-coupon] => WC_Order_Item_Coupon_Data_Store
    			[order-item-fee] => WC_Order_Item_Fee_Data_Store
    			[order-item-product] => WC_Order_Item_Product_Data_Store
    			[order-item-shipping] => WC_Order_Item_Shipping_Data_Store
    			[order-item-tax] => WC_Order_Item_Tax_Data_Store
    			[payment-token] => WC_Payment_Token_Data_Store => WC_Product_Data_Store_CPT
    			[product-grouped] => WC_Product_Grouped_Data_Store_CPT
    			[product-variable] => WC_Product_Variable_Data_Store_CPT
    			[product-variation] => WC_Product_Variation_Data_Store_CPT
    			[shipping-zone] => WC_Shipping_Zone_Data_Store
    			[webhook] => WC_Webhook_Data_Store
    			[order-item-line_item_removed] => WC_Order_Item_Product_Data_Store
    			[order-item-line_item_switched] => WC_Order_Item_Product_Data_Store
    			[order-item-coupon_pending_switch] => WC_Order_Item_Coupon_Data_Store
    			[order-item-fee_pending_switch] => WC_Order_Item_Fee_Data_Store
    			[subscription] => WCS_Subscription_Data_Store_CPT
    			[product-variable-subscription] => WCS_Product_Variable_Data_Store_CPT
    			[product-subscription_variation] => WC_Product_Variation_Data_Store_CPT
    			[order-item-line_item_pending_switch] => WC_Order_Item_Product_Data_Store
    			[report-revenue-stats] => Automattic\WooCommerce\Admin\API\Reports\Orders\Stats\DataStore
    			[report-orders] => Automattic\WooCommerce\Admin\API\Reports\Orders\DataStore
    			[report-orders-stats] => Automattic\WooCommerce\Admin\API\Reports\Orders\Stats\DataStore
    			[report-products] => Automattic\WooCommerce\Admin\API\Reports\Products\DataStore
    			[report-variations] => Automattic\WooCommerce\Admin\API\Reports\Variations\DataStore
    			[report-products-stats] => Automattic\WooCommerce\Admin\API\Reports\Products\Stats\DataStore
    			[report-variations-stats] => Automattic\WooCommerce\Admin\API\Reports\Variations\Stats\DataStore
    			[report-categories] => Automattic\WooCommerce\Admin\API\Reports\Categories\DataStore
    			[report-taxes] => Automattic\WooCommerce\Admin\API\Reports\Taxes\DataStore
    			[report-taxes-stats] => Automattic\WooCommerce\Admin\API\Reports\Taxes\Stats\DataStore
    			[report-coupons] => Automattic\WooCommerce\Admin\API\Reports\Coupons\DataStore
    			[report-coupons-stats] => Automattic\WooCommerce\Admin\API\Reports\Coupons\Stats\DataStore
    			[report-downloads] => Automattic\WooCommerce\Admin\API\Reports\Downloads\DataStore
    			[report-downloads-stats] => Automattic\WooCommerce\Admin\API\Reports\Downloads\Stats\DataStore
    			[admin-note] => Automattic\WooCommerce\Admin\Notes\DataStore
    			[report-customers] => Automattic\WooCommerce\Admin\API\Reports\Customers\DataStore
    			[report-customers-stats] => Automattic\WooCommerce\Admin\API\Reports\Customers\Stats\DataStore
    			[report-stock-stats] => Automattic\WooCommerce\Admin\API\Reports\Stock\Stats\DataStore
    		)
    		[current_class_name:WC_Data_Store:private] => WC_Order_Item_Product_Data_Store
    		[object_type:WC_Data_Store:private] => order-item-product
    	)
    	[meta_data:protected] => Array (
    		[0] => WC_Meta_Data Object (
    			[current_data:protected] => Array (
    				[id] => 238
    				[key] => infos
    				[value] => mavaleur
    			)
    			[data:protected] => Array (
    				[id] => 238
    				[key] => infos
    				[value] => mavaleur
    			)
    		)
    		[1] => WC_Meta_Data Object (
    			[current_data:protected] => Array (
    				[id] => 239
    				[key] => _vendor_id
    				[value] => 3
    			)
    			[data:protected] => Array (
    				[id] => 239
    				[key] => _vendor_id
    				[value] => 3
    			)
    		)
    		[2] => WC_Meta_Data Object (
    			[current_data:protected] => Array (
    				[id] => 266
    				[key] => _reduced_stock
    				[value] => 1
    			)
    			[data:protected] => Array (
    				[id] => 266
    				[key] => _reduced_stock
    				[value] => 1
    			)
    		)
    	)
    )

  9. #9
    Expert confirmé
    Avatar de laurentSc
    Homme Profil pro
    Webmaster débutant perpétuel !
    Inscrit en
    Octobre 2006
    Messages
    10 470
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 60
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Webmaster débutant perpétuel !
    Secteur : Industrie

    Informations forums :
    Inscription : Octobre 2006
    Messages : 10 470
    Points : 5 828
    Points
    5 828
    Billets dans le blog
    1
    Par défaut
    Bonsoir,
    j'avance à tâtons et je me hasarde mais peux-tu faire
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    foreach($item as $key=>$value) {
         echo "key=".$key."<br/>";
         var_dump($value);
         echo "<br/>";
    }
    et donner le résultat en remettant en rouge les valeurs qui t'intéressent (si on les voit) ?

  10. #10
    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
    merci pour votre repense laurentSc
    mai ce code n'affiche rien du tout même pas une erreur désolé

  11. #11
    Expert confirmé
    Avatar de laurentSc
    Homme Profil pro
    Webmaster débutant perpétuel !
    Inscrit en
    Octobre 2006
    Messages
    10 470
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 60
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Webmaster débutant perpétuel !
    Secteur : Industrie

    Informations forums :
    Inscription : Octobre 2006
    Messages : 10 470
    Points : 5 828
    Points
    5 828
    Billets dans le blog
    1
    Par défaut
    Pour creuser (demain car je vais me pieuter ), peux-tu mettre en pièce jointe ton code PHP ?

  12. #12
    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
    c'est un site wordpress le plugins woocommerce
    je suis sur le fichier qui se trouve
    wordpress/wp-content/plugins/woocommerce/templates/myaccount/orders.php
    Fichiers attachés Fichiers attachés

  13. #13
    Expert confirmé
    Avatar de laurentSc
    Homme Profil pro
    Webmaster débutant perpétuel !
    Inscrit en
    Octobre 2006
    Messages
    10 470
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 60
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Webmaster débutant perpétuel !
    Secteur : Industrie

    Informations forums :
    Inscription : Octobre 2006
    Messages : 10 470
    Points : 5 828
    Points
    5 828
    Billets dans le blog
    1
    Par défaut
    Ok,
    Mais y a sûrement moyen de copier l'article ou la page concerné....

    Bon, Chu sûr mon téléphone et j'ai répondu avant de voir qui u avait une pièce jointe. Je regarderai mais peut-être que cet après-midi...

  14. #14
    Membre éprouvé
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Août 2012
    Messages
    631
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Août 2012
    Messages : 631
    Points : 1 220
    Points
    1 220
    Par défaut
    Citation Envoyé par TH3ROOT Voir le message
    merci pour votre aide malheureusement en faisant sa sa m'affiche :
    id: 238, key:infos , value:ma valeurid: 239, key: _vendor_id , value:3id: 266, key: _reduced_stock , value:1
    
    6000
    produit
    
    que souhaites-tu exactement récupérer comme donnée? j'ai fait une boucle te permettant de récupérer n'importe quelle donnée se trouvant dans le sous tableau meta_data. dans cette boucle tu peux choisir ce dont tu as besoin comme donnée.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
     
    $data = json_decode($item, true);
     
    foreach ($data['meta_data'] as $key => $items) {
    	echo $items['value']; //récupère valeur
        //   echo $items['key']; 
     
    }

  15. #15
    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
    Merci armel18 pour votre repense votre boucle me permet de récupérer une partie de l'objet sauf que l'affichage n'est pas bon.
    exemple l'affichage de ce code :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
    foreach ($data['meta_data'] as $key => $items) {
    	echo $items['value']; 
     
    }
    me donne le résultat suivant :

    ma valeur31
    alors que je veux juste l'affichage de ma valeur sans le 31 que je sais pas elle correspond a quoi
    encore je vous remercie beaucoup pour votre aide

  16. #16
    Expert confirmé
    Avatar de laurentSc
    Homme Profil pro
    Webmaster débutant perpétuel !
    Inscrit en
    Octobre 2006
    Messages
    10 470
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 60
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Webmaster débutant perpétuel !
    Secteur : Industrie

    Informations forums :
    Inscription : Octobre 2006
    Messages : 10 470
    Points : 5 828
    Points
    5 828
    Billets dans le blog
    1
    Par défaut
    Je viens de jeter un oeil à order.php ; on y exploite la variable $item mais en fait, elle est fabriquée à partir de $order_items, elle-même fabriquée à partir de $order qui est fabriquée par $order = wc_get_order( $customer_order ); qui vient de foreach ( $customer_orders->orders as $customer_order ) et $customer_orders doit être construite par le plugin woocommerce (en tout cas, par le code que tu donnes). Pour aller plus loin, je t'invite à te tourner vers le sous-forum https://www.developpez.net/forums/d2...able-d-plugin/ que visiblement, tu connais déjà...

  17. #17
    Membre actif
    Homme Profil pro
    libre
    Inscrit en
    Juin 2019
    Messages
    205
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Autre

    Informations professionnelles :
    Activité : libre

    Informations forums :
    Inscription : Juin 2019
    Messages : 205
    Points : 292
    Points
    292
    Par défaut
    Je n'ai pas grande connaissance en PHP; je pense que le code suivant devrait marcher

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $data->meta_data[0]->value;
    par contre les membres dans les la class sont protégés donc inaccessibles selon le var dump.

    EDIT:
    ma valeur31
    alors que je veux juste l'affichage de ma valeur sans le 31 que je sais pas elle correspond a quoi
    encore je vous remercie beaucoup pour votre aide
    Ajouter un retour à la ligne et tu vas comprendre .

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    echo $items['value'];  
    echo '<br>';

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

Discussions similaires

  1. Récupérer une valeur d'un tableau avec jQuery
    Par waouni dans le forum jQuery
    Réponses: 8
    Dernier message: 21/05/2012, 11h23
  2. Réponses: 2
    Dernier message: 25/04/2012, 13h31
  3. [HTML] Récupérer une valeur dans un tableau - DIV
    Par frtou dans le forum Balisage (X)HTML et validation W3C
    Réponses: 5
    Dernier message: 02/09/2008, 10h12
  4. Récupérer une valeur dans un tableau ?
    Par le polak dans le forum Excel
    Réponses: 1
    Dernier message: 26/05/2008, 18h08
  5. Récupérer une valeur dans un tableau
    Par Jeren dans le forum Langage
    Réponses: 2
    Dernier message: 29/04/2008, 10h03

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