8 – “Order items” view displaying removed items (variations)?

I’m dynamically removing items from cart with this function:

  static function _remove_product_variation_from_cart($variationId) {
    $orders = Drupal::service('commerce_cart.cart_provider')->getCarts();
    if (empty($orders)) {
      return 0;
    }
    $items = reset($orders)->getItems();

    foreach ($items as $item) {
      $quantity = $item->getQuantity();
      $itemVariationId = $item->getPurchasedEntity()->id();
      if ($variationId == $itemVariationId){
        foreach ($orders as $order) {
          $order->removeItem($item)->save();
        }
        return $quantity;
      }
    }
    return 0;
  }

And during checkout process it’s all fine – removed items are not displayed. But page:

/user/user_id/orders/order_id

is listing also removed items (that’s view “Order items”). Sum (order total) is correct however.
On other hand i.e. view “Checkout Order Summary” is returning order items correctly (without removed ones).

Am I removing cart item wrong way or something? Why is this happening?

terminal – Unicode Characters not Displaying with ZSH

I’m accessing a server running Ubuntu from my Mac using Terminal. On the server, I recently switched from Bash to ZSH and now Unicode characters are not being displayed anymore, for example the folder that in bash was listed as '芸能山城組' is now being listed as ''$'350212270350203275345261261345237216347265204'.

I already set the locales in my .zshrc to "en_US.UTF-8" but that doesn’t seem to change anything. It’s also not the terminal font, because echo -e 'u82B8' outputs correctly.

Does anybody know what could be going wrong?

meta tags – How do you prevent HTML special character coding from displaying on a website?

An article in the Wall Street Journal (wsj.com) displays HTML special character code instead of the actual character, the greater-than sign. Thus, instead of displaying >, the article displays >. This occurs (for me, at least) on Chrome, Firefox, and Safari (all latest versions with cache cleared).

My (limited) understanding is that websites should have the following code in the header:

<meta http-equiv="content-type" content="text/html;charset=utf-8" /> (α)

The wsj.com site has this code in the header: <meta charset="UTF-8">. Is this the cause of the problem? In other words, if the WSJ site had <meta http-equiv="content-type" content="text/html;charset=utf-8" /> in the header, would we see > instead of &gt;?

The Wall Street Journal article is:

The article is probably behind a firewall, so here is an image of the sentence as it appears in the article:

sentence in WSJ article displaying HTML special character code

TIA,

Mark

Footnote
α. Kyrnin, Jennifer. “How to Use Special Characters in HTML.” Lifewire (20 February 2020).

list – Displaying text value when there is a certain value in another column

(I am putting this here as I am new and do not have enough Rep to add a comment)

You have a few errors in the Syntax of your formula. Parenthesis in the incorrect places and OR functions in the wrong place as well as incorrect use of OR in the IF Statements.

The OR Function should come after the IF Function for those that require an OR comparison and each OR Value is separated by a comma.

Check out the following link which gives some good examples of how to structure the statements. As an example from the site:

=IF(OR((Column1)>(Column2), (Column1)<(Column3)), “OK”, “Not OK”)
If 15 is greater than 9 or less than 8, return “OK”. (OK)

Also as it can be easier to run through a working sample against an example I have provided the formula I was able to achieve your desired result with:

=IF((Risk Score)<=6,"Low",IF(OR((Risk Score)>6,(Risk Score)<=12),"Medium",IF(OR((Risk Score)>12,(Risk Score)<=19),"High",IF((Risk Score)>19,"Extreme"))))

g suite – Displaying a “friendly name” for an ID in Google Sheets

I have a spreadsheet in Google Sheets which contains information split across several sheets. To keep things consistent between sheets, I use numbers as IDs, like (very simplified example):

  • Users: User ID, Name, Address,
  • Products: Product ID, Product Name
  • Orders: Order ID, User ID, Product ID

This works fine, but the “orders” sheet is hard to read at a glance and hard to add new items to because it’s just a random list of numbers. What I’d like is to have a more user-friendly interface on top of the data, so that the orders table shows something more like “Order ID, User Name, Product Name” so that it’s easy to read and I can add a row by just knowing the names, without having to look up the correct IDs.

What I want is for under the hood it to store the actual IDs so the table doesn’t break if we e.g. rename a product. Is there a good pattern for accomplishing this in Sheets?

magento 2.4 setup is not displaying, showing the page isn’t working, HTTP error 500

magento 2.4 setup is not displaying, showing the page isn’t working HTTP error 500, but i tried with simple php code.server is working fine. what may be the error, i am using php 7.3
enter image description here

javascript – Input type range bubble showing value not displaying properly on start

I have a problem with displaying value of input type=”range”. When page loads ,bubble is positioned in left side of input.

enter image description here

But my goal is to make that bubble always above the slider thumb. Like this.

enter image description here

I can’t figure it out why, but when I click on slider thumb and try to set new value ,problem disappears and bubble is working just fine. This problem occurs only if page is loaded. Does anybody know what can be the problem? Thank you.

Codesandbox link : https://codesandbox.io/s/suspicious-tereshkova-ujk45?file=/src/index.css

Custom post categories are not displaying on the page

I created a custom post type which is displaying on the menu. I created two posts and added them to the category. Everything working on the admin side.

Now I am trying to display on the website but it’s not displaying. var_dump($plans); not displaying the output.

would you help me out what is the issue in this code?

function viewTravelPlan( $atts ){
  if($atts('cat')=='All'){      
    $plans = get_posts(array(
      'showposts' => 80, //add -1 if you want to show all posts
      'post_type' => 'travelplan'
      ));
  }else{  
    $plans = get_posts(array(
      'showposts' => 10, //add -1 if you want to show all posts
      'post_type' => 'travelplan',
      'tax_query' => array(
        array(
      'taxonomy' => 'travelPlans_cat',
      'field' => 'slug',
      'terms' => $atts('cat') //pass your term name here
        )
      ))
       );
  }
  var_dump($plans);   
  
     $data = '<div class="main-carousel mt-5">';
    foreach($plans as $plan){
      
    $tid = $plan->ID;
    $data.= ' <div class="carousel-cell">
    <a href="'.get_permalink($tid).'">
                    <div class="blogBoxwrapper">
          <p>Testing</p>
                    </div>
                    </a>
                    </div>';   
    }
    $data.='</div>';
    return $data; 

}
add_shortcode( 'travelPlan', 'viewTravelPlan');

magento 1.9 – rest roles are not displaying in system/webservices/rest-roles

I Created a Custom module with rest api, but the api roles are not displaying in system/web-services/rest-roles

here is the api code

<?xml version="1.0"?>
<config>
    <api2>
        <resource_groups>
            <bms_calls translate="title" module="Bms_Calls">
                <title>Calls api</title>
                <sort_order>23</sort_order>
            </bms_calls>
        </resource_groups>
        <resources>
            <bms_class translate="title" module="Bms_Calls">
                <group>bms_calls</group>
                <model>calls/api2_restapi</model>
                <title>Calls</title>
                <sort_order>24</sort_order>
                <privileges>
                    <guest>
                          <create>1</create>
                          <delete>1</delete>
                          <retrieve>1</retrieve>
                          <update>1</update>
                    </guest>
                    <admin>
                         <create>1</create>
                          <delete>1</delete>
                          <retrieve>1</retrieve>
                          <update>1</update>
                    </admin>
                    <customer>
                        <create>1</create>
                          <delete>1</delete>
                          <retrieve>1</retrieve>
                          <update>1</update>
                    </customer>
                </privileges>
                <attributes  translate="name phone message" module="Bms_Calls">
                    <name>Name</name>
                    <phone>Phone</phone>
                    <message>Message</message>
                </attributes>
                <routes>
                    <route_entity>
                        <route>/servicebms/inboundoncall/:call_date/:call_time/:caller_number/:called_number/:call_status/:agent_number/conversation_duration/:call_duration/:call_type/:recording_url</route>
                        <action_type>entity</action_type>
                    </route_entity>
                    <route_collection>
                        <route>/servicebms/calls</route>
                        <action_type>collection</action_type>
                    </route_collection>
                    
                </routes>
                <versions>1</versions>
            </bms_calls>
        </resources>
    </api2>
</config>

Store views are not displaying in Admin portal product details page

Store views are there if I will go to Stores >> All Stores

But If I go to any product details page and the scope drop-down only shows the default store view.
enter image description here

enter image description here