Skip to content

Commit b309ea7

Browse files
authored
Merge pull request #596 from magefan/11501-issue-during-categories-import-wp
11501-issue-during-categories-import-wp
2 parents ef5e8d0 + 40b7130 commit b309ea7

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Model/ResourceModel/Category.php

+6-5
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object)
114114
*/
115115
protected function _afterSave(\Magento\Framework\Model\AbstractModel $object)
116116
{
117-
$oldStoreIds = $this->lookupStoreIds($object->getId());
117+
$oldStoreIds = $this->lookupStoreIds($object->getId(), false);
118118
$newStoreIds = (array)$object->getStoreIds();
119119
if (!$newStoreIds || in_array(0, $newStoreIds)) {
120120
$newStoreIds = [0];
@@ -254,12 +254,13 @@ public function checkIdentifier($identifier, $storeIds)
254254
/**
255255
* Get store ids to which specified item is assigned
256256
*
257-
* @param int $categoryId
258-
* @return array
257+
* @param $categoryId
258+
* @param bool $useCache
259+
* @return array|mixed
259260
*/
260-
public function lookupStoreIds($categoryId)
261+
public function lookupStoreIds($categoryId, $useCache = true)
261262
{
262-
if (null === self::$allStoreIds) {
263+
if (null === self::$allStoreIds || !$useCache) {
263264
$adapter = $this->getConnection();
264265

265266
$select = $adapter->select()->from(

0 commit comments

Comments
 (0)