PHP code example of solutiondrive / sylius-product-bundles-plugin

1. Go to this page and download the library: Download solutiondrive/sylius-product-bundles-plugin library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

solutiondrive / sylius-product-bundles-plugin example snippets


$bundleCreator = $container->get('solutiondrive.product_bundles.product_bundle_creator');


$slotOptionsFactory = new solutionDrive\SyliusProductBundlesPlugin\Factory\ProductBundleSlotOptionsFactory();

$hatSlotOptions = $slotOptionsFactory->createNewWithValues(1, 'TopHats');

$shirtSlotOptions = $slotOptionsFactory->createNewWithValues(2, 'Shirts', ['someAdditionalOption' => 'AndItsValue']);

$bundleCreator->createProductBundle('YourAwesomeBundle', $prductRepresentationOfTheBundle);
$bundleCreator->addSlot('YourAwsomeHats', $hatSlotOptions, $hatsToAssignToSlot);
$bundleCreator->addSlot('YourAwsomeShirts', $shirtSlotOptions, $shirtsToAssignToSlot);

$productBundle = $bundleCreator->getProductBundle();