2012-11-28 72 views
3

我需要修改我的默认发票号码从1000000012012 - 00001Magento - 自定义发票号码

我知道我在哪里可以找到increment_last_id在表eav_entity_store。但我不知道我必须设置哪种格式的发票号码。

请帮助一些建议。

回答

1

您可以通过编辑下面的类定制订单/发票/贷记通知单/出货数(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; 
} 

这样,您就不必在数据库结构手动改变任何东西此实现。

希望这会帮助你。

0

更改发票编号的最好办法是下面这个简单的SQL查询来运行:

  1. 检查发票纪录eav_entity_store表通过运行下面的查询

    SELECT * FROM eav_entity_store其中entity_type_id在(存在从eav_entity_type中选择entity_type_id,其中entity_type_code ='invoice');

  2. 如果不存在任何记录,请从magento后端创建一个虚拟发票。然后,你将有一个记录表中,现在运行下面的脚本:

    更新eav_entity_store设置increment_last_id = “YOUR_DESIRED_INVOICE_ID”,increment_prefix = 'X-',其中entity_type_id中(从eav_entity_type选择entity_type_id其中entity_type_code = '发票')

尝试了这一点,并创建新的发票:

更新eav_entity_store设置increment_last_id = “0001”,increment_prefix = '2002',其中entity_type_id中(从eav_entity_type选择entity_type_id其中entity_type_code = '发票')

http://deepakbhatta.com/magento-set-custom-invoice-id/

这对我来说很好。

谢谢