Skip to content

how to load product store wise? #1246

Closed
@sivajik34

Description

@sivajik34

i think in ProductRepository class following function will load product store wise by given sku.but store_id not using any where.how to load product store wise?
Actually i want set product status website wise.
for example 1 product included in 2 websites.and i want set product status in first website enable.in second website disable.
public function get($sku, $editMode = false, $storeId = null, $forceReload = false)
{
$cacheKey = $this->getCacheKey(func_get_args());
if (!isset($this->instances[$sku][$cacheKey]) || $forceReload) {
$product = $this->productFactory->create();

        $productId = $this->resourceModel->getIdBySku($sku);
        if (!$productId) {
            throw new NoSuchEntityException(__('Requested product doesn\'t exist'));
        }
        if ($editMode) {
            $product->setData('_edit_mode', true);
        }
        $product->load($productId);
        $this->instances[$sku][$cacheKey] = $product;
        $this->instancesById[$product->getId()][$cacheKey] = $product;
    }
    return $this->instances[$sku][$cacheKey];
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions