- Posts: 26
- Thank you received: 1
Showing characteristics name in cart with value
9 years 10 months ago #258736
by jannick
Showing characteristics name in cart with value was created by jannick
-- HikaShop version -- : 2.6.4
-- Joomla version -- : 3.6.5
-- PHP version -- : 5.6
Hi,
I am trying to show the name of the characteristics along with the value of the characteristic. It's working good when i'm adding different products to the cart. But when i add to products wich are the same(only different custom field or variant) it's not working.
As you can see in the image, every second product from the same type has an empty array:
This is the code i'm using in the cart.php file:
Could you give me a code example how i can bind the name of the characteristics to the value the right way?
Thanks!
-- Joomla version -- : 3.6.5
-- PHP version -- : 5.6
Hi,
I am trying to show the name of the characteristics along with the value of the characteristic. It's working good when i'm adding different products to the cart. But when i add to products wich are the same(only different custom field or variant) it's not working.
As you can see in the image, every second product from the same type has an empty array:
This is the code i'm using in the cart.php file:
Code:
<?php foreach ($row->characteristics as $key => $characteristic) : ?>
<p><?php echo '<strong>'. $this->full_cart->products[$i -1]->characteristics[$characteristic->characteristic_parent_id]->characteristic_value.'</strong>' . ": ".$characteristic->characteristic_value ?></p>
<?php endforeach; ?>
Could you give me a code example how i can bind the name of the characteristics to the value the right way?
Thanks!
Please Log in or Create an account to join the conversation.
9 years 10 months ago - 9 years 10 months ago #258740
by nicolas
Replied by nicolas on topic Showing characteristics name in cart with value
Hi,
I'm not able to reproduce that problem.
If I add the code:
after the code:
in the file "cart" of the view "checkout", I do see the characteristics objects for all the rows of the same product.
I don't get NULL entries, AND I don't get the characteristics names:
pasteboard.co/hDcxh3unW.png
So I don't know what you did in your view, but there must be something wrong with the way you customized it.
I'm not able to reproduce that problem.
If I add the code:
Code:
echo '<pre>';var_dump($row->characteristics);echo '</pre>';
Code:
if($group && $row->cart_product_option_parent_id) continue;
I don't get NULL entries, AND I don't get the characteristics names:
pasteboard.co/hDcxh3unW.png
So I don't know what you did in your view, but there must be something wrong with the way you customized it.
Last edit: 9 years 10 months ago by nicolas.
Please Log in or Create an account to join the conversation.
9 years 10 months ago #258862
by jannick
Replied by jannick on topic Showing characteristics name in cart with value
Hi,
Thanks for the reply.
I have tried to use a fresh view with this modification and it's stil not working. I also do see the characteristics objects and they are not NULL. I want to show the characteristics with their name. To do so i use this line of code:
$this->full_cart->products[$i -1]->characteristics[$characteristic->characteristic_parent_id]->characteristic_value
And this value is empty as explained in my previous message. I have used this post to create this:
www.hikashop.com/forum/4-how-to/53060-di...ame-in-checkout.html
and modified the code a little to make it work.
Thanks for the reply.
I have tried to use a fresh view with this modification and it's stil not working. I also do see the characteristics objects and they are not NULL. I want to show the characteristics with their name. To do so i use this line of code:
$this->full_cart->products[$i -1]->characteristics[$characteristic->characteristic_parent_id]->characteristic_value
And this value is empty as explained in my previous message. I have used this post to create this:
www.hikashop.com/forum/4-how-to/53060-di...ame-in-checkout.html
and modified the code a little to make it work.
The following user(s) said Thank You: Mohamed Thelji
Please Log in or Create an account to join the conversation.
Time to create page: 0.064 seconds