- Posts: 25
- Thank you received: 1
Can get product name,id,etc...?
9 years 5 months ago #267104
by Krok
Can get product name,id,etc...? was created by Krok
Hello guys ! I have a question, can i get the product name,id,etc for my customize product component for hikashop i have tested
but this code display "1.000";
Can i have help pls.
Code:
$product_id =2;
$products = hikashop_get('class.product');
$product=$products->get(product_id);
echo $product->product_wieght;
but this code display "1.000";
Can i have help pls.
Please Log in or Create an account to join the conversation.
9 years 5 months ago #267107
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Replied by Jerome on topic Can get product name,id,etc...?
Hello,
I think you are using "product_weight" and not "product_wieght".
Most of the product information can be used directly ; but for some parts, like the dimensions and the weight, you need to handle also the "unit".
That's why in HikaShop you can find some classes/helper to display or convert it.
What do you want to do exactly ?
www.hikashop.com/support/documentation/6...ocumentation.html#db
Regards,
I think you are using "product_weight" and not "product_wieght".
Most of the product information can be used directly ; but for some parts, like the dimensions and the weight, you need to handle also the "unit".
That's why in HikaShop you can find some classes/helper to display or convert it.
What do you want to do exactly ?
www.hikashop.com/support/documentation/6...ocumentation.html#db
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Please Log in or Create an account to join the conversation.
9 years 5 months ago - 9 years 5 months ago #267150
by Krok
Replied by Krok on topic Can get product name,id,etc...?
--English version--
Hello Jerome, i would like create a product customization component that work with hikashop, in first time i would like get all product for display his in my component administrator panel, and add a function in this panel for add "customize" button in selected product, in the third time i would like to display the "customize" buttom in the products selected by the administrator. I have already the backend system. Thx for you reply. Have a nice day.
(Sorry for my english, i use google traduction because i'm french and i have small difficulty in english )
--Version française--
Bonjour Jerome, je voudrais créer un composant de customization de produit qui marche avec hikashop, dans un premier temps je voudrais récupérer tout les produits et les afficher dans la page administrateur de mon composant, dans un second temps je voudrai pourvoir ajouter un bouton de customization sur des produits choisis par l'admin (ce qui explique pourquoi je dois recup les produits). et modifier le prix en fonction de la customization apporté.Merci pour votre réponse aussi rapide.
Hello Jerome, i would like create a product customization component that work with hikashop, in first time i would like get all product for display his in my component administrator panel, and add a function in this panel for add "customize" button in selected product, in the third time i would like to display the "customize" buttom in the products selected by the administrator. I have already the backend system. Thx for you reply. Have a nice day.
(Sorry for my english, i use google traduction because i'm french and i have small difficulty in english )
--Version française--
Bonjour Jerome, je voudrais créer un composant de customization de produit qui marche avec hikashop, dans un premier temps je voudrais récupérer tout les produits et les afficher dans la page administrateur de mon composant, dans un second temps je voudrai pourvoir ajouter un bouton de customization sur des produits choisis par l'admin (ce qui explique pourquoi je dois recup les produits). et modifier le prix en fonction de la customization apporté.Merci pour votre réponse aussi rapide.
Last edit: 9 years 5 months ago by Krok.
Please Log in or Create an account to join the conversation.
9 years 5 months ago #267152
by nicolas
Replied by nicolas on topic Can get product name,id,etc...?
Hi,
Well, the code:
is fine. It's normal that it displays 1.000 if you have entered 1 for the weight of your product since the weight is stored as a decimal with three digits in the database.
If it's not want you want then you'll have to convert the value to something else.
For example:
will actually display 1.
Well, the code:
Code:
$product_id =2;
$products = hikashop_get('class.product');
$product=$products->get(product_id);
echo $product->product_weight;
If it's not want you want then you'll have to convert the value to something else.
For example:
Code:
echo round($product->product_weight);
Please Log in or Create an account to join the conversation.
Time to create page: 0.176 seconds