texts: Add multiple items to cart while saving cart

texts:
I've run into a problem with my code when I try to add multiple items to my cart. I've added a product with the ID of 7 to the cart and then i'm trying to add a product with an ID of 8 to the cart, but instead it adds the product with ID 7 twice.
$params = array(
    'form_key' => $this->_formKey->getFormKey(),
    'product' => 8,
    'qty' => 1
);

$product = $this->_product->load(8);
$this->_cart->addProduct($product, $params);

$params = array(
    'form_key' => $this->_formKey->getFormKey(),
    'product' => 7,
    'qty' => 1
);

$product = $this->_product->load(7);
$this->_cart->addProduct($product, $params);

$this->_cart->save();

If I add another cart save between adding the two products, the next block of code is completely ignored currently.
Is there any way of getting around this or am I missing something?


texts: How to Override Core Block, Model and controller in Magento2

texts:
I'm stuck in overriding core model Blocks and Controllers in Magento 2.
Can any one help on this?
Let's take list toolbar as example where I need to add a new sort option called sort by most popular. How do I add it? I guess for this we need to add option in block level and condition in List.php collection level.


texts: Magento 2 frontend route only allow POST method

texts:
I'm using magento 2.2.5 and created a frontend route like this:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <router id="standard">
        <route id="spin" frontName="spin">
            <module name="Neverending_Story" />
        </route>
    </router>
</config>

How can i allow only POST method request that can access this route ??


texts: Magento1 website Security patch installation by script

texts:
Magento1 my website i have installing following Security patch:
Security patch 10975
Security patch 10415
Security patch 9767
Security patch 8788
Security patch 7405
  but i want script in my root folder then run above Security patch.

so i want script.

So help me.

Thank you,
Your Faithfully,
Mehul Kanjariya


texts: How to copy phpunit test xml file of a module under dev/tests/unit/ with composer installation in Magento 2?

texts:
I wrote a module including phpunit test xml file. I want to automatically copy that xml file under dev/tests/unit/ after composer update.

The composer.json of the module looks like

{
    "name": "myvendor/mymodule",
    "description": "myvendor mymodule",
    "require": {
        "php": "~5.5.22|~5.6.0|~7.0.2|7.0.4|~7.0.6"
    },
    "type": "magento2-module",
    "version": "1.0.0",
    "license": [
        "proprietary"
    ],
    "autoload": {
        "files": [ "registration.php" ],
        "psr-4": {
            "MyVendor\\MyModule\\": ""
        }
    },
    "extra": {
        "map": [
            [
                "mymodule-phpunit.xml",
                "dev/tests/unit/mymodule-phpunit.xml"
            ]
        ]
    }
}

But the node extra/map does not work.


texts: How to override one function from one of the core blocks class?

texts:
I need to override one function from the following file:
Mage/Adminhtml/Block/Widget/Grid/Massaction/Abstract.php

The function that needs to be overriden is getJavaScript().

I have tried at least three different solutions from SE, however, none of them seemed to produce any outcome.


texts: Error Create Store View for each Magento 2 language

texts:
I have installed the following language packs:

php bin/magento setup: static-content: deploy -f nl_NL
php bin/magento setup: static-content: deploy -f fr_FR
php bin/magento setup: static-content: deploy -f de_DE

Once the deploy is done, the cache cleaned and reindexed, I have created a Store View for each language but when I activate them and change in my store to the selected language I get the following error:

Can someone help me understand what the problem is please? Because I can not find out why it is not working for me.

thank you very much!


texts: Unable to save category image on Magento 2.3

texts:
Im using Magento 2.3.1 and im unable to save the category image, the strange thing is i can save the title, the content and everything else.

I have tested on a fresh install and it works, so it looks like its my db broken.

I need to know witch tables are involved on this?, maybe something related to attributes?

I have also changed the template and same error, so this is a db issue. Something related to the ids.

Please note also when i access to Catalog->Product on dashboard im getting this:

Can't check requested quantity for products without Source Items support.


texts: How to add X-Frame-Options="sameorigin" to Magento 1.7?

texts:
We are planning an upgrade to our store within 2-3 months, but in the interim, I need to pass a PCI compliance scan of our website. This is the only error that I cannot seem to figure out how to install.

I need to add X-Frame-Options="sameorigin" (To prevent clickjacking) to the headers of all of my website pages.  Where would I implement such code?


texts: Can anyone Explain Wizard creation in Magento catalog product step like configurations in Magneto2?

texts: I have checked in Magento 2 dev docs where wizard component explain only by frontend point of view But anyone who knows how it is going to work for backend development point of view?


texts: Magento 2 : How to show all active categories in layered navigation with its sub-categories?

texts:
These are Categories List in admin:

Categories Showing in Layered Navigation on Shop Parts Category Page:

Now you can see only first child categories of shop parts category are showing and I want to show them as well as all children of those categories.

How can I achieve this functionality?


texts:
how can I remove the customer tab at admin side please have a look in attachment https://prnt.sc/s76tjx
I want to remove the billing agreement tab but not able to remove can someone help me

here is a code

<referenceBlock name="customer_edit_tab_view">
    <referenceBlock name="customer.billing.agreement.grid" remove="true" /> <!-- Not working -->
    <referenceBlock name="billing" remove="true" /> <!-- Not working -->
    <referenceBlock name="billing-agreement" remove="true" /> <!-- Not working -->
</referenceBlock>

and also for this
https://prnt.sc/s7cbiv

thanks in advance


texts: make changes in page content before load in magento

texts: I want to make changes in cms page's content dynamically before page load on front-end.


texts: Additional fee interferes with other fees

texts:
I've added an additional fee (for prepaid customs and duty) based heavily on this tutorial at
excellencemagentoblog.com.

I thought I had it working, but now that a few people are using it in the wild, we've discovered a problem.

When there are other fees outside the ones normally displayed, then the whole collect totals thing breaks.  For example, if a merchant uses a cart rule that gives a discount based on subtotal, the discount doesn't show, my fee doesn't show, and the grand total is wrong (it's not the total without the discount and fee, and it's also not the correct total with them).

If I remove the collector from the config.xml, then everything goes back to how it should, but obviously my additional fee doesn't work anymore.

Because of the checkout process followed (programatically created order after 3rd party hosted checkout), I really don't need my additional fee run in the cart or visible in the quote, only in the order views, invoice, etc.

Collect totals is far from my expertise so I appreciate any help.  I'm happy to post any code that might help.  Just let me know what you'd like to see. most of it follows very closely the tutorial, with just some additional logic to determine the amount and if it applies.


texts: How to Change "Place order" button link to my custom module page

texts:
I want to Change "Place order" button link and redirect to my custom module page.
But I didn't create any payment module.
I want my Place Order button will redirect to custom module page where I can collect data from users (Products data that customer order in forms)
Module Path: app>code>Softadroit>Prescription>controller>index>index.php


texts: How Do I Incorporate Google Adsense Into My Product Pages

texts:
I realize there is one other question on this issue with no real answers only counter questions to the op that question is here

https://magento.stackexchange.com/questions/79516/how-to-add-an-ad-from-adsense-to-my-magento

but I am specifying what page and I will be more attentive then the other op with follow ups.

google adsense is only a small snippet of code, but Im gonna be honest I understand all the blocks and page and phtml like I understand Cyrillic languages... I dont... not at all.

All I want to do is have it show up at the bottom of the page.  I think I managed to get it on the side (although i never saw any ads, probably due to it being my first day with adsense Im told) from this post

http://forum.azmagento.com/how-to/how-do-i-get-adsense-ads-on-my-site-90103.html

althought that may have not worked as it should, but still it made a block reservation on the right side, but this was only on the home page, and not on the product pages.

I have a huge bounce rate on my product pages from google searches and want to captivate on this bounce rate.


texts:
I get an error like:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry
'hracky/elektricke/bburago-range-rover-sport-black-d5848030-evoqu' for
key 'URL_REWRITE_REQUEST_PATH_STORE_ID', query was: INSERT INTO
url_rewrite
(redirect_type,is_autogenerated,metadata,description,entity_type,entity_id,request_path,target_path,store_id)
VALUES

but my actual url is : hracky/elektricke/bburago-range-rover-sport-black-d5848030-evoque-jednomiestn-odpruzene-napravy-cervene-kozene-sedadla-dialkovy
It always checks for the first 64 characters and that found duplicate but in database there is not duplicate.


texts: How to redirect a category page link to CMS page link in Magento 2

texts:
I want to redirect my category link to some cms page. Could anyone tell me how to do so? Any help will be appreciated.

@Kho TruongDinh As you specified, I have used URL rewrite, but it did not work for me..

What I really did is... I created a category 'Type', and I created a cms page for that category as 'type-page'.

Then I went to URL rewrites.

I wrote a URL rewrite as below.

But now, the redirect is not working, it still shows the default category page. Any solution????


texts: system.xml What is the difference in adding a new configuration option process for different option types (secret, file)?

texts:
From the official M2 Developer certification guide I'm stuck at this question.

  How would you add a new system
  configuration option? What is the difference in this process for different option types (secret, file)?

I know how to add new system configuration options but I have no ideea about this part  What is the difference in this process for different option types (secret, file)?.

Any clues,tips are highly appreciated.


texts:
I have try to search, but I did not get any suitable suggestion or solution.
I want to have on my frontpage detail of product (I mean this: http://community.user.magentotrial.com/asicsr-men-s-gel-kayanor-xii-95.html on homepage).
Have you any suggestion, or idea, or even extension (I did not find suitable extension).
I want, that visitor can directly choose attributes and buy product, he do not need go to product detail page - so detail page is first, what you will see after opening my site url.

// I forgot my installation is 1.9.0.1 (demo is 1.8 but does not matter, it is just to imagine what I mean)

Thank you very much Peter


texts: I am starting out learning Magento with no PHP experience, what are my options?

texts:
I have programming experience and HTML experience and am struggling to find a good guide for beginners.

The Magento website seems pitched at experts but I could be looking in all the wrong places.

Are there any especially good books or online resources?

In particular I would like to learn how to add my own JavaScript to the various pages in the site for a custom retail data analytics service I am working on.


texts: Product Name is not showing on product detail page

texts:
Product name is showing on product listing but when I clicked to view the specific product details it's not showing product name all other things. I use setup: upgrade and index: reindex and cache: flush many time but same result.

See Product Detail Image Below

See Admin Panel Image


texts: M2 Save custom attribute on Customer Group form

texts:
I've created a plugin to save an attribute on customer group form. The form input is a multi select, so I added a table field (string) in the customer_group database via updateSchema.php I figured that a text field will contain comma separated values.

The field is showing fine, I then added a before plugin to the default controller. But I'm stuck right there. I don know how to save this field.
The field appears in the db.

app/code/vendor/plug/Setup/UpgradeSchema.php

namespace vendor\plug\Setup;

use Magento\Framework\Setup\UpgradeSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;

/**
 * @codeCoverageIgnore
 */
class UpgradeSchema implements UpgradeSchemaInterface
{
    /**
     * {@inheritdoc}
     */
    public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
    {
        $setup->startSetup();
        if (version_compare($context->getVersion(), '0.1.0', '<')) {
            $setup->getConnection()->addColumn(
                $setup->getTable('customer_group'),
                'shipping_method',
                [
                    'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
                    'length' => 100,
                    'nullable' => true,
                    'default' => null,
                    'unsigned' => true,
                    'comment' => 'Shipping method id'
                ]
            );
        }

        $setup->endSetup();
    }
}

app/code/vendor/plug/etc/di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Customer\Block\Adminhtml\Group\Edit\Form">
    <plugin name="add_form_field" type="vendor\plug\Model\Plugin\Form" sortOrder="1"/>
</type>
<type name="Magento\Customer\Controller\Adminhtml\Group\Save">
    <plugin name="save_field" type="vendor\plug\Model\Plugin\Form" sortOrder="1"/>
</type>

The plugin:
app/code/vendor/plug/Model/Plugin/Form.php

namespace vendor\plug\Model\Plugin;

class Form extends \vendor\plug\Model\Source\Method
{

    public function aftersetForm(
        \Magento\Customer\Block\Adminhtml\Group\Edit\Form $forma)
    {
        $form = $forma->getForm();
        $fieldset=$form->addFieldset('base1_fieldset', ['legend' => __('Envio')]);
        $shipping = $fieldset->addField('shipping_method',
            'multiselect',
            [
                'name' => 'shipping_method',
                'label' => __('Shipping Method'),
                'title' => __('Shipping Method'),
                'class' => 'required-entry',
                'required' => true,
                'values' => $this->toOptionArray(),
            ]);
        return $form;
    } //this shows ok!

    public function beforeExecute(\Magento\Customer\Controller\Adminhtml\Group\Save $save)
    {
        echo 'Local before <br>';
        //Dont know what to do
        return $returnValue;
    }


texts: Magento 2 Ebizmarts Mailchimp extension error

texts:
I installed ebizmarts mailchimp extension to my magento 2 store.
After selecting the Apikey in stores tab, its not showing mailchimp list on the dropdown.

I am getting js error:

script error for: configmonkeyapikey

anyone else got the same issue and have solution for this?

thanks


texts: Different list.phtml for categorys in the backend of Magento 2.1.7

texts:
I try to switch the list.phtml for 4 categorys.
Each category should have his own list.phtml.

The problem:

I don't want to call it by the category id directly. I know I can easy do this directly in the list.phtml file for every category.

I want to call it in the backend from magento 2.

product->category under design.

I used:

<referenceBlock name="category.products.list">
    <arguments>
        <argument name="template" xsi:type="string">Magento_Catalog::product/list_souvenirs.phtml</argument>
    </arguments>
</referenceBlock>

and

<referenceBlock name="category.products.list">
     <action method="setTemplate">
        <argument name="template" xsi:type="string">Magento_Catalog::product/list_souvenirs.phtml</argument>
     </action>
</referenceBlock>

but none of them works.

The theme still use the list.phtml instead of my "list_souvenirs.phtml"

The list.phtml is called in the catalog_category_view.xml like this:

<referenceContainer name="content">
    <block class="Magento\Catalog\Block\Category\View" name="category.products" template="Magento_Catalog::category/products.phtml">
        <block class="Magento\Catalog\Block\Product\ListProduct" name="category.products.list" as="product_list" template="Magento_Catalog::product/list.phtml">

Its not a problem with my default.xml because I can delete the "breadcrumbs"  for example.

<referenceBlock name="breadcrumbs" remove="true" />


texts: Reset the admin panel settings of a module installed in Demo magento project every specific time interval

texts:
How to reset the admin panel settings of a module installed in a demo magento project everyday or in any time frame.

I want to create a demo project for the module that I have developed, so that any User can login to admin panel and have access to My module functionality and settings. So when they logout, the settings in Admin panel will get changed compared to default values that I have set. It will create confusion to all the other Users who will Login after the initial user.

So I want to reset all my module settings in admin panel to default value every specific time interval for example: every 5 minutes, the values need to reset.


texts: Images replaced but still bringing the old images

texts:
For speed optimization Google suggested certain images to be compressed from GIF to PNG.

I have placed them in the folder mentioned in the manifest. But after loading the site and upon inspecting the site images its again loading the .gif images.

whats happening? I'm just an amateur in Magento. any help would be appreciated.


texts: How to get store category url in Magento 1.8?

texts:
how can I get the store category url?

I know I can get the store direct url like this,

Contact Us

But what about the store's categories?

The categories I have in my store, such as 'Wines', 'Food', etc, so if I do this,

{{store direct_url="wines"}} // returns http://mystore/wine

I will get a 404 error page. Because the url should be like this,

http://mystore/wine.html

Any idea?


texts: while importing product csv validation is done after clicking on import getting below error.


texts: update SKU on save using observer in Magento 2

texts:
On Saving New/Old products in admin, I am updating the SKU automatically with [PRODUCTID]-[COLOR] value.

I am able to update any attribute via observer, but when try to update SKU it gives me an error.  I am using 2.1.8 version and event observer.

I if use

$this->action->updateAttributes([$id], ['ATTRIBUTE-name)' => "ANYVALUE"],$storeId);   // It works,

if Attribute = sku , it fails.

Notice: Undefined index: value in \www\magento\vendor\magento\module-eav\Model\Entity\AbstractEntity.php on line 1567

This is my code

<?php
                namespace [NAMESPACE]\[MODULE]\Observer;

                class Productsaveafter implements \Magento\Framework\Event\ObserverInterface
                {
                    protected $action;
                    protected $storemanager;

                    public function __construct(
                        \Magento\Catalog\Model\Product\Action $action,
                        \Magento\Store\Model\StoreManagerInterface $storemanager
                    ){
                        $this->action = $action;
                        $this->storemanager = $storemanager;
                    }

                public function execute(\Magento\Framework\Event\Observer $observer)
                {
                    $product = $observer->getEvent()->getProduct();
                    $id = $product->getId();
                    $MYSKU = $id.'-RED'; // example

                        $storeId = $this->storemanager->getStore()->getStoreId();
                    $this->action->updateAttributes([$id], ['sku' => $MYSKU],$storeId);

                        return $this;
                }

                ?>

Event XML:

    <event name="catalog_product_save_after">
        <observer name="myobserver_productsaveafter" instance="[NAMESPACE]\[MODULE]\Observer\Productsaveafter" />
    </event>

DI XMl is empty

Does anybody can tell me what is wrong with my code or suggest another way to do this?


texts: Change timeout for dropdown in magento 2

texts:
I need to change the timeout for the dropdowns of megamenu,
cart icon and my account.
I found the dropdown.js file in the Mage folder but I am not able to understand from where do I change the timeout.
But I don't think dropdown.js is the right file

I referred this link for mini cart

  Magento 2, Change On hover instead of 'click' for mini cart

Not able to find the same for Magamenu and 'My account' dropdown at the top header


texts: Coupon wrong Grand Total Caclulation and minimum order value... again

texts:
I've read a lot about this problem, but mine seems to be ... different. I have 1 item in my cart and I've used a discount cupon - look at the result.

Somehow 0,50 € are being added to the VAT.... from nowhere!!! If I add 2 items, then instead of 0,50€, 1,01€ is being added. Does
anyone know about this bug?
This only seems to happen if I use the discount coupon
I have a rule "min. order value = 20€". If I use the discount coupon I can't go to checkout because " The min. order value is not reached...". So it seems that magento is looking at the Grand Total Value and not at the Order value. I could go ahead and change it in the /app/code/core/Mage/Sales/Model/Quote/Address.php file. But is this really a bug of magento?


texts: If no records found I see whitespace error PHP Magento 2

texts:
I just used raw sql to get value from table, this is my code.

 public function getPaymentUsed(){

    $order = $this->getOrderId();
    $this->_resources = \Magento\Framework\App\ObjectManager::getInstance()
    ->get('Magento\Framework\App\ResourceConnection');
    $connection= $this->_resources->getConnection();
    //$sql = "SELECT payment_made FROM `walletsToOrders` WHERE `customer_id` = '$customerid' AND `product_id` = '$prid' ";
    $sql = "SELECT payment_made FROM `walletsToOrders` WHERE `order_id` = '$order' ";
    $result2 =  $connection->fetchall($sql);
    $real_product = $result2['0'];
    $real_product_price = $real_product['payment_made'];
    return $real_product_price;
    $connection->query($sql);
    }

When no record found I see this error.

This is not supposed to arrive.

But when record found I see my output.


texts: Magento 2.3.3 - Date format issue in admin area with different locale

texts:
I tried to edit the product special price date from admin with different locale and it showing issue with date format.

It is working properly with en_US locale. When I switch the locale to nl_NL, the day and year changed each other.

For example : If I selected 30/01/2020 and 01/01/2021 date in en_US locale.

It shows 20-01-2030 and 21-01-2001 in nl_NL locale. Also, I can correct the date and save again with nl_NL. It shows the same issue after save.


texts: Magento 2 - Enable the authorisation login popup modal

texts:
How do I activate the authorize Login popup modal for Magento 2?

Like shown below. Is this a Extension or can I activate this by configuration or by edits in my Theme?


texts:
I have created a backup database by command line:

  php bin/magento setup:backup --db

Then I import it to my new PHPMyAdmin, But it shows a bug:

Static analysis:

4 errors were found during analysis.

    Unexpected character. (near "\" at position 0)
    Unexpected beginning of statement. (near "\" at position 0)
    Unexpected beginning of statement. (near "nCREATE" at position 1)
    Unrecognized statement type. (near "ALGORITHM" at position 9)

SQL query: Documentation

\nCREATE ALGORITHM=UNDEFINED SQL SECURITY INVOKER VIEW `inventory_stock_1` AS select distinct `legacy_stock_status`.`product_id` AS `product_id`,`legacy_stock_status`.`website_id` AS `website_id`,`legacy_stock_status`.`stock_id` AS `stock_id`,`legacy_stock_status`.`qty` AS `quantity`,`legacy_stock_status`.`stock_status` AS `is_salable`,`product`.`sku` AS `sku` from (`cataloginventory_stock_status` `legacy_stock_status` join `catalog_product_entity` `product` on((`legacy_stock_status`.`product_id` = `product`.`entity_id`)))


texts: Unable to save products setting on admin panel

texts:
I'm having an issue where I'm unable to save any changes to product in the Magento 2 admin area. It throws me 500 Internal Server Error. after checking error's logs I found the following error does anyone have an idea . Thank you

main.WARNING: Cannot gather stats! Warning!stat(): stat failed for
/usr/local/var/www/mysite/pub/media/catalog/product/1/l/at_ssok.jpg
{"exception":"[object]
(Magento\Framework\Exception\FileSystemException(code: 0): Cannot
gather stats! Warning!stat(): stat failed for
/usr/local/var/www/mysite/pub/media/catalog/product/1/l/at_ssok.jpg at
/usr/local/var/www/mysite/vendor/magento/framework/Filesystem/Driver/File.php:77)"}
[]


texts:
I just manually installed Magento2 CE on Ubuntu server 18.04 with LAMP via composer, the install went ok and all checks were on green however the link given after installation to access the magento admin page is giving error 404.

To resolve this a few people say it should work by changing from the config:

sudo nano /etc/apache2/apache2.conf

From:

     Options Indexes FollowSymLinks
     AllowOverride None
     Require all granted

To

        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted

but is still not working, another tutorials also say to change the file pub/.htaccess to magento root folder which im guessing it would be located default on:  /var/www/html/magento

However I'm new to Ubuntu commands and I'm unable to  find any suggestions of hwo to do this, would it work with this?

sudo mv /var/www/html/magento/pub/.htaccess /var/www/html/magento

If, I tried it and is not working, any suggestions?? or anyone here who have fixed this issue before??

Thank you for your assistance.


texts:
Once again, a best practice question I have.
I need to pass some variable to a child block in a template. In particular, the child block is a Default Rendered block I specified in a custom RenderList in the sales order page.
I need to pass a variable to this child block, let's call it shipmentId.
I tried the following, in the parent block, and it works:
        $extra = $block->getChildBlock('renderer.list')->getChildBlock('default');
        if ($extra) {
            $extra->setData('shippingId',$shipment->getId());
        }

In the child block, the Default Renderer, I then just do
$block->getData('shippingId')
This works, but I suppose it is far from being good practice. How would you do it?
Thanks.


texts: How to get product id's of first page in the second page in magento 2 plp

texts: I need to get first page product id's while calling second page collection in ListProduct.php


texts: Magento 2.3 : change store view bypass from url

texts:
i want to change my store view from url  is it possible ?

so I just type url : http:// xxx. com/urltochangestoreview


texts: Magento 2: Select Field From Collection Query

texts:
I have below query. I want to select only 1 field from table instead of all.

$collection = $this->_collectionFactory->addFieldToFilter('status', 0)->load();
//$collection->getSelect()->column('id');
//$collection->getSelect()->from(['main_table' => $this->getMainTable()], array('main_table.id'));
echo $collectionBallotSelect->getSelect()->__toString();
exit;

I want to select only id field from table.


texts:
Im constantly seeing the following error in system.log I've gone into the file but cant see anything wrong can any one help me?

Warning: strlen() expects parameter 1 to be string, array given  in /app/code/core/Mage/Catalog/Model/Layer/Filter/Attribute.php on line 93


texts: How to add custom phtml in confimation popup before order place on checkout magento 2?

texts:
I want to show a popup to verify the mobile number before the order place Magento 2 onepagecheckout page.
Same like this: Magento 2: Place an Order Checkout button popup box


texts: Widgets not loads after creating custom theme magento 2

texts:
I have created custom theme. Sample data not loads on new created theme.
when I have checked

  Admin -> Widgets -> Design Package/Theme

Option to change Theme is disable. Is there another way to avoid creating new Widgets .


texts: Magento 2 Mobile view menu links redirect to undefined page

texts:
I have an instance Magento 2.3.3 In that I have installed the Weltpixel mega menu module and configure it.

In sub-menu I have added custom HTML with ul > li tags. The sub-menus are working perfectly in desktop view but not working on the mobile view.

I have categories as below and HTML as below:

First Menu

Mens
Women's
Bags
Chairs

Custom menu

Wine
Mouse
Ortho

When we click on "First Menu" or "Custom menu" on the mobile view it goes to an undefined URL. In the desktop view, it is working perfectly.

How to resolve this?

Thanks in advance!


texts: Is it correct to use multiple Attribute Sets in one Category while uploading products? Magento 2

texts:
My Question is about Product Uploading!
Is it the right practice to use multiple 'Attribute Sets' in the same category for uploading products?

Why I am asking this is, we have more than thirty thousand products.
On the category page, I see some product attributes repeatedly. For example,
"HEIGHT" is repeating two times.
When I explore those products inside both "HEIGHT"s, I saw different
attribute sets have been used under the same Category.
If it is not a correct way to use different attribute sets in one
category, than in our case is there a programmatic solution possible
to this issue or we have to edit all those products?


texts: Running Magento on PHP 5.3 - Is it a BIG security concern?

texts:
Earlier Magento versions 1.6-1.8 officially only support php version 5.4.

Given that Magento store is patched, is it a BIG security risk of running php 5.3 or 5.4?
I personally, never heard sites being hacked due to outdated php version. Correct me if I am wrong.


texts: Translation csv file in magento theme directory

texts:
-v 2.3
theme - luma
locale - UK

I need to change 'excl tax' to 'excl vat' on my catalog/cart pages and believe I need to create a CSV file with the translation contained this file.

My question is that the doc pages say to have this file in app/design/frontend/{themepackage}/{themename} in my system I have app/design/frontend/Magento the Magento directory is empty.

The theme directory I have is in path vendor/magento.
So where do I save the CSV file?


texts: Default values of a multiselect input in widget options using widget.xml

texts:
I have this option in my widget.xml:

<animation_effects>
                <label>Effects</label>
                <visible>1</visible>
                <required>0</required>
                <type>multiselect</type>
                <source_model>Test_MyModule_Model_System_Config_Source_Ease</source_model>
                <values>fade scale</values>
</animation_effects>

How can I set default values of this multiselect input of my widget ?


texts: i am using two different checkout extension in my store. I want to both work randomly for a/b testing is it possible??


texts: Theme(Zemez template monster) not supporting Multi-select Layered Navigation extension in magento 2.3.3

texts:
I have been searching for a free and open source Multiple select Layered Navigation.
I found this
https://www.magesolution.com/magento2-layered-navigation.html
extension which working 100% fine and fulfils my requirement on Blank magento or magento luma theme

As u can see i select multiple categories and attributes as well and results is showing without load using Ajax.
But Problem is i have installed Zemez's theme from template monster.
Theme is not supporting this extension and i am getting results as

As u can see in image after the selection of Brand attribute brand got disappears and filtering with single select and also loading the page not using Ajax.
i have done several changes in app/design/Vendor/theme/Magento_LayeredNavigation/templates/layer/
state.phtml ,layer.phtml, view.phtml but i am not getting expected results.
Please help to remove theme's override on methods and to extension successfully.


texts: Clear All URL Rewrites - Enterprise (1.13)

texts:
After several messed up imports, I've been left with a load of URL rewrites that I need to remove.

I'm running Enterprise 1.13

When I've had this problem in community, I've simply truncated core_url_rewrite, and the reindexed.

However, in Enterprise, I notice that there a number of different tables that control rewrites.

enterprise_url_rewrite
enterprise_url_rewrite_category_cl
enterprise_url_rewrite_product_cl
enterprise_url_rewrite_redirect
enterprise_url_rewrite_redirect_cl
enterprise_url_rewrite_redirect_rewrite

Am I safe to truncate all of them?

I fully anticipate for someone to tell me that I should never truncate these tables, so apologies for the naivety in advance.


texts: No output from php helper code in list.phtml

texts:
i have the following code in a helper file:

public  function getAvailableAttributesHelper($_product) {
    $_product   = Mage::getModel('catalog/product')->load($product_id);

    if ($_product->getTypeId()=='configurable')
    {

        //Get Attributes
        $attributes = $_product->getTypeInstance(true)->getConfigurableAttributes($_product);
        if (count($attributes))
        {
            $output .= '
';
            foreach($attributes as $att)
            {
                $pAtt=$_product->getProductAttribute();

                //get the child products
                $allProducts = $_product->getTypeInstance(true)->getUsedProducts(null, $_product);
                $frontValues =array();
                $output .= '
';
                $output .= $pAtt->getFrontendLabel();
                $output .= '
';
                foreach($allProducts as $p){
                //check stock, status, ...
                //do not show unsaleable options
                if(!$p->isSaleable()) continue;
                $out=$p->getAttributeText($pAtt->getName());
                $frontValues[$out]=$out;
            }
            $output .= '
';
            implode('

', $frontValues);
            $output .= '

';}
        }
        $output .= '
';

      } else {
         $output .= 'To Bad';
      }
      return $output;
}

I have the original code from here: https://stackoverflow.com/questions/23950764/magento-how-to-show-configurable-product-options-in-product-list-page
This way i can show the available options of the configurable products on the product list page. This is a great wish for our shop. Only we have bought a theme for our store, and that theme generates the products from a helper .... thats why i now try to get this code working in the helper.

In the \app\design\frontend\theme\default\template\catalog\list.phtml
is used <?php echo Mage::helper('mymodule')->getAvailableAttributesHelper($_product) ?> but without any output. What am i doing wrong?

I have magento 1.8.1 CE


texts:
I installed WordPress in my Linux Mint successfully. I used sudo chmod 777 -R  /var/www/html/wordpress/corewordpress

I am trying to install Magento2 same way but I can't.

Why it is happening ?


texts: How to add an extra sku field to all products?

texts: I'm just trying to add an extra sku field to all products, which is not showed in frontend but searchable in backend. I mean users or guests wont be able to see this extra sku but i will be able to search the products by this field. still not solved.


texts: How to setup more than one project in docker?

texts:
I have successfully installed Magento 2 with sample data using Docker

everything works fine but I have below question.

Magento 2 project Base URL is 127.0.0.1 How can I change this URL?
What if I want to add more than one project what kind of changes is required
for that?

Any help would be appreciated.

Thanks In Advance.


texts: How can I get store specific products. Mysql query will also work. Can some one help me on this. Thanks.


texts: Mage.php unable to find module class files

texts:
We have a Magento 1.9.2.4 site that works perfectly on our development server, but when deployed to production, throws errors that it can't find custom module classes (Mage_Ultimo_Helper_Cssgen is one example, it should be looking for Infortis_Ultimo_Helper_Cssgen), but the admin throws an error looking for another class).

The production setup is load balanced between two servers and the code is located on a shard NFS mount.  Permissions are set 755 for directories and 644 for files, and the owner is set to the apache user.  I have confirmed that all the files are present and the module XML file is present as well.


texts: Order Detail page get Order Item Collection When select any order in admin order grid in Magento 2

texts:
i have apply filter on order grid in admin page. Just all those order display in Admin Order Grid which is relate to current login admin products.

But when i click on any order row in grid then in Order detail page all order items are listed .
I want to show just those order item which is belong to current admin user products.
I have already save custom_attribute ("current_admin_id") in each product(eav_attribute) ,quote_item,quote,sales_order and sales_order_grid.

Just guid me little bit which event dispatch or which function return the order_items return in order detail page. if i get to known which calss->function return order collection then i will override and make custom.
Help me to find which and where the order_items collection that set in order detail page.


texts: How can I remove the main-category from the URL of sub-category in Magento2?

texts:
We need to remove the main-category from the URL of sub-category in magento2.

--> Normal magento 2.0 category url structure:

www.domain.com/category/

www.domain.com/category/subcategory/

www.domain.com/category/subcategory/subsubcategory/

--> The structure should be:

www.domain.com/category/

www.domain.com/subcategory/

www.domain.com/subsubcategory/


texts: Magento 2.3.5-p2 2FA QR code and revenue/amount Graph images don't load

texts:
I'm running a Magento 2.3.5-p2 site, but the dynamic images generated in the admin don't appear to load. When I updated to 2.4 the graph problem goes aways as the graphs are drawn with canvases instead, but the 2FA QR code issue remains.
I have tried disabling all 3rd party modules, but this hasn't made any difference Magento 2: Disable all custom and Third Party Module in single Command.
My hosting (Cloudways using AWS) provider doesn't think it is a server problem.
See screenshots below:
Magento 2 admin Graph image not loading Magento 2 admin Graph image not loading

Magento 2 admin 2FA Google Authenticator QR code image not loading Magento 2 admin 2FA Google Authenticator QR code image not loading

problem image urls are typically in this format https://m2.skates.co.uk/sk_admin/tfa/google/qr/key/6d51a9c283d43f0482ee69f53c51cde655eb5b12a51bf431f84752c493e9974e/
All other image types in both the admin and front end work perfectly fine.
Any ideas? Thanks so much for reading.


texts: How to get customer custom attribute value in observer in magento 2.2.X?

texts:
I have created a customer custom attribute like(gst_no).
In my Observer where I get my customer data I want to get the value of this attribute too.

 $order = $observer->getEvent()->getOrder();
 $order_id = $order->getIncrementId();
 $this->logger->info("order_id=========".$order_id."===========");
 $shippingAddress = $order->getShippingAddress(); // shipping address
 $email = $shippingAddress->getEmail();
 $this->logger->info($email);
 $customer = $order->getCustomer();
 //$this->logger->info("customerId==>".$customer_no."<");
 $customer_id = $order->getCustomerId();
 $this->logger->info("customerId==>".$customer_id."<");
 $gstno = $customer->getResource()->getAttribute('gst_no')->getFrontend()->getValue($customer);
 //$this->logger->info("customerId==>".$customer_no."<");
 $order->setGstNo($customer_id);
 $order->save();

But I am not getting attribute value.,can anyone help?


texts: How to map data from AutoQuotes Catalog Data Export to Magento Standard Products File to Import?

texts:
I am creating an e-commerce website using Magento 1.9 platform and they ask me to take the products data from AutoQuotes Catalog Data Export (http://aqnet.com, and they provide a Windows application with authentication to access the user's database).

However, the CSV file which is downloaded from the software has many columns which does not appear in a standard Import File of Magento (and vice-versa). I just want to ask what is the best way to map those data because there are approximately more than 10,000 products or what is the best solution I can do in this situation?


texts: How to duplicate category title and move description below product grid


texts: Insert custom block at payment Method section In Magento 2

texts:
I have some validations to place order through custom TestPayment method, for this I have to disable/enable the PlaceOrder button and showing some message under my custom payment method section. For this I have created the custom payment method and it is showing and working fine. But I don't know to to validate and showing messages here.

So Could you please suggest me how to showing messages and enable/disable PlaceOrder Button here based on customer Data.

TestVendor/TestPayment/view/frontend/web/js/view/payment/method-renderer/testpayment-method.js

/*browser:true*/
/*global define*/
define(
    [
        'Magento_Checkout/js/view/payment/default',
        'Magento_Customer/js/customer-data',
        'Magento_Checkout/js/model/quote',
        'jquery'
    ],
    function (Component, customer, quote, $) {
        'use strict';

        var customer_Data;

        return Component.extend({

            defaults: {
                template: 'TestVendor_TestPayment/payment/testpayment'
            },

            /** Returns send check to info */
            getMailingAddress: function() {
                return window.checkoutConfig.payment.checkmo.mailingAddress;
            },
            isDisplayed:function () {

                console.log(customer);
                console.log(customer.customer);
                console.log(customer_Data);
                var total = quote.getTotals();
                console.log(total);
                console.log(quote.billingAddress);

                return false;
            }

        });
    }
);

after debugging not getting data.


texts:
Magento 2.2.1 site migration from live to local win 10 wamp server, but path jump to the domain name?
1. I have modified the path in the data
2. Clean up the var/cache cache
3. app/etc/env.php also points to the mysql database
But after I type: 127.0.0.1/public_html, it jumps directly to the domain name. May I ask what is the reason?


texts: Cart Price Rules: Minimum Purchase of 2 of the same items to get 15% discount

texts:
I am trying to set up the following rule in Price Cart Rules:

  Promotion: 15% off selected products with minimum purchase of 2 items and above.

Criteria: No combined purchased allowed, meaning, discount will only be given if two or more of the same item is purchased.

Example:

SKU1 (Configurable Product)

Inside SKU1 contains the following simple products:

SKU1-1 (Product 1)

SKU1-2 (Product 2)

SKU1-3 (Product 3)

SKU1-4 (ProIuct 4)

This promotion code must work if i purchase 2 or more of SKU1-1. How do i achieve this?

Am aware that the minimum quantity can be adjusted in the product page settings, however, we would also want to give customers the option to purchase 1 item instead of forcing them to buy 2 to get the discount.


texts: Magento 2.3.5 adding custom product attribute

texts: I want to add a custom product attribute. Of the attribute is enabled (should only contain yes or no) if it’s enabled I want to change the price to coming soon if it’s disabled show the price.


texts: Only show attributes if they're not empty

texts:
I need to hide the attributes table if the attribute is empty.
This is my code in the attributes.phtml file

<?php if($_additional = $this->getAdditionalData()): ?>

<?php echo $this->__('Additional Information') ?>

        <col width="25%" />
        <col />

  <?php foreach ($_additional as $_data): ?>
      <?php $_attribute = $_product->getResource()->getAttribute($_data['code']);
      if (!is_null($_product->getData($_attribute->getAttributeCode())) && ((string)$_attribute->getFrontend()->getValue($_product) != '')) { ?>

          <?php echo $this->htmlEscape($this->__($_data['label'])) ?>
          <?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?>

      <?php } ?>
  <?php endforeach; ?>

<?php endif;?>

So the attribute isn't showing, but the attributes-spec-table still is. How do I hide this table if there is only an empty attribute?


texts: Magento2: How to get current product parent category on product detail page?

texts:
I want to get the current product parent category on the product detail page in Magento2?

My Code:

<?php
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->get('Magento\Framework\Registry')->registry('current_product');
$categories = $product->getCategoryIds(); /*will return category ids array*/
$local='';
$intr='';
foreach($categories as $category){
    $cat = $objectManager->create('Magento\Catalog\Model\Category')->load($category);
  $catid = $cat->getId();
  $parentid = $cat['parent_id'];
 $local=$parentid;
    }
?>

But I am not getting the value

Any help would be appreciated.


texts: Two magento installations and login problem

texts: I have installed two magento s in same server on main domain and sub domain as follows. www.domain.com and www.domain.com/subdomain. Those two magento s are active and use for different purposes. When one user use these two links user cannot logged to the second magento from same browser. So user should move to the incognito mode to log in to the second magento. How to fix this issue. I want to log both magentos in same time on same browser.


texts: Is it possible to disable Magento Message Queues

texts:
It seems that Magento 2.3 introduced the concept of message queues where certain jobs like bulk product updates, exports and some sales rule functionality is now processed asynchronously via these message queues, presumably for performance and scalability reasons.

Unfortunately there is a known issue that means that these message queue processes get spawned but never die resulting in endless loops that cause server crashes. see https://github.com/magento/magento2/issues/17951

I've never found that bulk updates, exports etc have ever had any performance impact on any of the Magento sites I have put live. I would prefer not to use these message queues and instead revert back to the functionality that existed before. Does anyone know if that is possible?


texts: Apply Order Number Prefix For Orders Container Recurring / Nominal Products

texts:
I am in the process of trying to highlight specific orders containing recurring / nominal products to an admin user as well as inside a data feed that exports order data on a daily basis to a fulfilment center.

Is there a way that I can apply an order prefix or suffix to any order containing a recurring / nominal product? Would this have a knock-on effect on the incremental value for future orders that are placed?


texts:
I have more than one websites in my store. I want to remove top menu bar for a particular website(Visible in one website and hidden in another).

It's possible to remove for particular store using layout XML file?

Please provide me inputs..


texts: How to post product with image on REST API?

texts:
I'm trying to post an image to a product, but on post I dont know where exactly to put it.
Should I put on custom_attributes as when I get it on GET ? Didn't have success, even using image, small_image and thumbnail and the same link image as one that I added manually.
Or should I use other way like Media Gallery Entries? If so could I get an example? because on documentation they only tell me things like "string" and don't know which are the possibilities.

Thanks.


texts: Magento 2 --Information Changes have been made to this section that have not been saved

texts:
After Migration, when I try to open a order in admin, it shows this error.
"Order View
Information Changes have been made to this section that have not been saved. This tab contains invalid data. Please resolve this before saving."

in M1 site, payment method was paypal and Saved CC.


texts: How to extend a core Product List Block model?

texts:
I want to extend pring a function into magento where I assemble some product data.

In the end I want to call a function like $this->getAlternateTitle() within Lists and Products.

This is what I have:
app/etc/modules/Namespace_Name.xml

    <?xml version="1.0"?>
<config>
    <modules>
        <Namespace_Catalog>
            <active>true</active>
            <codePool>local</codePool>
        </Namespace_Catalog>
    </modules>
</config>

then I'm making the config in app/code/local/Namespace/Catalog/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Namespace_Catalog>
            <version>0.0.1</version>
        </Namespace_Catalog>
    </modules>
    <global>
        <blocks>
                <class>Namespace_Catalog_Block_Product_List</class>
        </blocks>
    </global>
</config>

And finally defining the function here:
app/code/local/Namespace/Module/Block/Product/List.php

<?php

class Namespace_Catalog_Block_Product_List extends Mage_Catalog_Block_Product_List {
    public function makeBlue() {
     echo "Blueberrys are colorful";
    }
}

I am only getting back: Invalid method Mage_Catalog_Block_Product_List::makeBlue

What do I do wrong here? It's my first magento-function so please be kind with me ;)


texts:
I need some pointers on where to look/what to read etc in order to understand how to go about building a desktop app that can search my magento store.

I have a rough idea of how this could work, but perhaps there are better methods/ways of doing this that I do not know about.

If anyone has info they could point me at, or any pre-built starting points that I could take onwards to develop, that would be great!

I need to figure out how to get the search results from Magento for this purpose. I imagine it will use the Magento API, but beyond a very limited and basic understanding here, I could use some guidance :-)


texts: I want to add "per meter" in specific product pages

texts:
I want to sell this product according to length (i.e per meter or feet). I've tried a few extensions but they were not very useful. I just want to add the per meter or per feet feature for user so the user could by according to length. If an attribute could do this it'll be good. And the per feet or per meter should be shown on a few product.
so is this possible or not in Magento 2.3.5-p2.
P.s
Im kinda a new at magento so plz guide me thank you.


texts:
I have a product that is automatically added to the cart for those customers who are entitled to order it.

The customer can not add the product to cart herself.

However, we want the product to be visible in the product catalog, so the customer can see all the product images and information. However, there must not be price of the product visible and the add to cart button must be hidden.

How can I accomplish this?

If you a good extension to implement this, that would also be an option.


texts:
I don't understand the point: is it enough to apply all latest M1 patches to keep the Magento 1 up-to-date or do I need to download and install whole Magento 1 code package every time the new version becomes released?

The client wants to update to the latest Magento 1.9.4.2, now he has 1.9.4.1 installed. I see one patch was released after 1.9.4.1 release, do I need just to install it to have the code equal to 1.9.4.2?


texts:
I have a search bar on my page when I search for something it returns the result perfectly with correct pagination. As shown below
but when I clicked on page 2, it returns the data correctly but instead of showing it in the proper form it just prints the whole HTML page.
The code that I have written inside JSON's successful response is that.
success : function(res) {
    $('#replaceIt').html(res);
}

instead of showing the 2nd page it just shows this.


texts: Invalid carrier specified - Cannot add tracking to shipment

texts:
I'm trying to add tracking to orders via the SOAP (V1) interface using the sales_order_shipment.addTrack method - but as the title suggests I'm getting the following error: Invalid carrier specified

The first thing I tried was to use the custom carrier code as such:

'shipmentIncrementId' => $shipmentIncrementId,
'carrier' => 'custom',
'title' => 'My courier',
'trackNumber' => $tracking

(Note that both $shipmentIncrementId and $tracking are correct.)

This produced the aforementioned error.

So I decided to make my own module adding a custom carrier, I followed this tutorial. Most importantly, I've implemented isTrackingAvailable() and made it return true.

Now, interestingly, if I make the call to sales_order_shipment.getCarriers my custom carrier is there, so it should be available! However, when I again make the sales_order_shipment.addTrack call with the following details:

'shipmentIncrementId' => $shipmentIncrementId,
'carrier' => 'name_of_module',
'title' => 'Custom Carrier',
'trackNumber' => $tracking

Where name_of_module is obviously the correct name of the module, returned by getCarriers and this time I've matched the title to the one defined in the module (Custom Carrier).

With this, I still get the same error of Invalid carrier specified! Surely if getCarriers returns this carrier for an order it shouldn't be invalid?

The only place on the web that attempts to document this error is here, as described above I have followed the suggested steps according to that link.

Could anyone point me to where I'm going wrong? Thanks in advance for your help.

P.S. If it makes any difference, I'm trying to avoid adding a new module for every single carrier we use, I'd like to be able to pass through the correct title of the carrier through SOAP and add any tracking number (we don't use any of the predefined carriers in Magento).

Edit

The following is the code that calls the API:

$this->magentoAPI->request(
    'sales_order_shipment.addTrack',
        [
            'shipmentIncrementId' => $shipmentIncrementId,
            'carrier' => 'fesp_fixstupidcarriers',
            'title' => 'Custom Carrier',
            'trackNumber' => $tracking,
        ]
);

This uses my custom function, which in turn runs call_user_func_array([$client, 'call'], $arguments);

$arguments comes out as the following array:

[
    'whatever-the-session-id-is',
    'sales_order_shipment.addTrack',
    '100002290',
    'fesp_fixstupidcarriers',
    'Custom Carrier',
    '9348278247008183'
];

I'm showing actual data this time, that's a real shipmentIncrementId, the actual carrier code, and the real tracking number.

This function works for all other calls of the API I've tried (about a dozen).


texts: Whenever I have heavy traffic to certain page Magento adds "-1" to the URL and if the traffic maintains it adds "-1-1" and so so on. This makes it impossible to link back to my website.


texts:
I'm using Magento 2.3.3 on Ubuntu 18.04.
I'm having 141 000 products that I want to export to a CSV file. Nothing happens when I try to export. It just says

Message is added to the queue, wait to get your file soon

I tried to check the export process but the computer thinks forever.
Not able to get file when i m try to use export
Is there another way to export?


texts:
How can I develop a custom payment gateway in magento 2.3 version.
I tried many tutorials but none of them is working correctly.
What tutorial best to follow?


texts: Magento 2 change validation messsage in checkout address fields

texts:
Working on Magento 2 checkout validation following is the code

<?php
namespace VendorName\ModuleName\Block;

class LayoutProcessor
{
     /**
     * @param \Magento\Checkout\Block\Checkout\LayoutProcessor $subject
     * @param array $jsLayout
     * @return array
     */
     public function afterProcess(
         \Magento\Checkout\Block\Checkout\LayoutProcessor $subject,
         array  $jsLayout
     ) {
        $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
    ['shippingAddress']['children']['shipping-address-fieldset']['children']['street'] = [
        'component' => 'Magento_Ui/js/form/components/group',
        'label' => __('Address'),
        'required' => true,
        'dataScope' => 'shippingAddress.street',
        'provider' => 'checkoutProvider',
        'sortOrder' => 60,
        'type' => 'group',
        'children' => [
            [
                'component' => 'Magento_Ui/js/form/element/abstract',
                'config' => [
                    'customScope' => 'shippingAddress',
                    'template' => 'ui/form/field',
                    'elementTmpl' => 'ui/form/element/input'
                ],
                'dataScope' => '0',
                'provider' => 'checkoutProvider',
                'validation' => true,
                'additionalClasses' => 'additional',
                'label' => __('Street')
            ],
            [
                'component' => 'Magento_Ui/js/form/element/abstract',
                'config' => [
                    'customScope' => 'shippingAddress',
                    'template' => 'ui/form/field',
                    'elementTmpl' => 'ui/form/element/input'
                ],
                'dataScope' => '1',
                'provider' => 'checkoutProvider',
                'validation' => true,
                'label' => __('Number')
            ],
            [
                'component' => 'Magento_Ui/js/form/element/abstract',
                'config' => [
                    'customScope' => 'shippingAddress',
                    'template' => 'ui/form/field',
                    'elementTmpl' => 'ui/form/element/input'
                ],
                'dataScope' => '2',
                'provider' => 'checkoutProvider',
                'validation' => true,
                'label' => __('District')
                ]
            ]

        ];

         return $jsLayout;
     }
 }

How to change the vallidation message for the fields Please help


texts: there is a product in shopping cart but Mini cart is not displaying the product

texts:
![i had 2 product in shopping but mini cart is not displaying the product.
I had done all the checkout setting in sales, but nothing is working/.]1


texts:
Is there any way to change the count of items displayed beside the cart icon?

Currently if I add 2 products with an item count of 100 each this count shows 200. Our customer would like it to only display 2 in this example (as in 2 different products).

I would be open to overriding Magento core functions, if that is necessary to get this working.


texts: display attribute to specific customer group

texts:
I have look for this in google, bing and magento.stackexchange and see nothing about it.

We have a situation: we have make a new attribute in admin and we want this attribute to be visible on front end but only for one type of customer groups and not all.

Can anyone have a solution or maybe module?

Thanks!


texts: Magento 2 error on refund - Transaction has been declined. Please try again later

texts:
I have this error on Magento 2.3.3 when I try to refund (credit memo) an order with visa (authorize.net).
[2020-06-17 05:43:44] main.DEBUG: array (   'request' =>    array (
    'payload_type' => 'createTransactionRequest',
    'merchantAuthentication' =>
    array (
      'name' => '8Hkxxxx',
      'transactionKey' => '2485P7zxxxxxx',
    ),
    'transactionRequest' =>
    array (
      'transactionType' => 'refundTransaction',
      'amount' => '3.12',
      'payment' =>
      array (
        'creditCard' =>
        array (
          'cardNumber' => '27xx',
          'expirationDate' => 'XXXX',
        ),
      ),
      'refTransId' => NULL,
      'order' =>
      array (
        'invoiceNumber' => '1000049324',
      ),
      'poNumber' => NULL,
      'customer' =>
      array (
        'id' => NULL,
        'email' => 'xx@gmail.com',
      ),
      'billTo' =>
      array (
        'firstName' => 'xx',
        'lastName' => 'xx',
        'company' => '',
        'address' => 'xxN Riverside Ave',
        'city' => 'St Clair',
        'state' => 'MI',
        'zip' => 'xx',
        'country' => 'US',
      ),
      'shipTo' =>
      array (
        'firstName' => 'xx',
        'lastName' => 'xx',
        'company' => '',
        'address' => 'xx N Riverside Ave',
        'city' => 'St Clair',
        'state' => 'MI',
        'zip' => 'xx079',
        'country' => 'US',
      ),
      'customerIP' => 'xx.49.12.69',
    ),   ),   'response' => '{"transactionResponse":{"responseCode":"3","authCode":"","avsResultCode":"P","cvvResultCode":"","cavvResultCode":"","transId":"0","refTransID":"","transHash":"","testRequest":"0","accountNumber":"XXXXxx52","accountType":"","errors":[{"errorCode":"6","errorText":"The credit card number is invalid."}],"transHashSha2":"581E58B78444F0AFCFAAE0F5C949EF2F773D190B63D2BBD53BA39E1F9AEF4DFB7C11F20B1E6163A5A146A8C92586BB049BE169FE40953E0A1F863EEB42BFFE55","SupplementalDataQualificationIndicator":0},"messages":{"resultCode":"Error","message":[{"code":"E00027","text":"The transaction was unsuccessful."}]}}', ) [] []

please advice
Thanks


texts: what does setObject function do in magento?

texts:
<?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->setForceUseCustomerAttributes(true)->toHtml() ?>

this code call 'customer/widget/name.phtml' file and convert into html

but what setObject($this->getFormData())->setForceUseCustomerAttributes(true)->toHtml() can do here


texts: How to add custom js file after footer in Magento2?

texts: While creating custom theme, I need to add custom js file after footer. How can I do that in Magento2 ...pls help me out?


texts: When creating order from backend custom price is not updating price in magento 2.3.4

texts: I am using magento 2.3.4 and I cannot create a custom price for a customer in admin. When I select a customer and create a new order I can not create a custom price, it keeps the original price.


texts:
I have a store using Magento 1.7 and I need to set a login/registration page as the first page that is shown before buying anything, so that it is mandatory to log in.

I edited cms.xml, under app/design/frontend/base/default/layout/cms.xml, and managed to show login/registration in the homepage:

<cms_page translate="label">
    CMS Pages (All)
    <reference name="content">
        <block type="core/template" name="page_content_heading" template="cms/content_heading.phtml"/>
        <block type="page/html_wrapper" name="cms.wrapper" translate="label">
            CMS Content Wrapper
            <action method="setElementClass"><value>std</value></action>
            <block type="customer/form_login" name="customer_form_login" template="customer/form/login.phtml"/>
            <block type="cms/page" name="cms_page"/>
        </block>
    </reference>
</cms_page>

I also added a line in customer.xml under design/frontend/default/custom_theme/layout/customer.xml for removing the login/registration boxes after customer login, so that it looks like:

<customer_logged_in>
    <reference name="top.links">
        <remove name="customer_form_login"></remove>
(...)

But I still can navigate through all the contents of my store without loging in; how should I do in order that the first page only contains login/registration? I think that is something related to layouts and phtml, but I am a bit confused and don't know which file I should edit or if I should include some other files.

Any help is much appreciated :-)


texts: Send JSON response from Magento\Wishlist\Controller\Index\Add controller in Magento 2.2.2

texts:
I am trying to override Magento\Wishlist\Controller\Index\Add controller's execute() method to return a JSON response.

I have created a after plugin for it.

Vendor\Company\etc\frontend\di.xml:

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
  <type name="Magento\Wishlist\Controller\Index\Add">
    <plugin name="vendorCompanyExtension" type="Vendor\Company\Plugin\Index\Add" sortOrder="10" disabled="false"/>
  </type>
</config>

Vendor\Company\Plugin\Index\Add.php:

<?php

namespace Vendor\Company\Plugin\Index;

class Add
{
    /**
     * @var \Magento\Framework\Json\Helper\Data
     */
    protected $_jsonHelper;

    public function __construct(
        \Magento\Framework\Json\Helper\Data $jsonHelper
    ) {
        $this->_jsonHelper = $jsonHelper;
    }

    public function afterExecute(\Magento\Wishlist\Controller\Index\Add $subject, $result)
    {

        $newResult = [];

        $newResult["message"] = "Hello";

        $subject->getResponse()->representJson(
            $this->_jsonHelper->jsonEncode($newResult)
        );

        return $result;

    }
}

In the original Magento\Wishlist\Controller\Index\Add.php, there is a code:

$resultRedirect->setPath('*', ['wishlist_id' => $wishlist->getId()]);
        return $resultRedirect;

I am trying to return a JSON response instead of redirecting to a Wishlist page after a product is added to the wishlist.

Any help would be appreciated.


texts:
I have created a plugin in my custom module to override the default method getName() in Magento\Catalog\Model\Product.php

I've created my custom module named Firstmodule inside app\code\Magento. I am using the after listener of plugins.

The file app\code\Magento\Firstmodule\etc\frontend\di.xml

<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
    <type name="Magento\Catalog\Model\Product">
        <plugin name="Magento_Firstmodule::before" type="Magento\Firstmodule\Model\Basic" sortOrder="1" />
    </type>
</config>

And the Model app\code\Magento\Firstmodule\Model\Basic.php

<?php
namespace Magento\Firstmodule\Model;

class Plugin {

    public function afterGetName(\Magento\Catalog\Model\Product $subject, $result)
    {
        return '|' . $result . '|';
    }
}

Still there is no result on the frontend product view page.

Can anyone tell me what is missing.? thanks in advance.


texts:
I am using the following code:

{{block type="catalog/product_list" category_id="3" template="catalog/product/list.phtml"}}

how would I use the "grid" view of this template? In a previous question here someone told me to use
{{widget type="catalog/product_widget_new" products_count="5" template="catalog/product/widget/new/content/new_grid.phtml"}}

however, this doesn't seem to let me choose a specific category to display.

To wrap up I am essentially trying to use the grid view with a specific category. I also don't want to set the default view to grid I would like it to remain list on the category pages.

Thanks for any help you can give.


texts: Move layered navigation block between product list toolbar and product list

texts:
I have moved the layered navigation block into the content section however I can't figure out how to position the block. I can only get it to show at the very top of the page or the bottom. I need it before the product listing and after the toolbar. So far my xml looks like this:

 <reference name="content">
     <block type="catalog/layer_view" name="catalog.leftnav" before="product_list" after="product_list_toolbar" template="catalog/layer/view.phtml"/>
</reference>

But that doesn't seem to be working. Any suggestions?

Thanks


texts: How to get the product collection based on catalog & cart price rules?

texts: I am trying to get all products based on catalog price rules and cart price rules under all categories which is valid for today's date in Magento 2


texts: Magento Tablerates ignores the last part of the postal codes 1793"EB" the "EB" part

texts:
Is there a way to ignore the last part of the postal code the "EB" part? So that it only looks at the first part the "1790" part.

Now when I fill in 1793 only, it works. But when I fill in 1793EB, it doesn't work and it goes back to the default price for that land.


texts: Magento 2 - Create order programmatically without payment

texts:
I'm going to create an order programmatically without a payment. But it requires to set a valid payment method when I run the following code. Is there any way to skip it?

    $quote = $this->_quoteFactory->create();
    $quote->setStore($store);
    $quote->setCurrency($store->getCurrentCurrency()->getDataModel());
    $quote->assignCustomer($customer->getDataModel());
    $quote->addProduct($product);
    $quote->setPaymentMethod('checkmo');
    $quote->save();
    $order = $this->_quoteManagement->submit($quote);


texts: Product collection override but filter not magento in Magento 2.4

texts:
I have override vendor/magento/module-catalog/Model/Layer.php for custom product collection but now the layer navigation and product count is working wrong, I checked for Magento\CatalogSearch\Model\Search\IndexBuilder.php file but this is not exist in M 2.4.1 + elastic search.
I am following this link https://www.rakeshjesadiya.com/apply-custom-conditions-for-product-collection-in-magento-2/
and https://community.magento.com/t5/Magento-2-x-Programming/Incorrect-product-count-in-layered-navigation-after-overriding/m-p/104534#M5628
But not working for me.


texts: How to get post values in catalog_product_save_after observer in Magento 2?

texts:
<?php

namespace Maxime\Helloworld\Observer;

use Magento\Framework\Event\ObserverInterface;

class Productsaveafter implements ObserverInterface
{

 public function execute(\Magento\Framework\Event\Observer $observer)

 {
  $post = $this->getRequest()->getPostValue();
    }

}

Used this code. But it didin't gives the post values.


texts:
I want to change the grey around my white box to white. What do I need to change?

I already tried ->email-inline.scss

#background-table {
    background-color: white;
}


texts: Adminhtml Collection - Reset pagination, respecting grid filters

texts:
I need to get the full collection, with adminhtml grid filters applied, but without the grid pagination

I've tried several things, for instance...

$this->getCollection()->clear()->setPageSize(false)->load();

But I am getting always the paginated collection

Any tips?


texts: Magento 1.9.3 : Bundle product add to cart too slow

texts:
I want to add bundle product to add to cart from external php file and it is successfully adding but it is taking long time approx 30sec.

<?php

include 'app/Mage.php';
Mage::app('default');
umask(0);

$size = 2;

$productId = 123; // bundle product

$product = Mage::getModel('catalog/product')
->setStoreId(Mage::app()->getStore()->getId())
->load($productId);

$product->addCustomOption('size',$size);
$session =  Mage::getSingleton("core/session", array("name" => "frontend")); // frontend session

//cart params
$cartParams = array(
            'product' => $productId,
            'related_product' => null,
            'bundle_option' => array(
                '3'=> '176399802',
                '4' => '176420135'
            ),
            'qty' => 1,
        );
try{
    $cart = Mage::getModel('checkout/cart'); // cart object
    $cart->init();
    $cart->addProduct($product, $cartParams);
    $cart->save();
    $session->setCartWasUpdated(true);
    echo Mage::getModel('checkout/cart')->getQuote()->getItemsCount();
}catch(Exception $e){
    echo $e->getMessage();
}

and when I perform any action to cart page it is also taking time. Actions like ( load cart page, delete items etc )

Please look into this and help me to sort out this problem.

Any help would be appreciated

Thanks.


texts: why flat rate always show ₹5.00 whether changed in admin panel

texts:
I need your help.why the changes in flat rate not affecting.If I disabled it shows and whether i changed it shows "fixed  ₹5.00".Please help me i am confused on what to do.

Please check this :

http://qwertykart.com/
login:jis123@gmail.com password:jis123
http://qwertykart.com/checkout/cart/


texts: Attach CSV file in mail magento 2.3.2 programmatically?

texts: I am unable to attach CSV file in magento 2.3.2 custom extension controller. I am referring below link but its not working.Link >> https://github.com/extait-com/email-attachment.


texts: Magento 2.1:- Can set all shipping method programmatically?

texts:
I create one module in Magento 2.1.

I want to need set all shipping method programmatically using custom module with plugin or model.

Can it possible for that ?
And yes, so how it possible ?

Any one know give me suggestion for that.

Thanks for answer in advance.


texts: Magento2 model save() method connected to db table structure in the install schema

texts:
I have a basic model - MyModel.
The install schema for the table that the model is working with is

$setup
->getConnection()
->newTable('my_table')
->addColumn(
    'id',
    Table::TYPE_INTEGER,
    null,
    ['identity' => true, 'unsigned' => true, 'nullable' =>
        false, 'primary' => true],
    'primary key'
)
->addColumn(
    'start_date',
    Table::TYPE_DATETIME,
    null,
    ['nullable' => true],
    'start date'
)
->addColumn(
    'end_date',
    Table::TYPE_DATETIME,
    null,
    ['nullable' => true],
    'end date'
);

The format of the data that can be saved in a db field of type DATETIME must be the fallowing

'Y-m-d' => '2017-12-13'

When I execute the fallowing code

$myModel->setData([
 'start_date'=>'13-12-2017',
 'end_date'=>'15-12-2017'
]);
$myModel->save();

I explicitly set the date string to be in the wrong format - 'd-m-Y'. The weirdest thing happens. I get no SQL error and the dates are saved in the DB in the right format and the start_date and end_date values are saved correctly and the result looks like that:

id  start_date          end_date
1   2017-12-13 00:00:00 2017-12-15 00:00:00

How does the model's save() method know which values should be of type  DATETIME and how does it convert that value to the desired format for storing in the DB.


texts: Magento 2 : Lifetime, scope and general usage for all types of sessions

texts:
There are a lot of session types in magento 2 . The ones I know of are listed below ;

1)  \Magento\Catalog\Model\Session //vendor/magento/module-catalog/Model/Session.php

2) \Magento\Newsletter\Model\Session //vendor/magento/module-newsletter/Model/Session.php

3) \Magento\Persistent\Model\Session //vendor/magento/module-persistent/Model/Session.php

4) \Magento\Customer\Model\Session //vendor/magento/module-customer/Model/Session.php

5) \Magento\Backend\Model\Session //vendor/magento/module-backend/Model/Session.php

6) \Magento\Checkout\Model\Session //vendor/magento/module-checkout/Model/Session.php

Can someone please tell me about lifetime, scope and general usage for these sessions, so I can know which session to use when?


texts:
My site started life as version 1.6 and was upgraded a couple of years ago to 1.9.0.1. All appeared ok until the last security patches (others have been installed by others who are nolonger available).

I now want to Upgrade CE Magento 1.9.0.1 to 1.9.3.1 can this be done in one step? In the past i have used connect manager to upgrade, however this is not showing any Magento version upgrades (i does show a couple of module upgrades but thats it).

So my question is:

Upgrade CE Magento 1.9.0.1 to 1.9.3.1 can this be done in one step?
How can i get the upgrade to show in connect manager?
Should i be upgrading using a different method?

Many thanks as i said its been a couple of years since i last had a lot of Magento involvement (due to ill health) so im a bit rusty. Thanks again


texts:
I have two questions:

When you apply the latest security patch, does it patch up previous vulnerabilities? For example, if I patch my site with SUPEE-5994 do I still have to patch it with SUPEE-5344 and SUPEE-1533 if I haven't done so already? If I would have to apply the previous patches, is there a sequence I should do it in? IE. SUPEE-1533 then 5344 then 5994?
Install patch through PHP I am going to use this method of patching since I believe it is the easiest method for me since I am not familiar with the SSH method. However in one of the comments, Kevin Schroder says:

  This method requires the webserver to have write access to the files.
  If you use this method make ABSOLUTELY sure that you change perms back
  to what they were so the web server cannot write to the files besides
  /media and /var –

Does this mean I have to CHMOD a certain file(s) or folder(s) to a certain permission? Can someone clarify this so that a little kid can understand. :)


texts: Magento 2: Product List Not Showing in Catalog and Search

texts:
I am having a problem with the product list when adding new products. It was working properly until I added a new product. Then, the product list stopped being visible in the catalog pages and search results. I'm not able to replicate this in my local environment, and upon further investigation, I found out that this line of code doesn't work in a catalog page if there are products in that particular catalog:

<?= $block->getProductListHtml() ?>

Note: I changed the theme back to luma, and the issue still exists.

Update: I found out that these lines of code in vendor/magento/module-catalog/view/frontend/templates/product/list.phtml are causing the issue:

$productImage = $block->getImage($_product, $imageDisplayArea);
if ($pos != null) {
   $position = ' style="left:' . $productImage->getWidth() . 'px;'
               . 'top:' . $productImage->getHeight() . 'px;"';
}


texts: How to stop abandonment cart emails to get fired when restoring quote data in cart page in Magento 2?

texts:
I am facing an issue after restoring Quote items on the cart page.
For restoring Quote I used below code
 $this->_checkoutSession->restoreQuote();

I have abandonment cart email functionality, but the dis-advantage is as soon as cart items are restored it fires abandonment cart email.
How can I stop this? Any advice is appreciated.


texts:
I wonder if it possible to set a tax rule for a particular website without any dependence on a specific country.

For example: I have 2 websites on my site - for english language and for german language. I want to set the taxes for all the products on english website to 19%, and on german website to 20% - for all the countries at the same time.

Thanks for advices.


texts: Magento 2 - Categories not display when Page Cache is on

texts:
I have a very strange issue on Magento 2.2.2, if I enable the Page Cache (Full page caching - FPC) the top navigation is not display anymore.

What I can do?
Thank you


texts:
Just had a look at the var/log/system.log file and surprised to see the number of errors. I cleaned up the file and refreshed the website and it logged following errors:

  [2016-10-12 14:27:20] main.CRITICAL: Broken reference: the 'header.panel.wrapper' element cannot be added as child to 'header.container', because the latter doesn't exist [] []
  [2016-10-12 14:27:20] main.CRITICAL: Broken reference: the 'header-wrapper' element cannot be added as child to 'header.container', because the latter doesn't exist [] []
  [2016-10-12 14:27:20] main.CRITICAL: Broken reference: the 'navigation.sections' element cannot be added as child to 'page.top', because the latter doesn't exist [] []
  [2016-10-12 14:27:20] main.CRITICAL: Broken reference: the 'top.container' element cannot be added as child to 'page.top', because the latter doesn't exist [] []
  [2016-10-12 14:27:20] main.CRITICAL: Broken reference: the 'breadcrumbs' element cannot be added as child to 'page.top', because the latter doesn't exist [] []
  [2016-10-12 14:27:20] main.CRITICAL: Broken reference: the 'footer' element cannot be added as child to 'footer-container', because the latter doesn't exist [] []
  [2016-10-12 14:27:20] main.CRITICAL: Broken reference: the 'catalog.compare.sidebar' element cannot be added as child to 'sidebar.additional', because the latter doesn't exist [] []
  [2016-10-12 14:27:20] main.CRITICAL: Broken reference: the 'sale.reorder.sidebar' element cannot be added as child to 'sidebar.additional', because the latter doesn't exist [] []
  [2016-10-12 14:27:20] main.CRITICAL: Broken reference: the 'wishlist_sidebar' element cannot be added as child to 'sidebar.additional', because the latter doesn't exist [] []
  [2016-10-12 14:27:20] main.CRITICAL: Broken reference: the 'header.panel.wrapper' tries to reorder itself towards '', but their parents are different: 'header.container' and '' respectively. [] []
  [2016-10-12 14:27:20] main.CRITICAL: Broken reference: the 'navigation.sections' tries to reorder itself towards '', but their parents are different: 'page.top' and '' respectively. [] []

Same behavior on a fresh installation with no custom theme!
Any idea to why these layout errors!!


texts: How should dependencies of manually installed modules be installed?

texts:
We are setting up a Magento 2 store using Composer to manage packages whenever possible. This is working great for us, except that some third-party extensions we have purchased are not available to install via Composer. They require the extension to be manually copied into app/code.

However, at least one such manually-installed extension required a separate open source library that was not bundled with the extension. This dependency was specified in the extension's composer.json file, but since the extension itself wasn't installed through Composer, it was not picked up by composer update.

Thus the question: is there any way to have Composer inspect the dependencies of manually installed extensions living in app/code? If not, is the best approach here to simply copy & paste any dependencies into the main project composer.json? That's pretty inelegant.

One solution would be to create our own private repository for each of these third-party extensions and then install them via Composer, despite the vendor instructions. We may eventually adopt that approach, but I'm wondering if there are other options.


texts: innodb_file_per_table setting on or off?

texts:
I've run into the bloated one innodb tablespace before and since then have opted for a file per table in innodb, innodb_file_per_table = 1. Because Magento has so many tables they say to only turn it on if you know what you are doing since there will be an fsync per table.

I'm at the point where I need to decide. Not like I can't reverse my decision but I'd like to get it right the first time. I know it will come down to our hardware, but my question to everyone is if anyone has this setting on and if so are you having any issues?


texts: Images Not Displaying On Product Pages? Failed to load resource

texts:
On the majority of my product pages, the product image loads. However, on certain pages it shows no images.

Examples:
https://www.midselec.co.uk/brushed-nickel-3-blade-ceiling-fan-52-inch-with-light-alloy
https://www.midselec.co.uk/westinghouse-capitol-ceiling-fan-with-light-42-inch-gun-metal

Working:
https://www.midselec.co.uk/halley-brushed-nickel-ceiling-fan-with-light-48-inch
https://www.midselec.co.uk/airforce-hand-dryer
https://www.midselec.co.uk/chrome-industrial-3-blade-ceiling-fan-48-inch

I inspected the page and it seems the images located in /cache cannot be served
Failed to load resource: the server responded with a status of 404 ()


texts:
I have a situation where we give 5% discount on any payment method but credit cards. The one way I found to apply this rule correctly was via Shopping Cart rules.

Thing is, the client wants both the original and the discounted price to be displayed on the catalog and product pages.

I haven't found a way to cleanly do this yet. I tried my hand on catalog prices but then I get two discounts. Please, help a beginner out.


texts: How to get the Customers Increment Id in PDFs

texts:
I changed the table "eav_entity_store" in my DB so i get a customer_increment_id like this "2015_00001".
This works fine and every new customer get this id (2015_xxxxx) in "customer_entity.increment_id".

The normal value for this colmn is NULL and the system use entity_id for the customer_id.

Now i want do print this increment_id in my invoice/shipping/creditmemo-PDFs instead the normal customer_id.
Is there an easy way to get the increment_id from the customer_id?

I have the place in my Abstract.php to print the id, but i don´t find the value for the increment_id. I only got the normal custumer_id [ $order->getCustomerId() ].


texts: How to trace events / Alternatives of Mage::dispatchEvent to hook events?

texts:
Testing out observers and following tutos , i have created an observer for 'catalog_product_save_after' that worked.
But searching through the files i cannot find the Mage::dispatchEvent('catalog_product_save_after');

How is this possible?

This question is interesting for me because at first the observer i have setted was not working and i thought it was because the event were simply not existing.


texts: Magento 2 : How to write logs from a phtml file in a theme

texts: How to write logs in var/log/whatever_file from a phtml file which belongs to my custom theme?


texts:
I have "just" got a new client with an existing magento webshop (www.roonrahn.com), which has a lot of issues. When I run a test on https://developers.google.com/speed/pagespeed/insights/?url=roonrahn.com&tab=desktop

the site scores poorly, which is no wonder; BUT when I download the "optimized" images, they are tiny! Not just in kb but in pixel size.

Why is google serving me these tiny images?

Maybe there is something wrong with the template, that google interpret weird?


texts: How to a third-party module uses a layout update that changes the template path for a core block?

texts:
A third-party module uses a layout update that changes the template path for a core block from  Magento_Catalog::product/view/addto/compare.phtml toMyCompany_MyModule::custom/view/addto/compare.phtml. The merchant has a customized version of this template in their custom theme. What is a consequence of this setup?

A - This setup will throw an IllegalStateException.

B - If a preference for the core block is set, the template will no longer apply.

C - If another module is installed which also customizes the same core template, the templates will be rendered sequentially.

D - If the custom module is removed, the custom template will no longer apply.

Please correct me on this which answer is correct of given 4 options
i tried much R&D of it and according to C or D is the correct answer please help me to correct this.


texts: How to change multiple products status by specific SKU in magento 1.9 Myql query?

texts:
How to i can change multiple products status by specific SKU in magento 1.9 with Myql query ? i have lot of products disabled but i want specific products enabled by SKU with Mysql query or programming. how to i'll do this ?

Thanks


texts: magento2 - how do I show css updates in production mode?

texts:
I've spent a few days reading complex questions and answers on this topic. I'm looking for clear instructions regarding how to make simple edits like changes to CSS in my magento2 site. Is it possible to do so in production mode?
At the moment, I'm unable to see changes to the CSS in BOTH development and production mode. I've tried editing both the style.css file in my theme and the .less file in the theme web/css/source folder.
Running commands like

php bin/magento setup:static-content:deploy

isn't doing anything.


texts: How to align product name , price to center in magento 2 ? it have option in theme or change in code

texts:
I have products in the page I need to centrer the product name and price?

I have an option to theme or change in the code?


texts: Magento2 custom sql to get data from external table and import into product

texts:
In Magento2 I am trying to connect to an external database and table and use the data to update a custom product attribute where the sku' match in both tables. I temporarily put this code in my footer.phtml file as I am just trying. ti do a quick import/population of custom attributes from an external source
I am trying to do the below query. If I remove my query code and just card code a sku and a part id it updates Magento just fine so something about my sql it does not like.
I confirmed my credentials are valid for accessing the database
$machine = "xxxxx";
$machineu = "xxxx";
$machinep = "xxx";
$machinedbname = "xxxx";

// Create connection
$conn = mysqli_connect($machine, $machineu, $machinep, $machinedbname);
if (!$conn) {
   die("Connection failed: " . mysqli_connect_error());
}

$testsql = mysqli_query($conn, "SELECT * FROM tempinfo");
while($row = mysqli_fetch_array($testsql))
{
  extract($row);
  echo "
test $sku

";
  $_product = $objectManager->create('\Magento\Catalog\Api\ProductRepositoryInterface')->get($sku,true, 0, true);
  $_product->setCustomAttribute("part_id", "$part_id");
  $_product->save($_product);
}


texts: How to set page cache expires to 7 days?

texts: I am using varnish with default magento 2.3.3 VCL and the default nginx configuration that comes with magento install. At present I see the expires is set to -1. How can I set expires to one week?


texts: Do I really need Magento over WooCommerce

texts:
I'm going to build an online store for our local store.

I have a decent WordPress experience, but I'm doing a research if I'm better off building it with Magento.

From what I have found out, in case you have a lot of products, it's best to go with Magento. We will probably have around 2000 products at the start and will go to up to 10000 in up to 1-2 years.

It will be mainly a store, rather than a blog.

However, Im not sure if we are able to afford a big VPS at the moment, as we are not sure if we will have a lot of orders at the start. Adding the fact that I will spend a ton of time to learn Magento, is it really necessary to go with Magento??

My plan is to start off with WooCommerce and then learn Magento over one year period. Then use a tool to migrate all the products from WordPress to the new Magento store I will build, in case we decide it's worth the time/money.

This way I will see if it will have any sales and if it will be worth taking a server with a lot of resources and spending the time to build a Magento store from scratch with no experience and a lot of time spent learning it.

Can anyone advise me if my plan seems legit? Please add any advise you believe will be useful in my case.


texts: Is there any tool or method to find out the infinite loop within magento?

texts:
I have magento site having 145 extension installed. There are different custom and 3rd party plugins.

The problem is any event trigger on some random condition and make server down.

any tool that scan php or magento code for looping query and infinite loop.

thanks in advance


texts: Need to manually write in the DB in patch_list table a particular CMS block

texts: I have just been asked to do this, and me and my colleagues have no idea, any help would be greatly appreciated!


texts: Get cached product image for preset size

texts:
My theme view.xml has:
<image id="product_small_image" type="small_image">
   <width>135</width>
   <height>135</height>
</image>

I have a class like this:
<?php

use Magento\Catalog\Helper\Image;

class ImageFinder
{
    private $imageHelper;

    /**
     * ImageFinder constructor.
     *
     * @param Image $imageHelper
     */
    public function __construct(
        Image $imageHelper
    ) {
        $this->imageHelper = $imageHelper;
    }

    public function getImageViaHelper($product)
    {
        return $this->imageHelper
            ->init($product, 'product_small_image')
            ->setImageFile($product->getData('small_image'))
            ->getUrl();
    }
}

which I call via:
$imagePath = $this->imageFinder->getImageViaHelper($product);

What I want is to fetch the URL of the cached product_small_image in a 135px square. However it doesn't work - it returns the original size.
If I add ->resize(135, 135) before ->getUrl() this works, but I don't want this because that will cache a new image which will not persist after flushing the media catalog cache. Can I not request a specific size which is either loaded from the cache or added to the cache when I request it?


texts: Show SKU and Product Name in Sales_Order_Grid?

texts:
I have been stuck for hours trying to add both Product Name and SKU to the Sales Order Grid in Magento.

I have created the joins and added the columns but the no data is being displayed and can't figure out why???

Any help would be nice...

Inside _prepareCollection

protected function _prepareCollection()
{
          $collection->getSelect()->joinLeft(array('sfoi' => 'sales_flat_order_item'),
            'order_id=main_table.entity_id = quote_item_id', array('sfoi.sku',
            'sfoi.name'));
        $this->setCollection($collection);
        return parent::_prepareCollection();
    }

And my two columns

$this->addColumn('sku', array(
    'header' => Mage::helper('sales')->__('SKU'),
    'align' => 'left',
    'sortable' => true,
    'index' => 'sku'
));

$this->addColumn('name', array(
    'header' => Mage::helper('sales')->__('Item Name'),
    'align' => 'left',
    'sortable' => true,
    'index' => 'name'
));

$this->addColumn('total_item_count', array(
    'header' => Mage::helper('sales')->__('Total Items'),
    'width' => '80px',
    'index' => 'total_item_count',
    'type' => 'text',
    'filter_index' => 'total_item_count'
));

I am able to get number of items into the Grid but not name and SKU is just empty

Could do with a heads up here!


texts: Magento 2 : How to change print and PDF logo?

texts:
I want to set print logo different as per website logo.

  Is it possible to set different logo for print and PDF in Magento 2 ?


texts: Magento 2 - How to register New Customer from REST API

texts:
I am new to REST Api, I am working on to create customer account via using Rest API but struggling with one error which I am trying to find I authorized account properly but when I try to create new account It gives me an error

First Error

{ "message": "%fieldName is a required field.",
"parameters": {
    "fieldName": "customer"
},

Second Error (After adding Customer Param)

"message": "Please enter a customer email.",

I am not sure what i am doing wrong. I tried to use email param but its not working. Can anyone help me with this.

Software use: Postman
Resource: https://devdocs.magento.com/guides/v2.2/rest/tutorials/orders/order-create-customer.html


texts: Checkout Error when confirming new order (MySQL server has gone away)

texts:
I am having some issues with my Magento site. I have 2 backend guys on it and they cant get to the bottom of it.

It started off with this error this morning

  Error: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

When a customer has enters their delivery/payment details and clicks complete the order it  hangs for 1-2 minutes and then returns the above error.

We figured out that if a customer pays with paypal it goes through perfectly. Also with some credit card transactions, we noticed that some go through but we still get the above error.

We have increased
max_allowed_packet and query_cache_size

Any help would be greatly appreciated asIi am not a techie and my techies can't figure it out

Magento 1.9, Onestepcheckout

(max_allowed_packet is not the issue here)


texts: Could someone please explain Declarative Database Schema

texts:
So, I read that Magento 2.3 will be introducing Declarative Database Schema.

  Today, when you want to alter the schema of a Magento database, the
  pattern used to accomplish this is to use the InstallSchema and
  UpgradeSchema classes where code is written to alter the schema.
  Magento 2.3 will change the recommended way by implementing a
  declarative database schema.

Please, could someone help explain what this means and why it's so beneficial. And is this referring to changes to the DB itself or just the scripts used to install and upgrade.

Thanks.


texts: Magento 2.2.2 getting error unable to process binding if: function(){return getCartParam('summary_count') }

texts:
I am getting an error like

  unable to process binding if: function(){return getCartParam('summary_count') }

in magento 2.2.2

I tried below commands

php bin/magento setup:upgrade && php -dmemory_limit=6G bin/magento setup:di:compile && php -dmemory_limit=6G bin/magento setup:static-content:deploy -f && php bin/magento cache:clean && php bin/magento cache:flush

I also remove my overridden template code of minicart.phtml file in my custom theme

Still, I faced this error, anyone has any idea about this error?


texts: special price is not working fine while adding product into cart

texts:
While uploading products, special price given from Magento admin is working fine in product page.

But, in cart page it's taking actual price.

I had tried many answers from internet. But, still failed to solve. please help to fix it?


texts: Insert records to database table via controller method

texts: Can anyone tell me how to insert records to database table via controller method?


texts: I wonder to know if you have an ER diagram of Magento 2 (as the same you published of magento 1.0.x (http://anna.voelkl.at/uploads/magento/ce1922.png)