Hook: beforeAddToCart

Bevor ein Produkt in den Warenkorb gelegt wurde

/*
 * -- Registration: --
 * $GLOBALS['MERCONIS_HOOKS']['beforeAddToCart'][] = array('myMerconisHookClass', 'myBeforeAddToCart');
 *
 * -- Invocation: --
 * Before adding a new cart item to the cart
 *
 * -- Parameters: --
 *	1. $arrItemInfoToAddToCart - the item info that will be added to the cart and that can be manipulated with this hook
 *	2. $objProductOrVariant - the product or variant object
 *  
 * -- Return value: --
 * $arrItemInfoToAddToCart - the possibly manipulated item info that will be put to the cart
 *
 * -- Objective: --
 * e.g. add specific information to a cart item, for example to use this information with a custom logic for detecting
 * the scale price quantity
 *
 */

public function myBeforeAddToCart($arrItemInfoToAddToCart, $objProductOrVariant) {

	/*
	 * Example: Add the product code to the cart item information. This
	 * could be used in the hook "getScalePriceQuantity" to change the way
	 * the scale price quantity is calculated. For example, all cart items
	 * with the same product code prefix could be grouped.
	 */
	
	$arrItemInfoToAddToCart['productCode'] = $objProductOrVariant->_code;
	
	return $arrItemInfoToAddToCart;
}