7 require
__DIR__ .
'/../../../Magento/Catalog/_files/products.php';
20 ->setAttributeSetId(4)
22 ->setName(
'Bundle Product')
23 ->setSku(
'bundle-product')
24 ->setVisibility(\
Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH)
25 ->setStatus(\
Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED)
26 ->setStockData([
'use_config_manage_stock' => 1,
'qty' => 100,
'is_qty_decimal' => 0,
'is_in_stock' => 1])
31 ->setBundleOptionsData(
34 'title' =>
'Bundle Product Items',
35 'default_title' =>
'Bundle Product Items',
41 'title' =>
'Bundle Product Items Option 2',
42 'default_title' =>
'Bundle Product Items Option 2',
49 ->setBundleSelectionsData(
55 'selection_can_change_qty' => 1,
63 'selection_can_change_qty' => 1,
70 if (
$product->getBundleOptionsData()) {
80 $bundleLinks =
$product->getBundleSelectionsData();
81 if (!empty($bundleLinks[$key])) {
82 foreach ($bundleLinks[$key] as
$linkData) {
88 $link->setSku($linkProduct->getSku());
90 if (isset(
$linkData[
'selection_can_change_qty'])) {
91 $link->setCanChangeQuantity(
$linkData[
'selection_can_change_qty']);
135 if (
$option->isMultiSelection()) {
136 $optionsData[
$option->getId()] = array_column($selectionsCollection->toArray(),
'product_id');
174 $orderItem->setBasePrice($selectedProduct->getPrice());
175 $orderItem->setPrice($selectedProduct->getPrice());
176 $orderItem->setRowTotal($selectedProduct->getPrice());
177 $orderItem->setProductType($selectedProduct->getTypeId());
184 $order->setIncrementId(
'100000001');
186 $order->setStatus(
$order->getConfig()->getStateDefaultStatus(\
Magento\Sales\Model\Order::STATE_NEW));
187 $order->setCustomerIsGuest(
true);
189 $order->setCustomerFirstname(
'firstname');
190 $order->setCustomerLastname(
'lastname');
202 $order->setBaseSubtotal(100);
203 $order->setBaseGrandTotal(100);
defined('TESTS_BP')||define('TESTS_BP' __DIR__
foreach($optionCollection as $option) $requestInfo
static getObjectManager()