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>"; 

Error after applying patch to authorize.net module

I have applied patch from MD5 to SHA-512 to Magento 2 Authorize.net direct post module, when i tried to test purchasing with a credit card i got this error on exception.log file

main.CRITICAL: Warning: pack(): Type H: illegal hex digit : in /public_html/vendor/magento/module-authorizenet/Model/Directpost/Response.php on line 111  

this is the code line 111

return strtoupper(hash_hmac('sha512', $  message, pack('H*', $  signatureKey))); 

How can i fix this error?

Applying filters in Flaks API with MongoDB

I am trying to filter my data based on nationality field of the data.

@app.route("/api/v1/players/<name>", methods = ['GET']) def get_player(name):     """     returns an object of a player given a name     """     try:         player = db.players.find_one({'name': name})         return jsonify({'result': player_to_dict(player)})      except:         return jsonify({             'result': 'failure',              "error": 400,              "message": "Bad Request (Double check player's name)"}), 400  @app.route("/api/v1/players/<nation>", methods = ['GET']) def get_player_by_nation(nation):     """     returns an array of player objects given a nation     """     try:         player = db.players.find({'nation': nation})         return jsonify({'result': player_to_dict(player)})      except:         return jsonify({             'result': 'failure',              "error": 400,              "message": "Bad Request (Double check nation's name)"}), 400 

I tried something like this, but since those two endpoints are considered the same thing, only the /<name> endpoint gets called and gives me an error when I put in a nation name.

What is the convention of applying filters or sorting in Flask?

Indian with UAE resident visa expiring in 2 months while applying for Schengen Visa

Me and my family are planning for a week long trip to Austria, Hungary & Czech Republic(max. no of stay).

We will be returning from there on October 28th, 2019 and my wife’s UAE Resident Visa is expiring on January 1 2020(2 month validity as per the Checklist I have seen). But rest of the family got their visa till mid year of 2020.

Will this be a problem in the visa application?

Can minor child travel out of France before applying DCEM

I am an Indian, I am in France for a work and arrived last year. I had got the RP last year which is expired now and I have submitted my files for renewal of carte de Sejour. So I have a recepisse which allow me to travel outside France.

Now my family (wife and 2 year old kid) have arrived here in France, they both have type D long stay VISA valid for one year. I have validated my wife’s VISA online (required instead of applying carte de sejour).

For my daughter, I understood from sources that I need to apply for DCEM once I got my carte de sejour. Yes, I have not yet applied for DCEM for my kid yet.

Now the issue is I need to travel to India for an important family function and come back to France. I know for me and for my wife it’s ok to travel outside France and come back.

My question is whether there will be any issue for my daughter to enter into France as she don’t have DCEM (not even applied) but valid VISA.

How can I prompt for device password before applying updates?

I have an encrypted boot partition on an USB drive. How can I prompt the user to insert the USB drive, and decrypt it before applying system updates?

I can write the script to decrypt and mount the partition, but I don’t know how to run it before the update process, and how to display a GUI window prompting the user for password.

Applying for UK visit visa soon

I went to UK back in 2009 january and I overstayed while My Dad was already there. I was a minor through out the whole period of my overstay i returned back in 2011 june. Since that its been more than 10 years and i am planning to visit my sister who is a british citizen for 5 days genuinely. I live in canada since 2015 i was an international student and now i am on my work permit i earn well and i am HR in a franchise restaurant. Can someone help me with what are my chances for getting approved. As i was a minor and it wasn’t my decision to overstay. I also have a USA visa which i travelled for 2 days back in 2017.