Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Variables
product_downloadable_with_files.php File Reference

Go to the source code of this file.

Variables

 $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
 
 $product = $objectManager->create(\Magento\Catalog\Model\Product::class)
 
 $sampleFactory = $objectManager->create(\Magento\Downloadable\Api\Data\SampleInterfaceFactory::class)
 
 $linkFactory = $objectManager->create(\Magento\Downloadable\Api\Data\LinkInterfaceFactory::class)
 
 $downloadableData
 
 $extension = $product->getExtensionAttributes()
 
 $links = []
 
 $linkData
 
 $link = $linkFactory->create(['data' => $linkData])
 
 $content = $objectManager->create(\Magento\Downloadable\Api\Data\File\ContentInterfaceFactory::class)->create()
 
 $sampleContent = $objectManager->create(\Magento\Downloadable\Api\Data\File\ContentInterfaceFactory::class)->create()
 
if(! $link->getSortOrder()) if(null===$link->getPrice()) if($link->getIsUnlimited()) $links [] = $link
 
if($product->getLinksPurchasedSeparately()) else
 
 $stockRegistry = $objectManager->get(\Magento\CatalogInventory\Api\StockRegistryInterface::class)
 
 $stockItem = $stockRegistry->getStockItem($product->getId())
 

Variable Documentation

◆ $content

$content = $objectManager->create(\Magento\Downloadable\Api\Data\File\ContentInterfaceFactory::class)->create()

Definition at line 82 of file product_downloadable_with_files.php.

◆ $downloadableData

$downloadableData
Initial value:
= [
'sample' => [
[
'is_delete' => 0,
'sample_id' => 0,
'title' => 'Downloadable Product Sample Title',
'file' => json_encode(
[
[
'file' => '/f/u/jellyfish_1_4.jpg',
'name' => 'jellyfish_1_4.jpg',
'size' => 1024,
'status' => 0,
],
]
),
'sample_url' => null,
'sort_order' => '0',
],
],
]

Definition at line 16 of file product_downloadable_with_files.php.

◆ $extension

$extension = $product->getExtensionAttributes()

Definition at line 58 of file product_downloadable_with_files.php.

◆ $link

$link = $linkFactory->create(['data' => $linkData])

Definition at line 75 of file product_downloadable_with_files.php.

◆ $linkData

$linkData
Initial value:
= [
'product_id' => 1,
'sort_order' => '0',
'title' => 'Downloadable Product Link',
'sample' => [
'url' => null,
],
'link_url' => null,
'is_delete' => 0,
'number_of_downloads' => 15,
'price' => 15.00,
]

Definition at line 60 of file product_downloadable_with_files.php.

◆ $linkFactory

$linkFactory = $objectManager->create(\Magento\Downloadable\Api\Data\LinkInterfaceFactory::class)

Definition at line 14 of file product_downloadable_with_files.php.

◆ $links [1/2]

$links = []

Definition at line 59 of file product_downloadable_with_files.php.

◆ $links [2/2]

if (! $link->getSortOrder()) if (null===$link->getPrice()) if ( $link->getIsUnlimited()) $links[] = $link

Definition at line 113 of file product_downloadable_with_files.php.

◆ $objectManager

Definition at line 8 of file product_downloadable_with_files.php.

◆ $product

$product = $objectManager->create(\Magento\Catalog\Model\Product::class)

Definition at line 12 of file product_downloadable_with_files.php.

◆ $sampleContent

$sampleContent = $objectManager->create(\Magento\Downloadable\Api\Data\File\ContentInterfaceFactory::class)->create()

Definition at line 93 of file product_downloadable_with_files.php.

◆ $sampleFactory

$sampleFactory = $objectManager->create(\Magento\Downloadable\Api\Data\SampleInterfaceFactory::class)

Definition at line 13 of file product_downloadable_with_files.php.

◆ $stockItem

$stockItem = $stockRegistry->getStockItem($product->getId())

Definition at line 159 of file product_downloadable_with_files.php.

◆ $stockRegistry

$stockRegistry = $objectManager->get(\Magento\CatalogInventory\Api\StockRegistryInterface::class)

Definition at line 158 of file product_downloadable_with_files.php.

◆ else

if ( $product->getLinksPurchasedSeparately()) else
Initial value:
{
$product->setTypeHasRequiredOptions(false)->setRequiredOptions(false)

Definition at line 153 of file product_downloadable_with_files.php.