<?php

declare(strict_types=1);

namespace App\Model;

use Contao\Model;

/**
 * add properties for IDE support
 *
 * @property string $not_buyable
 */
class Standard extends \Isotope\Model\Product\Standard
{
    public function generate(array $arrConfig)
    {

        $arrButtons = array();
        foreach ($arrConfig['buttons'] as $button)
        {
            if ($button == 'add_to_cart' && $this->not_buyable)
            {
                continue;
            }
            $arrButtons[] = $button;
        }
        $arrConfig['buttons'] = $arrButtons;

        return parent::generate($arrConfig);
    }
}
