$val ) { $permutation = null; if ( isset( $val['parent_id'] ) and (int)$val['parent_id'] and isset( $val['product-id'] ) ) $permutation = \shop\Product::get_product_permutation_hash( (int)$val['product-id'] ); if ( !$permutation and isset( $val['attributes'] ) and is_array( $val['attributes'] ) and count( $val['attributes'] ) ) $permutation = implode( '|', $val['attributes'] ); $quantity_options = \shop\Product::get_product_permutation_quantity_options( $val['parent_id'] ? $val['parent_id'] : $val['product-id'], $permutation ); if ( (int)$basket[ $key ][ 'quantity' ] < 1 and ( (int)$quantity_options['quantity'] > 0 or (int)$quantity_options['stock_0_buy'] === 1 ) ) { $basket[ $key ][ 'quantity' ] = 1; $result = true; } if ( ( $val[ 'quantity' ] > $quantity_options['quantity'] ) and !$quantity_options['stock_0_buy'] ) { $basket[ $key ][ 'quantity' ] = $quantity_options['quantity']; if ( $message ) \S::error( 'Ilość jednego lub więcej produktów została zmniejszona z powodu niestarczających stanów magazynowych. Sprawdź proszę koszyk.' ); $result = true; } } \S::set_session( 'basket', $basket ); return $result; } public function __get( $variable ) { if ( array_key_exists( $variable, $this -> data ) ) return $this -> $variable; } public function __set( $variable, $value ) { $this -> $variable = $value; } public function offsetExists( $offset ) { return isset( $this -> $offset ); } public function offsetGet( $offset ) { return $this -> $offset; } public function offsetSet( $offset, $value ) { $this -> $offset = $value; } public function offsetUnset( $offset ) { unset( $this -> $offset ); } }