How to ignore opening quote in views sort

I use views to display a sorted list of book titles. Titles that begin with a quote are listed first. I want to ignore the quote for sorting purposes. So, instead of:

  • “Once Upon a Time”: Fairy Tales in Reality
  • Grimm’s Fairy Tales
  • The Best Book of Fairy Tales

I want:

  • Grimm’s Fairy Tales
  • “Once Upon a Time”: Fairy Tales in Reality
  • The Best Book of Fairy Tales

It appears the Views Natural Sort module will handle this, but it’s still in Alpha for Drupal 8, and there seem to be quite a few steps to use it. Is there another, relatively straightforward (non-custom-code if possible) means of accomplishing this?

I’ve read a number of posts addressing more complex situations with fairly complex solutions, but it seems something this simple should have a simple solution.

Get Quote and Quote Items using Magento 2 SOAP API

I am working with Magento 2 Rest APIs ( For Abundant cart ) and having issue with Quotes, I am able to get all Quotes ( with desired filters, is_active = 1, items_count > 0 ) using API :

/rest/V1/carts/search

and its items

/rest/V1/carts/:quoteId/items

Now, issue is in certain quotes it doesn’t return any items though when i check quote_item table i could see items are there.

And when i check quote total using :

/rest/V1/carts/:quoteId/totals

it returns desired results.

Now I’m little confuse how Quotes working and i have below questions :

1 – Why Quote items returned via API are different then the items in Database.

2 – Why some Quotes return items using /rest/V1/carts/search and some quotes doesn’t ?

3 – Strange case i have found is , a quote has 4 items 3 items converted to order and 1 item is not converted. however when i see quote totals it gives value of all 4 items.

Overriding Quote Item Weight Programatically

My goal is to alter the weight of a product based on a chosen custom option. I have the custom option part working, but am unable to alter the weight of the item is such a way that affects the shipping estimates.

The below code partly works, in that it initially sets the correctly updated weight in the quote_item table. However, this gets overwritten, and is always overwritten before shipping is calculated. Is there a better way to do this? Or should I be plugging in later, perhaps? Any thoughts would be greatly appreciated!

<?php  namespace Ibex\Options\Model\Plugin;  use Magento\Quote\Model\Quote;  class Weight {     protected $  configurationHelper;      public function __construct(         \Magento\Catalog\Helper\Product\Configuration $  configurationHelper     )     {         $  this->configurationHelper = $  configurationHelper;     }      public function beforeSetProduct(\Magento\Quote\Model\Quote\Item $  subject, $  product)     {         $  logger = \Magento\Framework\App\ObjectManager::getInstance()->get('\Psr\Log\LoggerInterface');          $  customOptions = $  product->getCustomOptions();          if (isset($  customOptions['option_ids'])){             $  optionIds = $  customOptions['option_ids'];              foreach (explode(',', $  optionIds->getValue()) as $  optionId) {                 $  option = $  product->getOptionById($  optionId);                 if (isset($  customOptions['option_'.$  optionId])){                     $  itemOption = $  subject->getOptionByCode('option_'.$  optionId);                      $  group = $  option->groupFactory($  option->getType())                     ->setOption($  option)                     ->setConfigurationItem($  subject)                     ->setConfigurationItemOption($  itemOption);                      if($  group->getOption()->getValueById($  itemOption->getValue())){                         $  optionValue = $  group->getOption()->getValueById($  itemOption->getValue());                         $  selectedWeight = $  optionValue->getCustomWeight();                     }                 }             }         }         $  weight = $  product->getWeight();         if(isset($  selectedWeight)){           $  newWeight = $  weight + $  selectedWeight;         }         if(isset($  newWeight)){           $  product->setWeight($  newWeight);         }         return [$  product];     } } 

XSS possible inside the value field of input tag when double quote is filtered?

Is it possible to get XSS in the value field of Input tag when the application filters out double quote?

<input type="hidden" name="something" id="somenthing" value="my_input_goes_here"> 

input from request goes inside the value field , so i tried to close it with " and give a payload like " accesskey="X" onclick="alert(1)" but " is filtered out.

So any XSS vector possible in this scenario?

Set Custom Price to Quote item magento2 from controller

I am adding the product to the cart with below code.

class AddItems extends \Magento\Framework\App\Action\Action {     protected $  formKey;       protected $  cart;    protected $  product;    protected $  checkoutSession;     public function __construct(     \Magento\Framework\App\Action\Context $  context,     \Magento\Framework\Data\Form\FormKey $  formKey,     \Magento\Checkout\Model\Cart $  cart,     \Magento\Catalog\Model\ProductFactory $  product,          \Magento\Checkout\Model\Session $  checkoutSession,     array $  data = [] ) {     $  this->formKey = $  formKey;     $  this->cart = $  cart;     $  this->product = $  product;       $  this->checkoutSession = $  checkoutSession;     parent::__construct($  context); }   public function execute()   {         $  productId = 1;         $  customPrice = 150;         $  params = array(             'form_key' => $  this->formKey->getFormKey(),             'product_id' => $  ProductId, //product Id             'qty'   => 1 //quantity of product                         );                        $  _product = $  this->product->create()->load($  productId);                   $  this->cart->addProduct($  _product, $  params);             $  this->cart->save();              $  quote = $  this->cart->getQuote();             $  quoteId = $  quote->getId();             $  productItem = $  this->getProductQuote($  _product);             $  productItem->setCustomPrice($  customPrice);             $  productItem->setOriginalCustomPrice($  customPrice);              // Enable super mode on the product.             $  productItem->getProduct()->setIsSuperMode(true);  }   public function getProductQuote($  product){     $  quote = $  this->checkoutSession->getQuote();             $  cartItems = $  quote->getItemByProduct($  product);             return $  cartItems;    }  } 

I am adding custom price to the quote item with above code. Its not updating the custom price.

Can anyone look into this and update me please. Thanks

Software library quote attributable to Michael A Jackson?

While discussing modular software, a colleague recently suggested that the following quote (or words similar) is attributable to computer scientist Michael A Jackson. However, I can find no reference to it on the internet, and was wondering if anyone is able to point me to any of Jackson’s works which contain it?

A software module library is the only type of library in which everyone wants to put something in, and no-one wants to take something out.

Software library quote attributable to Michael A Jackson?

While discussing modular software, a colleague recently suggested that the following quote (or words similar) is attributable to computer scientist Michael A Jackson. However, I can find no reference to it on the internet, and was wondering if anyone is able to point me to any of Jackson’s works which contain it?

A software module library is the only type of library in which everyone wants to put something in, and no-one wants to take something out.

magernto 2 set multiple coupon on quote

I know many post asked before i asked this question but all of them are about magento 1 or does not have good response I wanna to set multi coupon on quote. i wanna do like this code

    $  newCouponCode=explode(",",$  couponCode);         foreach ($  newCouponCode as $  cpCode) {          $  quote->setCouponCode($  cpCode);         $  this->quoteRepository->save($  quote->collectTotals()); 

for each coupon that customer sent to controller i explode it and set to quote and collect discount. at the end i sum all of the discount and set to quote item. my problem is how to remove the coupons or tell to magento this coupon is used. and another problem is how to save the quote and tell magento does not collect discount again is there any free module for this ?

terraform could not escape single quote

I am trying to escape a single quote in my string:

$  {join("\n",formatlist("%s ansible_host=%s ansible_ssh_common_args='-o ProxyCommand=\"ssh -W %%h:%%p -q cloud-user@%s\"'","$  {module.compute.ops_master_names}","$  {module.compute.ops_master_priv_ips}","$  {module.ips.bastion_fips[0]}"))}" 

I have tried with different combinations (\’ or \’ or ” or ‘ ), but I received an illegal char escape or it doesn’t print the single quote. my need is print the line

ansible_ssh_common_args='-o ProxyCommand="ssh -W %h:%p -q cloud-user@%s"' 

the double quote and percentage character are well interpreted