PHP code example of vbpupil / product

1. Go to this page and download the library: Download vbpupil/product 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/ */

    

vbpupil / product example snippets


$prod = new SimpleProduct(
    'Iphone X',
    new Collection()
);

$prod->setLive(true);

$prod->setSlug('iphone-x'); //defines urls safe string

$prod->setDescription(
    '<p>The iPhone X, pronounced "iPhone 10," was introduced at Apple\'s September 2017 event as a classic "One more thing...".</p>',
    'long_description');

echo $prod->getItem('long_description');

foreach ($prod->getItems() as $desc) {
    echo $desc;
}

$prod->setVariations(
        new Collection()
    );

    $myVariation = new \vbpupil\Variation\AbstractVariation(
            [
                'title' => 'FFF',
                'product_code' => 'MYPRODCODE-01'
            ]
        );
    
    $prod->variations->addItem($v);

$a = new Auditable(
            2,
            AuditableType::SALE(),
            'Sold',
            '2019-08-22 14:42:20',
            AuditableAssociatedDocumentType::SALES_ORDER(),
            115
        )

$a = new Auditable(
            2,
            AuditableType::SALE(),
            'Sold',
            '2019-08-22 14:42:20',
            AuditableAssociatedDocumentType::SALES_ORDER(),
            115
        )