I want to get the value of a select attribute in the checkout page, and then use it to show or not the delivery data

I want to get the value of a select attribute in the checkout page on WooCommerce, and then use it to show or not the delivery data.

I have tried everything but it still does not appear, the object of my products when I go through it comes out empty.

I have tried something similar to this to see what data I am getting but it comes out empty:

add_filter( 'woocommerce_cart_item_name', 'cart_variation_description', 20, 3); function cart_variation_description( $  name, $  cart_item, $  cart_item_key ) {     // Get the corresponding WC_Product     $  product_item = $  cart_item['data'];      if(!empty($  product_item) && $  product_item->is_type( 'variation' ) ) {         // WC 3+ compatibility         //$  descrition = $  product_item->get_description();         //$  descrition = $  product_item->get_attribute( 'pa_modo' );         $  descrition = $  product_item->get_post_meta( $  variation->ID, 'price_1_50', true );         $  result = __( 'Description: ', 'woocommerce' ) . $  descrition;         return $  name . '<br>' . $  result;     } else         return $  name; } 

Thanks a lot.

Create DB snapshot without specifying the FILENAME attribute

I create DB snapshot as one of the tasks in SSIS package. The package works with 20 different DBs. Thus, each DB will have a snapshot with hard-coded FILENAME attribute.

CREATE DATABASE Sales_snap ON   (    NAME = SalesData,    FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\data\SalesData_snap.ss' ),   (    NAME = SalesData1,    FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\data\SalesData1_snap.ss' ),   (    NAME = SalesData2,    FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\mssql\data\SalesData2_snap.ss' )  AS SNAPSHOT OF Sales  

Is there a way to use some default path for FILENAME instead of copy-pasting the same string 20 x 3 times? Alternatively, is there any way to specify base path only once and then reuse it in other SSIS tasks?

How to utilise multiple values from a single shortcode attribute?

i.e [test somevalues=1,2,3,4,5]

First time poster and alsoa php newb, I’m trying to add a feature to a plugin but I seem to keep triggering a debug notice from wordpress.

$  somearray = shortcode_atts([                'somevalues' => null,     ], $  atts); $  somearray['somevalues'] = array_map( 'trim', str_getcsv( $  somearray['somevalues'], ',' ) );  

The above does work, but it results in a debug Notice: wpdb::prepare was called incorrectly.

Is there a way to achieve the same without triggering the notice? It doesn’t have to be csv, I just need it to return a string of somevalues, rather than returning an int. I guess what I want it to act like is as if it was written like [test somevalues=one,two,three,four,five]

Any suggestions on how to get around this? Many thanks

Get the list of all Weight attribute members

I have, in SSAS, a fact PERSONS which contains the Measures [Number of PERSONS] and [Weight]. The first one has the value 844. In order to achieve some calculus, I would like to get the list of all Weights, not only the list of the different ones.

The query

WITH member number as COUNT (NONEMPTY( [Measures].[Weight]   ))  SELECT number ON 0 FROM [mycube] 

produces: result

I don’t understand this result. It is not the result of an aggregation.

The query:

WITH member number as COUNT (NONEMPTY([Dim Date].[Date].[Date].members , [Measures].[Weight]   ))  SELECT number ON 0 FROM [mycube] 

used to bypass some aggregation produces: too many results

which is not the correct number.

An answer could to create a dimension (I could get the entire list with the function ‘.members’) but it is goes against the purpose of Weight, which is a measure, not a group.

thank you.

Return product list based on current product attribute

I have modified my single-product.php and want to pop in a block of other products that share the same brand name which I have specified in a product attribute called ‘brand’.

This is my code so far but it is returning all the products and NOT filtering by the pa_brand.

<!-- Custom 4 up product filtered by Brand attribute -->         <ul class="products">                 <?php             $  args = array(                 'post_type' => 'product',                 'posts_per_page' => 4,                 'taxonomy' => 'pa_brand',                 'field'    => 'slug',                 'terms'    => $  product->get_attribute( 'brand' )                 );             $  loop = new WP_Query( $  args );             if ( $  loop->have_posts() ) {                 while ( $  loop->have_posts() ) : $  loop->the_post();                     wc_get_template_part( 'content', 'product' );                 endwhile;             } else {                 echo __( 'No products found' );             }             wp_reset_postdata();         ?>     </ul><!–/.products–> 

Is there a potential XSS in this html action attribute?

I’m working on a website and I noticed that if I go to the following URL: website.com/page?alert() this message is reflected in the action form. I tried to close the action attribute using double quotes in order to try a classic like " onload="alert(1)" but double quotes are URLencoded if i read the source code. Do you have some suggestion? Or is just a rabbit hole? Thanks

 <form method="post" action="./page?alert()" id="cn"> <div class="n"> 

How can I emulate Orderless attribute?

Suppose I want an expression to automatically sort its arguments. This can be done via

SetAttributes[f, Orderless] f[3, 2, 1] (*output is f[1, 2, 3]*) 

Just as an exercise, I want to emulate this behavior myself with

f[x__] := f[Sequence @@ Sort[{x}]] 

which doesn’t work due to infinite iteration.

I would be enlightened if anyone can show me an example how to implement this.

What is the appropriate way to represent type attribute of one entity in a conceptual model?

I have a vehicle entity, and this vehicle can be of different types. How a model this in a conceptual design?, I place the type as an attribute of the vehicle entity? and if each vehicle has its own set of attributes, how do I model each vehicle type if it is already as a vehicle attribute?