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

Go to the source code of this file.

Variables

 $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
 
 $simpleProducts []
 
 $productRepository = $objectManager->get(Magento\Catalog\Api\ProductRepositoryInterface::class)
 
 $product = $objectManager->create(\Magento\Catalog\Model\Product::class)
 
 $bundleOptions = []
 
 $bundleOptionsQty = []
 
foreach($product->getExtensionAttributes() ->getBundleProductOptions() as $option) $buyRequest
 
 $addressData = include __DIR__ . '/address_data.php'
 
 $billingAddress = $objectManager->create(\Magento\Quote\Model\Quote\Address::class, ['data' => $addressData])
 
 $shippingAddress = clone $billingAddress
 
 $quote = $objectManager->create(\Magento\Quote\Model\Quote::class)
 
 $rate = $objectManager->create(\Magento\Quote\Model\Quote\Address\Rate::class)
 
 $quoteIdMask = $objectManager->create(\Magento\Quote\Model\QuoteIdMaskFactory::class)->create()
 

Variable Documentation

◆ $addressData

$addressData = include __DIR__ . '/address_data.php'

Definition at line 171 of file quote_with_bundle.php.

◆ $billingAddress

$billingAddress = $objectManager->create(\Magento\Quote\Model\Quote\Address::class, ['data' => $addressData])

Definition at line 172 of file quote_with_bundle.php.

◆ $bundleOptions

$bundleOptions = []

Definition at line 153 of file quote_with_bundle.php.

◆ $bundleOptionsQty

$bundleOptionsQty = []

Definition at line 154 of file quote_with_bundle.php.

◆ $buyRequest

foreach ( $product->getExtensionAttributes() ->getBundleProductOptions() as $option) $buyRequest
Initial value:
= new \Magento\Framework\DataObject(
['qty' => 1, 'bundle_option' => $bundleOptions, 'bundle_option_qty' => $bundleOptionsQty]
)
$bundleOptions
$bundleOptionsQty

Definition at line 166 of file quote_with_bundle.php.

◆ $objectManager

Definition at line 7 of file quote_with_bundle.php.

◆ $product

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

Definition at line 40 of file quote_with_bundle.php.

◆ $productRepository

$productRepository = $objectManager->get(Magento\Catalog\Api\ProductRepositoryInterface::class)

Definition at line 36 of file quote_with_bundle.php.

◆ $quote

$quote = $objectManager->create(\Magento\Quote\Model\Quote::class)

Definition at line 180 of file quote_with_bundle.php.

◆ $quoteIdMask

$quoteIdMask = $objectManager->create(\Magento\Quote\Model\QuoteIdMaskFactory::class)->create()

Definition at line 203 of file quote_with_bundle.php.

◆ $rate

$rate = $objectManager->create(\Magento\Quote\Model\Quote\Address\Rate::class)

Definition at line 191 of file quote_with_bundle.php.

◆ $shippingAddress

$shippingAddress = clone $billingAddress

Definition at line 176 of file quote_with_bundle.php.

◆ $simpleProducts

$simpleProducts[]
Initial value:
= $objectManager->create(\Magento\Catalog\Model\Product::class)
->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE)
->setAttributeSetId(4)
->setWebsiteIds([1])
->setName('Simple Product 1')
->setSku('simple-1')
->setPrice(10)
->setDescription('Description with <b>html tag</b>')
->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH)
->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED)
->setCategoryIds([2])
->setStockData(['use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, 'is_in_stock' => 1])
->save()
$objectManager

Create simple and bundle products for quote

Definition at line 9 of file quote_with_bundle.php.