0

I have total 10 multi-store in a single domain, when customer ordering from different store invoice increment Id and Prefix is creating different. but I want only two different invoice type, prefix "1" for store id 6 and all other store prefix's should be same like '19' and all increment id should be same.

10 different store but invoice should be only two types.

Is there any good solution, highly appreciated.

thanks

4

1 回答 1

0
You are require to follow below steps to do this:

1) - In the /Namespace/Module/etc/config.xml you have to write the following thing: 

 <config>
    <modules>
        <Namespace_Module>
            <version>0.1.0</version>
        </Namespace_Module>
    </modules>
    <global>
        <models>
            <eav>
                <rewrite>
                    <entity_store>Namespace_Module_Model_Entity_Store</entity_store>
                </rewrite>
            </eav>
        </models>
    </global>
</config> 

2) - Register module in magento module list under app/etc/modules/Namespace_Module.xml
    <config>
        <modules>
        <Namespace_Module>
            <active>true</active>
            <codePool>local</codePool>
            <depends />
        </Namespace_Module>
        </modules>
    </config>
3) - You have to copy the same code under /Mage/Eav/Model/Entity/Store.php into your file under /Namespace/Module/Model/Entity/Store.php.

4) Edit your Store.php file:  Please find below code 
 public function loadByEntityStore($entityTypeId, $storeId)
    {
        $this->_getResource()->loadByEntityStore($this, $entityTypeId, 1);//1 is your default store_id
        return $this;
    }

Replace it with below code

public function loadByEntityStore($entityTypeId, $storeId)
    {
        $this->_getResource()->loadByEntityStore($this, $entityTypeId, 1);//1 is your default store_id
        return $this;

    if($storeId==6){//6==StoreID
        $this->_getResource()->loadByEntityStore($this, $entityTypeId, 1);//1 is your default store_id
    }else{
        $this->_getResource()->loadByEntityStore($this, $entityTypeId, 19);
    } 
    }


Hope this will work for you. :)
Best of luck.


Below is the solution for all Store view. In this solution all store Ids will be same.

Find in app/code/mage/sales/model/entity/setup.php the following piece of code: 

 'invoice' => array(
                'entity_model'      => 'sales/order_invoice',
                'table'             =>'sales/order_entity',
                'increment_model' =>'eav/entity_increment_numeric',
                'increment_per_store'=>false, 

and chance 

 'increment_per_store'=>false 

To

 'increment_per_store'=>true 
于 2014-01-29T09:43:28.220 回答