magento2 – How to get lifetime best seller products

I am creating an API for getting best seller products.

There are a lot answer on community which answering for get best seller on monthly/yearly basis.

I want to get lifetime bestselling product just like Admin dashboard bestseller.

/vendor/magento/module-backend/Block/Dashboard/Tab/Products/Ordered.php

/vendor/magento/module-backend/Block/Dashboard/Grids.php

I looked on above file and they are responsible for Showing bestseller on Admin dashboard But I could not replicate for APIs

Thanks in advance

Adding author option to [products] woocommerce shortcode

I am trying to modify the (products) shortcode usage:

Shortcodes included with WooCommerce

What I am looking was passing the author id from short code e.g (products author=2) to the query.

With the reference of:
https://wordpress.org/support/topic/adding-a-special-product-attribute-to-the-products-shortcode/

But the sample was a true/false parameter to trigger the $query_args change, seems it’s not exactly my goal. And the function below is the only part I can put into use.

function htdat_woocommerce_shortcode_products_query( $query_args, $attributes ) {       
$query_args = array(
   //Receive the id//'author'    => '1',
   'post_status'    => 'publish',
   'post_type'      => 'product',
   'post_per_page'      => 12,
   );   
   
  return $query_args;
}
add_filter( 'woocommerce_shortcode_products_query', 'htdat_woocommerce_shortcode_products_query', 10, 2 );

If anyone could help, thank you.

magento2 – Filter products based on location

I have a Magento2 Store where I have multiple location. for (eg. Jaipur, Delhi, Mumbai etc).

I want to show products based on location. (Product A is available for one location only, Product B available for all locations).

If user select location Jaipur then only display products available for that location.

Locations may increase in future.

So keeping scalability and future customization how can I achieve it?

Thanks

r – After multiplying two variables, how can I filter those products based on the value of the original variables?

I am interested in multiplying subsets of two variables, Z and x in my dataset, but the two subsets are of different lengths so I can’t subset both before multiplying them. How can I filter the product based on the value of the original variables?

Here is a simplified data sample. I want to multiply Z and x, but keep only the products for which Z is greater than the 50th percentile and for which abs(x) is less than 100. My code below generates 10 values for each. There are 5 values for Z > 50th percentile, but only 4 values for abs(x) < 100.

## Create dataframe
set.seed(47610)
Z <- rnorm(10, mean = 5, sd = 1)
x <- rnorm(10, mean = -101, sd = 3) 
df <- data.frame(cbind(Z, x))

## Keep only Z above 50th percentile, multiply by x
Z <- df %>% filter(Z > quantile(Z, 0.5)) %>% select(Z)
Zx <- Z*df$x

Z and Zx are both 5×1.

If I try to filter after obtaining Zx through multiplication, I get the following error message telling me the dimensions are wrong:

Error: Problem with filter() input ..1.
x Input ..1 must be of size 5 or 1, not size 10.
ℹ Input ..1 is abs(df$x) < 100.

How can I achieve this? Thanks for the help.

integration – Deterministic Approximation of Products of Integrals

Suppose that I am interested in approximating the product of two integrals. For simplicity, let $P$ be a probability density function, let $f, g$ be two $P$-integrable functions, define

begin{align}
phi = int P(x) f(x) , dx \
gamma = int P(x) g(x) , dx,
end{align}

and say that I am interested in approximating the product $phi cdot gamma$.

I am interested in how a numerical analyst would approach this problem. A naive solution to this would be to do e.g. Gaussian quadrature with $P$ as the base measure, use the GQ nodes to form approximations of $phi, gamma$, and then multiply the approximations together. Can / does one ever do fancier things than this in practice?

I ask because I come from a statistics / applied probability background, where one often places a premium on having unbiased estimates of integrals. As such, taking the product of two estimates which use the same set of function evaluations will generally induce a statistical bias, and so there are simple and popular techniques which allow for this bias to be removed. I am curious about whether similar approaches are considered in numerical analysis.

To compress the question further: from the point of view of numerical analysis, are there better ways of approximating a product of integrals than taking the product of approximations to each of the integrals?

Best Germicidal Company in California | Buy Germicidal Products Online

Best Germicidal Company to Buy Germicidal Products or equipment Online In California USA. #Aeroasis Manufacturer Offers a Wide Range Of Germicidal Products @Low Price. Buy Germicidal Products In California!

.

php – Woocommerce: display products with same short description

I’m trying to display products with same short description or even the description/content as related products. I’ve tried two ways but it doesn’t seem to work.

1st method

add_filter( 'woocommerce_related_products', 'cusfu_related_products_by_same_desc', 9999, 3 ); 

function cusfu_related_products_by_same_desc( $related_posts, $product_id, $args ) {
   $product = wc_get_product( $product_id );
   $shortdesc = $product->get_short_description();
   $related_posts = get_posts( array(
      'post_type' => 'product',
      'post_status' => 'publish',
      'short_description' => $shortdesc,
      'fields' => 'ids',
      'exclude' => array( $product_id ),
   ));
   return $related_posts;
}

2nd method

add_filter( 'woocommerce_related_products', 'cusfu_related_products_by_same_desc', 9999, 3 ); 
function cusfu_related_products_by_same_desc( $related_posts, $product_id, $args ) {
   $product = wc_get_product( $product_id );
   $shortdesc = $product->get_short_description();
   $related_posts = get_posts( array(
      'post_type' => 'product',
      'post_status' => 'publish',
      'meta_key' => 'short_description'
      'meta_value' => $shortdesc,
      'fields' => 'ids',
      'exclude' => array( $product_id ),
   ));
   return $related_posts;
}

Any help is appreciated.

8 – How do I display only products that do not exceed the end date?

I created in my product type, a “Date interval” field.

I created a view that contains this field. With a start date and an end date.

I want my view to show only products that are within the end date.

I have searched in “FILTER CRITERIA” and I could not find anything to limit the results of my sight.

How do I display only products that do not exceed the end date?

magento2 – Magento 2.4 Products are not showing in category – Elastic Search enabled

I have found the solution, it was a custom attribute created by an extension.

The problem – attribute type was text and it was set to use in Layered Navigation.

The fix – tracked that attribute in catalog_eav_attribute table and set the column is_filterable to 0 (you won’t be able to change this from the backend as the field is enabled for editing only for catalog input type Yes/No, Dropdown, Multiple Select and Price)

The problem occurs only when you have Elastic Search enabled.

The best way to identify the attribute is to execute the below SQL query –

select * from catalog_eav_attribute EAV1 join eav_attribute EAV2 on EAV2.attribute_id = EAV1.attribute_id and frontend_input = 'text' where EAV1.is_filterable = 1

How can current versions of Adobe products continue to run on the new Macs with Apple Silicon?

During its November 10, 2020 event, Apple has announced that Adobe is bringing its major apps to Apple Silicon, starting with the Lightroom photography software. They also said that all current versions will continue to run, but the new ones will take advantage of Apple Silicon directly. How can it be the current versions will run on the new ARM processor, since they were compiled for x86 Intel processors?