Showing characteristics name in cart with value

  • Posts: 26
  • Thank you received: 1
7 years 10 months ago #258736

-- 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:
<?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!

Attachments:

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
7 years 10 months ago #258740

Hi,

I'm not able to reproduce that problem.
If I add the code:

echo '<pre>';var_dump($row->characteristics);echo '</pre>';
after the code:
if($group && $row->cart_product_option_parent_id) continue;
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.

Attachments:
Last edit: 7 years 10 months ago by nicolas.

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

  • Posts: 26
  • Thank you received: 1
7 years 10 months ago #258862

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.

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.067 seconds
Powered by Kunena Forum