Add a field in product class

  • Posts: 4
  • Thank you received: 0
10 years 8 months ago #147814

Hi to everybody,
I'm making a customized plugin for hikashop and I'm wondering to know how to add a key in the product array. I need this additional field for a project I'm involved to. It will be shown in Checkout Cart view.

Can I do it catching hte onAfterCartProductLoad event? And how?

Thank you so much in advance

-- HikaShop version -- : 2.3
-- Joomla version -- : 3.2

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 8 months ago #147854

Hi,

Yes, you can add it in there. Something like that:

function onAfterCartProductLoad(&$cart){
foreach($cart->products as $k => $p){
 $cart->products[$k]->my_field = 'my_value';
}
}

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

Time to create page: 0.054 seconds
Powered by Kunena Forum