mysql – Change post format through phpmyadmin

I’d like to change post format of some post that have a certain metakey (let’s say video_url_embed) from standard post to video post (let’s say term_taxonomy_id 13805 in wp_term_taxonomy). I’m having some issues, I have to add a row for any post.
Any suggestion?
That’s what I’m trying SELECT post_id FROM wp_postmetaWHEREmeta_key= 'mvp_video_embed' INSERT INTO wp_term_relationships(object_id, term_taxonomy_id, term_order) SELECT ID, 13805, 0 FROM wp_posts WHERE post_status = 'publish' and post_type = 'post'

How do I change from existing products to a config product?

I have a set of live simple products – which are the same product but different sizes. I need to change these simple products to a config product.

Do I need to create a new config product and assign the simple products as varients?

module – Magento 2.4.2: How to change the shipping label?

With a custom shipping module, I am adding brokerage and duties to the shipping cost for an order from Canada. How can the shipping label be changed so that it reads “Shipping includes brokerage and duties”

enter image description here

Below is entire customshipping.php script

<?php

namespace PerfectmakeupmirrorsCustomShippingModelCarrier;

use MagentoQuoteModelQuoteAddressRateRequest;
use MagentoShippingModelCarrierAbstractCarrier;
use MagentoShippingModelCarrierCarrierInterface;
use PerfectmakeupmirrorsPmmFedexModelPmmFedexCarrier;
use MagentoFrameworkAppResourceConnection;

/**
 * Custom shipping model
 */
class Customshipping extends AbstractCarrier implements CarrierInterface
{
    const FEDEX_METHODS = (
        'EUROPE_FIRST_INTERNATIONAL_PRIORITY' => 'Europe First Priority',
        'FEDEX_1_DAY_FREIGHT' => '1 Day Freight',
        'FEDEX_2_DAY_FREIGHT' => '2 Day Freight',
        'FEDEX_2_DAY' => '2 Day',
        'FEDEX_2_DAY_AM' => '2 Day AM',
        'FEDEX_3_DAY_FREIGHT' => '3 Day Freight',
        'FEDEX_EXPRESS_SAVER' => 'Express Saver',
        'FEDEX_GROUND' => 'Ground',
        'FIRST_OVERNIGHT' => 'First Overnight',
        'GROUND_HOME_DELIVERY' => 'Home Delivery',
        'INTERNATIONAL_ECONOMY' => 'International Economy',
        'INTERNATIONAL_ECONOMY_FREIGHT' => 'Intl Economy Freight',
        'INTERNATIONAL_FIRST' => 'International First',
        'INTERNATIONAL_GROUND' => 'International Ground',
        'INTERNATIONAL_PRIORITY' => 'International Priority',
        'INTERNATIONAL_PRIORITY_FREIGHT' => 'Intl Priority Freight',
        'PRIORITY_OVERNIGHT' => 'Priority Overnight',
        'SMART_POST' => 'Smart Post',
        'STANDARD_OVERNIGHT' => 'Standard Overnight',
        'FEDEX_FREIGHT' => 'Freight',
        'FEDEX_NATIONAL_FREIGHT' => 'National Freight'
    );
    const SHIPPING_STANDARD = 'STD';
    const SHIPPING_2ND_DAY = '2DY';
    const SHIPPING_OVERNIGHT = 'ON';
    protected $_shipping_mode_strings = array(
        self::SHIPPING_STANDARD => 'Standard Ground',
        self::SHIPPING_2ND_DAY => 'Second Day',
        self::SHIPPING_OVERNIGHT => 'Next Day Air',
    );

    /**
     * @var string
     */
    protected $_code = 'customshipping';

    /**
     * @var bool
     */
    protected $_isFixed = true;

    /**
     * @var MagentoShippingModelRateResultFactory
     */
    private $rateResultFactory;

    /**
     * @var MagentoQuoteModelQuoteAddressRateResultMethodFactory
     */
    private $rateMethodFactory;

    /**
     * @var PerfectmakeupmirrorsCustomShippingHelperData
     */
    private $helper;

    /**
     * @var PsrLogLoggerInterface
     */
    protected $_logger;

    /**
     * @var PerfectmakeupmirrorsPmmFedexModelPmmFedexCarrier;
     */
    private $carrierFedex;

    /**
     * @var MagentoFrameworkAppResourceConnection;
     */
    protected $resource;

    /**
     * @var MagentoFrameworkAppResourceConnection;
     */
    protected $scopeConfig;

    /**
     * @param MagentoFrameworkAppConfigScopeConfigInterface $scopeConfig
     * @param MagentoQuoteModelQuoteAddressRateResultErrorFactory $rateErrorFactory
     * @param PsrLogLoggerInterface $logger
     * @param MagentoShippingModelRateResultFactory $rateResultFactory
     * @param MagentoQuoteModelQuoteAddressRateResultMethodFactory $rateMethodFactory
     * @param MagentoFrameworkAppResourceConnection $resource
     * @param array $data
     */
    public function __construct(
        MagentoFrameworkAppConfigScopeConfigInterface $scopeConfig,
        MagentoQuoteModelQuoteAddressRateResultErrorFactory $rateErrorFactory,
        PsrLogLoggerInterface $logger,
        MagentoShippingModelRateResultFactory $rateResultFactory,
        MagentoQuoteModelQuoteAddressRateResultMethodFactory $rateMethodFactory,
        PerfectmakeupmirrorsCustomShippingHelperData $helper,
        PerfectmakeupmirrorsPmmFedexModelPmmFedexCarrier $carrierFedex,
        MagentoFrameworkAppResourceConnection $resource,
        array $data = ()
    ) {
        parent::__construct($scopeConfig, $rateErrorFactory, $logger, $data);

        $this->rateResultFactory = $rateResultFactory;
        $this->rateMethodFactory = $rateMethodFactory;
        $this->carrierFedex = $carrierFedex;
        $this->_logger = $logger;
        $this->helper = $helper;
        $this->resource = $resource;
        $this->scopeConfig = $scopeConfig;
    }

    /**
     * Custom Shipping Rates Collector
     *
     * @param RateRequest $request
     * @return MagentoShippingModelRateResult|bool
     */
    public function collectRates(RateRequest $request)
    {
        if (!$this->getConfigFlag('active')) {
            return false;
        }
        
        if ($request->getDestCountryId() == "CA") {
            // Shipping to Canada.
            // 1. Get the array of method objects from $fedex_results object
            // 2. Loop through the array of method objects to set carrier.
            // 3. Set carrier to custom shipping.
            // 4. Add brokerage to the shipping cost based on the table canada_brokerage_fees.
            $fedex_results = $this->carrierFedex->collectRates($request);

            // MagentoQuoteModelQuoteAddressRateResultMethod $methods
            $methods = $fedex_results->getAllRates();
            foreach ($methods as $method) {
                // 3. Set carrier to custom shipping.
                $method->setCarrier($this->_code);

                // Get subtotal from the $request object.
                // The request object is not giving the subtotal directly.
                // Using Quote object.
                // Refer https://magento.stackexchange.com/questions/341393/magento-2-4-2-how-to-get-order-sub-total-in-my-custom-module/341410#341410
                $quote = null;
                $items = $request->getAllItems();
                foreach($items as $item) {
                    /** @var Quote $quote */
                    $quote = $item->getQuote();
                    break;
                }
                if (!$quote) {
                    return false;
                }
                $subtotal = $quote->getSubtotal();                

                // Convert subtotal from USD to CAD
                // Get current CAD rate.
                $current_usd_to_cad_rate = $this->get_magento_system_info("pmm/currency_conversion/usd_to_cad_conversion");
                $subtotal_cad = $subtotal * floatval($current_usd_to_cad_rate);

                // Use table canada_brokerage_fee in Magento DB
                // Create DB connection
                // http://blog.chapagain.com.np/magento-2-run-custom-sql-query/
                $connection = $this->resource->getConnection();
                $tableName = $this->resource->getTableName('canada_brokerage_fees');

                // Compute brokerage.
                // Fetch relevant fee from the table canada_brokerage_fees 
                // based on the merchandise total.
                $sql = $connection->select()->from($tableName)->where('max_merchandise_cost <= ?', $subtotal_cad)
                ->order('brokerage_cost_cad DESC')->limit(1);
                $result = $connection->fetchAll($sql);                
                $brokerage_cost_cad = $result(0)('brokerage_cost_cad') ?? 0;

                // TODO
                // Compute duty and add it to brokerage_cost_cad.
                // All mirror and skin care products are duty free.

                // Set new price with brokerage added to the shipping cost.
                $method->setPrice($method->getPrice() + $brokerage_cost_cad);
            }
            return $fedex_results;
        } elseif (($request->getDestRegionCode() == "AK") || ($request->getDestRegionCode() == "HI") || ($request->getDestCountryId() == "PR")) {
            // For Alaska, Hawaii, and Puerto Rico
            // We want to get the shipping computation using Fedex

            $fedex_results = $this->carrierFedex->collectRates($request);
            // 1. Get the array of method objects from $fedex_results object
            // 2. Loop through the array of method objects to set carrier.
            // 3. Set carrier to custom shipping. 

            // MagentoQuoteModelQuoteAddressRateResultMethod $methods
            $methods = $fedex_results->getAllRates();
            foreach ($methods as $method) {
                $method->setCarrier($this->_code);
            }
            return $fedex_results;
        }

        // Below Processing is for Mainland USA.
        // Custom Shipping needs to be computed.
        /** @var MagentoShippingModelRateResult $result */
        $result = $this->rateResultFactory->create();

        /** @var MagentoQuoteModelQuoteAddressRateResultMethod $method */
        $method = $this->rateMethodFactory->create();

        $method->setCarrier($this->_code);
        $method->setCarrierTitle($this->getConfigData('title'));

        $method->setMethod($this->_code);
        $method->setMethodTitle($this->getConfigData('name'));

        $this->_logger->info(__FILE__ . ': At Start');

        // Get all the items.
        // NOTE: This getAllItems here is related to Quote and not the order.
        if ((!($items = $request->getAllItems())) or (count($items) == 0)) {
            return FALSE;
        }

        //Standard code commented. Custom code added.
        //$shippingCost = (float)$this->getConfigData('shipping_cost');
        $shippingCost = (float)$this->helper->compute_standard_shipping_cost($items);

        $method->setPrice($shippingCost);
        $method->setCost($shippingCost);

        $result->append($method);

        return $result;
    }

    /**
     * Get all the allowed methods for Custom Shipping. This sends the CustomShipping
     * method as well as all the allowed methods of Fedex. This is required to ensure
     * the Fedex shipping methods to be considered as valid methods.
     * 
     * @return array
     */
    public function getAllowedMethods()
    {
        $custom_shipping_methods = ($this->_code => $this->getConfigData('name'));
        $allowed_methods = array_merge($custom_shipping_methods, $this->FEDEX_METHODS);
        return $allowed_methods;
    }

    /**
     * get_magento_system_info - receives the path as parameter.
     * This parameter holds the path to the field.
     * This function returns a value in Magento core_config_data table.
     * 
     * @param string $path
     * @return string $config_data
     */
    private function get_magento_system_info($path)
    {
        // Refer https://store.magenest.com/blog/get-set-config-data-programmatically-magento-2/
        // Refer https://firebearstudio.com/blog/how-to-write-and-get-config-values-by-scope-in-magento-2.html

        // Call functions to get config data with default (global) scope
        return $this->scopeConfig->getValue($path);
    }
}

How to change the product list page to drop down refresh?

I have two themes, one for PC and one for mobile. I want to change the product list page of mobile to the dropdown refresh mode. What should I do? If you have a good plan, thank you very much

content search web part – How to change “There are no items to show” message for Item Display Template?

We are using SP2016 enterprise and I am trying to customize a Item Display template for a Content Search web part. My work is based on existing template under Master Page Gallery > Display Templates > Content web part (subfolder) > Item_LargePicture.html .

I searched online and several tutorial suggest look for the line with

if (ctx.ClientControl.get_shouldShowNoResultMessage())

but this line is not exist in Item_LargePicture.html.

I have tried inserted the above line and sample content but it is not working. My Content search webpart always returning There are no items to show.

P.S. my custom template works great when there is item to show. The only problem is when result = 0 the error message is not working as expected.

magento2 – URL Category rewrites not updated after the change

There might be multiple reasons for the same problem. But anyway, you might solve it by installing olegkoval/magento2-regenerate-url-rewrites and running these commands below.

php bin/magento ok:urlrewrites:regenerate --entity-type=category
php bin/magento index:reindex

Note: Before performing this please backup your database and commit your current code.

seo – Will Google Analytics maintain the data history for pages if I change my URL pattern?

I am considering simplifying the URL pattern for my website from:

example.com/journal/posts/42-article-title

to:

example.com/posts/42-article-title

But, I am concerned that the history of activity on the old URL will be presented separately from the new URL even though the pages are the same. Will this activity history be tracked separately in GA?

Or, if I do a 301 redirect on the old URLs is GA smart enough to link the two URL’s histories together and track their activity as single page from both before and after the routing change?

dnd 5e – If you change your Wizard subclass from Chronurgy Magic to something else, do you retain the subclass specific Dunamancy Spells?

You do not have to be a Chronurgist or Graviturgist to learn Dunamancy spells. Having the spell written down is sufficient.

The assertion you make in the question is incorrect, the rest of the paragraph that you quoted explains this quite plainly:

However, the Dungeon Master can consider allowing other spellcasting classes opportunities throughout the campaign to learn a handful of dunamancy-themed spells as rewards. Perhaps the characters uncover a cache of magical contraband, among which is a couple of spell scrolls, or a traveling acolyte takes some downtime with a friendly cleric character and opens their mind to some of the stranger secrets of the universe, unlocking a spell or two. There are many unique ways to bring these spells into your game without requiring any specific dunamis-wielding subclasses to be present in the adventuring party.

Only Chronurgy and Graviturgy wizards can learn these spells when leveling up, but wizards of any class can learn Dunamancy spells using the “found spell” method. Once the spells are written in your spellbook you have access to them. One of the suggested methods for a DM to provide these spells is through found spell scrolls:

Perhaps the characters uncover a cache of magical contraband, among which is a couple of spell scrolls

Thus, a wizard that finds a Dunamancy spell is free to write it down in their spellbook as usual. But a wizard changing from Chronurgy or Graviturgy to another wizard subclass already has the spells written down. So they retain access.

That said, use and continued use of these spells is always subject to the DM’s permission.

SharePoint Online: Change “Display Format” to Standard in the “Modified” column name

There is a way, in SharePoint Online, to Change “Display Format” to Standard from “Friendly” in the “Modified” column name?

I would like do this for all sites in the tenant and for all data fields and the last but not least, for all future teams, sites and so on

Thank you enter image description here

How do I change the channel on a Yongnuo YN685C flash?

I have the Yongnuo YN685C for Canon cameras. I am using the YN622C-TX and also the YN622C.

How do I change the channel on the YN685C?