Skip to main content
deleted 1653 characters in body
Source Link

I want to add "laba cena" (attribute) in catalog price rule dropdown I am using data patch but its not working

<?php
namespace Devall\SpecialPrice\Setup\Patch\Data;

use Magento\Eav\Setup\EavSetup;
use Magento\Eav\Setup\EavSetupFactory;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\Patch\DataPatchInterface;

class AddLabaCenaAttribute implements DataPatchInterface
{
/** @var ModuleDataSetupInterface */
private $moduleDataSetup;

/** @var EavSetupFactory */
private $eavSetupFactory;

/**
 * @param ModuleDataSetupInterface $moduleDataSetup
 * @param EavSetupFactory $eavSetupFactory
 */
public function __construct(
    ModuleDataSetupInterface $moduleDataSetup,
    EavSetupFactory $eavSetupFactory
) {
    $this->moduleDataSetup = $moduleDataSetup;
    $this->eavSetupFactory = $eavSetupFactory;
}

/**
 * {@inheritdoc}
 */
public function apply()
{
    /** @var EavSetup $eavSetup */
    $eavSetup = $this->eavSetupFactory->create(['setup' => $this->moduleDataSetup]);

    $eavSetup->addAttribute('catalog_product', 'laba_cena', [
        'type' => 'string',
        'label' => 'laba cena',
        'input' => 'select',
        'used_in_product_listing' => true,
        'user_defined' => true,
    ]);
}

/**
 * {@inheritdoc}
 */
public static function getDependencies()
{
    return [];
}

public static function getVersion()
{
    return '1.0.1';
}


/**
 * {@inheritdoc}
 */
public function getAliases()
{
    return [];
}
}

any tips?

now using `<?php namespace Devall\SpecialPrice\Setup\Patch\Data;

 <?php
 namespace Devall\SpecialPrice\Setup\Patch\Data;

  use Magento\Framework\Setup\Patch\DataPatchInterface;
  use Magento\Eav\Setup\EavSetup;

      class AddLabaCenaAttribute implements DataPatchInterface
     {
   protected $eavSetupFactory;

public function __construct( EavSetup $eavSetupFactory)
{
    $this->eavSetupFactory = $eavSetupFactory;
}

/**
 * @inheritDoc
 */
public static function getDependencies()
{
    return [];
}

/**
 * @inheritDoc
 */
public function getAliases()
{
    return [];
}

/**
 * @inheritDoc
 */
public function apply()
{
    $this->eavSetupFactory->updateAttribute(4,184,'is_used_for_promo_rules',1,null);
}

      }`

still no success .

I want to add "laba cena" (attribute) in catalog price rule dropdown I am using data patch but its not working

<?php
namespace Devall\SpecialPrice\Setup\Patch\Data;

use Magento\Eav\Setup\EavSetup;
use Magento\Eav\Setup\EavSetupFactory;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\Patch\DataPatchInterface;

class AddLabaCenaAttribute implements DataPatchInterface
{
/** @var ModuleDataSetupInterface */
private $moduleDataSetup;

/** @var EavSetupFactory */
private $eavSetupFactory;

/**
 * @param ModuleDataSetupInterface $moduleDataSetup
 * @param EavSetupFactory $eavSetupFactory
 */
public function __construct(
    ModuleDataSetupInterface $moduleDataSetup,
    EavSetupFactory $eavSetupFactory
) {
    $this->moduleDataSetup = $moduleDataSetup;
    $this->eavSetupFactory = $eavSetupFactory;
}

/**
 * {@inheritdoc}
 */
public function apply()
{
    /** @var EavSetup $eavSetup */
    $eavSetup = $this->eavSetupFactory->create(['setup' => $this->moduleDataSetup]);

    $eavSetup->addAttribute('catalog_product', 'laba_cena', [
        'type' => 'string',
        'label' => 'laba cena',
        'input' => 'select',
        'used_in_product_listing' => true,
        'user_defined' => true,
    ]);
}

/**
 * {@inheritdoc}
 */
public static function getDependencies()
{
    return [];
}

public static function getVersion()
{
    return '1.0.1';
}


/**
 * {@inheritdoc}
 */
public function getAliases()
{
    return [];
}
}

any tips?

now using `<?php namespace Devall\SpecialPrice\Setup\Patch\Data;

    use Magento\Framework\Setup\Patch\DataPatchInterface;
  use Magento\Eav\Setup\EavSetup;

      class AddLabaCenaAttribute implements DataPatchInterface
     {
   protected $eavSetupFactory;

public function __construct( EavSetup $eavSetupFactory)
{
    $this->eavSetupFactory = $eavSetupFactory;
}

/**
 * @inheritDoc
 */
public static function getDependencies()
{
    return [];
}

/**
 * @inheritDoc
 */
public function getAliases()
{
    return [];
}

/**
 * @inheritDoc
 */
public function apply()
{
    $this->eavSetupFactory->updateAttribute(4,184,'is_used_for_promo_rules',1,null);
}

      }`

still no success .

I want to add "laba cena" (attribute) in catalog price rule dropdown I am using data patch but its not working

any tips?

now using

 <?php
 namespace Devall\SpecialPrice\Setup\Patch\Data;

  use Magento\Framework\Setup\Patch\DataPatchInterface;
  use Magento\Eav\Setup\EavSetup;

      class AddLabaCenaAttribute implements DataPatchInterface
     {
   protected $eavSetupFactory;

public function __construct( EavSetup $eavSetupFactory)
{
    $this->eavSetupFactory = $eavSetupFactory;
}

/**
 * @inheritDoc
 */
public static function getDependencies()
{
    return [];
}

/**
 * @inheritDoc
 */
public function getAliases()
{
    return [];
}

/**
 * @inheritDoc
 */
public function apply()
{
    $this->eavSetupFactory->updateAttribute(4,184,'is_used_for_promo_rules',1,null);
}

      }`

still no success .

added 866 characters in body
Source Link

I want to add "laba cena" (attribute) in catalog price rule dropdown I am using data patch but its not working

<?php
namespace Devall\SpecialPrice\Setup\Patch\Data;

use Magento\Eav\Setup\EavSetup;
use Magento\Eav\Setup\EavSetupFactory;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\Patch\DataPatchInterface;

class AddLabaCenaAttribute implements DataPatchInterface
{
/** @var ModuleDataSetupInterface */
private $moduleDataSetup;

/** @var EavSetupFactory */
private $eavSetupFactory;

/**
 * @param ModuleDataSetupInterface $moduleDataSetup
 * @param EavSetupFactory $eavSetupFactory
 */
public function __construct(
    ModuleDataSetupInterface $moduleDataSetup,
    EavSetupFactory $eavSetupFactory
) {
    $this->moduleDataSetup = $moduleDataSetup;
    $this->eavSetupFactory = $eavSetupFactory;
}

/**
 * {@inheritdoc}
 */
public function apply()
{
    /** @var EavSetup $eavSetup */
    $eavSetup = $this->eavSetupFactory->create(['setup' => $this->moduleDataSetup]);

    $eavSetup->addAttribute('catalog_product', 'laba_cena', [
        'type' => 'string',
        'label' => 'laba cena',
        'input' => 'select',
        'used_in_product_listing' => true,
        'user_defined' => true,
    ]);
}

/**
 * {@inheritdoc}
 */
public static function getDependencies()
{
    return [];
}

public static function getVersion()
{
    return '1.0.1';
}


/**
 * {@inheritdoc}
 */
public function getAliases()
{
    return [];
}
}

any tips?

now using `<?php namespace Devall\SpecialPrice\Setup\Patch\Data;

    use Magento\Framework\Setup\Patch\DataPatchInterface;
  use Magento\Eav\Setup\EavSetup;

      class AddLabaCenaAttribute implements DataPatchInterface
     {
   protected $eavSetupFactory;

public function __construct( EavSetup $eavSetupFactory)
{
    $this->eavSetupFactory = $eavSetupFactory;
}

/**
 * @inheritDoc
 */
public static function getDependencies()
{
    return [];
}

/**
 * @inheritDoc
 */
public function getAliases()
{
    return [];
}

/**
 * @inheritDoc
 */
public function apply()
{
    $this->eavSetupFactory->updateAttribute(4,184,'is_used_for_promo_rules',1,null);
}

      }`

still no success .

I want to add "laba cena" (attribute) in catalog price rule dropdown I am using data patch but its not working

<?php
namespace Devall\SpecialPrice\Setup\Patch\Data;

use Magento\Eav\Setup\EavSetup;
use Magento\Eav\Setup\EavSetupFactory;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\Patch\DataPatchInterface;

class AddLabaCenaAttribute implements DataPatchInterface
{
/** @var ModuleDataSetupInterface */
private $moduleDataSetup;

/** @var EavSetupFactory */
private $eavSetupFactory;

/**
 * @param ModuleDataSetupInterface $moduleDataSetup
 * @param EavSetupFactory $eavSetupFactory
 */
public function __construct(
    ModuleDataSetupInterface $moduleDataSetup,
    EavSetupFactory $eavSetupFactory
) {
    $this->moduleDataSetup = $moduleDataSetup;
    $this->eavSetupFactory = $eavSetupFactory;
}

/**
 * {@inheritdoc}
 */
public function apply()
{
    /** @var EavSetup $eavSetup */
    $eavSetup = $this->eavSetupFactory->create(['setup' => $this->moduleDataSetup]);

    $eavSetup->addAttribute('catalog_product', 'laba_cena', [
        'type' => 'string',
        'label' => 'laba cena',
        'input' => 'select',
        'used_in_product_listing' => true,
        'user_defined' => true,
    ]);
}

/**
 * {@inheritdoc}
 */
public static function getDependencies()
{
    return [];
}

public static function getVersion()
{
    return '1.0.1';
}


/**
 * {@inheritdoc}
 */
public function getAliases()
{
    return [];
}
}

any tips?

I want to add "laba cena" (attribute) in catalog price rule dropdown I am using data patch but its not working

<?php
namespace Devall\SpecialPrice\Setup\Patch\Data;

use Magento\Eav\Setup\EavSetup;
use Magento\Eav\Setup\EavSetupFactory;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\Patch\DataPatchInterface;

class AddLabaCenaAttribute implements DataPatchInterface
{
/** @var ModuleDataSetupInterface */
private $moduleDataSetup;

/** @var EavSetupFactory */
private $eavSetupFactory;

/**
 * @param ModuleDataSetupInterface $moduleDataSetup
 * @param EavSetupFactory $eavSetupFactory
 */
public function __construct(
    ModuleDataSetupInterface $moduleDataSetup,
    EavSetupFactory $eavSetupFactory
) {
    $this->moduleDataSetup = $moduleDataSetup;
    $this->eavSetupFactory = $eavSetupFactory;
}

/**
 * {@inheritdoc}
 */
public function apply()
{
    /** @var EavSetup $eavSetup */
    $eavSetup = $this->eavSetupFactory->create(['setup' => $this->moduleDataSetup]);

    $eavSetup->addAttribute('catalog_product', 'laba_cena', [
        'type' => 'string',
        'label' => 'laba cena',
        'input' => 'select',
        'used_in_product_listing' => true,
        'user_defined' => true,
    ]);
}

/**
 * {@inheritdoc}
 */
public static function getDependencies()
{
    return [];
}

public static function getVersion()
{
    return '1.0.1';
}


/**
 * {@inheritdoc}
 */
public function getAliases()
{
    return [];
}
}

any tips?

now using `<?php namespace Devall\SpecialPrice\Setup\Patch\Data;

    use Magento\Framework\Setup\Patch\DataPatchInterface;
  use Magento\Eav\Setup\EavSetup;

      class AddLabaCenaAttribute implements DataPatchInterface
     {
   protected $eavSetupFactory;

public function __construct( EavSetup $eavSetupFactory)
{
    $this->eavSetupFactory = $eavSetupFactory;
}

/**
 * @inheritDoc
 */
public static function getDependencies()
{
    return [];
}

/**
 * @inheritDoc
 */
public function getAliases()
{
    return [];
}

/**
 * @inheritDoc
 */
public function apply()
{
    $this->eavSetupFactory->updateAttribute(4,184,'is_used_for_promo_rules',1,null);
}

      }`

still no success .

Source Link

new attribute for catalog price rule

I want to add "laba cena" (attribute) in catalog price rule dropdown I am using data patch but its not working

<?php
namespace Devall\SpecialPrice\Setup\Patch\Data;

use Magento\Eav\Setup\EavSetup;
use Magento\Eav\Setup\EavSetupFactory;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\Patch\DataPatchInterface;

class AddLabaCenaAttribute implements DataPatchInterface
{
/** @var ModuleDataSetupInterface */
private $moduleDataSetup;

/** @var EavSetupFactory */
private $eavSetupFactory;

/**
 * @param ModuleDataSetupInterface $moduleDataSetup
 * @param EavSetupFactory $eavSetupFactory
 */
public function __construct(
    ModuleDataSetupInterface $moduleDataSetup,
    EavSetupFactory $eavSetupFactory
) {
    $this->moduleDataSetup = $moduleDataSetup;
    $this->eavSetupFactory = $eavSetupFactory;
}

/**
 * {@inheritdoc}
 */
public function apply()
{
    /** @var EavSetup $eavSetup */
    $eavSetup = $this->eavSetupFactory->create(['setup' => $this->moduleDataSetup]);

    $eavSetup->addAttribute('catalog_product', 'laba_cena', [
        'type' => 'string',
        'label' => 'laba cena',
        'input' => 'select',
        'used_in_product_listing' => true,
        'user_defined' => true,
    ]);
}

/**
 * {@inheritdoc}
 */
public static function getDependencies()
{
    return [];
}

public static function getVersion()
{
    return '1.0.1';
}


/**
 * {@inheritdoc}
 */
public function getAliases()
{
    return [];
}
}

any tips?