Wrong ReadSecurity and WriteSecurity (Item-level permissions) attributes in PnPProvisioningTemplate

I’m creating a provisioning template for a SharePoint 2016 list using Get-PnPProvisioningTemplate -Out export.xml -Handlers All -PersistBrandingFiles.

Some lists define different Item-level Permissions. Item-level permissions restricted to user

However, the exported file doesn’t include those permissions, defining 0 for both ReadSecurity and WriteSecurity: <pnp:ListInstance ... ReadSecurity="0" WriteSecurity="0" ...>.

Is there any way to include the correct Item-level permissions in exported templates?

Related product by attributes

I looking for solutution to display related product by attributes.

I’ve use function from https://stackoverflow.com/questions/49960219/display-related-products-for-a-specific-product-attribute-value-in-single-produc/ but it’s works only for one attribute. I want to modificate this function to show product from 2 attribute.

Mandatory and non mandatory attributes for products

I am trying to come up with a simple way of implementing the following design, but I always end up with something overly complicated.

I am trying to design a database where companies can store products. Each product belongs to exactly one category, and depending on the category, they share some common attributes that I want to be mandatory. They can also have different attributes that are up to the company to define.

As of now, and based on this question I asked last year, my idea is to have the following:

  • Company table to store everything related to the company (one company can have several products)
  • Product table to store everything related to the product (one product can be in one category, and can have several features)
  • Category table just to save the name of the category
  • Attribute table attributes that can be defined by the company for that product
  • Product Feature table joint table

With these tables, companies will be able to add their products to a category and add as many attributes as they want.

Now, dependant on the category, I want to make mandatory to define a set of attributes. For example, if we are talking about groceries, and a category would be ‘Fruits’, I might want the company to always provide the following attributes: color, country of origin. If instead of fruits, the category is ‘Cereals’ I might want to be always provided with the following: allergens, expire date

I have thought of two different solutions, which are:

  • Create a new table for each category that needs these mandatory attributes. This, of course, will be a problem as if a new mandatory attribute is added to an existing category, all previous ones will have no value. Also, every time I add a new category I should define a new table for the attributes.
  • The other option I have thought of is to simply manage this in the frontend of the application. Once a company adds a product belonging to one of those categories, prompt them to input the mandatory attributes and simply save them as a ‘normal’ attribute.

I am more inclined towards using the second solution. Using the first one I could end up with a ddbb with dozens of tables, but I would like some input to see if anyone can come up with a better solution.

magento 2 ; only want custom product attributes to show on custom product

I created a custom virtual product that is based on a date attribute. i.e product is available on certain days a month.

However, the only attributes I want for it are name, sku, quantity, date.

I built a custom date feature but this date is now showing up on all other type of products.

question 1:

how can i ensure that the custom attributes only show on my custom virtual product.

QUESTION TWO

How can I remove all other attributes/form values like content, design etc

this is what i did to create the custom date attribute:

Test/Example/Ui/Component/DataProvider/Product/Form/Modifier/Datetime.php

public function install(ModuleDataSetupInterface $  setup, ModuleContextInterface $  context)     {         $  eavSetup = $  this->eavSetupFactory->create(['setup' => $  setup]);          $  eavSetup->addAttribute(                 \Magento\Catalog\Model\Product::ENTITY,         'dome_dates',         [             'group' => 'Custom Attribute',             'label' => 'Dome Date',             'type' => 'datetime',             'input' => 'date',             'class' => 'validate-date',             'required' => false,             'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE,             'visible' => true,             'required' => false,             'user_defined' => true,             'default' => '',             'searchable' => true,             'filterable' => true,             'filterable_in_search' => true,             'visible_in_advanced_search' => true,             'comparable' => false,             'visible_on_front' => false,             'used_in_product_listing' => true,             'unique' => false         ]     );      } 

and in my Di:

 <virtualType name="Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Pool">         <arguments>             <argument name="modifiers" xsi:type="array">                 <item name="dome_dates" xsi:type="array">                     <item name="class" xsi:type="string">Test\Example\Ui\DataProvider\Product\Form\Modifier\Datetime</item>                     <item name="sortOrder" xsi:type="number">100</item>                 </item>             </argument>         </arguments>     </virtualType> 

Facing problem with custom attributes in customer address checkout

I am facing a problem adding customer address custom attributes, in Magento 2.2 is working fine but after upgrading to Magento 2.3 i am receiving this error when shipping-information is saved:

Error occurred during “shipping_address” processing. Error occurred during “customAttributes” processing. A custom attribute is specified with a missing attribute code. Verify the code and try again.

It is happening when sending shipping information, custom attributes keys are not the custom attributes labels, so when magento validate the custme attributes it’s sending the error. I dont find any different in documentation from Magento 2.2 and 2.3 about adding custom attributes.

enter image description here

Here is an example of how I am adding custom attributes

$  customFieldBetweenStreets = [         'component' => 'Magento_Ui/js/form/element/abstract',         'config' => [             // customScope is used to group elements within a single form (e.g. they can be validated separately)             'customScope' => 'shippingAddress.custom_attributes',             'customEntry' => null,             'template' => 'ui/form/field',             'elementTmpl' => 'ui/form/element/input',             'tooltip' => [                 'description' => 'Entre calles',             ],         ],         'dataScope' => 'shippingAddress.custom_attributes' . '.' . $  customAttributeCodeBetweenStreets,         'label' => 'Entre calles',         'provider' => 'checkoutProvider',         'sortOrder' => 122,         'validation' => [             'required-entry' => true,             'max_text_length' => 60         ],         'options' => [],         'filterBy' => null,         'customEntry' => null,         'visible' => true,     ]; 

And my set-shipping-information-mixin

return function (setShippingInformationAction) {     return wrapper.wrap(setShippingInformationAction, function (originalAction, messageContainer) {          var shippingAddress = quote.shippingAddress();          if (shippingAddress['extension_attributes'] === undefined) {             shippingAddress['extension_attributes'] = {};         }          if (shippingAddress.customAttributes != undefined) {             $  .each(shippingAddress.customAttributes , function( key, value ) {                  if($  .isPlainObject(value)){                     value = value['value'];                 }                  shippingAddress['customAttributes'][key] = value;                 shippingAddress['extension_attributes'][key] = value;              });         }          return originalAction(messageContainer);     }); }; 

});

Here the $ .each(shippingAddress.customAttributes , function( key, value ) Key is returning the 0,1,2,3 etc, index while in Magento 2.2 is the custom attribute code I am adding in my Layout Processor

Any help would be appreciated

Magento 2 use extension attributes in source edit form

Is there a way to populate UI dataSource with my extension attributes when editing source in (Stores->Inventory->Sources)? I have added my extension attributes to source edit form via extending UI component, now I need to populate its data. All extension_attributes are saved in my repository and are loaded when get, getList for sources is called. enter image description here

Woocommerce products with shared attributes and prices

I have a Woocommerce store with a large group of similar variable products that share the same attributes (size, material, etc.) and prices. I would like to find a method to update the former properties of the products in the group as efficiently as possible, so that changes would be applied to all the products in the group. In other words, I would like to link these products and their properties together in some way, so that so I could easily make bulk changes (e.g. change the prices) to them when necessary. Is there a way to accomplish this?

Magento 2 REST API – Get filterable attributes of a category before and after applying filter with multiselect

I am trying to achieve multiselect filter in custom script to be able to use it in custom REST API.

While I am able to get all filterable attributes specific to a category. But after applying filter through params (e.g. Size), the size attribute get removed from the filterable attribute list after apply (default magento behaviour).

Need filters to behave as multiselect. I tried to implement it using classes of some 3rd party modules but of no help.

Below is my code

<?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); // Copyright 2009, FedEx Corporation. All rights reserved. // Version 12.0.0 use Magento\Framework\App\Bootstrap; /** * If your external file is in root folder */ require __DIR__ . '/app/bootstrap.php'; $  params = $  _SERVER; $  bootstrap = Bootstrap::create(BP, $  params); ini_set('display_errors', 1); $  obj = $  bootstrap->getObjectManager(); $  state = $  obj->get('Magento\Framework\App\State'); $  state->setAreaCode('frontend');  $  objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $  categoryFactory = $  objectManager->get('Magento\Catalog\Model\CategoryFactory'); $  storeManager = $  objectManager->get('Magento\Store\Model\StoreManagerInterface'); $  resource = $  objectManager->get('Magento\Framework\App\ResourceConnection'); $  request = $  objectManager->get('Magento\Framework\App\Request\Http'); $  params = $  request->getParams(); $  connection = $  resource->getConnection(); $  storeId = $  storeManager->getStore()->getId(); $  categoryId = 824;  $  category = $  categoryFactory->create()->setStoreId($  storeId)->load($  categoryId); $  storeManager->setCurrentStore($  storeId);  $  filterableAttributes = $  objectManager->get(\Magento\Catalog\Model\Layer\Category\FilterableAttributeList::class); $  appState = $  objectManager->get(\Magento\Framework\App\State::class); $  layerResolver = $  objectManager->get(\Magento\Catalog\Model\Layer\Resolver::class); $  filterList = $  objectManager->create(     \Magento\Catalog\Model\Layer\FilterList::class,     [         'filterableAttributes' => $  filterableAttributes     ] );  $  layer = $  layerResolver->get(); $  layer->setCurrentCategory($  category); $  allFilters = $  filterList->getFilters($  layer);  $  beforefinalFilters = []; foreach ($  allFilters as $  filter) {     if ($  filter->getName() != 'Category' && $  filter->getName() != 'Price'){         if ($  filter->getItemsCount()) {             $  output = [];             foreach ($  filter->getItems() as $  item) {                 if($  item->getFilter()->getData("attribute_model")){                     $  flag = false;                     $  code = $  item->getName();                     $  name = strip_tags($  item->getLabel());                      $  beforefinalFilters[$  code][] = array(                                                'name'=> $  name,                         'value'=> $  item->getValue(),                         'code'=> $  item->getFilter()->getAttributeModel()->getAttributeCode(),                         'isActive' => $  flag                     );                 }             }         }     } }  echo "Before filter: \n"; echo "<pre>"; print_r($  beforefinalFilters); echo "</pre>"; echo "----------------------------------------------------------------------------------"; echo "<br>";  $  appliedFilters = array(); foreach ($  allFilters as $  filter) {     if ($  filter->getName() != 'Category' && $  filter->getName() != 'Price' && $  filter->getItemsCount() && isset($  params[$  filter->getAttributeModel()->getAttributeCode()])) {         $  appliedFilters[$  filter->getAttributeModel()->getAttributeCode()]['label'] = $  filter->getAttributeModel()->getFrontendLabel();         $  appliedFilters[$  filter->getAttributeModel()->getAttributeCode()]['value'] = isset($  params[$  filter->getAttributeModel()->getAttributeCode()])?$  params[$  filter->getAttributeModel()->getAttributeCode()]:'';         $  appliedFilters[$  filter->getAttributeModel()->getAttributeCode()]['filter'] = $  filter;         $  request->setParam($  filter->getAttributeModel()->getAttributeCode(), $  params[$  filter->getAttributeModel()->getAttributeCode()]);     } }  foreach ($  appliedFilters as $  key => $  value) {     $  filter = $  value['filter'];     $  filterValue = $  value['value'];     if($  key == 'price' || $  key == 'category'){         continue;     }else{         //apply filter         //Magento\Catalog\Model\Layer\Filter\Attribute         $  filter->apply($  request);     } }  $  collection = $  layer->getProductCollection(); $  collection->getSelect()->group('e.entity_id');   //get filters after applying $  allFiltersAfter = $  filterList->getFilters($  layer);  $  afterfinalFilters = []; foreach ($  allFiltersAfter as $  filter) {     if ($  filter->getName() != 'Category' && $  filter->getName() != 'Price'){         if ($  filter->getItemsCount()) {             $  output = [];             foreach ($  filter->getItems() as $  item) {                 if($  item->getFilter()->getData("attribute_model")){                     $  flag = false;                     $  code = $  item->getName();                     $  name = strip_tags($  item->getLabel());                     $  afterfinalFilters[$  code][] = array(                                                 'name'=> $  name,                         'value'=> $  item->getValue(),                         'code'=> $  item->getFilter()->getAttributeModel()->getAttributeCode(),                         'isActive' => $  flag                     );                 }             }         }     } }  echo "\n After filter: \n"; echo "<pre>"; print_r($  afterfinalFilters); echo "</pre>"; 

Terminology: Difference between decision variables, features and attributes?

Could there be a difference between the words “feature”, “attribute”, and “decision variable” when used in the same paper? The one I am specifically thinking about is about an optimization method for clustering, but I am also wondering if there generally are any scenarios for which it could be.

I can’t manage to google up an answer that either confirms or denies that these are the same thing, and I have no formal training in data science.

Search is not working by product attributes

We have added couple of products on our Magento 2 site. In the home page of the site, we have a search form and there we have put input boxes as product name, from, to and location. We want to display the results as per the selected criteria in the form but its not working as expected.

Code:

<dd id="construction" class="item content active" data-role="content" >                      <form method="GET" action="<?php echo $  block->getUrl('catalogsearch/result/');?>">                         <fieldset class="search-forms-fieldset" id="date-range-1">                         <legend class="legend"><span><?= /* @escapeNotVerified */ __('Search Settings') ?></span></legend>                          <div class="field region">                             <label for="select" class="label"><span>Select</span></label>                              <div class="control" id="conselect">                                 <input type="text" name="q" placeholder="<?= /* @escapeNotVerified */ __('What are you looking for?') ?>" />                                 <?php /*?><select name="looking" id="looking">                                     <option value="">Please select</option>                                     <option value="5">5</option>                                     <option value="10">10</option>                                     <option value="15">15</option>                                     <option value="20">20</option>                                 </select><?php */?>                             </div>                         </div>                         <div class="field">                             <label for="location" class="label"><span><?= /* @escapeNotVerified */ __('Location') ?></span></label>                              <div class="control" id="conlocation">                                 <input type="text" name="location" placeholder="<?= /* @escapeNotVerified */ __('Location') ?>" />                             </div>                         </div>                          <div class="field">                             <label for="available_from" class="label"><span><?= /* @escapeNotVerified */ __('Available From') ?></span></label>                              <div class="control" id="confrom">                                 <input type="text" name="available_from" placeholder="<?= /* @escapeNotVerified */ __('Available From') ?>" id="date-from-1" />                             </div>                         </div>                         <div class="field">                             <label for="available_to" class="label"><span><?= /* @escapeNotVerified */ __('Location') ?></span></label>                              <div class="control" id="conto">                                 <input type="text" name="available_to" placeholder="<?= /* @escapeNotVerified */ __('Available To') ?>" id="date-to-1"/>                             </div>                           </div>                          </fieldset>                         <div class="actions-toolbar">                           <div class="primary">                             <button type="submit"                                     class="action search primary"                                     title="<?= $  block->escapeHtml(__('Search')) ?>">                                 <span><?= /* @escapeNotVerified */ __('Search') ?></span>                             </button>                           </div>                         </div>                       </form>                  </dd> 

Please see the below screenshot for your reference:

enter image description here