Why wont the product description attribute, when set to TextArea, convert line breaks to

Magento v2.4.2

My product description attribute was set to TextArea, and its worked fine for the last year. New lines where rendered as
in HTML on the product page. I decided to change it to TextEditor so I can use HTML. I didnt realize when I did that, all my non HTML descriptions would lose all their formatting and new lines or line breaks would no longer render as
and my descriptions would look like one giant run on paragraph.

So I changed the attribute back to TextArea thinking it would revert back. It didnt. There is still new line or line breaks in all the product descriptions, so the data is still here. Its just not rendering like it used to.

I have cleared the cache, redeployed etc etc…any ideas?

javascript – DIV with CSS resize attribute detectable in Java Script

A DIV can be resize using CSS like this

resize: both;
overflow: auto;

So, when you mouse over the DIV , you will get the resize cursor on the lower right corner.

I tried to detect the cursor change to “resize” in Java Script with no luck so far. I tried to log the cursor style with this code on a “click event” when the cursor change to “resize” like this:

console.log(document.body.style.cursor);
console.log(e.target.style.cursor);

The log result id always a ” ” (empty) instead of a “resize” value.

Thanks in advance for your help.

anonymity – What is the definition of “sensitive attribute” in the context of k-anonimity?

I have encountered the term “sensitive attribute” multiple times when reading up on the concept of k-anonimity — but the texts never formally define what this term means.

Take this example of a k-anonymized table from Wikipedia:

+------+---------------+--------+-------------------+----------+-------------------+
| Name |      Age      | Gender | State of domicile | Religion |     Disease       |
+------+---------------+--------+-------------------+----------+-------------------+
| *    | 20 < Age ≤ 30 | Female | Tamil Nadu        | *        | Cancer            |
| *    | 20 < Age ≤ 30 | Female | Kerala            | *        | Viral infection   |
| *    | 20 < Age ≤ 30 | Female | Tamil Nadu        | *        | TB                |
| *    | 20 < Age ≤ 30 | Male   | Karnataka         | *        | No illness        |
| *    | 20 < Age ≤ 30 | Female | Kerala            | *        | Heart-related     |
| *    | 20 < Age ≤ 30 | Male   | Karnataka         | *        | TB                |
| *    | Age ≤ 20      | Male   | Kerala            | *        | Cancer            |
| *    | 20 < Age ≤ 30 | Male   | Karnataka         | *        | Heart-related     |
| *    | Age ≤ 20      | Male   | Kerala            | *        | Heart-related     |
| *    | Age ≤ 20      | Male   | Kerala            | *        | Viral infection   |
+------+---------------+--------+-------------------+----------+-------------------+

Where “Disease” is defined as the sensitive attribute. One can observe that this “sensitive attribute” does not hold in any kind of k-anonymity (k > 1)…

Is the sensitive attribute the piece of information which under no circumstances should be mapped to an individual? Or is it the attribute which shall not be generalized/suppressed for the purpose of data mining? Or is it something entirely different?

magento2.4.1 – How to solve Element ‘block’, attribute ‘destination’: The attribute ‘destination’ is not allowed

My homepage getting the following error,

1 exception(s):
Exception #0 (MagentoFrameworkConfigDomValidationException): Element 'block', attribute 'destination': The attribute 'destination' is not allowed.
Line: 953

Element 'block', attribute 'destination': The attribute 'destination' is not allowed.
Line: 988


Exception #0 (MagentoFrameworkConfigDomValidationException): Element 'block', attribute 'destination': The attribute 'destination' is not allowed.
Line: 953

Element 'block', attribute 'destination': The attribute 'destination' is not allowed.
Line: 988

<pre>#1 MagentoFrameworkConfigDom->__construct('<layout xmlns:xs...', &MagentoFrameworkAppArgumentsValidationState#0000000058d80d55000000006a5c4095#, array(), NULL, 'C:/xampp/htdocs/...', '%message%nLine: ...') called at (vendormagentoframeworkObjectManagerFactoryAbstractFactory.php:121)
#2 MagentoFrameworkObjectManagerFactoryAbstractFactory->createObject('MagentoFramewor...', array('<layout xmlns:xs...', &MagentoFrameworkAppArgumentsValidationState#0000000058d80d55000000006a5c4095#, array(), NULL, 'C:/xampp/htdocs/...', '%message%nLine: ...')) called at (vendormagentoframeworkObjectManagerFactoryDynamicDeveloper.php:66)

How to solve this error?

Log error:

(2021-03-01 04:07:53) report.INFO: Cache file with merged layout: LAYOUT_frontend_STORE1_5161502e12d09aab87e298d5a11fd6c6e_page_layout_merged and handles default, cms_index_index, cms_page_view, cms_index_index_id_home, am_mega_menu_layout: Please correct the XML data and try again. Element 'block', attribute 'destination': The attribute 'destination' is not allowed.
Line: 953

Element 'block', attribute 'destination': The attribute 'destination' is not allowed.
Line: 988
 () ()
(2021-03-01 04:07:53) report.ERROR: Element 'block', attribute 'destination': The attribute 'destination' is not allowed.
Line: 953

Element 'block', attribute 'destination': The attribute 'destination' is not allowed.
Line: 988
 () ()

formal languages – How to evaluate a Kleene’s Closure through CFG and attribute grammars

The semantic rules of the attribute grammar “compute” the value of the expression to the left in terms of the values of the expressions to the right. With a grammar for regular expressions as you propose this is straightforward, but precisely because of that this can be confusing.

For instance the meaning of the rule $S_0to S_1 S_2$ is concatenation, and this operation is directly translated into that operation on languages: $S_0.text{val} = (S_1.text{val}) cdot (S_2.text{val})$

(I have indexed the variables of the rules for clarity.)

Similarly for the Kleene star operation, here the syntactic notation $*$ in the expression, and in the production rule, is translated into the semantic operation Kleene star on languages which has the intended meaning. Thus $S_0to S_1^*$ with semantic rule $S_0.text{val} = (S_1.text{val})^*$

That’s all.

Once however, in a compiler setting, I have seen a different approach. There the semantic value of the expression was not a language, but a finite state automaton (non-deterministic, with $varepsilon$ rules). In that way the intended meaning of the expression is nicely captured in a computable fashion. The operations in the semantic rules are then the concatenation and star constructions on automata.

uicomponent – Custom Category Attribute not rendered in backend Categories Page

i try to add a new category attribute in Magento 2.3.6 and render an input in the category backend.
Setup worked, attribute is created. But the category_form.xml seems to be ignored. Maybe someone can show me whats wrong here.

I used this explanation first:
https://devdocs.magento.com/guides/v2.3/ui_comp_guide/howto/add_category_attribute.html

But i dont get the Attribute shown in backend. Module is enabled, setup creates the entries in eav_attribute and catalog_eav_attribute. I dont have errors in the logs.

Vendor/Module/Setup/InstallData.php

<?php
namespace VendorModuleSetup;

use MagentoFrameworkSetup{
    ModuleContextInterface,
    ModuleDataSetupInterface,
    InstallDataInterface
};

use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;

class InstallData implements InstallDataInterface
{
    private $eavSetupFactory;
    
    public function __construct(EavSetupFactory $eavSetupFactory) {
        $this->eavSetupFactory = $eavSetupFactory;
    }
    
    public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {
        $eavSetup = $this->eavSetupFactory->create(('setup' => $setup));
        $eavSetup->removeAttribute(MagentoCatalogModelCategory::ENTITY, 'product_group');
        $eavSetup->addAttribute(MagentoCatalogModelCategory::ENTITY, 'product_group', (
            'type'     => 'varchar',
            'label'    => 'Product Group',
            'default'  => null,
            'input'    => 'text',
            'visible'  => true,
            'required' => false,
            'global'   => MagentoEavModelEntityAttributeScopedAttributeInterface::SCOPE_STORE,
            'group'    => 'general',
            'source' => '',
            'backend'  => '',
            'user_defined' => false,
            'sort_order'   => 100,
        ));
    }
}

UI Component
Vendor/Module/view/adminhtml/ui_component/category_form.xml

<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <fieldset name="general">
        <field name="product_group">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="required" xsi:type="boolean">false</item>
                    <item name="validation" xsi:type="array">
                        <item name="required-entry" xsi:type="boolean">false</item>
                    </item>
                    <item name="sortOrder" xsi:type="number">100</item>
                    <item name="dataType" xsi:type="string">string</item>
                    <item name="formElement" xsi:type="string">input</item>
                    <item name="label" translate="true" xsi:type="string">Product Group</item>
                </item>
            </argument>
        </field>
    </fieldset>
</form>

Would be great if someone can help me 🙂

Regards,
Andreas

python – Erro AttributeError: ‘Aluno’ object has no attribute ‘lista_estudante’

Nesse código preciso criar uma lista com os dados do DB que são lidos no Python pela classe Aluno

Trecho do código que necessita imprimir a lista que foi inserida no DB com um INSERT

class Aluno(object):

    def update_aluno(self, nome_aluno, id_curso, data_nascimento_aluno, email_aluno, telefone_aluno):
    """ atualiza informações do aluno baseado no id_aluno """
    sql = """ UPDATE Aluno
                SET nome_aluno = %s
                SET id_curso = %s
                SET data_nascimento_aluno = %s
                SET email_aluno = %s
                SET telefone_aluno = %s
                WHERE id_curso = %s"""
    conn = None
    updated_rows = 0
    
    try:
        # read database configuration
        params = config(filename="/database.ini")
        # connect to the PostgreSQL database
        conn = psycopg2.connect(**params)
        # create a new cursor
        cur = conn.cursor()
        # execute the UPDATE  statement
        cur.execute(sql, (nome_aluno, id_curso, data_nascimento_aluno, email_aluno, telefone_aluno))
        # get the number of updated rows
        updated_rows = cur.rowcount
        # Commit the changes to the database
        conn.commit()
        # Close communication with the PostgreSQL database
        cur.close()
    except (Exception, psycopg2.DatabaseError) as error:
        print(error)
    finally:
        if conn is not None:
            conn.close()

    return updated_rows

Trecho do código que executa e solicita informações ao usuário:

  elif lista_selecionada == 2:
    print("Confira a lista de alunos da Escola: n")
    estudante = Aluno()
    estudante.lista_estudante()

    id_estudante = int(input("Digite a matrícula do aluno que deseja atualizar: n"))
    nome_aluno = input("Digite o novo nome do aluno: n")
    is_curso = input("Digite o curso 3 para Fundamental e 4 para Fundamental 2: n")
    data_nascimento_aluno = input("Digite a nova data de nascimento do aluno: n")
    email_aluno = input("Digite o novo e-mail do aluno: n")
    telefone_aluno = input("Digite o novo telefone do aluno: n")
    
    estudante.update_aluno(matricula_aluno = id_estudante, id_curso=is_curso, nome_aluno=nome_aluno, data_nascimento_aluno = data_nascimento_aluno, email_aluno = email_aluno, telefone_aluno=telefone_aluno)

Entendi que preciso fazer um referência a estudante.lista_estudante() na classe, só que não tenho ideia de como, podem me ajudar?

magento2 – Add Block to Product Page with selection attribute in backend

I am trying to create an option where I can select yes or no in the backend, and when it’s set to yes, it adds a block with an image in the product page. Here’s what I have so far:

  1. I created a Yes/No Attribute called “samsung_5_vjet_garanci” and
    made sure its Visible on Catalog Pages on Storefront. Added it on a sample product, and set it to YES
  2. Created a CMS Block with just the “<img src=”{{media url=”wysiwyg/image.png”}}” alt=”” />” with identifier “samsung-garanci”
  3. Created a .phtml file and uploaded it /app/design/frontend/vendor/themename/Magento_Catalog/templates/product/view/samsung.phtml
<?php $_product = Mage::getSingleton('catalog/product')
            ->load($_product->getId());

if ($_product->getAttributeText('samsung_5_vjet_garanci') == "Yes"): ?>

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('samsung-garanci')->toHtml(); ?>

<?php endif; ?>
  1. Added a block in catalog_product_view.xml

    <referenceContainer name="product.info.main">
        <block class="MagentoCatalogBlockProductView" name="samsung" as="samsung" after="-" template="Magento_Catalog::product/view/samsung.phtml" />
    </referenceContainer>
    

But it’s not working, what am I doing wrong, it’s been 3 days figuring this out, and still nothing.
Thank you very much if you help me

plugin – magento 2 hide out of stock products except when a specific attribute equals yes

I would like to hide out of stock products generally so I’ve added the option in the store configuration settings. However there are certain products that will be restocked soon. I’d like to keep showing those.

Therefore I decided to add an attribute to them to mark them for restock att_restock.

However I’m not sure how to override the logic so that it works in the category, layered navigation and search results pages now. I’ve tried other solutions in

Where should I add my plugin in order to add my logic in the selection?

Any help is appreciated.

magento2.4 – Magento 2.4 : Sort Product by attribute value

i have configurable and simple product in my website with Attribute color: (Values – Red, Green, Blue)

I want to sort product on the listing page with specific attribute value, for example, all product having red as color should show first then rest of products.

I could not get any way to get this done