- Posts: 10
- Thank you received: 0
Getting Product Details of Variant
11 years 8 months ago - 11 years 8 months ago #185456
by philipp
Getting Product Details of Variant was created by philipp
-- HikaShop version -- : latest
-- Joomla version -- : latest
-- PHP version -- : latest
-- Browser(s) name and version -- : ff latest
Hello Everybody,
I am about to create a tiny cart module. Its working quiete well so far, but there are some things that I cannot figure out…
I am loading the Products on the Cart as described here ( www.hikashop.com/support/support/documen...umentation.html#code ):
That returns the Products from the cart, and the parent product (the products I am dealing with are variants), what is cool so far, but I would like to retrieve the COMPLETE name of the product, which should include the variant names.
For Example:
I have a Main Product, with two charackteristics: size and color. That product has the name »canUcodeIt«. Now, in the cart, there is one of its variants and I would like to display the name like this:
canUcodeIt-XL-RED
BUT even If can get »canUcodeIt« from the parent product, how can I get the details of the variant?
How can I get the Price? It is not included in the Data Object…
Thanks in Ahead!
-- Joomla version -- : latest
-- PHP version -- : latest
-- Browser(s) name and version -- : ff latest
Hello Everybody,
I am about to create a tiny cart module. Its working quiete well so far, but there are some things that I cannot figure out…
I am loading the Products on the Cart as described here ( www.hikashop.com/support/support/documen...umentation.html#code ):
Code:
//If you want to get a list of the products in the cart, you can use the code :
$cartClass = hikashop_get('class.cart');
$productsArray = $cartClass->get();
/*
Note that if the current cart has no products, the cart will be deleted. So you would have to re-init it after that call with the line:
*/
$cartClass->initCart();
That returns the Products from the cart, and the parent product (the products I am dealing with are variants), what is cool so far, but I would like to retrieve the COMPLETE name of the product, which should include the variant names.
For Example:
I have a Main Product, with two charackteristics: size and color. That product has the name »canUcodeIt«. Now, in the cart, there is one of its variants and I would like to display the name like this:
canUcodeIt-XL-RED
BUT even If can get »canUcodeIt« from the parent product, how can I get the details of the variant?
How can I get the Price? It is not included in the Data Object…
Thanks in Ahead!
Last edit: 11 years 8 months ago by philipp.
Please Log in or Create an account to join the conversation.
11 years 8 months ago #185587
by Xavier
Replied by Xavier on topic Getting Product Details of Variant
Hi,
You should use $cartClass->loadFullCart(); instead of $cartClass->get();
This will give you all the details needed.
For the product name, the easiest way is to edit the variants and set a name for each of them.
But if you have a big range of products I understand that the code is the fastest way
You should use $cartClass->loadFullCart(); instead of $cartClass->get();
This will give you all the details needed.
For the product name, the easiest way is to edit the variants and set a name for each of them.
But if you have a big range of products I understand that the code is the fastest way
Please Log in or Create an account to join the conversation.
11 years 8 months ago #185607
by philipp
Replied by philipp on topic Getting Product Details of Variant
would be fine if this would have been mentioned in the documentation…
Please Log in or Create an account to join the conversation.
Time to create page: 0.177 seconds