Hi,
In the userpoints plugin, to get the product quantity we are using
if(isset($product->order_product_quantity))
$product_price *= (int)$product->order_product_quantity;
else
$product_price *= (int)$product->cart_product_quantity;
So we are sure to always get the product quantity when we are dealing with a cart (during the checkout) and with an order (when the order is made).
Otherwise, the object "$product" is coming from the cart/order ; so you do not have access to the product custom field; you have data from the "item custom fields" and element in the table "hikashop_order_item".
If you want to access to product custom field, you will need to load the products from the database.
The variable $product_ids contains all id of the products ; so you can perform a query to load the data from the table "product" and then check the value of the custom field.
Something like (raw code / untested)
$query = 'SELECT * FROM '. hikashop_table('product') . ' WHERE product_id IN ('.implode(',', $product_ids).')';
$db->setQuery($query);
$full_products = $db->loadObjectList('product_id');
/* ... */
if(isset($full_products[ $product->product_id ])) {
$product_points = (int)@$full_products[ $product->product_id ];
if($product_points > 0)
$points += $product_points * (int)( isset($product->order_product_quantity) ? $product->order_product_quantity : $product->cart_product_quantity );
}
Regards,