我想重新给发票编号。重新编号的内容如下。
我想要发票ID的格式:INV-10001-2014
INV-00001-13;INV-00002-13;O-00003-13;[发票为'INV',数字为5位;"-";当前年份。明年该编号应在14位结束(从2014年开始)。
您可以通过编辑以下类别自定义订单/发票/信用备忘录/装运编号(increment_id):
Mage_Eav_Model_Entity_Increment_Numeric
特别是,仔细查看以下方法的代码:
getNextId()、getPrefix()、getPadLength()、format($id)
现在,您将找不到方法getPrefix()、getPadLength()的方法定义,因为它们是神奇的getter方法。你可以根据自己的愿望来定义这些方法。
例如:
public function getPrefix(){
$prefix = $this->_getData('prefix');
/* Do some customization */
return $prefix;
}
public function getPadLength()
{
$padLength = $this->_getData('pad_length');
/* Do some customization */
return $padLength;
}
这样,您就不必手动更改数据库结构中的任何内容。
希望这对你有帮助。
您可以使用事件sales_order_invoice_save_before
设置自定义发票编号
在你的观测者方法中使用
$invoice = $observer->getInvoice();
$newInvoiceId = 'Your new Invoice id'
$invoice->setIncrementId($newInvoiceId);
您可以通过此链接获得帮助
http://www.warpconduit.net/2012/04/18/how-to-change-the-order-increment-id-and-prefix-in-magento/
http://www.magentocommerce.com/magento-connect/aschroder-set-custom-order-number.html