magento2 – Magento 2: Filter a custom column in the admin grid

I have a custom column in an admin grid, this column is filled with custom rendering and is not actually saved in the database. Is it possible to always filter by this column?

in my Grid.php file:

  'test_column', (
    'header' => __('Test Column'), 
    'index' => 'test_column', 
    'renderer' => 'CompanyModuleBlockStockMovementRendererTest'

And here is my "test.php"Render file:

    if ($comments) {
      return 'yes';
    } else {
      return 'no';

So now, in my custom column on my grid with either yes or no text values. These are not actually saved in the database, but only returned text. How can I filter using the text in this column?

magento2 – Custom product block Magento 2 in cms page

I want to display a custom product block in the cms page. So I created


then in

myphpcode.phtml I write the following code

 $productId = "1141"; //Product Id

 $objectManager = MagentoFrameworkAppObjectManager::getInstance();
 $product =
 echo $product->getName();

and in the cms page I write the following code

{{block class="MagentoFrameworkViewElementTemplate" template="Magento_Theme::myphp/myphpcode.phtml"}}

now i can get the product name . But I want to get the whole product block. Like how a product in a category page or a search page, etc.

Why I do this, it is that I have 3,4 product IDs. I have to display these products in cms page. If this product is in the same category, I can do it by inserting a widget with the category ID. Bu that's not it.

So, I want to display the entire product block in the pages

magento2 – How to save data in two different tables (administrator grid form)

In NewAction.php, I save data in two different tables. Both models have a different model for new contacts. They work well, but when editing existing data, they update the first row of the table and create a new row in the second row. here in my code "con_id" is a foreign key

 class NewAction extends MagentoBackendAppAction
 * Edit A Contact Page
 * @return MagentoBackendModelViewResultPage|MagentoBackendModelViewResultRedirect
 * @SuppressWarnings(PHPMD.NPathComplexity)
public function execute()

    $contactDatas = $this->getRequest()->getParam('contact');

    if(is_array($contactDatas)) {
        $contact = $this->_objectManager->create(Contact::class);
        $id = $contact->getId();
        $contactt = $this->_objectManager->create(Contactt::class);
        $contactt->setData('con_id', $id);
        $contactt->setData('address', $contactDatas('address'));
        $contactt->setData('zipcode', $contactDatas('zipcode'));
        $contactt->setData('country', $contactDatas('country'));
             $this->messageManager->addSuccessMessage(__('You saved the data.'));
             $this->messageManager->addErrorMessage(__('Data was not saved.'));
        $resultRedirect = $this->resultRedirectFactory->create();
        return $resultRedirect->setPath('*/*/index');

magento2 – Calling MAGENTO API 1.9 with the help of HTML and JAVASCRIPT (question of experts – problem) HELP

I need someone who knows MAGENTO well and everything about API and REST APIS

I have a website and I want to validate (check if you wish) if the email of a certain customer exists or not in MAGENTO (version 1.9)

In fact, only MAGENTO version 2 has a standard API endpoint called clients / isEmailAvailable to check if e-mail is available BUT I'm using MAGENTO version1.9, so I can not use it. You understand me?

This is my HTML code:


Email validator

AND it would be possible to call the MAGENTO 2 API using this code:

        url: "page",
        type: 'POST',
        data: JSON.stringify({"customerEmail": ""}),
        contentType: "application/json",
        dataType: "json",
        showLoader: true,
        success: function (response) {

BUT I can not use that in MAGENTO 1.9, so I'm a bit desperate 🙁

How can I validate if an email exists or not to use something
similar but for MAGENTO 1.9 instead?

This is my MAGENTO API, take a look at this:


Here is an example of the JSON code I received from MAGENTO when I clicked "SEND" on POSTMAN:

        "magento_id": "54678",
        "firstname": "Richard",
        "lastname": "Herther",
        "email": "",
        "password": null,
        "website_id": "8",
        "group_id": "7",
        "disable_auto_group_change": "0",
        "prefix": null,
        "middlename": null,
        "suffix": null,
        "taxvat": null,
        "account_id": (
        "document": "66958746845",
        "document_type": "15",
        "gender": null,
        "telephone": null

Please note that I have a user name and a TOKEN to access MAGENTO APIs

Please, I do not know what to do, I'm lost!

Thank you

magento2 – Hide the payment method if the customer has more than one order of treatment

I am new to Magento and I am trying to learn Magento.
I try to hide a payment method if the customer has more than one order of treatment. So I created a module call, KgPayMethod. In this module, I added this line to events.xml.

and my class like this:

getEvent()->getMethodInstance()->getCode() == "banktransfer" )
            $checkResult = $observer->getEvent()->getResult();
            $checkResult->setData('is_available', false);

Now, I do not know how to get all orders from customers and if it had only had a processing order, the payment method would be hidden only in this case.

Maybe use $ observ-> getEvent () -> getOrder () but how to debug?

Thanks for the help!

magento2 – how to fix Note: Offset undefined: 0 in magento 2?

Exception # 0 (exception): Note: Undefined offset: 0 in /var/www/clients/client0/web2/web/app/code/Mirasvit/Search/Block/Result.php

 * @return IndexInterface
public function getFirstMatchedIndex()
    foreach ($this->getIndices() as $index) {
        if (($index->getData('store_id') == false
            || $index->getData('store_id') == $this->getCurrentStore()->getId())
        ) {
            return $index;

    return $this->getIndices()(0);

magento2 – Magento 2 defines the attributes of command extension via the API

Is it possible to set the value of the extension attribute of a command when creating the command via the API or is there an end node? Appropriate API to update an existing order with this information?

For example to create a command that I'm calling / rest / V1 / carts / 49 / order

with the following charge:

    "paymentMethod": {
                "method": "banktransfer"
    "billing_address": {
                "email": "",
            "region": "New York",
            "region_id": 43,
            "region_code": "NY",
                "country_id": "US",
                "street": ["123 Oak Ave"],
                "postcode": "10577",
                "city": "Purchase",
                "telephone": "512-555-1111",
                "firstname": "Jane",
                "lastname": "Doe"
     "extension_attributes": {
        "legacy_order_id": {
            "value": "1111-1111-1111"

But that does not seem to be defined in relation to the attribute extension orders

magento2 – Can save the configuration parameter, but it does not change

I can save the changed configuration settings, but nothing changes when the page is reloaded.

Example: I will change region / state. I fill "Limburg" (it is now Antwerpen). I change that. No mistake, everything is fine. But when the page is reloaded, the region / state is always "Antwerpen". In the facade is also not changed.

What is going on?

magento2 – Free online payment extension for SPS Tunisia

Battery Exchange Network

The Stack Exchange network includes 175 question-and-answer communities, including Stack Overflow, the largest and most reliable online community on which developers can learn, share knowledge and build their careers.

Visit Stack Exchange

Magento2 displays the label on the product page if the price is with or without tax

In the EU you have to go on the label if the price is incl. or excl. tax in the shop. If you run different stores in which you have both settings, this can be done with different custom translation strings that are specific to the store view.
Magento has the information, whether a price is TTC or excl, but the question is how to code it. In Magento1, I solved it with the following code, but until now, I do not know how to do it with Magento2:

    __('Incl. Tax') ?> 

    __('Excl. Tax') ?> 

Ideas? Thank you so much!