[Skip to main content](#vessel-content)

#   Tentative d'assignation de la propriété "price\_currency\_id" sur le tableau

##

- **[stevenoyer](/forum/user/65905-stevenoyer "View stevenoyer's Profile")**
- [![stevenoyer's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/65905-stevenoyer "View stevenoyer's Profile") Topic Author
- [ Offline](/forum/user/65905-stevenoyer)

Less More

- Posts: 8
- Thank you received: 2
-
-
-

3 years 6 months ago -  3 years 6 months ago [\#350765](#350765) by [stevenoyer](/forum/user/65905-stevenoyer "View stevenoyer's Profile")  *[Tentative d'assignation de la propriété "price\_currency\_id" sur le tableau](/forum/5-support-en-francais-french-support-/906208-tentative-dassignation-de-la-propriete-price-currency-id-sur-le-tableau#350765 "-- HikaShop version -- : 4.6.2 -- Joomla version -- : 4.2.8 -- PHP version -- : 8.2.0 -- Browser(s) name and version -- : Google Chrome 111.0.5563.146 -- Error-message(debug-mod must be tuned on) -- : Attempt to assign property &quot;price&#95;currency&#95;id&quot; on array  Bonjour,  Je suis sur le développement d'un plugin Hikashop. Lors de la création d'un produit et des prix, j'ai cette erreur qui s'affiche :  Voici mon code :  En utilisant le code disponible ici =&gt;   www.hikashop.com/support/documentation/6...r-documentation.html  :  J'ai la même erreur.  Ligne 46 de ma classe &quot;Product&quot;  Voici le tableau de prix qui est dans $this-&gt;product-&gt;prices :  Est-ce qu'une personne saurait m'orienter pour régler mon problème ?  D'avance merci, Bonne journée.")* was created by *[stevenoyer](/forum/user/65905-stevenoyer "View stevenoyer's Profile")*

-- HikaShop version -- : 4.6.2
-- Joomla version -- : 4.2.8
-- PHP version -- : 8.2.0
-- Browser(s) name and version -- : Google Chrome 111.0.5563.146
-- Error-message(debug-mod must be tuned on) -- : Attempt to assign property "price_currency_id" on array

Bonjour,

Je suis sur le développement d'un plugin Hikashop. Lors de la création d'un produit et des prix, j'ai cette erreur qui s'affiche :
Code:

0 Attempt to assign property "price_currency_id" on array

Voici mon code : Code:

// Ma classe class PriceModel { public int $price_currency_id; public float $price_value; public int $price_min_quantity; public function __construct() { $this-&gt;price_currency_id = 1; $this-&gt;price_min_quantity = 0; } } $priceHika = new PriceModel; $priceHika-&gt;price_value = $product-&gt;price_ttc;

En utilisant le code disponible ici =&gt; [ www.hikashop.com/support/documentation/6...r-documentation.html](https://www.hikashop.com/support/documentation/62-hikashop-developer-documentation.html) : Code:

$product = new stdClass(); $product-&gt;product_name = 'My product'; $product-&gt;categories = array(17, 18); // an array of category ids linked to the product $price = new stdClass(); $price-&gt;price_currency_id = 1; $price-&gt;price_value = 9.99; $price-&gt;price_min_quantity = 0; $product-&gt;images = array(12, 20); // an array of ids from the hikashop_file table where you store the data of each image // ...etc... $productClass = hikashop_get('class.product'); $success = $productClass-&gt;save($product); if($success) { $productClass-&gt;updateCategories($product, $success); $productClass-&gt;updatePrices($product, $success); $productClass-&gt;updateFiles($product, $success); }

J'ai la même erreur.

Ligne 46 de ma classe "Product" Code:

$hikashopProduct = new hikashopProductClass(); $success = $hikashopProduct-&gt;save($this-&gt;product); if (!empty($this-&gt;product-&gt;prices)) { $hikashopProduct-&gt;updatePrices($this-&gt;product, $success); } // $this-&gt;product est mon objet contenant toutes les informations de mon produit

Voici le tableau de prix qui est dans $this-&gt;product-&gt;prices : Code:

Array ( [0] =&gt; Systrio\Plugins\Hikabarr\Hikashop\Models\PriceModel Object ( [price_currency_id] =&gt; 1 [price_value] =&gt; 16000 [price_min_quantity] =&gt; 0 ) )

Est-ce qu'une personne saurait m'orienter pour régler mon problème ?

D'avance merci,
Bonne journée.

- [ ![Capturedecran2023-04-06a16.59.51.png](/forum/attachment/56832) ](/forum/attachment/56832 "...6a16.59.51.png") [ ](/forum/attachment/56832?download=1 "...6a16.59.51.png")

Last edit: 3 years 6 months ago by [stevenoyer](/forum/user/65905-stevenoyer "View stevenoyer's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUtc3VwcG9ydC1lbi1mcmFuY2Fpcy1mcmVuY2gtc3VwcG9ydC0vOTA2MjA4LXRlbnRhdGl2ZS1kLWFzc2lnbmF0aW9uLWRlLWxhLXByb3ByaWV0ZS1wcmljZS1jdXJyZW5jeS1pZC1zdXItbGUtdGFibGVhdT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86290
- Thank you received: 14268
-
-

3 years 6 months ago [\#350774](#350774) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Tentative d'assignation de la propriété "price\_currency\_id" sur le tableau](/forum/5-support-en-francais-french-support-/906208-tentative-dassignation-de-la-propriete-price-currency-id-sur-le-tableau#350774 "-- HikaShop version -- : 4.6.2 -- Joomla version -- : 4.2.8 -- PHP version -- : 8.2.0 -- Browser(s) name and version -- : Google Chrome 111.0.5563.146 -- Error-message(debug-mod must be tuned on) -- : Attempt to assign property &quot;price&#95;currency&#95;id&quot; on array  Bonjour,  Je suis sur le développement d'un plugin Hikashop. Lors de la création d'un produit et des prix, j'ai cette erreur qui s'affiche :  Voici mon code :  En utilisant le code disponible ici =&gt;   www.hikashop.com/support/documentation/6...r-documentation.html  :  J'ai la même erreur.  Ligne 46 de ma classe &quot;Product&quot;  Voici le tableau de prix qui est dans $this-&gt;product-&gt;prices :  Est-ce qu'une personne saurait m'orienter pour régler mon problème ?  D'avance merci, Bonne journée.")*

Bonjour,

Difficile à dire quoi que ce soit. Pourriez-vous fournir une copie du code complet du plugin ?
En tout cas, le code de la documentation ne génère pas cette erreur.
Le code de la documentation ne fourni même pas de $product-&gt;prices donc l'appel à updatePrices ne va pas généré cette erreur.

The following user(s) said Thank You: [stevenoyer](/forum/user/65905-stevenoyer "View stevenoyer's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUtc3VwcG9ydC1lbi1mcmFuY2Fpcy1mcmVuY2gtc3VwcG9ydC0vOTA2MjA4LXRlbnRhdGl2ZS1kLWFzc2lnbmF0aW9uLWRlLWxhLXByb3ByaWV0ZS1wcmljZS1jdXJyZW5jeS1pZC1zdXItbGUtdGFibGVhdT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[stevenoyer](/forum/user/65905-stevenoyer "View stevenoyer's Profile")**
- [![stevenoyer's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/65905-stevenoyer "View stevenoyer's Profile") Topic Author
- [ Offline](/forum/user/65905-stevenoyer)

Less More

- Posts: 8
- Thank you received: 2
-
-
-

3 years 6 months ago [\#350787](#350787) by [stevenoyer](/forum/user/65905-stevenoyer "View stevenoyer's Profile")  Replied by *[stevenoyer](/forum/user/65905-stevenoyer "View stevenoyer's Profile")* on topic *[Tentative d'assignation de la propriété "price\_currency\_id" sur le tableau](/forum/5-support-en-francais-french-support-/906208-tentative-dassignation-de-la-propriete-price-currency-id-sur-le-tableau#350787 "-- HikaShop version -- : 4.6.2 -- Joomla version -- : 4.2.8 -- PHP version -- : 8.2.0 -- Browser(s) name and version -- : Google Chrome 111.0.5563.146 -- Error-message(debug-mod must be tuned on) -- : Attempt to assign property &quot;price&#95;currency&#95;id&quot; on array  Bonjour,  Je suis sur le développement d'un plugin Hikashop. Lors de la création d'un produit et des prix, j'ai cette erreur qui s'affiche :  Voici mon code :  En utilisant le code disponible ici =&gt;   www.hikashop.com/support/documentation/6...r-documentation.html  :  J'ai la même erreur.  Ligne 46 de ma classe &quot;Product&quot;  Voici le tableau de prix qui est dans $this-&gt;product-&gt;prices :  Est-ce qu'une personne saurait m'orienter pour régler mon problème ?  D'avance merci, Bonne journée.")*

Bonjour Nicolas,

Merci pour votre réponse.

Effectivement je me suis trompé concernant le code de la documentation, je me suis aidé de ce post =&gt; [ www.hikashop.com/forum/install-update/90...-produit-en-php.html](https://www.hikashop.com/forum/install-update/904384-creation-de-produit-en-php.html)

J'ai vu que cette personne avait assigné les prix en procédant ainsi : Code:

$product-&gt;prices = array($price);

Concernant le code du plugin, je vous en fait part sur votre messagerie privée.

Bonne journée.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUtc3VwcG9ydC1lbi1mcmFuY2Fpcy1mcmVuY2gtc3VwcG9ydC0vOTA2MjA4LXRlbnRhdGl2ZS1kLWFzc2lnbmF0aW9uLWRlLWxhLXByb3ByaWV0ZS1wcmljZS1jdXJyZW5jeS1pZC1zdXItbGUtdGFibGVhdT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86290
- Thank you received: 14268
-
-

3 years 6 months ago [\#350788](#350788) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Tentative d'assignation de la propriété "price\_currency\_id" sur le tableau](/forum/5-support-en-francais-french-support-/906208-tentative-dassignation-de-la-propriete-price-currency-id-sur-le-tableau#350788 "-- HikaShop version -- : 4.6.2 -- Joomla version -- : 4.2.8 -- PHP version -- : 8.2.0 -- Browser(s) name and version -- : Google Chrome 111.0.5563.146 -- Error-message(debug-mod must be tuned on) -- : Attempt to assign property &quot;price&#95;currency&#95;id&quot; on array  Bonjour,  Je suis sur le développement d'un plugin Hikashop. Lors de la création d'un produit et des prix, j'ai cette erreur qui s'affiche :  Voici mon code :  En utilisant le code disponible ici =&gt;   www.hikashop.com/support/documentation/6...r-documentation.html  :  J'ai la même erreur.  Ligne 46 de ma classe &quot;Product&quot;  Voici le tableau de prix qui est dans $this-&gt;product-&gt;prices :  Est-ce qu'une personne saurait m'orienter pour régler mon problème ?  D'avance merci, Bonne journée.")*

Rebonjour,

C'est sympa que vous développiez un plugin pour cette plateforme.
Avez-vous intention de le rendre disponible pour d'autres ? J'imagine que d'autres utilisateurs de la communauté Française pourrait être intéressés par ce développement.

Concernant votre problématique sur le prix, le souci vient du code: Code:

if (!empty($this-&gt;getPrices())) { $this-&gt;product-&gt;prices[] = $this-&gt;getPrices(); }

dans la fonction save de votre class Product
getPrices retourne un array de prix et c'est ça que HikaShop n'aime pas.
J'imagine que ce que vous vouliez écrire c'est plutôt: Code:

if (empty($this-&gt;getPrices())) { $this-&gt;product-&gt;prices = $this-&gt;getPrices(); }

The following user(s) said Thank You: [stevenoyer](/forum/user/65905-stevenoyer "View stevenoyer's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUtc3VwcG9ydC1lbi1mcmFuY2Fpcy1mcmVuY2gtc3VwcG9ydC0vOTA2MjA4LXRlbnRhdGl2ZS1kLWFzc2lnbmF0aW9uLWRlLWxhLXByb3ByaWV0ZS1wcmljZS1jdXJyZW5jeS1pZC1zdXItbGUtdGFibGVhdT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[stevenoyer](/forum/user/65905-stevenoyer "View stevenoyer's Profile")**
- [![stevenoyer's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/65905-stevenoyer "View stevenoyer's Profile") Topic Author
- [ Offline](/forum/user/65905-stevenoyer)

Less More

- Posts: 8
- Thank you received: 2
-
-
-

3 years 6 months ago [\#350801](#350801) by [stevenoyer](/forum/user/65905-stevenoyer "View stevenoyer's Profile")  Replied by *[stevenoyer](/forum/user/65905-stevenoyer "View stevenoyer's Profile")* on topic *[Tentative d'assignation de la propriété "price\_currency\_id" sur le tableau](/forum/5-support-en-francais-french-support-/906208-tentative-dassignation-de-la-propriete-price-currency-id-sur-le-tableau#350801 "-- HikaShop version -- : 4.6.2 -- Joomla version -- : 4.2.8 -- PHP version -- : 8.2.0 -- Browser(s) name and version -- : Google Chrome 111.0.5563.146 -- Error-message(debug-mod must be tuned on) -- : Attempt to assign property &quot;price&#95;currency&#95;id&quot; on array  Bonjour,  Je suis sur le développement d'un plugin Hikashop. Lors de la création d'un produit et des prix, j'ai cette erreur qui s'affiche :  Voici mon code :  En utilisant le code disponible ici =&gt;   www.hikashop.com/support/documentation/6...r-documentation.html  :  J'ai la même erreur.  Ligne 46 de ma classe &quot;Product&quot;  Voici le tableau de prix qui est dans $this-&gt;product-&gt;prices :  Est-ce qu'une personne saurait m'orienter pour régler mon problème ?  D'avance merci, Bonne journée.")*

Rebonjour Nicolas,

Votre solution est fonctionnelle et je vous remercie de m'avoir aidé à régler mon problème.
En fonction de l'évolution du projet, il est envisageable qu'il soit rendu disponible pour d'autres. Nous vous tiendrons informés.

Merci pour votre temps,
Bonne journée.

The following user(s) said Thank You: [nicolas](/forum/user/63-nicolas "View nicolas's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUtc3VwcG9ydC1lbi1mcmFuY2Fpcy1mcmVuY2gtc3VwcG9ydC0vOTA2MjA4LXRlbnRhdGl2ZS1kLWFzc2lnbmF0aW9uLWRlLWxhLXByb3ByaWV0ZS1wcmljZS1jdXJyZW5jeS1pZC1zdXItbGUtdGFibGVhdT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop- Install &amp; Update- Product &amp; Category Display- Content Creation- Sales and Orders- - Orders management- - Reports &amp; Statistics- Customers- Checkout- Payment Methods- Shipping Methods- Import &amp; Export (CSV, XLS…)- Specific Features- - Affilation- - Taxes- - Wishlist- - Vote- - Carousel &amp; Slider- - Mass Actions- - Filters &amp; Search- - Discount &amp; Coupon- - Feature Request- Integrations- Showcase- General Talk about HikaShop- Development- - HikaShop 3.0 Beta- Translation- Commercial Jobs HikaShop Components- HikaMarket- - Market: Feature requests- - Market: How to?- - Market: Bug Report- HikaSerial- - General talk about HikaSerial- - Serial: Bug Report- - Serial: How to?- - Support en Français de HikaSerial (French Support)- - HikaSubscription- HikaAuction- - Auction: Feature requests- - Auction: How to?- - Auction: Bug report Hikashop around the world- Support en Français (French Support)- Russian- - FAQ. Курс выживания с Hikashop. Частые вопросы и о- - Расширения Hikashop- - Наши сайты на Hikashop- 日本語版サポート(Japanese Support)- Thai- German Archives- Bug Report- How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.228 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
