Can get product name,id,etc...?

  • Posts: 25
  • Thank you received: 1
6 years 11 months ago #267104

Hello guys ! I have a question, can i get the product name,id,etc for my customize product component for hikashop i have tested

$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.

  • Posts: 25994
  • Thank you received: 4004
  • MODERATOR
6 years 11 months ago #267107

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,


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.

  • Posts: 25
  • Thank you received: 1
6 years 11 months ago #267150

--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.

Last edit: 6 years 11 months ago by Krok.

Please Log in or Create an account to join the conversation.

  • Posts: 81379
  • Thank you received: 13037
  • MODERATOR
6 years 11 months ago #267152

Hi,

Well, the code:

$product_id =2;
$products = hikashop_get('class.product');
$product=$products->get(product_id);
echo $product->product_weight;
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:
echo round($product->product_weight);
will actually display 1.

Please Log in or Create an account to join the conversation.

Time to create page: 0.062 seconds
Powered by Kunena Forum