Making a user configurable light array to change functions

i’ve got the basics of my code working but I can’t for the life of me figure out how to turn the lights into an array so the user can drag in whatever lights they want in the inspector.

I gather I need to turn the whole thing into a gameobject or something along those lines but im really not a coder and am working mostly off copypasta. The problem with turning them into a gameobject is unity doesn’t seem to like that for lights so i’m at an impasse 🙂

using System.Collections; using System.Collections.Generic; using UnityEngine;  public class headlight : MonoBehaviour  {     public Light headlights;      // Start is called before the first frame update     void Start()     {         headlights = GetComponent<Light>();     }      // Update is called once per frame     void Update()     {         if (Input.GetKeyDown(KeyCode.L))         {             headlights.enabled = !headlights.enabled;         }      } } 

About import configurable product by csv in Magento 2

I want import configurable product by csv in Magento 2.

My csv like this.

sku,product_type,configurable_variations,configurable_variation_labels 2100,configurable,"sku=2100-50,size=50|sku=2100-6062,size=6062|sku=2100-5658,size=5658",size=Size 

When run import, magento show OK, but it not show in product, type product not change from simple to configurable. How to import it? Please help me. Thanks all.

Magento 2.x How to allow children of Configurable Products to have Custom Options?

In Magento 2.x, core functionality does not allow you to set Custom Options on child products belonging to a Configurable Product. If you attempt to set a custom option on such a child product (which in Magento 2.x is a Virtual Product), it is removed from the parent Configurable Product when you save it.

Are there any known workarounds to this limitation? Any help in writing custom code to support this in Configurable Products would be appreciated. Thanks.

Configurable products import doesn’t work configurable_variations not imported

I am trying to import configurable products using a script. All products imported successfully but child product is not associated with the parent in case of configurable. Please check below script & attached CSV.

$  this->eavConfig->clear();     $  importModel = $  this->importModel;     $  importModel->setData(         [             'entity' => 'catalog_product',             'behavior' => 'append',             'import_images_file_dir' => 'pub/media/catalog/product',             Import::FIELD_NAME_VALIDATION_STRATEGY =>                 ProcessingErrorAggregatorInterface::VALIDATION_STRATEGY_SKIP_ERRORS         ]     );      $  source = $  this->csvSourceFactory->create(         [             'file' => 'Setup/fixtures/product.csv',             'directory' => $  this->readFactory->create(                 $  this->componentRegistrar->getPath(ComponentRegistrar::MODULE, 'Custom_Catalog')             )         ]     );      $  currentPath = getcwd();     chdir(BP);     $  importModel->validateSource($  source);       try {         $  this->importModel->importSource();     } catch (\Exception $  e) {          $  e->getMessage();     }      chdir($  currentPath);      $  this->eavConfig->clear(); 

enter image description here My observations on the above code are as below 1)If I put qty more than 1 2)If I run the above script 2 times it is working.

configurable prices shows 0 on category page when MSI enabled + magento 2

Configurable product price showing 0 instead of showing minimum price on category page When MSI enabled. As I found that It is happening due to stock configuration ie. if display out of stock configuration set to no then price is showing correctly. But I need display out of stock product.

When I start the reindex process it is talking lot of time with MSI enabled. And interestingly, it min_price and max_price of configurable products is 0.

I have gone through this link but no luck : https://github.com/magento/magento2/issues/22516

Any help would be much appreciated.

Filter Options value when creation configurable product magento 2

I have a custom attribute that i will create my product configurable according to it and every product has his specific values so i want to filter the options when creation product to just show me the associated option of this product. I tried this via Ui/DataProvider Modifier but nothing changed i still see all the options an d not filtered ones: Here is my code

namespace Vendor\MyModule\Ui\DataProvider\Product\Form\Modifier;

use Magento\Catalog\Api\Data\ProductAttributeInterface; use Magento\Catalog\Model\Locator\LocatorInterface; use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier; use Magento\Framework\Stdlib\ArrayManager; use Magento\Framework\UrlInterface; use Magento\Ui\Component\Form\Field;

/** * Data provider for “Custom Attribute” field of product page */ class PrixVente extends AbstractModifier { //const SUGGEST_FILTER_URI = ‘Mdweb_ConfigAttribute/something/suggestCustomAttr’;

/**  * @param LocatorInterface $  locator  * @param UrlInterface $  urlBuilder  * @param ArrayManager $  arrayManager  */ protected $  eavConfig; protected $  registry;  public function __construct(     LocatorInterface $  locator,     UrlInterface $  urlBuilder,     ArrayManager $  arrayManager,     \Magento\Eav\Model\Config $  eavConfig,     \Magento\Framework\Registry $  registry ) {     $  this->locator = $  locator;     $  this->urlBuilder = $  urlBuilder;     $  this->arrayManager = $  arrayManager;     $  this->_eavConfig = $  eavConfig;     $  this->registry = $  registry;  }  /**  * {@inheritdoc}  */ public function modifyMeta(array $  meta) {     $  meta = $  this->customiseCustomAttrField($  meta);      return $  meta; }  /**  * {@inheritdoc}  */ public function modifyData(array $  data) {     return $  data; }  /**  * Customise Custom Attribute field  *  * @param array $  meta  *  * @return array  */ protected function customiseCustomAttrField(array $  meta) {     $  fieldCode = 'choix_prix_product'; //your custom attribute code      $  elementPath = $  this->arrayManager->findPath($  fieldCode, $  meta, null, 'children');     $  containerPath = $  this->arrayManager->findPath(static::CONTAINER_PREFIX . $  fieldCode, $  meta, null, 'children');      if (!$  elementPath) {         return $  meta;     }        $  meta = $  this->arrayManager->merge(         $  containerPath,         $  meta,         [             'arguments' => [                 'data' => [                     'config' => [                         'dataScope' => '',                         'formElement' => 'container',                         'componentType' => 'container',                          'component' => 'Magento_Ui/js/form/components/group',                         'scopeLabel' => __('[GLOBAL]'),                     ],                 ],             ],             'children' => [                 $  fieldCode => [                     'arguments' => [                         'data' => [                             'config' => [                                 'componentType' => Field::NAME,                                 'formElement' => 'select',                                 'options' => $  this->getOptions(),                                 'config' => [                                     'dataScope' => $  fieldCode,                                  ],                             ],                         ],                     ],                 ]             ]         ]     );      return $  meta; }  /**  * Retrieve custom attribute collection  *  * @return array  */  protected function toOptionArray() {     // Get your options     $  attributeCode = "choix_prix_product";      $  attribute = $  this->_eavConfig->getAttribute('catalog_product', $  attributeCode);     $  options = $  attribute->getSource()->getAllOptions();      $  _product = $  this->registry->registry('current_product');      $  idprod = $  _product->getId();     $  tab = [];      $  _sku = $  _product->getSku(); // for sku      $  var1 = substr($  _sku, 0, 1);       $  var2 = substr($  _sku, 1, 2);      $  objectManager = \Magento\Framework\App\ObjectManager::getInstance();     $  resource = $  objectManager->get('Magento\Framework\App\ResourceConnection');     $  connection = $  resource->getConnection();     $  tableName = $  resource->getTableName('table_prix');       $  fields = array('prix_unitaire', 'prix_id');       $  sql = $  connection->select()         ->from($  tableName, $  fields)         ->where('code_famille' . '=?', $  var1)         ->where('code_nom_commercial' . '=?', $  var2)         ->join('table_choix',             'table_choix.choix_id = table_prix.code_choix',             [                 'designation_choix'             ]);      $  result = $  connection->fetchAll($  sql);     foreach ($  options as $  option) {         if ($  result) {             $  i = 0;             foreach ($  result as $  elt) {                  if ($  option['label'] == " Choix" . $  elt['designation_choix'] . "-" . $  elt['prix_unitaire'] . "£") {                      $  tab[] = [['label' => $  option['label'], 'value' => $  option['value']]];                  }                 $  i++;              }          }     }      return $  tab;    } public function getOptions() {       return $  this->toOptionArray();  } 

}

any help please