Get item custom field values in onBeforeCartUpdate

  • Posts: 13
  • Thank you received: 0
9 years 1 month ago #217592

-- HikaShop version -- : 2.6.6
-- Joomla version -- : 3.4.4
-- PHP version -- : 5.6.13
-- Browser(s) name and version -- : safari
-- Error-message(debug-mod must be tuned on) -- : N/A

I have products set up with item custom fields which are then used to create a custom file. I need to access those custom fields as the product is being put in the cart so that the image that is displayed in the cart reflects the item values the customer entered for the product.

so far in a plugin on an onBeforeCartUpdate event function I have:

$productClass = hikashop_get('class.product');
$product = $productClass->get($product_id);
var_dump($product);

which displays a lot of product fields but not the item custom values that the user entered before clicking "Add to Cart".

In my onBeforeCartUpdate function, how do I access the item custom values the customer selected?

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 1 month ago #217606

Hi,

If you load the product ; you will load the "product" custom fields.
If you want to access to the "item" custom fields ; you should load the "order product" ; but that's not needed when you have the order object (from a "loadFullCart" because the item custom fields are already loaded there).

Regardsn


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

Time to create page: 0.053 seconds
Powered by Kunena Forum