original_string: public function generate($pattern, array $options = array())
      {
          $options += array('store_id' => null, 'placeholders' => array());
  
          $result = null;
          $this->hook->attach('sku.generate.before', $pattern, $options, $result);
  
          if (isset($result)) {
              return (string) $result;
          }
  
          $sku = $pattern;
          if (!empty($options['placeholders'])) {
              $sku = gplcart_string_replace($pattern, $options['placeholders'], $options);
          }
  
          $result = $this->getUnique(mb_strimwidth($sku, 0, 200, ''), $options['store_id']);
          $this->hook->attach('sku.generate.after', $pattern, $options, $result);
          return $result;
      }
code: public function generate($pattern, array $options = array())
      {
          $options += array('store_id' => null, 'placeholders' => array());
  
          $result = null;
          $this->hook->attach('sku.generate.before', $pattern, $options, $result);
  
          if (isset($result)) {
              return (string) $result;
          }
  
          $sku = $pattern;
          if (!empty($options['placeholders'])) {
              $sku = gplcart_string_replace($pattern, $options['placeholders'], $options);
          }
  
          $result = $this->getUnique(mb_strimwidth($sku, 0, 200, ''), $options['store_id']);
          $this->hook->attach('sku.generate.after', $pattern, $options, $result);
          return $result;
      }
code_tokens: public function generate ( $ pattern , array $ options = array ( ) ) { $ options += array ( 'store_id' => null , 'placeholders' => array ( ) ) ; $ result = null ; $ this -> hook -> attach ( 'sku.generate.before' , $ pattern , $ options , $ result ) ; if ( isset ( $ result ) ) { return ( string ) $ result ; } $ sku = $ pattern ; if ( ! empty ( $ options [ 'placeholders' ] ) ) { $ sku = gplcart_string_replace ( $ pattern , $ options [ 'placeholders' ] , $ options ) ; } $ result = $ this -> getUnique ( mb_strimwidth ( $ sku , 0 , 200 , '' ) , $ options [ 'store_id' ] ) ; $ this -> hook -> attach ( 'sku.generate.after' , $ pattern , $ options , $ result ) ; return $ result ; }
docstring: Generates a SKU
  @param string $pattern
  @param array $options
  @return string
docstring_tokens: Generates a SKU