문제

나는 (역사적인 이유로) ID가 1, 3, 4, 7인 4개의 서로 다른 매장 뷰를 갖춘 매장(Magento CE 1.6.2)을 운영하고 있습니다.주문 번호는 10000001, 30000001, 40000001, 70000001과 같습니다.

Magento CE 1.9.1을 사용하여 새로운 설치를 설정했지만 이제 스토어 ID는 1, 2, 3, 4...입니다.

이전 상황에서 이것을 어떻게 바꾸나요?

이 글을 접하게 되었습니다 --> http://www.thevortexcode.com/how-to-change-order-prefix-and-default-value-of-ordershipmentinvoice-numbercredit-memo-in-magento/ 설정/변경 방법을 설명합니다. eav_entity_store.increment_prefix

하지만 1.9에서는 작동하지 않는 것 같습니다 ...

도움이 되었습니까?

해결책

상점 ID를 편집하세요. store_id 열의 core_store 데이터베이스 테이블.외래 키로 인해 거의 모든 다른 테이블에서 업데이트됩니다.

또한 다음을 업데이트해야 합니다.

  • default_store_idcore_store_group 테이블

언급한 대로 실제 데이터베이스 ID를 변경하는 것은 다소 급진적입니다.또한 여전히 업데이트해야 합니다. eav_entity_store 테이블.

따라서 증분 ID에 대해 매장별 구성을 간단히 설정할 수도 있습니다.다음에서 이 작업을 수행할 수 있습니다. eav_entity_store 테이블:

  • 매장 ID 1의 경우 increment_prefix 1로
  • 매장 ID 2의 경우 increment_prefix 3으로
  • 매장 ID 3의 경우 increment_prefix 4까지
  • 매장 ID 4의 경우 increment_prefix 7까지

다른 팁

원시 SQL 문이 아닌 모델 래퍼를 더 잘 사용합니다.

예 :

$productEntityType = Mage::getModel('eav/entity_type')
    ->loadByCode(Mage_Catalog_Model_Product::ENTITY);
$entityStoreConfig = Mage::getModel('eav/entity_store')
    ->loadByEntityStore($productEntityType->getId(), 0);
$entityStoreConfig->setEntityTypeId($productEntityType->getId())
    ->setStoreId(0)
    ->setIncrementPrefix($prefix)
    ->setIncrementLastId($lastId)
    ->save();
.

보기 :

다른 이유로 여러 번 이렇게해야했습니다. 이는 내가하는 일입니다 :

이 쿼리는 Entity_Type_Code= Order

에 대한 증분 ID를 보여줍니다.
SELECT * FROM  eav_entity_store join eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
WHERE eav_entity_type.entity_type_code='order';
.

업데이트하려는 행을 찾으면 다음과 같이 변경할 수 있습니다.

UPDATE eav_entity_store
INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
SET eav_entity_store.increment_prefix='X'
WHERE eav_entity_type.entity_type_code='order' and eav_entity_store.eav_entity_store_id = {row_id_here};
.

incrment_last_id의 값은 이미 increment_prefix를 포함하므로 일반적으로 incrment_last_id에서 새 주문 증가 ID가 좋아 보이므로 increment_last_id에서 이전 Eccement_prefix를 제거합니다.

예약 increment_order_id가있는 따옴표가있는 경우 오래된 increment_id 과 함께 주문을 볼 수 있습니다. 업데이트 후에 새 따옴표를 생성하기 시작하면 모두 괜찮을 것입니다.

일반적으로 개발 환경에서 INCREMENT_ID를 업데이트 한 후 is_active= 0 에 대한 모든 인용문을 설정합니다.

자세한 내용은 여기를 확인하십시오 : http://www.warpconduit.net/2012/04/18/how-to-change-the-iner-increment-id-and-prefix-in-magento/

나는 정말로 Magento DB로 직접 쿼리를 사용하지 않으려 고합니다.가능한 경우 설치 또는 업그레이드 스크립트가있는 간단한 모듈을 만듭니다.예를 들어 아래의 스크립트를 사용하여 증분 ID 및 증분 접두사를 변경할 수 있습니다.

<?php

    $this->startSetup();

    /*
     * Get the resource model
    */
    $resource = Mage::getSingleton('core/resource');

    /*
    * Retrieve the write connection
    */
    $writeConnection = $resource->getConnection('core_write');

   /*
    * Retrieve our table name
    */
    $table = $resource->getTableName('eav/entity_store');

    $table2=$resource->getTableName('eav/entity_type');


    $query = "UPDATE {$table}
    INNER JOIN {$table2} ON {$table2}.entity_type_id ={$table}.entity_type_id
    SET {$table}.increment_last_id='XXXXXXXXX'
    WHERE {$table2}.entity_type_code='order' AND eav_entity_store.store_id = 'Y'";

   /*
   * Execute the query
   */
   $writeConnection->query($query);

   $this->endSetup();
.

여기서 xxxxxxxxx는 시작하려는 증분 ID이고 y를 수행하려는 상점 ID가됩니다.

실제 접두사를 변경하려면 아래의 쿼리를 사용하십시오.

        $query = "UPDATE {$table}
    INNER JOIN {$table2} ON {$table2}.entity_type_id ={$table}.entity_type_id
    SET {$table}.increment_prefix='X'
    WHERE {$table2}.entity_type_code='order' AND eav_entity_store.store_id = 'Y'";
.

여기서 x는 사용하려는 접두사이고 y를 사용하려는 SOTRE ID가됩니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top