filters – chosen_shipping_methods – Uncaught Error: Call to a member function get() on null

I use the function to filter payment gateways. Unfortunately, since I updated WordPress by several versions (5.6.2), I get an error:

The E_ERROR error was caused on line 155 of /(…)/functions.php. Error message: Uncaught Error: Call to a member function get () on null in /(…)/functions.php:155

Probably a small thing, but I’ve been trying to find a solution for a long time and I have no idea. Someone help?

This error is very important because I do not have access to the tabs in the administration panel: Statistics and Marketing.

function my_custom_available_payment_gateways( $gateways ) {
    $chosen_shipping_rates = WC()->session->get( 'chosen_shipping_methods' );

        if ( in_array( 'flat_rate:1', $chosen_shipping_rates ) ) {
        unset( $gateways('cod') );}
        
        elseif ( in_array( 'flat_rate:5', $chosen_shipping_rates ) ) {
        unset( $gateways('bacs') );
        unset( $gateways('przelewy24') );       }
        
        elseif ( in_array( 'flat_rate:2', $chosen_shipping_rates ) ) {
        unset( $gateways('cod') );      }
        
        elseif ( in_array( 'flat_rate:6', $chosen_shipping_rates ) ) {
        unset( $gateways('bacs') );
        unset( $gateways('przelewy24') );       }
        
        elseif ( in_array( 'flat_rate:3', $chosen_shipping_rates ) ) {
        unset( $gateways('cod') );      }
        
        elseif ( in_array( 'flat_rate:7', $chosen_shipping_rates ) ) {
        unset( $gateways('bacs') );
        unset( $gateways('przelewy24') );       }           
        
        elseif ( in_array( 'easypack_parcel_machines_cod', $chosen_shipping_rates ) ) {
        unset( $gateways('bacs') );
        unset( $gateways('przelewy24') ); } 

        elseif ( in_array( 'local_pickup:4', $chosen_shipping_rates ) ) {
        unset( $gateways('cod') );  }

    return $gateways;
}
add_filter( 'woocommerce_available_payment_gateways', 'my_custom_available_payment_gateways' );

database theory – What do I call a relational schema without the constraints?

It is common in db theory to define a ‘relation schema’ as consisting of a relation name, the (names of the) attributes, as well as constraints on the relation. A ‘database schema’ is then a set of such relation schemas.

An instance of the database schema consists of a finite set of tuples for each of the relations, which satisfies all of the constraints.

Now what I need is the notion of a relation schema, and sets of such without the constraints. I want to add the constraints separately, and then be able to talk about how some instance of the (constraint-less) schema satisfies the constraints or not. E.g. define ‘legal instances’ as instances that satisfy the constraints.

Is it defined like that somewhere in the literature? What are the common names for a db schema sans constraints?

Call me crazy, but I miss Hsphere

Having run an Hsphere cluster for years, I finally retired it a few years back and moved to a host using cpanel. Hsphere just seemed much mo… | Read the rest of https://www.webhostingtalk.com/showthread.php?t=1838695&goto=newpost

jsom – call executeQueryAsync mutliple times and add results into an array

I am trying to get the Files Urls from selected documents. I am using SPContext to make a call and then using a callback function to push results into an array then later in the code I loop through the array to access the urls so I can download the documents. However, the problem is that it downloads documents double times or triple times, depending on how many I have selected.

My questions are:

  1. how can I retrieve the urls of the selected documents. Is there a better way than the one I have so far?
  2. How can I download only a single copy of the document, thus avoiding double download of the same document?
  3. For my understanding, how can I call executeQueryAsync multiple times and store the response in an array as I have done below? Please let me know how can I improve my code.

I am using Sharepoint 2013. Thank you for your help.


function DownloadFiles(onComplete) {
        var selectedItems = SP.ListOperation.Selection.getSelectedItems(ctx);
        var count = selectedItems.length;
        if (count == 0) {
            alert("Please select an item from the list");
            return false;
        }
        var arrOfLinks = ();
        for (i in selectedItems) {
            var clientContext = new SP.ClientContext();
            var targetList = clientContext.get_web().get_lists().getByTitle(ctx.ListTitle);
            targetListItem = targetList.getItemById(selectedItems(i).id, 'FileLeafRef', 'ContentType', 'File', 'FileRef');

    
            clientContext.load(targetListItem);
            arrOfLinks.push(targetListItem);
            clientContext.executeQueryAsync(() => {
                onComplete(arrOfLinks);
            }, Function.createDelegate(this, this.onQueryFailed));
        }
    }
    
    function myCall() {
        DownloadFiles((arrayOfLinks) => {
          for (var i = 0; i < arrayOfLinks.length; i++) {
             var url = window.location.origin + arrayOfLinks(i).get_item('FileRef');
            window.location.href = `/_layouts/15/download.aspx?SourceUrl=${url}`;
           }
        });
    }
    
    function onQueryFailed(sender, args) {
        alert('Request failed. nError: ' + args.get_message() + 'nStackTrace: ' + args.get_stackTrace());
    }

wordpress – Child Theme Generator Uncaught Error: Call to undefined function imagettftext()

Estoy tratando de crear un tema en wordpress con el plugin child teme generator pero estoy obteniendo este error:

WordPress Error: There has been a critical error on your website. Please check your site admin email inbox for instructions.

En el correo electrónico estoy obteniendo esta información:

An error of type E_ERROR was caused in line 453 of the file /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/child-theme-generator/includes/class-child-theme-generator-functions.php. Error message: Uncaught Error: Call to undefined function imagettftext() in /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/child-theme-generator/includes/class-child-theme-generator-functions.php:453
Stack trace:

#0 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/child-theme-generator/includes/class-child-theme-generator-functions.php(287): Ch_Th_Gen_Functions::create_screenshot_png()

#1 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/child-theme-generator/admin/class-child-theme-generator-admin.php(197): Ch_Th_Gen_Functions::files_generation()

#2 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/child-theme-generator/admin/partials/child-theme-generator-admin-display.php(61): Ch_Th_Gen_Admin->section_create()

#3 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/child-theme-generator/admin/class-child-theme-generator-admin.php(133): include_once(‘/opt/bitnami/ap…’)

#4 /opt/bitnami/apps/wordpress/htdocs/wp-includes/class-wp-hook.php(287): Ch_Th_Gen_Admin->display_options_page()

#5 /opt/bitnami/ap

c++ – Store Memory Resource from which an object was created to the object itself to be able to call delete as usual?

When a memory resource (or allocator) is used to create an object, one needs to remember at deletion by which memory resource it was created.

Is it a good pattern to store the memory resource to the object itself and do the appropriate deletion in the class’ delete operator? The following code shows the idea:

#include <memory_resource>

using namespace std::pmr;

struct A
{
    A (memory_resource * memres_ = nullptr)
      : memres(memres_)
    {}
    memory_resource * memres;

    void operator delete(A * this_, std::destroying_delete_t)
    {
        if ( memory_resource * memres_ = this_->memres )
            polymorphic_allocator(memres_).delete_object(this_);
        else
            ::delete(this_);
    }
};

int main()
{
    A * aGlobal = new A;
    delete aGlobal;

    memory_resource * memres = get_default_resource();
    A * aPmr = polymorphic_allocator(memres).new_object<A>(memres);
    delete aPmr;
}

xml – Call to the “Get_Item_Quantity” function in the web service (trying to call soap api using magento restful services)

I have a function in xml document and I want to return it’s parameters. My knowledge of connecting the two services is very limited. Do I need to create some middleware or is it possible just to call from magento swagger? Any help or resources to point me in the right direction would be super!

    Function name: Get_Item_Quantity

This function takes Type, Code fields and returns Qty1, Qty2, Qty3 Qty4
Parameters:

Type = 0 – input value
Code = ‘product100317’ – input value
Qty 1 – return value
Qty 2 – return value
Qty 3 – return value
Qty 4 – return value

How do i go about this?

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:microsoft-dynamics-schemas/codeunit/myWSAPI" targetNamespace="urn:microsoft-dynamics-schemas/codeunit/myWSAPI">
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:microsoft-dynamics-nav/xmlports/x00000" elementFormDefault="qualified" targetNamespace="urn:microsoft-dynamics-nav/xmlports/x00000">
<complexType name="APIDataCapture">
<sequence>
<element minOccurs="1" maxOccurs="1" name="Type" type="string"/>
<element minOccurs="1" maxOccurs="1" name="Code" type="string"/>
<element minOccurs="1" maxOccurs="1" name="Qty1" type="string"/>
<element minOccurs="1" maxOccurs="1" name="Qty2" type="string"/>
<element minOccurs="1" maxOccurs="1" name="Qty3" type="string"/>
<element minOccurs="1" maxOccurs="1" name="Qty4" type="string"/>
</sequence>
</complexType>
<complexType name="Root" mixed="true">
<sequence>
<element minOccurs="1" maxOccurs="unbounded" name="APIDataCapture" type="tns:APIDataCapture"/>
</sequence>
</complexType>
<element name="Root" type="tns:Root"/>
</schema>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:microsoft-dynamics-nav/xmlports/x50014" elementFormDefault="qualified" targetNamespace="urn:microsoft-dynamics-nav/xmlports/x50014">
<complexType name="APIDataCapture">
<sequence>
<element minOccurs="1" maxOccurs="1" name="Type" type="string"/>
<element minOccurs="1" maxOccurs="1" default="0" name="EntryNo" type="int"/>
<element minOccurs="1" maxOccurs="1" name="SalesOrderFound" type="string"/>
<element minOccurs="1" maxOccurs="1" name="SalesOrderNo" type="string"/>
<element minOccurs="1" maxOccurs="1" default="0" name="SalesOrderLineNo" type="int"/>
<element minOccurs="1" maxOccurs="1" name="SalesOrderETADate" type="string"/>
<element minOccurs="1" maxOccurs="1" name="SalesOrderItemNo" type="string"/>
</sequence>
</complexType>
<complexType name="Root" mixed="true">
<sequence>
<element minOccurs="1" maxOccurs="unbounded" name="APIDataCapture" type="tns:APIDataCapture"/>
</sequence>
</complexType>
<element name="Root" type="tns:Root"/>
</schema>
<schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="urn:microsoft-dynamics-schemas/codeunit/MyWSAPI">
<element name="Get_Item_ETA_Date">
<complexType>
<sequence>
<element minOccurs="1" maxOccurs="1" name="itemNo" type="string"/>
</sequence>
</complexType>
</element>
<element name="Get_Item_ETA_Date_Result">
<complexType>
<sequence>
<element minOccurs="1" maxOccurs="1" name="return_value" type="date"/>
</sequence>
</complexType>
</element>
<element name="Find_Duplicate_Ext_Doc_No">
<complexType>
<sequence>
<element minOccurs="1" maxOccurs="1" name="custNo" type="string"/>
<element minOccurs="1" maxOccurs="1" name="extDocNo" type="string"/>
</sequence>
</complexType>
</element>
<element name="Find_Duplicate_Ext_Doc_No_Result">
<complexType>
<sequence>
<element minOccurs="1" maxOccurs="1" name="return_value" type="boolean"/>
</sequence>
</complexType>
</element>
<element name="Get_Item_Quantity">
<complexType>
<sequence>
<element xmlns:q1="urn:microsoft-dynamics-nav/xmlports/x00000" minOccurs="1" maxOccurs="1" name="aPIDataCapture" type="q1:Root"/>
</sequence>
</complexType>
</element>
<element name="Get_Item_Quantity_Result">
<complexType>
<sequence>
<element xmlns:q2="urn:microsoft-dynamics-nav/xmlports/x00000" minOccurs="1" maxOccurs="1" name="aPIDataCapture" type="q2:Root"/>
</sequence>
</complexType>
</element>
<element name="GetSalesOrderETA">
<complexType>
<sequence>
<element xmlns:q3="urn:microsoft-dynamics-nav/xmlports/x50014" minOccurs="1" maxOccurs="1" name="aPIDataCapture" type="q3:Root"/>
</sequence>
</complexType>
</element>
<element name="GetSalesOrderETA_Result">
<complexType>
<sequence>
<element xmlns:q4="urn:microsoft-dynamics-nav/xmlports/x50014" minOccurs="1" maxOccurs="1" name="aPIDataCapture" type="q4:Root"/>
</sequence>
</complexType>
</element>
</schema>
</types>
<message name="Get_Item_ETA_Date">
<part name="parameters" element="tns:Get_Item_ETA_Date"/>
</message>
<message name="Get_Item_ETA_Date_Result">
<part name="parameters" element="tns:Get_Item_ETA_Date_Result"/>
</message>
<message name="Find_Duplicate_Ext_Doc_No">
<part name="parameters" element="tns:Find_Duplicate_Ext_Doc_No"/>
</message>
<message name="Find_Duplicate_Ext_Doc_No_Result">
<part name="parameters" element="tns:Find_Duplicate_Ext_Doc_No_Result"/>
</message>
<message name="Get_Item_Quantity">
<part name="parameters" element="tns:Get_Item_Quantity"/>
</message>
<message name="Get_Item_Quantity_Result">
<part name="parameters" element="tns:Get_Item_Quantity_Result"/>
</message>
<message name="GetSalesOrderETA">
<part name="parameters" element="tns:GetSalesOrderETA"/>
</message>
<message name="GetSalesOrderETA_Result">
<part name="parameters" element="tns:GetSalesOrderETA_Result"/>
</message>
<portType name="MyWSAPI_Port">
<operation name="Get_Item_ETA_Date">
<input name="Get_Item_ETA_Date" message="tns:Get_Item_ETA_Date"/>
<output name="Get_Item_ETA_Date_Result" message="tns:Get_Item_ETA_Date_Result"/>
</operation>
<operation name="Find_Duplicate_Ext_Doc_No">
<input name="Find_Duplicate_Ext_Doc_No" message="tns:Find_Duplicate_Ext_Doc_No"/>
<output name="Find_Duplicate_Ext_Doc_No_Result" message="tns:Find_Duplicate_Ext_Doc_No_Result"/>
</operation>
<operation name="Get_Item_Quantity">
<input name="Get_Item_Quantity" message="tns:Get_Item_Quantity"/>
<output name="Get_Item_Quantity_Result" message="tns:Get_Item_Quantity_Result"/>
</operation>
<operation name="GetSalesOrderETA">
<input name="GetSalesOrderETA" message="tns:GetSalesOrderETA"/>
<output name="GetSalesOrderETA_Result" message="tns:GetSalesOrderETA_Result"/>
</operation>
</portType>
<binding name="MyWSAPI_Binding" type="tns:MyWSAPI_Port">
<binding xmlns="http://schemas.xmlsoap.org/wsdl/soap/" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="Get_Item_ETA_Date">
<operation xmlns="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="urn:microsoft-dynamics-schemas/codeunit/MyWSAPI:Get_Item_ETA_Date" style="document"/>
<input name="Get_Item_ETA_Date">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</input>
<output name="Get_Item_ETA_Date_Result">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</output>
</operation>
<operation name="Find_Duplicate_Ext_Doc_No">
<operation xmlns="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="urn:microsoft-dynamics-schemas/codeunit/myWSAPI:Find_Duplicate_Ext_Doc_No" style="document"/>
<input name="Find_Duplicate_Ext_Doc_No">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</input>
<output name="Find_Duplicate_Ext_Doc_No_Result">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</output>
</operation>
<operation name="Get_Item_Quantity">
<operation xmlns="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="urn:microsoft-dynamics-schemas/codeunit/myWSAPI:Get_Item_Quantity" style="document"/>
<input name="Get_Item_Quantity">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</input>
<output name="Get_Item_Quantity_Result">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</output>
</operation>
<operation name="GetSalesOrderETA">
<operation xmlns="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="urn:microsoft-dynamics-schemas/codeunit/myWSAPI:GetSalesOrderETA" style="document"/>
<input name="GetSalesOrderETA">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</input>
<output name="GetSalesOrderETA_Result">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</output>
</operation>
</binding>
<service name="myWSAPI">
<port name="myWSAPI_Port" binding="tns:MyWSAPI_Binding">
<address xmlns="http://schemas.xmlsoap.org/wsdl/soap/" location="http://nav-devapp.myrugs.local:7947/NAV80TEST_Staging/WS/My%20Living%252C%20Inc./Codeunit/MyWSAPI"/>
</port>
</service>
</definitions>

entities – Site suddenly died with “Call to undefined function entity_get_info()”

Suddenly this morning website died and the only thing it shows is:
Fatal error: Call to undefined function entity_get_info() in /home/millennium/www/www/sites/all/modules/entity/includes/entity.inc on line 217

I have seen that people go arround by disableing some modules, but i am entirely unable to access the website – hence unable to disable modules.

Any ideas on a workaround? I treid clearing the browser cache too.

controllers – Ajax call not working on Magento_Wishlist

I have created a controller for products added wishlist or not, if available include class name,

Controller:

<?php

namespace HeartListcolorControllerIndex;

class Wishlist extends MagentoFrameworkAppActionAction {

    public function __construct(
        MagentoFrameworkAppActionContext $context,
        MagentoWishlistHelperData $wishlistHelper,
        MagentoFrameworkControllerResultJsonFactory $jsonFactory
        ) {
            parent::__construct($context);
            $this->wishlistHelper = $wishlistHelper;
            $this->jsonFactory = $jsonFactory;
    }

    public function execute() {
        $result = $this->jsonFactory->create();
        $data = $this->wishlistHelper->getWishlistItemCollection()->getData();

        return $result->setData(('status' => 200, 'items' => $data));
    }
}

The controller working, i want to include class using ajax

Path: appdesignfrontendZeromy_themeMagento_Wishlisttemplatescatalogproductlistaddtowishlist.phtml

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

/** @var MagentoWishlistBlockCatalogProductProductListItemAddToWishlist $block */
?>
<?php if ($block->getWishlistHelper()->isAllow()) : ?>
    <div class="product-id-<?php echo $block->getProduct()->getId();?>">

    <a href="#"
       class="action towishlist"
       title="<?= $block->escapeHtmlAttr(__('Add to Wish List')) ?>"
       aria-label="<?= $block->escapeHtmlAttr(__('Add to Wish List')) ?>"
       data-post='<?= /* @noEscape */ $block->getAddToWishlistParams($block->getProduct()) ?>'
       data-action="add-to-wishlist"
       role="button">
       <img class="whislist-icon" src="<?php /* @escapeNotVerified */ echo $block->getViewFileUrl('images/whislist.png'); ?>" />
        <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span>
    </a>
</div>
<?php endif; ?>

<script>
require(('jquery'), function($){
jQuery.ajax({
url: '<?php echo $this->getUrl('customwishlist/index/wishlist') ?>',
method: 'get',
dataType: 'json',
success: function(data) {
var wislistAddesCheckData = data;
var itemLenth = wislistAddesCheckData.items.length;
for(i=0;i<itemLenth; i++){
var wislistAddedProductId = wislistAddesCheckData.items(i).product_id;
$(".product-id"+wislistAddedProductId).addClass('in-wishlist');
}
}
});
});
</script>

The script not functioning, the class not included, how to included that, my condition if products added to the wishlist should include class ,

<div class="product-id-<?php echo $block->getProduct()->getId();?>">

I want in angular 8 orr above to call api and subscribe data from it before going further execution

I am calling api and subscribe data from it before going further execution