本文整理匯總了PHP中Magento\CatalogImportExport\Model\Import\Product::getProductWebsites方法的典型用法代碼示例。如果您正苦於以下問題:PHP Product::getProductWebsites方法的具體用法?PHP Product::getProductWebsites怎麽用?PHP Product::getProductWebsites使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\CatalogImportExport\Model\Import\Product
的用法示例。
在下文中一共展示了Product::getProductWebsites方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: populateGlobalProduct
/**
* Populate global product
*
* @param \Magento\Catalog\Model\Product $product
* @return $this
*/
protected function populateGlobalProduct($product)
{
foreach ($this->import->getProductWebsites($product->getSku()) as $websiteId) {
foreach ($this->websitesToStoreIds[$websiteId] as $storeId) {
$this->storesCache[$storeId] = true;
if (!$this->isGlobalScope($storeId)) {
$this->addProductToImport($product, $storeId);
}
}
}
return $this;
}
示例2: populateGlobalProduct
/**
* Populate global product
*
* @param \Magento\CatalogImportExport\Model\Import\Product $product
* @return $this
*/
protected function populateGlobalProduct($product)
{
foreach ($this->import->getProductWebsites($product->getSku()) as $websiteId) {
foreach ($this->websitesToStoreIds[$websiteId] as $storeId) {
$this->storesCache[$storeId] = true;
if (!$this->isGlobalScope($storeId)) {
$this->addProductToImport($product, $storeId);
$this->entityStoresToCheckOverridden[] = $this->connection->quoteInto('(store_id = ?', $storeId) . $this->connection->quoteInto(' AND entity_id = ?)', $product->getId());
}
}
}
return $this;
}
示例3: testGetProductWebsites
/**
* Cover getProductWebsites().
*/
public function testGetProductWebsites()
{
$productSku = 'productSku';
$productValue = ['key 1' => 'val', 'key 2' => 'val', 'key 3' => 'val'];
$expectedResult = array_keys($productValue);
$this->setPropertyValue($this->importProduct, 'websitesCache', [$productSku => $productValue]);
$actualResult = $this->importProduct->getProductWebsites($productSku);
$this->assertEquals($expectedResult, $actualResult);
}