product – how to get short description on mail of refund on Magento2

i am want to show product short description on refund mail.

My error: Fatal error: Uncaught Error: Call to a member function getId() on null in

i am editing in : Magento_Sales/templates/email/items/creditmemo/default.phtml

My code is:

    <?php
    /**
     * Copyright © Magento, Inc. All rights reserved.
     * See COPYING.txt for license details.
     */
    
    // @codingStandardsIgnoreFile
    
    ?>
    <?php $_item = $block->getItem() ?>
    <?php $_order = $block->getItem()->getOrder(); 
    ?>
    <tr>
        <td class="item-info<?php if ($block->getItemOptions()): ?> has-extra<?php endif; ?>">
            <p class="product-name"><?= $block->escapeHtml($_item->getName()) ?></p>
            <p class="sku"><?= /* @escapeNotVerified */  __('SKU') ?>: <?= $block->escapeHtml($block->getSku($_item)) ?></p>
            <p><?php 
$objectManager =  MagentoFrameworkAppObjectManager::getInstance();
   $productId = $block->getId($_item);
   $currentproduct = $objectManager->create('MagentoCatalogModelProduct')->load($productId);
   echo $currentproduct ->getShortDescription();  
         
       ?></p>

Please help me.

sql – get woocommerce product image url and price from database

I want to get some product data directly from the database, currently I have this, but I’m missing the featured image URL:

 SELECT 
  p.ID,
  p.post_title,
  `post_content`,
  `post_excerpt`,
  t.name AS product_category,
  t.term_id AS product_id,
  t.slug AS product_slug,
  tt.term_taxonomy_id AS tt_term_taxonomia,
  tr.term_taxonomy_id AS tr_term_taxonomia,
  MAX(CASE WHEN pm1.meta_key = '_price' then pm1.meta_value ELSE NULL END) as price,
  MAX(CASE WHEN pm1.meta_key = '_sku' then pm1.meta_value ELSE NULL END) as sku 
FROM wp_posts p 
LEFT JOIN wp_postmeta pm1 ON pm1.post_id = p.ID
LEFT JOIN wp_term_relationships AS tr ON tr.object_id = p.ID
JOIN wp_term_taxonomy AS tt ON tt.taxonomy = 'product_cat' AND tt.term_taxonomy_id = tr.term_taxonomy_id 
JOIN wp_terms AS t ON t.term_id = tt.term_id
WHERE p.post_type in('product', 'product_variation') AND p.post_status = 'publish' AND p.post_content <> ''
GROUP BY p.ID,p.post_title

Bundle or Group Product for Digital and physical products

I am having issues trying to allocate a digital product as well as a physical product to be sold in a bundle or group. I have read comments above but it does not help with Shipping costs? If I add the mp3 for downloading the shipping disappears and if I change to physical I cannot attach the downloadable content.

Is there a way to get downloadable as well as physical sold together and have a shipping option?

magento2 – Error 404 when go to simple product URL of configurable product

I have a configurable product showing on frontend. There are 3 simple product link with it.

Here is my configurable product in backend:

enter image description here

The URL of my configurable product in frontend will be like this:

https://domain/becks-beer-bt-330ml-24pk.html

But if I try to access its simple product link like my URL key:

https://domain/becks-beer-bt-330ml-24pk-case-24.html

or

https://domain/becks-beer-bt-330ml-24pk-each.html

It give me error 404 page. Is it possible for me to go to simple product URL of my configurable product.

Thank you!

optimization – Minimize the maximum inner product with vectors in a given set

Given a set $S$ of non-negative unit vectors in $mathbb R_+^n$, find a non-negative unit vector $x$ such that the largest inner product of $x$ and a vector $v in S$ is minimized. That is,
$$
min_{xin mathbb R_+^n,|x|_2=1}max_{vin S} x^Tv.
$$

It seems like a quite fundamental problem in computational geometry. Has this problem been considered in the literature?

It can be formulated as an infinity norm minimization problem, which can in turn be expressed as a quadratically constrained LP. If the rows of matrix $A$ are the vectors in $S$, we seek
$$
begin{align}
&&min_x|Ax|_infty
\ rm{s.t.} && x^Tx=1
\ && xgeq 0.
end{align}
$$

But the quadratic constraint is non-convex, so this is not very encouraging.

magento2 – Magento 2 : Get Product Collection based on Attribute

You can use the Product Collection factory as below.

$_collection = $this->_productCollectionFactory->create();
$_collection->addAttributeToSelect('*');
$_collection->addAttributeToFilter('status',MagentoCatalogModelProductAttributeSourceStatus::STATUS_ENABLED);
// Your attribute code   
$_collection->addAttributeToFilter('size',  array('notnull' => true));

Get your product.

foreach ($_collection as $_product) {
    $_product->getName();
}

magento2.3 – Where is the “Set Product as New” attribute saved in the Magento 2.3 EE database?

I know that Magento 2 EE doesn’t utilize the “newsFromDate” and “newsToDate” attributes, but I can’t figure out where Magento EE is storing the data for the “Set Product as New” option on the products?

I’m trying to check if a product is new, but I’m unsure what to use to get that data if I can’t find it in the database. Any ideas?