- Posts: 76
- Thank you received: 2
How to access product details using PHP?
- jberry210490
-
Topic Author
- Offline
Less
More
13 years 3 months ago #107988
by jberry210490
How to access product details using PHP? was created by jberry210490
Hi there,
I have products which are sold in different weights. I have created a weight characteristic to be used for these products and it all works fine.
The cost per kg decreases if you by larger weights. I want to show the saving made by choosing larger weights.
I would know how to do this (I think) by editing the view file "product show" if I could just work out how to get the following quantities from the hikashop system using php code:
The idea being I could extract a numeric quantity from the "charactersitic value" string, find the smallest of these values, find the price corresponding to that value and put them into to a little calculation with the currently selected variant details to show how much money they have saved by selecting a greater weight.
Does anyone know enough about the hikashop system to work out how to get hold of these values in the "product show" view file? Or if I've missed a piece of documentation, please point me to it...
Jonathan
I have products which are sold in different weights. I have created a weight characteristic to be used for these products and it all works fine.
The cost per kg decreases if you by larger weights. I want to show the saving made by choosing larger weights.
I would know how to do this (I think) by editing the view file "product show" if I could just work out how to get the following quantities from the hikashop system using php code:
- The currently selected variant price.
- The currently selected variant characteristic value.
- The available variants charactersitic values
- The price of a variant with a given charactersitic value
The idea being I could extract a numeric quantity from the "charactersitic value" string, find the smallest of these values, find the price corresponding to that value and put them into to a little calculation with the currently selected variant details to show how much money they have saved by selecting a greater weight.
Does anyone know enough about the hikashop system to work out how to get hold of these values in the "product show" view file? Or if I've missed a piece of documentation, please point me to it...
Jonathan
Please Log in or Create an account to join the conversation.
13 years 3 months ago #108023
by nicolas
Replied by nicolas on topic How to access product details using PHP?
Hi,
All the information of the product is available in the $this->element variable in the show.php view file.
So you can do a var_dump on that variable to see what it contains and how to access what you need.
We actually have a simplified version here:
www.hikashop.com/en/support/documentation/157
It actually doesn't contain the characteristic data in it.
All the information of the product is available in the $this->element variable in the show.php view file.
So you can do a var_dump on that variable to see what it contains and how to access what you need.
We actually have a simplified version here:
www.hikashop.com/en/support/documentation/157
It actually doesn't contain the characteristic data in it.
The following user(s) said Thank You: jberry210490
Please Log in or Create an account to join the conversation.
- jberry210490
-
Topic Author
- Offline
Less
More
- Posts: 76
- Thank you received: 2
13 years 3 months ago #108303
by jberry210490
Replied by jberry210490 on topic How to access product details using PHP?
Thanks Nicolas,
Exactly what I needed. Got my little "saving box" to work now.
Jonathan
Exactly what I needed. Got my little "saving box" to work now.
Jonathan
Please Log in or Create an account to join the conversation.
Time to create page: 0.149 seconds