getLastId(); if (strpos($lastId, $this->getPrefix()) === 0) { $lastId = substr($lastId, strlen($this->getPrefix())); } $lastId = str_pad((string)$lastId, $this->getPadLength(), $this->getPadChar(), STR_PAD_LEFT); $nextId = ''; $bumpNextChar = true; $chars = $this->getAllowedChars(); $lchars = strlen($chars); $lid = strlen($lastId) - 1; for ($i = $lid; $i >= 0; $i--) { $p = strpos($chars, $lastId[$i]); if (false === $p) { throw new \Magento\Framework\Exception\LocalizedException( __('Invalid character encountered in increment ID: %1', $lastId) ); } if ($bumpNextChar) { $p++; $bumpNextChar = false; } if ($p === $lchars) { $p = 0; $bumpNextChar = true; } $nextId = $chars[$p] . $nextId; } return $this->format($nextId); } }