Display characteristics name in checkout

  • Posts: 13
  • Thank you received: 0
11 years 10 months ago #53060

Hi,
I was wondering, if one could get to display characteristics name and value in checkout cart just like the custom item fields?
When I print_r($row) in checkout/cart.php view, I can see there is characteristics array. But that array has only characteristics id's and not names.
So the question is - how do I get characteristics names in that array?

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

  • Posts: 13201
  • Thank you received: 2322
11 years 10 months ago #53161

Hi LVlidbiters,

Try with that in a column:

foreach($row->characteristics as $characteristic){
	echo $characteristic->characteristic_value;
}

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

  • Posts: 81597
  • Thank you received: 13081
  • MODERATOR
11 years 10 months ago #53237

The characteristics values are displayed automatically if you turn on the "append characteristic values to product name" option of the Display tab of the configuration.
There is also a span with a CSS class around them so that you can personnalize the style of the values.

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

  • Posts: 13
  • Thank you received: 0
11 years 10 months ago #53240

No, you didn't understand me correctly.
I want to display characteristics value along with its name. For example, if a shirt is sold and its characteristic is size, then I want them to display in the checkout table like this:
Shirt, Size: L. By default I can only get Shirt L. I need "size" to be displayed also.

And no, can not use custom item fields for this.

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

  • Posts: 81597
  • Thank you received: 13081
  • MODERATOR
11 years 10 months ago #53242

In that case, you could either turn off the option and do like Xavier says and customize that checkout/cart.php view file,

or you could edit the file administrator/components/com_hikashop/classes/product.php and change the code there to have the characteristic name added.

Option one is preferable to avoid modifying the core code of HikaShop.

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

  • Posts: 13
  • Thank you received: 0
11 years 10 months ago #53245

Thanks, but like I said in my first post, there are only characteristic values in that array in checkout/cart.php view available.
So the only option for me is the second one.

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

  • Posts: 81597
  • Thank you received: 13081
  • MODERATOR
11 years 10 months ago #53246

In $row->characteristics yes, but in the $rows array, you should find additional entries for the main products info which should include the characteristics name. Then, you would have to cross reference the $row->characteristic_parent_id and the characteristic_id of the characteristics in the main product in order to get the names.

The following user(s) said Thank You: LVlidbiters

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

  • Posts: 13
  • Thank you received: 0
11 years 10 months ago #53247

Oh, thanks! This should really help me :)

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

  • Posts: 9
  • Thank you received: 1
10 years 3 months ago #139264

This did the trick for me:
<?php foreach($row->characteristics as $characteristic){
echo "<br /><span class='characteristic'>".$this->orderInfos->products[$i-1]->characteristics[$characteristic->characteristic_parent_id]->characteristic_value.": ".$characteristic->characteristic_value."</span>";
} ?>
Maybe it will help somebody.

The following user(s) said Thank You: nicolas

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

  • Posts: 81597
  • Thank you received: 13081
  • MODERATOR
7 years 5 days ago #268375

Hi,

For anyone reading this topic. The modification is now different with HikaShop 3 :
www.hikashop.com/forum/checkout/889971-d...checkout.html#268355

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

Time to create page: 0.084 seconds
Powered by Kunena Forum