गहरी खुदाई करते समय, मुझे एहसास हुआ कि eav_entity_type.increment_per_storeयह मददगार हो सकता है।
यह है। लेकिन केवल उस मामले के लिए, जब आप समान ऑर्डर संख्या सीमा साझा करने के लिए अपने Magento इंस्टॉलेशन के लिए सभी स्टोर व्यूज (विश्व स्तर पर, चाहे वे किसी भी वेबसाइट में परिभाषित किए गए हों) चाहते हैं increment_id।
यह मेरे विशिष्ट मुद्दे को हल नहीं करता है, लेकिन शायद यह कुछ अन्य लोगों के लिए उपयोगी है, इसलिए यहां हम जाते हैं:
अपने क्रम संख्या के वैश्विक बंटवारे को सक्रिय करने के eav_entity_type.increment_per_storeलिए 0, आदेश इकाई के लिए सेट करें
यह ऑर्डर इकाई के रिकॉर्ड को लोड Mage_Eav_Model_Entity_Type::fetchNewIncrementId()करते store_id = 0समय उपयोग करने की ओर जाता है eav_entity_store, कोई फर्क नहीं पड़ता कि यह वास्तव में किस स्टोर को देखता है।
यदि ऐसा कोई रिकॉर्ड मौजूद नहीं है, तो Magento एक, प्रयोग store_idऔर increment_prefixका निर्माण करता है 0।
public function fetchNewIncrementId($storeId = null)
{
if (!$this->getIncrementModel()) {
return false;
}
if (!$this->getIncrementPerStore() || ($storeId === null)) {
/**
* store_id null we can have for entity from removed store
*/
$storeId = 0;
}
// Start transaction to run SELECT ... FOR UPDATE
$this->_getResource()->beginTransaction();
$entityStoreConfig = Mage::getModel('eav/entity_store')
->loadByEntityStore($this->getId(), $storeId);
if (!$entityStoreConfig->getId()) {
$entityStoreConfig
->setEntityTypeId($this->getId())
->setStoreId($storeId)
->setIncrementPrefix($storeId)
->save();
}
$incrementInstance = Mage::getModel($this->getIncrementModel())
->setPrefix($entityStoreConfig->getIncrementPrefix())
->setPadLength($this->getIncrementPadLength())
->setPadChar($this->getIncrementPadChar())
->setLastId($entityStoreConfig->getIncrementLastId())
->setEntityTypeId($entityStoreConfig->getEntityTypeId())
->setStoreId($entityStoreConfig->getStoreId());
/**
* do read lock on eav/entity_store to solve potential timing issues
* (most probably already done by beginTransaction of entity save)
*/
$incrementId = $incrementInstance->getNextId();
$entityStoreConfig->setIncrementLastId($incrementId);
$entityStoreConfig->save();
// Commit increment_last_id changes
$this->_getResource()->commit();
return $incrementId;
}
यह उपयोग कर किसी भी इकाई प्रकार के लिए काम करना चाहिए eav/entity_increment_numericमॉडल, जैसे order, invoice, shipmentऔर creditmemo।
हालांकि जागरूक रहें, कि मुझे increment_per_storeअभी तक कोई आधिकारिक दस्तावेज नहीं मिला। और यह कि आपको इसे कॉन्फ़िगर करने की अनुमति देने वाले Magento बैकएंड में कोई विकल्प नहीं है।
इसका मतलब यह हो सकता है या नहीं, कि यह आधिकारिक तौर पर इस्तेमाल करने के लिए नहीं सोचा गया है।
अपने जोखिम पार इस्तेमाल करें। यदि आपके परिवर्तन कहर बरपाते हैं, तो मुझे दोष न दें। आपको ^ ^ चेतावनी दी गई है