Hook: beforeAddToCart
Bevor ein Produkt in den Warenkorb gelegt wurde
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | /* * -- 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 ; } |