texts: Magento 2: How to Override Block in Custom Module

texts:
I want to overide cart item Renderer Block in custom extension.
This is my Block file but this is not work

 <?php
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Vendor name\Modulename\Block\Cart\Item;

/**
 * Shopping cart item render block
 *
 * @author      Magento Core Team <core@magentocommerce.com>
 *
 * @method \Magento\Checkout\Block\Cart\Item\Renderer setProductName(string)
 * @method \Magento\Checkout\Block\Cart\Item\Renderer setDeleteUrl(string)
 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
 */
class Renderer extends \Magento\Checkout\Block\Cart\Item\Renderer implements
    \Magento\Framework\DataObject\IdentityInterface
{
     public function getFormatedOptionValue($optionValue)
    {

        /* @var $helper \Magento\Catalog\Helper\Product\Configuration */

        if(isset($optionValue['value']))
        {
            $directory = 'http://localhost/dtooladvance/pub/media/designtool/designImages/'.$optionValue['value'];
            $optionValue['value'] = "";
            return $optionValue;
        }

        $helper = $this->_productConfig;
        $params = [
            'max_length' => 55,
            'cut_replacer' => ' ...'
        ];
        return $helper->getFormattedOptionValue($optionValue, $params);
    }

}

How I override Renderer block in custom extension for magento 2.


texts: Flat tables enabled from admin but it does not init flat tables

texts:
The problem is that when Magento tries to load the search results by some ids, it does not take the same number of products as it should be. I debugged and saw that despite the fact that we're using flat tables, Magento's query is build on EAV tables.

I verified that in Sustem->Configuration->Catalog->Frontend to specified Magento to use flat tables but it does not work.

Mage_Catalog_Model_Resource_Product_Collection->isEnabled() returns false and because of this, the flat tables are not used. I guess?

Mage::helper('catalog/product_flat')->isEnabled() returns true, so I guess flat is enabled after all.

Am I missing something?


texts: How to get rid of Add To Compare links in the template

texts: I am completely at a loss as to how to remove the Add to Compare links in my template.  I have done a global search and found every file that contains that phrase and have carefully commented out the section that contains that term in each file.  This worked to remove the term from the list view but not from the grid view.  Where else could this link be living?


texts:
I am only starting with Magento and I'm reading the devdocs but I seem to be stuck on something that would most likely be pretty obvious to more experienced developers.

In the theme inheritance documentation here, in the checkout button example, it says that in order to override the file

<Magento_Checkout_module_dir>/view/frontend/templates/cart/minicart.phtml

all I have to do is copy the file in

app/design/frontend/<vendor>/<theme>/Magento_Checkout/templates/cart/minicart.phtml

and then modify it as needed.

I tried that, and it worked as expected, I was able to add some text and then see it in the site.

Of course I did not understand much about the changes I needed to make to the file to follow the example so I kept reading and it says:

"You can find out what exactly code changes are required to perform this and other tasks in the Illustration of customizing templates topic."

In the link, it describes a different file,

<Magento_Checkout_module_dir>/view/frontend/web/template/minicart/content.html

than can be overridden by copying it to

app/design/frontend/<vendor>/<theme>/Magento_Checkout/web/template/minicart/content.html

This does not seem to work for me at all. Creating the file does not seem to affect the inheritance, and the file from <Magento_Checkout_module_dir> ends up being used when the site is rendered.

I would like to ask the following.

1) Am I messing up somewhere and the file is not overridden? (absolutely not unexpected)

2) What is the difference between template files in the /view/frontend/templates directory and the ones in view/frontend/web/template? What could I read to clarify that?

Thank you for your time

EDIT

After cleaning up the pub/static directory with rm -R pub/static/* and running php bin/magento setup:static-content:deploy successfully (0 errors on all themes, including the one I created), the file seems to remain not overridden.

However, after checking in

pub/static/frontend/<vendor>/<theme>/en_US/Magento_Checkout

everything seems to be a normal file except template/minicart/content.html that appears to be a symlink to

app/design/frontend/<vendor>/<theme>/Magento_Checkout/web/template/minicart/content.html

which is indeed the static file I am trying to override.

Still, any changes to the file (made both before and after the static content deployment) are not displayed in the site.


texts: Show hide admin form fields on change Magento 2

texts:
I want to show-hide wood type on the basis of change of type field.

Here is my _prepareForm code:-

 $model = $this->_coreRegistry->registry('current_model');

    $isElementDisabled = !$this->_isAllowedAction('Krisha_Visualizer::content');
    $form = $this->_formFactory->create();

    $form->setHtmlIdPrefix('content_');
    $fieldset = $form->addFieldset('base_fieldset', ['legend' => __('Visualizer Content Information')]);
    if ($model->getId()) {
        $fieldset->addField('visualizer_id', 'hidden', ['name' => 'id']);
    }
    $fieldset->addField(
        'name',
        'text',
        [
            'name' => 'post[name]',
            'label' => __('Name'),
            'title' => __('Name'),
            'required' => true,
            'disabled' =>  $isElementDisabled
        ]
    );
    $fieldset->addField(
        'is_active',
        'select',
        [
            'label' => __('Status'),
            'title' => __('Visualizer Status'),
            'name' => 'post[is_active]',
            'required' => true,
            'options' => $model->getAvailableStatuses(),
            'disabled' => $isElementDisabled
        ]
    );
    if (!$model->getId()) {
        $model->setData('is_active', $isElementDisabled ? '0' : '1');
    }

    $fieldset->addField(
        'type',
        'select',
        [
            'label' => __('Type'),
            'title' => __('Visualizer type'),
            'name' => 'post[type]',
            'required' => true,
            'options' => $model->getAvailableTypes(),
            'disabled' => $isElementDisabled
        ]
    );
    if (!$model->getId()) {
        $model->setData('type', $isElementDisabled ? '0' : '1');
    }

    $fieldset->addField(
        'wood_type',
        'select',
        [
            'label' => __('Wood Type'),
            'title' => __('Visualizer Wood type'),
            'name' => 'post[wood_type]',
            'required' => true,
            'options' => $model->getAvailableWoodTypes(),
            'disabled' => $isElementDisabled
        ]
    );
    if (!$model->getId()) {
        $model->setData('wood_type', $isElementDisabled ? '0' : '1');
    }

    $fieldset->addField(
        'small_image',
        'image',
        [
            'title' => __('Small Image'),
            'label' => __('Small Image'),
            'name' => 'post[small_image]',
            'note' => __('Allow image type: jpg, jpeg, gif, png'),
        ]
    );

    $fieldset->addField(
        'main_image',
        'image',
        [
            'title' => __('Main Image'),
            'label' => __('Main Image'),
            'name' => 'post[main_image]',
            'note' => __('Allow image type: jpg, jpeg, gif, png'),
        ]
    );

    $this->_eventManager->dispatch('krisha_visualizer_content_edit_tab_main_prepare_form', ['form' => $form]);
    $form->setValues($model->getData());
    $this->setForm($form);

    return parent::_prepareForm();

Thank you


texts: How to Get a Language Switcher in Custom phtml File.?

texts:
I have a Custom Page, on that I had Hide the Header and Footer. But i need a Language Switcher in my custom Page. I had tried like this below on my Layout XML file,

<block class="Magento\Store\Block\Switcher" name="store_language" as="store_language" template="Magento_Store::switch/languages.phtml"/>

My full Layout Xml File is below,

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"layout="1column"xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
    <css src="St_CustomMultiseller::css/customregister.css"/>
</head>
<body>
  <referenceBlock name="header.content" remove="true" />
  <referenceContainer name="footer-container" remove="true"/>
  <referenceBlock name="page.main.title" remove="true" />
   <referenceBlock name="vendor_create_form" remove="true"/>
  <referenceBlock name="vendor.create">
       <action method="setTemplate">
             <argument name="template" xsi:type="string">St_CustomMultiseller::account/create.phtml </argument>
       </action>
       <block class="\VendorsCustomRegister\Block\Account\Create\Vendor" name="new_vendor_create_form" template="St_CustomMultiseller::account/create/vendor-form.phtml"/>
       <block class="Magento\Store\Block\Switcher" name="store_language" as="store_language" template="Magento_Store::switch/languages.phtml"/>
  </referenceBlock>

</body>

But it not comes. Anyone help me to get the Language Switcher on my custom page.


texts: Trying to install Magento 2.4.1 using command line ? What is elasticsearch host?

texts:
I got this example command from the guide (tutorial) - https://devdocs.magento.com/guides/v2.4/install-gde/install/cli/install-cli.html#install-cli-example
bin/magento setup:install --base-url=http://127.0.0.1/magento2/ \
--db-host=localhost --db-name=magento --db-user=magento --db-password=magento \
--admin-firstname=Magento --admin-lastname=User --admin-email=user@example.com \
--admin-user=admin --admin-password=admin123 --language=en_US \
--currency=USD --timezone=America/Chicago --use-rewrites=1 \
--search-engine=elasticsearch7 --elasticsearch-host=es-host.example.com \
--elasticsearch-port=9200

I also have elasticsearch running.
But I have a doubt that host.example.com should be something good value(I am trying to install magento on localhost ) is it correct or not, if i copy paste the above command and run..
This below line elasticsearch-host=es-host.example.com  should be elasticsearch-host=es-host.localhost.com  .  I don't know if I am right or wrong, but please help me in proceeding further, any help will be great help.


texts:
I'm having a problem with Magento 1 cron job. AoE scheduler and logs show the same error:

  Host has not been available for a while now to update the status of
  this task and the task is not reporting back by itself

There are no errors in the code... Has anyone encountered this issue?


texts: How to hide a div on Checkout Page but show on other pages using header.phtml?

texts: I want to show certain content consisting within a <div> within the website header, so within header.phtml. I want to show this on all pages, except on the checkout/cart page. How can I achieve this?


texts: Mailchimp for Magento 2.1. not showing in the backend

texts:
I have followed this tutorial https://mailchimp.com/resources/guides/mailchimp-e-commerce/ to install Mailchimp for Magento extension.

The extension is not showing. So, what have I done so far:

I have extracted the extension zip where I get this folders: app, js, lib, shell, skin folders and package.xml. I copy and pasted this folders and files into magento root directory.
Run php bin/magento setup:upgrade adn php bin/magento setup:di:compile
Flush the cache
And nothing. There is no mailchimp tab on the configuration page.
I have successfully installed some plugins already, but they had different structure, so maybe I am missing some step.
For the previos plugin I needed to enable the plugin via terminal:

php bin/magento module:enable Pdf_Invoice_Plus

The name was in registration.php file. I don't have registration.php file in this extension so I don't know the real name of this extension so I tried:

php bin/magento module:enable mailchimp+MailChimp_For_Magento Unknown module(s): 'mailchimp+MailChimp_For_Magento'

php bin/magento module:enable MailChimp_For_Magento Unknown module(s): 'MailChimp_For_Magento'

php bin/magento module:enable Ebizmarts_MailChimp Unknown module(s): 'Ebizmarts_MailChimp'

I am stuck. Forever.


texts:
I have installed magento2.3.1 in example.com/test/ folder through commandline.Installed successfully. but when opening url in browser http://example.com/test/

it shows error

in backend it shows error


texts:
I'm working on making changes to an existing Magento site, but I don't want these changes to be 'live' since it could affect user interaction while changes are being made. I'd like to make all these changes and then make them 'live' once everything is done. I've been doing some research and think the best way for this is to host the site offline, make the changes, and re-upload those files that were changed.

Does anyone have a better solution / experience doing this?


texts: How to add a block (defined in a module) to a CMS page (specifically the home page) through admin page editor

texts:
I made a module and with in it a Block. I am trying to pull it into the home page by entering this into the editor for home page CMS page editor:

{{block type="thinkopen/overwriter" block_id="Categoriesmenu" name="Categoriesmenu" template="thinkopen_overwriter/categoriesmenu.phtml"}}

Somehow, I am not getting the results. Can you tell me what am I missing here? Things I did:
-My Thinkopen/Overwriter/etc/config.xml module config file is:

<config>
    <modules>
        <Thinkopen_Overwriter>
            <version>2.0.0.1</version>
        </Thinkopen_Overwriter>
    </modules>
    <global>
        <blocks>
            <overwriter>
                <class>Thinkopen_Overwriter_Block</class>
            </overwriter>
        </blocks>
    </global>
</config>

-My Block is defined in Block/Categoriesmenu.php as so:

<?php

class Thinkopen_Overwriter_Block_Categoriesmenu extends Mage_Core_Block_Template
{

    public function _construct()
    {

        return parent::_construct();
    }

    public function _beforeToHtml()
    {
        echo "Categories_Menu from my module";
    }

}
?>

-My cache is disabled and cleared.


texts: Creating customers programatically issue

texts:
I want to create some customers programatically and I have an issue when I want to save the website ID.

I have multiple website IDs:

0 => admin
1 => germany
2 => hungary
3 => romania

This is my code:

 $customer = Mage::getModel("customer/customer");
 $customer->setWebsiteId(3);
 $customer->setStoreId(1);
.....
 $customer->save();

When I saved a customer I get the Admin value selected from the website drop down. Whatever value I give to the website Id (like 12321) I got the Admin value. Why ?

Thanks.


texts: Magento 2.2 : How to add a background image in _extend.less?

texts:
I'm trying to add a background image to a div in the template advertisement.phtml of my custom page layout home_custom.xml.

For this, I have the following CSS in my _extend.less file:

div.outer {
    display: flex-inline;
    border: dotted;
    background: url('@{baseDir}images/advertisement.png');
}

Below is my custom theme's tree structure:

.
├── Magento_Theme
│   ├── layout
│   │   └── default.xml
│   ├── layouts.xml
│   ├── page_layout
│   │   └── home_custom.xml
│   ├── templates
│   │   └── advertisement.phtml
├── media
│   └── preview.png
├── registration.php
├── theme.xml
└── web
    ├── css
    │   └── source
    │       └── _extend.less
    └── images
        ├── advertisement.png
        └── logo.svg

However, I see the dotted border, but not the background image. How should I fix this issue ?


texts:
I need some help setting up the "dynamic" value for the facebook pixel. I'm not 100% familiar with Magento and these no datafeed to go off of. Here's the Facebook line I need to modify:

fbq('track', 'Purchase', {value: '0.00', currency:'USD'});

Are either of the below the correct value to replace the '0.00'?

Value: ?php echo number_format($quote->getGrandTotal(),2,'.','');?,

Value: <?php echo $amount; ?>,


texts: Magento 2 - Quantity Field on Related Products Listing

texts:
I'm trying to add a quantity field to the related products section on my product page.  I'm overriding module-catalog/view/frontend/templates/product/list/items.phtml in my theme.  So far, here is my 'related' case section:

case 'related':

   /** @var \Magento\Catalog\Block\Product\ProductList\Related $block */
    if ($exist = $block->getItems()->getSize()) {
        $type = 'related';
        $class = $type;
        $image = 'related_products_list';
        $title = __('Related Products');
        $items = $block->getItems();
        $limit = 0;
        $shuffle = 0;
        $canItemsAddToCart = $block->canItemsAddToCart();
        $showWishlist = false;
        $showCompare = false;
        $showCart = true;
        $templateType = null;
        $description = false;
    }
 break;

I set $showCart to true so I can now see an add to cart button under the related product, and it is functioning by adding one item to the cart.  I tried adding the following code above the button in items.phtml for the quantity field:

 <?php echo __('Quantity:'); ?>
 <input type="number"
     name="qty"
     id="qty"
     maxlength="12"
     value="<?php /* @escapeNotVerified */ echo $block->getProductDefaultQty() * 1 ?>"
     title="<?php /* @escapeNotVerified */ echo __('Qty') ?>" class="input-text qty"
     data-validate="<?php echo $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>"/>

Once I add this code, no matter what I put in the quantity field, it always adds one product.  Is there something I'm missing for the add to cart button to add the quantity I enter in the quantity field?


texts: how to remove request parameter in layered navigation

texts:
In layered navigation it is required to make custom parameter in remove link for triggering proper removal in this filter, to have possibility to save filter state in session and be able to remove this filter as well.

I using following approach:

public function apply(Zend_Controller_Request_Abstract $request, $filterBlock)
{
    if ($request->getParam('delete_filter') == 1) {
        $request->setParam('delete_filter', 0);
        Mage::getSingleton('customer/session')->unsFilterSettings();
        return $this;
    }
   // create filter from customer session paramteres

I am using Ajax filter and can't get rid of this delete_filter param, is it possible to patch request on the fly and remove this parameter ? I tried clearParams() - no luck


texts:
Currently I have two stores on my Magento installation with each of them having their own url.

SiteA.com -> SiteA.com

SiteB.com -> SiteB.com

However the admin section does not work this way. After the administrator logs in, the url switches to SiteA.com (see below).

SiteA.com/admin -> SiteA.com/admin

SiteB.com/admin -> SiteA.com/admin

My question is if I can get the admin URL to stay on the same domain like below. I am not worried about restricting information to each domain. I am only concerned about keeping the domain the same once logged in.

SiteA.com/admin -> SiteA.com/admin

SiteB.com/admin -> SiteB.com/admin


texts:
I have downloaded a theme. The folder contains app, js, media and skin folders.
I have disabled and flushed all the caches. Then I have copied the theme's folders to Magento root (located in local virtual host 'magento.local') overwriting the existing folders. That caused the site to stop working.
Later, I started to manually copy the files from the theme folders to the corresponding Magento locations so as not to delete any of the existing files and I have put down my theme's name in all of the the 'System -> Configuration -> Design -> Themes' inputs. However the site still has the default look.

I would say, that I should delete some of the default folders in the app, js, media or skin folders but I'm not sure which ones.

Is there any way some of you could help my having these information, please?

Thank you very much!


texts: Magento2 REST API 400 bad request specific error codes

texts:
In Magento2, while returning an error from a rest endpoint, i can throw an exception like this

throw new \Magento\Framework\Webapi\Exception(__('No centers matching search criteria'))

It will throw an error like

My requirement, is to add an error code along with response i.e.

{
"message": "No centers matching search criteria.",
"error_code":101
"trace": null
}

Any ideas how this is possible?


texts: How to install Magento 2.1 to PostgreSQL

texts:
As the topic. I would like to magento worked on PostgreSQL. Is it possible during installation instead of MySQL indicate PostgreSQL database?
Completely abandon MySQL. Only use PostgreSQL?


texts:
I am new in the magento 2 and created child theme first time , you can see here http://www.neplyn.in/staging/
Css is not loading not sure why.
DO I need to copy the parent theme css and put in child theme folder?


texts: How to remove footer from checkout onepage

texts:
I want to removed the footer from the onepage checkout in magento. I am try coding  using module controller and modulename and action on condition.

Can any one tell me a good process for changing layout in the checkout?


texts: Add to cart issue in some android devices

texts: I am facing issue in my website while clicking "ADD TO CART", it is redirecting to home page without adding the product to cart.This issue is occurring only in android 6, android 7 devices and is working fine in other devices.


texts:
This is my collection function:

public function getCollection()
{
    $searchCriteria = $this->searchCriteriaBuilder->addFilter('status', '1')->create();

    $someCollection = $this->someRepositoryInterface->getList($searchCriteria);

    return $someCollection->getItems();

}

So far everything works fine.

The filter works with no issues, all enabled items are displaying.

I need help with sorting. I have a field called "position". I need to display items in ascending way, what I mean is "position 1" should be first displayed item, second should be under first, etc.

As I suppose there should be an easy method for that but can't find it...

Any suggestions will be highly appreciated.


texts: Magento2 - How to validate image width and height in admin form

texts:
I have created a custom module for image upload in magento2 admin form. How to validate the image width and height.

Any help on the issue please?


texts: How to automatically cancel pending orders

texts:
We found that, sometimes we run out of stock/inventory due to (pending payment) orders.

so to automatically cancel pending orders.

we have magento 1.9.2.4


texts: How to set a cookie on add to cart and remove it when cart is empty?

texts:
As in title - I'd like to set a cookie when any product is added to the cart and remove it if cart is empty.

I found a somewhat similar answer for setting cookies on login, which is perfect, cause I'd like to do that as well, but have no clue how to set equivalent for chart items (I'm new to Magento).

version  1.9.2.4


texts: How to execute php file from magento admin in Magento 2?

texts:
I have created a php file on root folder of magento in Magento 2 and hit a controller on that file.
That process is done and i have tested it it running on terminal.
How would i run that script from magento backend on click a button is it possible.
Any help is appreciated.


texts: Alter Magento 2 shipping address on request

texts:
I want to alter shipping on some payment method like pickup.
I found request mine/shipping-information and i try alter it like so:
vendor/magento/module-checkout/view/frontend/web/js/model/shipping-save-processor/default.js
           payload.addressInformation.shipping_address.firstname ='Change1';
           payload.addressInformation.billing_address.firstname ='Change2';

I just change name in example to easy check is it working.
In magento 2 order, I can see that billing address has change but not the shipping address.
Is there any way to alter this so I can change address ?


texts: Magento2: How can call custom block after product title via xml in product list page?

texts:
I have tried below code but unable to call my custom block below product title or product price in list page. file-name of my module: catalog_category_view.xml

    <?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="content">
               <block class="Magento\Wishlist\Block\Catalog\Product\ProductList\Item\AddTo\Wishlist"
                       name="category.product.mwishlist" as="mwishlist" after="-"
                       template="Magenest_MultipleWishlist::catalog/product/list/mwishlist.phtml"/>
        </referenceContainer>

        <move element="category.product.mwishlist" destination="product.info.main"  after="-" />
    </body>
</page>

Anyone have and idea how can show my custom block after product price/title in product list page?


texts: Issue adding javascript to magento admin page

texts:
On the Magento admin new product page

/app/design/adminhtml/default/default/template/catalog/product/edit.phtml

I've tried to add the following code

<!-- Start Edits -->
<script src="jquery-2.1.1.js"></script>
<script type="text/javascript" >
//<![CDATA[
alert("This code is running!");
        $(window).load(function(){

function calculate()
{
    var values = [
        $("#cost").val(),
        $("#shipping_paid").val(),
        $("#tax_paid").val()
    ];

    var percent_value = $("#our_markup").val();

    var sub_total = eval( values.join('+') );
    var total = eval("sub_total+(sub_total * percent_value)");
    $("#price").val(total);
}

$(document).on('input', 'input', calculate);
$(document).on('change', 'select,input', calculate);

});
    //]]>
</script>
<!-- End Edits -->

Which will tally up the 3 text fields with id = "cost", "shipping_paid", "tax_paid", and put them in the text field id = "price". But for some reason it does not seem to want to perform correctly.

I have tried it in a stand alone file and all functionality works correctly.

Any help is appreciated!


texts:
I get There was a category move error. on moving(drag and drop) subcategory to another root category. How I debug this?

on console I get Expected to start loader but did not find one in the dom

this seems to be related to this https://github.com/magento/magento2/issues/3171

but on development works!!


texts: Need to change the site mail Logo if my module called in magento 2.3

texts:
I need to change the logo if the page is used in my custom modules. There are 2 Logos - Logo 1 and Logo 2.
My Module

test/login
test/list

If the above modules come I need to show the Logo 2


texts: How to add new products block to the product view page using local.xml

texts:
I'm trying to add a new products block to the product view pages, I have several products marked as new & they DO show up on the homepage, for some reason they won't display on the individual product pages.

here is what I have in my local.xml

<catalog_product_view>

        <reference name="root">
            <action method="setTemplate"><template>page/1column.phtml</template></action>
        </reference>

        <reference name="content">

        <block type="catalog/product_new" name="product_list_popular" alias="product_list_popular" template="catalog/product/product_list_popular.phtml">
            <action method="addPriceBlockType">
                <type>bundle</type>
                <block>bundle/catalog_product_price</block>
                <template>bundle/catalog/product/price.phtml</template>
            </action>
            <action method="setProductsCount"><count>8</count></action>
        </block>

        </reference>

    </catalog_product_view>

I have tried this in the content reference and by adding

<?php echo $this->getChildHtml('product_list_popular') ?>

to the 1column template [and removing the reference from local.xml] - niether of these work.

what am I doing wrong?


texts: Why is "web/unsecure/base_url" missing in `core_config_data`?

texts:
I try to create a copy of my project.

First I duplicated the project and the database, then I tried to change web/unsecure/base_url and web/secure/base_url in core_config_data to the new url.

But I noticed that they are not appearing in the database? This is all:

I also changed app/etc/local.xml to point at my new database.

This is what I get in the frontend right now:

  There has been an error processing your request SQLSTATE[HY000] [2002]

  No such file or directory

  ...

  Error log record number: 372605216729


texts:
All tutorials for optimizing Magento performance I read suggest that we should enable query cache in mysql -> my.cnf

However, I read a lot of other articles and even the mysqltuner script also suggest that this should be disabled if you use innodb

So what is the correct solution?

  http://mysql.rjweb.org/doc.php/memory#query_cache
  https://dba.stackexchange.com/questions/63415/how-to-decide-whether-to-enable-mysql-query-cache-using-innodb

vs

  https://www.crucialhosting.com/knowledgebase/improving-magento-performance-mysql-query-cache


texts: create product attribute - file upload with certain extensions like pdf, csv etc

texts:
I have created custom attribute type - file upload of type ravi_file in magento2.

public function execute(\Magento\Framework\Event\Observer $observer){
    $response = $observer->getEvent()->getResponse();
    $types = $response->getTypes();
    $types[] = array(
        'value' => 'ravi_file',
        'label' => __('File Upload by Ravi'),
        'hide_fields' => array(
            'is_unique',
            'is_required',
            'frontend_class',
            'is_configurable',
            '_default_value',

            'is_searchable',
            'is_visible_in_advanced_search',
            'is_filterable',
            'is_filterable_in_search',
            'is_comparable',
            'is_used_for_promo_rules',
            'position',
            'used_in_product_listing',
            'used_for_sort_by',
        )
    );
    $response->setTypes($types);
    return $this;  }

an attribute is created successfully. I assigned file upload attribute to default attribute set. I am getting following error on edit product.

I have created backend and frontend module by referring the https://community.magento.com/t5/Programming-Questions/Product-custom-attribute-file-upload/td-p/29460

I need a way to get the attribute listed on the product page where we can upload the file for the specific product. Please help, Thanks in advance.

Used events:

file_upload_add FileAttributeType => for adding custom file type in dropdown of the Catalog Input Type for Store Owner
catalog_entity_attribute_save_before => want to call file upload functionality


texts: Magento 2 configurable product price doesn't change

texts:
I'm using Magento 2.2.5 and for any configurable product if select different variation then product price is not changing.

Can anyone help me with this?


texts: Show All The Available Subcategory and Their Nested Subcategories in Menu in Magento 2

texts:
I have done all the required settings but still it's not showing on the front end.

I am getting result like this. I want to show all the nested subcategory in the menu. Please help.


texts: Cart rule free shipping on subtotal after discount magento 2

texts:
I am working on Magento 2.2.5. I have one cart rule that gives free shipping if the subtotal is equal to or greater then $50.

It is working well, but if the user gets any discount from a coupon or any other discount then it is not working properly as subtotal is not considering discount amount.

If user purchases $55 products then he/she will get the free shipping in the checkout page. But when he uses the coupon that gives 10%($5.5) discount then the amount will be $49.5 then also the free shipping is applying.

So anyway to add this rule on subtotal including discounted amount?

Or do I need to change any code for cart rule?

I read many solutions from the stack and tried but with no luck.

Some of are of Magento 1 but I am using Magento 2.2.5


texts:
I want to move the Ebizmarts_MageMonkey_Block_Checkout_Subscribe block to be under Mage_Checkout_Block_Agreements. What would be the best way to approach it?

Here is a screen shot of current layout:

Please let me know if you need anymore information!


texts:
How to make customer can not order product price '0'?

(I setup the stock number first and then setup price days later due to some reason.

Before I setup the price, customer order products with price '0' and I have to contact the

customer about the issue :(


texts: How to update product qty and Stock Status update programmatically by product id : Magento 2

texts:
I want to update product qty and change Stock Status as in stock by programmatically by product id. I dont want to insert new product, but I want only update existing product by its id. Any one know how to do it ? I tried following code but not getting result.

<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);

use Magento\Framework\App\Bootstrap;

require __DIR__ . '/app/bootstrap.php';

$bootstrap = Bootstrap::create(BP, $_SERVER);
$obj = $bootstrap->getObjectManager();
$storeManager = $obj->get('\Magento\Store\Model\StoreManagerInterface');
$objectManager =  \Magento\Framework\App\ObjectManager::getInstance();
$state = $objectManager->get('Magento\Framework\App\State');
$state->setAreaCode('frontend');
//$productMetadata = $objectManager->get('Magento\Framework\App\ProductMetadataInterface');
//echo 'VERSION ==> '.$productMetadata->getVersion();

$product_id = 1;
$product = $objectManager->get('Magento\Catalog\Model\Product')->load($product_id);
$productRepository = $objectManager->create('Magento\Catalog\Api\ProductRepositoryInterface');

$StockState = $objectManager->get('\Magento\CatalogInventory\Api\StockStateInterface');

//$product = $objectManager->get('Magento\Catalog\Model\Product')->load($product_id);
$product->setQty(100);
$product->save();

Edit : i want to run in a root directory and simple one php file. I want to run as

  localhost/m229/updateproduct.php


texts: Product details popup load but add to cart an other feature no work

texts:
I Use a simple popup. When I click Popup, then popup open and Ajax load product details page. But When product details page load by Ajax then I remove head,header,left,right and footer block.

Now the problem is my css work properly with popup but JavaScript not work so my add to cart button and other option which depends with JavaScript that's are not work.

UPDATE

Config.xml

<config>
    <modules>
        <Abdus_Ajaxproduct>
            <version>1.0.0</version>
        </Abdus_Ajaxproduct>
    </modules>
    <frontend>
        <layout>
            <updates>
                 <ajaxproduct_productload module="Ajaxproduct_Productload">
                 <file>ajaxproduct.xml</file>
                 </ajaxproduct_productload>
            </updates>
       </layout>
    </frontend>
    <global>
        <events>
            <controller_action_layout_load_before>
                <observers>
                    <Abdus_Ajaxproduct_Model_Observer>
                        <type>singletone</type>
                        <class>Abdus_Ajaxproduct_Model_Observer</class>
                        <method>checkForQuickView</method>
                    </Abdus_Ajaxproduct_Model_Observer>
                </observers>
            </controller_action_layout_load_before>
        </events>
    </global>
</config>

observer.php

    <?php
class Abdus_Ajaxproduct_Model_Observer{
    public function checkForQuickView($observer){
        $update = Mage::getSingleton('core/layout')->getUpdate();
        if ($product = Mage::registry('current_product')) {
            $update->addHandle('ajaxproduct_loadproduct_getbysku2');
        }
        return;
    }
}

ajaxproduct.xml

<layout version="0.1.0">
    <ajaxproduct_loadproduct_getbysku translate="label">
        <remove name="head" />
        <remove name="header" />
        <remove name="left" />
        <remove name="right" />
        <remove name="footer" />
    </ajaxproduct_loadproduct_getbysku>
</layout>


texts: Magento2 add custom values in collection->setOrder

texts:
I need to add some custom values in setOrder() of a collection, but it is not working.

$collection->setOrder("((lat - ".$lat.")*(lat - ".$lat.")) + ((lng - ".$lng.")*(lng - ".$lng."))", 'ASC');

The final part of my collection query like this:

ORDER BY ((lat - -34.9226513)*(lat - -34.9226513)) + ((lng - 138.6094486)*(lng - 138.6094486)) ASC

Please help anybody. Thanks in advance.


texts: serialize cross-site scripting (XSS) attacks any patch available

texts:
Any Patch is available for below Issue i have not upgraded
Security enhancements

  In general, we’ve removed serialize/unserialize from most the code to
  improve protection against remote code execution attacks. We’ve
  enhanced protection of code where use of object serialization or
  unserialization was unavoidable. Additionally, we’ve increased our use
  of output escaping to protect against cross-site scripting (XSS)
  attacks.

So you need to inject \Magento\Framework\Serialize\Serializer\Json class for serialize and unserialize values.

use following code for serialize and unserialize values.

protected $serialize;

public function __construct(
    \Magento\Framework\Serialize\Serializer\Json $serialize
) {
    $this->serialize = $serialize;
}

public function serialize($value){
    return $this->serialize->serialize($value);
}

public function unserialize($value){
    return $this->serialize->unserialize($value);
}


texts:
Created Magento 2 custom module but the layout seems not showing anything.
It is supposed to show some output but it is showing white blank screen in the page.

Please help

My URL
http://localhost/PG2/helloworld/Index/Index

Folder Structure:
http://prntscr.com/g1t4sp

controller code

      <?php

        namespace Inchoo\Helloworld\Controller\Index;

        use Magento\Framework\App\Action\Context;

        class Index extends \Magento\Framework\App\Action\Action
        {
            protected $_resultPageFactory;

            public function __construct(Context $context, \Magento\Framework\View\Result\PageFactory $resultPageFactory)
            {
                $this->_resultPageFactory = $resultPageFactory;
                parent::__construct($context);
            }

            public function execute()
            {

                // echo "Hello ";

                $resultPage = $this->_resultPageFactory->create();
                return $resultPage;
            }
        }

routes.xml

     <?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="helloworld" frontName="helloworld">
                    <module name="Inchoo_Helloworld" />
                </route>
            </router>
        </config>

module.xml code

            <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
                <module name="Inchoo_Helloworld" setup_version="1.0.0">
                </module>
            </config>

helloworld_Index_Index

        <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd" layout="1column">
            <body>
                <referenceContainer name="content">
                    <block class="Inchoo\Helloworld\Block\Helloworld" name="helloworld" template="helloworld.phtml" />
                </referenceContainer>
            </body>
        </page>

block class file

        class Helloworld extends \Magento\Framework\View\Element\Template
        {
            public function getHelloWorldTxt()
            {
                return 'Hello world!';
            }
        }


texts:
Now been at this for nearly 2 days...

Using Magento for years, never had this much trouble uploading images in bulk.

'Image does not exist' error when uploading a full product CSV with images attached. I have all images in media/import, all file names match, I have tried changing directory permissions, file permissions, trailing / on and off images. Have tried using Magmi, works fine for imports as long as images are not included..

Worth noting when the above error comes, no products will upload even without images... I have also found at different times the images are being assigned to products as within the product directories the image number directories have existed.

Only have 180-200 products, but 9 images per product, and the site needs to be update twice a day using CSV...

Really am lost for ideas now... very frustrating..

Let me know if i've missed anything!

Update... I have tried using a media_gallery header, CSV imports products not images, have tired using media/catalog/product/1/4 then image name, tried without / on file name, file names contain 3 underscores, have renamed images to remove them.. oddly some image have gone into media/catalog/product/1/4 directory though all of the above shows a 'image does not exist' error..


texts:
I'm using APC for my online store, and while the APC file cache is working properly, the user cached entries are very low.

Here are my settings:

Any help would be greatly appreciated


texts: How do you prevent Magento 2 from saving your cart between sessions

texts: I'm having an issue in Magento 2 where a user will add items to their cart then logout. When the user comes back they add the items to their cart again and click proceed to checkout only to have the items duplicated. Is there a way to prevent this duplication from occuring?


texts:
I have downloaded this file from https://github.com/rhoerr/supee-6788-toolbox
and have kept in root of my project but when I try to run command.

php -f fixSUPEE6788.php -- analyze

Then I get error in ssh.

PHP Warning:  require_once(./abstract.php): failed to open stream: No such file or directory in /var/www/html/fixSUPEE6788.php on line 28
PHP Fatal error:  require_once(): Failed opening required './abstract.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/html/fixSUPEE6788.php on line 28

What is that which I am missing. I need to resolve 404 error for custom modules which came after installing patch.
Please help.


texts: how can we make a Zip Code and postal code mandatory on checkout page in magento

texts: I am trying to make a zip code and postal code mandatory for shipping and billing information but i am not success kindly provide some solutions.


texts:
In my App folder -> /public_html/app/design/frontend, there are 3 folders, base, default, rwd.  Can someone give me help on what these folders are for?  I know RWD stands for Responsive Web Design, but what are the differences in the three base folders?  Default has my template theme, so I would assume, I would edit in there? But besides that, I'm not entirely sure what each folder is supposed to be for?

Thanks for the help


texts: Remove My billing and shipping address are the same in Magento2

texts:
Can we remove the checkbox and label called "My billing and shipping address are the same" during checkout in Magento2?

I don't want to allow customers to enter billing address there. All I need is to hide the checkbox with the label, can it be done? Please anyone help me.


texts: Thumbnails not appearing in either back or front end of store

texts: Weird issue. I uploaded images to each of my products and until recently, the thumbnails appeared both on the back end and the front end of Products. However, lately, that has changed and now even though I uploaded the image, the thumbnail image does not appear even though I gave it the proper role of thumbnail. Why would that be occurring? I re-indexed the database, cleared cache, pretty much everything you would expect to do. This is Magento v2.2.5.


texts:
I use an observer to display out of stock products last.
That works fine, but now I want to enable the Magento option to purchase products that are out of stock. (The default Magento backorder method)

In that case I need to set all products to status "In Stock", so this code does not work anymore.

How can I edit this code, so that it will check if qty is 0 instead, if status is "Out of stock"?

Observer:

<?php

class Outofstock_Model_Observer extends Mage_Core_Model_Abstract
{
    public function catalogProductCollectionLoadBefore(Varien_Event_Observer $observer)
    {
        $collection = $observer->getCollection();
        $collection->getSelect()->joinLeft(
            array('_inventory_table'=>$collection->getTable('cataloginventory/stock_item')),
            "_inventory_table.product_id = e.entity_id",
            array('is_in_stock', 'manage_stock')
        );
        $collection->addExpressionAttributeToSelect(
            'on_top',
            '(CASE WHEN (((_inventory_table.use_config_manage_stock = 1) AND (_inventory_table.is_in_stock = 1)) OR  ((_inventory_table.use_config_manage_stock = 0) AND (1 - _inventory_table.manage_stock + _inventory_table.is_in_stock >= 1))) THEN 1 ELSE 0 END)',
            array()
        );
        $collection->getSelect()->order('on_top DESC');
        $order = $collection->getSelect()->getPart('order');
        array_unshift($order, array_pop($order));
        $collection->getSelect()->setPart('order', $order);

    }
}

Correct code is, thanks to @Giuseppe:

class Outofstock_Model_Observer extends Mage_Core_Model_Abstract
{
    public function catalogProductCollectionLoadBefore(Varien_Event_Observer $observer)
    {
        $prefix = '_inventory_table'.rand(0, 10000);
        $collection = $observer->getCollection();
        $collection->getSelect()->joinLeft(
            array($prefix=>$collection->getTable('cataloginventory/stock_item')),
            "$prefix.product_id = e.entity_id",
            array('is_in_stock', 'manage_stock')
        );
        $collection->joinField(
                        'inventory_qty',
                        'cataloginventory_stock_item',
                        'qty',
                        'product_id=entity_id')
                    ->setOrder('inventory_qty','desc');

    }
}


texts: I want to change the white image frame with my own image. is there any way i can do that because that white background looks so cheap. please if anyone knows how to set an image on image frame and replace that white space with my image, help me here.


texts: Magento 2: Adding quote and order attribute using patch data

texts: Can we add custom quote and order attribute/field using patch data in Magento 2.3.x ? If yes then how it can be done ?


texts:
I wants to made a shipping rule in which if a customer make order of below 3000/= flat charges 150 rupees apply must and if he's order amount is more than 3000 than it must be free shipping, so i make a rule in my extension which is given below:

There i define condition if subtotal is less than or equals to 3000, shipping method should be  flat rate apply, than i also enable free shipping method and set minimum order requirement to 3001,

But the problem is when user place more than 3000 order it shows both shipping methods, can any one guide me why? although i set not to show method if not applicable in flat rate  as well as in free shipping.


texts: Uncaught Error: Call to undefined method :getUrl

texts:
i have an error which says Uncaught Error: Call to undefined method getUrl. The method getUrl is called in a block
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
class BackButton implements ButtonProviderInterface
{
    public function getButtonData()
    {
        return [
            'label' => __('Back'),
            'on_click' => sprintf("location.href= '%s';", $this->getBackUrl()),
            'class' => 'back',
            'sort_order' => 10
        ];
    }

    public function getBackUrl()
    {
        return $this->getUrl('*/*/');
    }
}

can someone help me with this. Thanks in advance


texts: Magento 2 : how to clear selected Value form Custom UI Component select(Dropdown)

texts:
Custom  ui component select(Dropdown)

<select class="admin__control-select" data-bind="
    event:{ change: selectOptionCategory(uid)},
    attr: {
        name: inputName,
        id: uid,
        disabled: disabled,
        'aria-describedby': noticeId
    },
    hasFocus: focused,
    optgroup: options,
    value: value,
    optionsCaption: caption,
    optionsValue: 'value',
    optionsText: 'label'"/>

Custom  ui component js

define([
    'jquery',
    'Magento_Ui/js/form/element/select'
], function ($, Select) {
    'use strict';
    return Select.extend({
        defaults: {
            customName: '${ $.parentName }.${ $.index }_input'
        },
        /**
        * Change currently selected option
        *
        * @param {String} id
        */
        selectOptionCategory: function(id){
            if(($("#"+id).val() != 0)) {
                $('div[data-index="cms_page"] select').val("");
            }
        },
    });
});

I want to clear selected value of cms_page dropdown when I click category dropdown but it give old value


texts: Custom eav category not showing in data front

texts:
I have added an attribute to my category. The attribute is working well on backend (it's showing and saving correctly), but I can't get it on the front.

Here's how i've added this (install):

        $eavSetup->addAttribute(
        \Magento\Catalog\Model\Category::ENTITY,
        'add_to_franco',
        [
            'type' => 'int',
            'label' => 'franco',
            'input' => 'boolean',
            'sort_order' => 333,
            'source' => '',
            'backend' => 'Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend',
            'global' => 1,
            'visible' => true,
            'required' => false,
            'user_defined' => false,
            'default' => null,
            'group' => 'General Information',
            'system' => false,
            'searchable' => true,
            'filterable' => true,
            'comparable' => true,
            'visible_on_front' => true,
            'used_in_product_listing' => true,
            'unique' => false,
            'apply_to' => ''

        ]
    );

This is the data i'm getting :

Array
(
    [entity_id] => 16
    [attribute_set_id] => 3
    [parent_id] => 2
    [created_at] => 2018-06-21 11:00:46
    [updated_at] => 2020-05-11 12:18:35
    [path] => 1/2/16
    [position] => 2
    [level] => 2
    [children_count] => 16
    [store_id] => 1
    [adresse_fournisseur] =>
    [all_children] =>
    [available_sort_by] =>
    [children] =>
    [custom_apply_to_products] => 0
    [custom_design] =>
    [custom_design_from] =>
    [custom_design_to] =>
    [custom_layout_update] =>
    [custom_use_parent_settings] => 0
    [default_sort_by] =>
    [description] =>
    [display_mode] => PRODUCTS
    [filter_price_range] =>
    [image] =>
    [include_in_menu] => 1
    [is_active] => 1
    [is_anchor] => 1
    [landing_page] =>
    [meta_description] =>
    [meta_keywords] =>
    [meta_title] =>
    [name] => Mes outils de communication
    [page_layout] =>
    [path_in_store] =>
    [poids_recherche] =>
    [url_key] => mes-outils-de-communication
    [url_path] => mes-outils-de-communication
)

And this is how i get the data :

 $cat = $objectManager->create('Magento\Catalog\Model\Category')->load($category);
 $data = $cat->toArray();


texts: Magento 2 : Upgrade from 2.0.0 to latest version

texts:
I want to upgrade my magento 2.0.2 to latest version with help of composer.
When i run command

  composer update

It want below authentication information :

Loading composer repositories with package information
    Authentication required (connect20.aveo-trade.cz):
      Username:

But i don't have any username and password for connect20.aveo-trade.cz

Now what i have to do for upgrade?


texts: Magento2: How can I override core js module price-box.js

texts:
I need to extend Magento_Catalog/js/price-box.js. I have used the 'mixins' feature, but it's not working for price-box.js.

requirejs-config.js:

var config = {
    config: {
        mixins: {
            'Magento_Catalog/js/price-box': {
                'My_Module/js/price-box/pluggin': true
            }
        }
    }
};

My_Module/view/frontend/web/js/price-box/pluggin.js

define(function () {
    'use strict';

    return function (target) {
        // modify target
        var reloadPrice = target.reloadPrice;
        target.reloadPrice = function() {
           cosole.log("hello");
        };
        return target;
    };
});


texts: Wysiwyg image upload button not there - Magento 1

texts: The image upload button on the Wysiwyg is not there on my Magento 1 site.


texts: How to load a phtml file only for homepage? (Magento 2)

texts:
I am trying to load a phtml file like this:

File /app/design/frontend/name/themename/Magento_Theme/layout/default.xml

    <referenceContainer name="page.top">
        <block class="Magento\Framework\View\Element\Template" name="startphoto" template="html/startphotos.phtml">
            <arguments>
                <argument name="section" xsi:type="string">homepage</argument>
                <argument name="position" xsi:type="number">0</argument>
            </arguments>
        </block>
    </referenceContainer>

I want to load it only on homepage, but it is still loading on every page. The arguments seems to be ignored.


texts:
Does anyone know how to make a product with not fixed price?

By default the product price is $1. But it can be changed by user dragging a price product slider (the product is a donation product).

So how to implement that? How to give an ability for the user to change the product price?

I was thinking about the configurable product with attribute set but I'm not sure that it's really elegant way to do so.

Thank you in advance!


texts: How to insert Categories into Magento programmatically?

texts:
This is the scenario:

I am making a SOAP call from Magento to a CMS
The CMS will produce and return a json encoded object of new Category names and some category properties ( Title, URL, Parent/Child relationship, that's pretty much it ) to Magento.
I need to iterate through this object, and take the Category names and insert them into the Magento DB so that Magento can manage these categories. I will also need to add whatever category properties to each category that aren't present in the object, and I need to correctly insert these Categories so that they show up in the admin section under Manage Categories.

My Question: I just need to know how to work with Magento's API to insert the Categories into the database correctly. Can anyone point me in the right direction?

Note: I'm using Magento CE 1.6.1.0. Using a plugin won't work in my case, because I need this to happen seamlessly to the user logging into the admin area. If there's a plugin someone knows of that is open source and has the functionality in it that I'm looking for, please share the name so I can study that code.

Thanks for any help!


texts: How to remove customer attributes which are created during install 3rd party extention in magento 2?


texts: Magento 2 - Check if attribute has value

texts:
I try to display two custom attributes in the product view page but this attributes is not exist for all products. How I can check if current product contain one of this two attributes?

I use this code to get the attributes value:

<?php /* @escapeNotVerified */ echo $_product->getResource()->getAttribute('data_sheet')->getFrontend()->getValue($_product); ?>
<?php /* @escapeNotVerified */ echo $_product->getResource()->getAttribute('health_sheet')->getFrontend()->getValue($_product); ?>


texts: magento 1.9: Get order & customer details

texts:
I am creating an extension on sales_order_place_after event observer & I want to get the Order & Customer Details with the following code, but I am not sure how to do this correctly.
config.xml
    <?xml version="1.0"?>
    <config>
        <modules>
            <Avyam_Sms>
                <version>0.0.1</version>
            </Avyam_Sms>
        </modules>
        <global>
            <models>
                <avyam_sms>
                    <class>Avyam_Sms_Model</class>
                </avyam_sms>
            </models>
        </global>
        <global>
            <events>
                <sales_order_place_after><!-- observe the event -->
                    <observers>
                        <avyam_sms>
                            <class>avyam_sms/observer</class>
                            <method>newFunction</method>
                        </avyam_sms>
                    </observers>
                </sales_order_place_after>
            </events>
        </global>
    </config>

Observer.php
    <?php
    class Avyam_Sms_Model_Observer {
        public function newFunction($observer) {
            Mage::log('The Product has been save', null, 'mylogfile.log');
        }
    }?>

Please assist me, thanks in advance.


texts: How sales rule condition validation work in Magento 2?

texts:
Please let me know, In Magento 2 How Sales rule condition validation works with the quote?

Thanks!


texts: Magento front end page characters /**/ at top of page

texts:
On my Magento 1.6.2.0 http://nilandsplace.com I have /**/
loading before page content and some gray space just under the Logo header and behind the menu. I was working on removing a Google Translate floating box that was in the way of my AddThis buttons. Removing the Script did not seem to remove the "Website Translator"
It took a lot of file exploring to finally get it gone from my Magento. I am sure during this effort I introduced the /**/ but I can't remember or find where it is? The View source shows the error:

<!-- END GOOGLE ANALYTICS CODE -->
/*<script type="text/javascript">var Translator = new Translate({"Please use only letters (a-z or A-Z), numbers (0-9) or underscore(_) in this field, first character should be a letter.":"Please use only letters (a-z or A-Z), numbers (0-9) or underscores (_) in this field, first character must be a letter."});</script>*/

It should look like this:

<!-- END GOOGLE ANALYTICS CODE -->
<script type="text/javascript">var Translator = new Translate({"Please use only letters (a-z or A-Z), numbers (0-9) or underscore(_) in this field, first character should be a letter.":"Please use only letters (a-z or A-Z), numbers (0-9) or underscores (_) in this field, first character must be a letter."});</script>

I have downloaded the whole site and database but I can't find /*<script ...</script>*/
I have done file compassion to my local copy made inJuly that does not have the error. I have done many kinds of string searches with no joy.Firebug shows the error, but not were it comes from.
I added some troubleshooting extensions to my Magento only to discover the page is not loading right at all. On my live site I have only 2 layout updates and my local copy has 48. Somehow all the layout updates are merged into to 1 on my live site. I have been trying to learn how a page is loaded in Magento Layout and Template, but can't seem to find who's on first and whats on second. What loads the page and what layout is first? I have looked in /app/design/frontend/... /base, /default, /enterprise and /pro. The last 2 I don't know why they are there for Magento CE.How do I figure what order things load?
Thanks


texts:
I want to print Quote detail's similar to print order from Cart page.

Is it possible to print quote details along with quote item detail and quote amount detail.

Please provide me the logic or code for the same, Thanks in advance !


texts: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: After Updating a Module

texts:
On My site i am running old version of Advanced Product Options Suite Extension for Magento 2 by mageworx. I just updated the Advanced Product Options Suite Extension into latest version. I tired updation with upload Extension files manually also tried update Extension via composer also. On both case after i run bin/magento setup:upgrade command i am getting below error.
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`dqgdqtpdwx`.`#sql-73a8_365`, CONSTRAINT `MAGEWORX_OPTBASE_PRD_ATTRS_PRD_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`product_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE CASCADE)

I tired to check on My Database but i cant found any table or data related to this error. Someone can help me to solve this issue ?


texts: Reindexing error message in Product Flat Data

texts:
I am having the same problem with the error message "cannot initialize the index processor", however that is the only error message I have.  I read some of the answers I do not have very big descriptions for my products, and I only added maybe 5 more attributes to the default set so I do not think that would be too many.   I tried some of the suggestions I have read here, removing files from var/locks but have not been able to fix this problem.
My main question is does this error message affect my website in a bad way or what happens if I just leave it and do nothing?

I am not a programmer so simple answers would help most.

Thank you to all.


texts:
I am using Magento 2 Magefan blog extension. The blog post URL is generated as below.
http://store-url/blog/post/hurry-xmas-with-family
But I want URL as below and it show the content of the above URL
http://store-url/hurry-xmas-with-family
How can this be achieved? Apart from using URL rewrite is there any other method?
I was thinking of creating a custom router but I think it will conflict with CMS router.


texts: How to get active filters in catalog/layer/view.phtml

texts:
I want to get catalog search active filters in catalog/layer/view.phtml.

How to do that?


texts: how to load or add js before require js in magento 2

texts:
I am trying to override default_head_blocks.xml like below

vendor\magento\module-theme\view\frontend\layout\default_head_blocks.xml

<?xml version="1.0"?>
<!--
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1"/>
        <css src="mage/calendar.css"/>
        <script src="requirejs/require.js"/>
    </head>
    <body>
        <referenceContainer name="after.body.start">
            <block class="Magento\Framework\View\Element\Js\Components" name="head.components" as="components" template="Magento_Theme::js/components.phtml" before="-"/>
        </referenceContainer>
    </body>
</page>

app\design\frontend\Enterprise\Orange\Magento_Theme\layout\default_head_blocks.xml

<?xml version="1.0"?>
<!--
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
                <head>
        <meta name="viewport" content="width=device-width, initial-scale=1"/>
                                <link src="js/customercookie.js"/>
                                <link src="js/customercookie.js"/>
                                <link src="Orange_Webform::js/mnpform.js"/>
        <css src="mage/calendar.css"/>
        <css src="common-header/css/custom.css"/>
                                <script src="shm/shm.js"/>
                                <script src="common-header/js/custom.js"/>
        <script src="requirejs/require.js"/>
    </head>
    <body>
        <referenceContainer name="after.body.start">
            <block class="Magento\Framework\View\Element\Js\Components" name="head.components" as="components" template="Magento_Theme::js/components.phtml" before="-"/>
        </referenceContainer>
    </body>
</page>

Just I want to load shm/shm.js before requirejs/require.js

Please do the needfull


texts: How to move correctly block-search and minicart to panel wrapper? Magento 2


texts:
I am trying to print invoice in magento.
I see some wired character in my invoice and my currency symbol in not visible in the invoice.

Also I see a statement (REJACKETED). What is mean by this. Do I need to worry about these ?

Please advice how do I avoid cross symbol in invoice.


texts: Display content between set products on magento 2 category page

texts:
I was wondering if there would be a solution to display blocks, with content i can enter in the backend, between or after a set amount of products. I know i can display some static content at the top of the page, but my client wants it to be between his products.

Any help or tips would be appreciated!


texts: Magento 2: Filter Product Collection by Multiple Categories (Magento 2.1)

texts:
I'm using Magento 2.1.0 and I'm currently having difficulties in filtering product collection with multiple categories. I've used more than a couple of ways to make it work but it won't.

Assuming:

$catalog_ids = [618, 619, 620];

Returns NULL

$productCollection = $this->productCollectionFactory->create()
    ->addAttributeToSelect('*')
    ->addCategoriesFilter(array('in' => $catalog_ids));

Returns exception: Invalid attribute name: category_id

$productCollection = $this->productCollectionFactory->create()
    ->addAttributeToSelect('*')
    ->addAttributeToFilter('category_id', array(
        'finset' => $catalog_ids
    ));

Returns Syntax error or access violation

$productCollection = $this->productCollectionFactory->create()
    ->addAttributeToSelect('*')
    ->addAttributeToFilter('category_ids', array(
        'finset' => $catalog_ids
    ));

Any advice on how I could be able to have this work or have something link this work?


texts: Adding Customer Attribute Value in customer information

texts:
I have a customer attribute named "tescoclubcard_number", the attribute is not displayed in customer model whereas is displayed in collection.

Can anyone please let me know how i can save the customer attribute value. To load the customer data i have done below:

$custData = $order->getData();
$custEmail = $custData['customer_email'];
$customer = Mage::getModel("customer/customer");
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
$data = $customer->loadByEmail($custEmail);

in data i am not getting the attribute "tescoclubcard_number" whereas it is there in collection.

Please let me know how i can save it.

EDIT

Another problem i am facing is, when i store tescoclubcard_number value in session and complete the payment using sagepay server the session values are destroyed. Is there a way to keep sessions in tact and use them on success page?


texts: Magento 2 Session getting reset after placing order

texts:
Can anyone help me with this?

I want some information from the session after order is placed. I tried customer session and even my own new session but after placing order am bot getting anything in session.

I tried to save my custom session on sales_order_save_commit_after but when am trying to fetch this get nothing

Can anyone tell me how we can fetch data from the session after placing an order. I believe everything getting reset.


texts: Magento 2 - creating a Custom Attribute of type Boolean and assigning its default value to all the existing products in the DB

texts:
I have created a custom Attribute for the Product which if type Boolean and set the default value as Yes.

When I try to fetch the newly created attribute through Rest API I am not able to get the attribute field in my response.

However if I update the product through CSV file and hit the API, I am able to get the custom attribute field in the response.

Is there any way where the custom attribute's default value(Yes/No) is applied directly to the products instead of updating through CSV file.


texts: Order beforeSave plugin throws TypeError

texts:
I've built a plugin that catches the order beforeSave event in order to add some extra data to the an order attribute. The problem is that when this plugin fires it causes an error:

Uncaught TypeError: Argument 1 passed to Magento\Sales\Model\OrderRepository::save() must implement interface Magento\Sales\Api\Data\OrderInterface, string given, called in /var/www/html/vendor/magento/framework/Interception/Interceptor.php on line 58 and defined in /var/www/html/vendor/magento/module-sales/Model/OrderRepository.php:156
Stack trace:
#0 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Sales\Model\OrderRepository->save('sales_order', 'order', NULL, NULL, NULL, NULL, Array, NULL, NULL, Array, true, 'order', Object(Magento\Store\Model\StoreManager), Object(Magento\Sales\Model\Order\Config), Object(Magento\Catalog\Model\ProductRepository\Interceptor), Object(Magento\Catalog\Model\ResourceModel\Product\CollectionFactory), Object(Magento\Sales\Model\ResourceModel\Order\Item\CollectionFactory), Object(Magento\Catalog\Model\Product\Visibility), Object(Magento\Sales\Model\Service\InvoiceService), Object(Magento\Directory\Model\CurrencyF"

I've cut down my plugin so it does absolutely nothing other than return the same object in gets at the start and I'm still getting this same issue. For example;

class OrderPlugin
{

protected $_logger;
protected $_orderApi;
protected $_orderAttributeFactory;
protected $_orderExtensionFactory;

public function __construct(\Psr\Log\LoggerInterface $logger, Data $helper, \MyModule\Shipstation\Model\OrderAttributeFactory $orderAttributeFactory, OrderExtensionFactory $orderExtensionFactory)
{
    $this->_logger = $logger;
    $this->helper = $helper;
    $this->_orderAttributeFactory = $orderAttributeFactory;
    $this->_orderExtensionFactory = $orderExtensionFactory;
}

public function beforeSave(\Magento\Sales\Api\OrderRepositoryInterface $subject, \Magento\Sales\Api\Data\OrderInterface $order){

    //$resultOrder = $this->saveFarmisonOrderIDAttribute($resultOrder);

    return $order;

}

my di.xml looks like;

<type name="Magento\Sales\Api\OrderRepositoryInterface">
    <plugin name="MyModule_Shipstation::orderPlugin" type="MyModule\Shipstation\Plugin\OrderPlugin" />
    <plugin name="MyModule_Shipstation::deliverydatePlugin" type="MyModule\Shipstation\Plugin\DeliveryDatePlugin" />
</type>

If I totally comment out my beforeSave method then the save works correctly as expected/


texts: How To Remove Select From Select Language from google translate in magento 2?

texts: i used google translate for change the web site language in that how can remove the select text from select language full text


texts: How to allow Magento to be accessed by anybody in my LAN?

texts:
Im running Magento 2.1.7 on Red Hat Enterprise 7. I have to allow everybody in the LAN to be able to access the website and I have done the following :

in /etc/httpd/conf/httpd.conf , Listen 80 is changed to Listen 8080 and

<Directory />
    AllowOverride none
    Require all granted
</Directory>

as well as

<Directory "/var/www">
    AllowOverride None
    # Allow open access:
    Require all granted
</Directory>

and

<Directory "/var/www/html">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Require all granted
</Directory>

I have looked few of the help available but mostly they are for WAMP. I'm not sure what the differences are because its working on WAMP with these settings. Computers in the same LAN is unable to connect on the LAMP and the Magento backend is inaccessible. It returns a Page not found error.

Please advice on what I can do.


texts:
I have added several cart price rules to magento but every time i enter the code to a shopping cart i get the error that the couponcode is not valid.

How can this be solved?


texts: Using "Product Price" in category view template for calculations

texts:
I need use the (final)product price for calculation purposes on the category page. In the category template file the price is loaded through the method:

<?php echo $this->getPriceHtml($_product, true); ?>

This returns HTML output like: "Your price is: $4,00". I'm using a combination of (normal) prices, special prices and tier prices. What I basically need is the price so I can make calculations with a another attribute.

I've been looking at a solution where I'm extending block functionality to just return the final prices. Until now I've failed to construct something that actually works.

Thanks!


texts: how to modify product price from non logged in user and add in cart

texts:
https://www.mageplaza.com/devdocs/how-to-change-product-price-with-plugin-magento-2.html
i am following this link for modify price but price not change in cart summary .like product price is $50 when i modify price+20 the price will show in cart page $70 but not change in cart summary


texts: Shipping methods like FEDEX/USPS are showing exception"This shipping method is not available. Please specify the zip code."

texts: While working with Magento2 shipping methods like DHL/FEDEX/USPS on checkout its throwing exception "This shipping method is not available. Please specify the zip code."


texts: Programmatically create attribute of type select and options

texts:
I am having following category structure.

Category 1
Category 2
Category 3
    - Category 3.1
        - Category 3.1.1
        - Category 3.1.2
        - Category 3.1.3
        - Category 3.1.4
        - Category 3.1.5
    - Category 3.2
        - Category 3.2.1
        - Category 3.2.2
        - Category 3.2.3
        - Category 3.2.4
        - Category 3.2.5
    - Category 3.3
        - Category 3.3.1
        - Category 3.3.2
        - Category 3.3.3
        - Category 3.3.4
        - Category 3.3.5
Category 4

In my layered navigation I need this as follows:

Category 3.1 (attribute)
    - Category 3.1.1 (options)
    - Category 3.1.2 (options)
    - Category 3.1.3 (options)
    - Category 3.1.4 (options)
    - Category 3.1.5 (options)

Category 3.2 (attribute)
    - Category 3.2.1 (options)
    - Category 3.2.2 (options)
    - Category 3.2.3 (options)
    - Category 3.2.4 (options)
    - Category 3.2.5 (options)

I need to make this dynamically and programmatically.

Please let me know how to achieve this.


texts: Method is being called from the "wrong" class - undefined method error

texts:
I have a CE Magento 1.9 application that is using a custom theme from Trego and a checkout extension from Webtex.  The application was functioning but then after installing the checkout extension, I got the following error when loading the home page:

Fatal error: Call to undefined method Webtex_OnePageCheckout_Helper_Data::isOnepageCheckoutEnabled() in C:\Sites\mycompany\app\code\community\Trego\OnepageCheckout\Block\Links.php on line 6

Line 6 is as follows:

if ($this->helper('onepagecheckout')->isOnepageCheckoutEnabled())

Here's the relevant file, \OnepageCheckout\Block\Links.php:

<?php
class Trego_OnepageCheckout_Block_Links extends Mage_Checkout_Block_Links
{
    public function addCheckoutLink()
    {
        if ($this->helper('onepagecheckout')->isOnepageCheckoutEnabled())
        {
            $parent = $this->getParentBlock();
            if ($parent)
                $parent->addLink($this->helper('onepagecheckout')->__('Checkout'), 'onepagecheckout', $this->helper('onepagecheckout')->__('Checkout'), true, array('_secure'=> true), 60, null, 'class="top-link-checkout"');

            return $this;
        }
        else
            return parent::addCheckoutLink();
    }
}

My question: Why is the application referencing the Webtex_OnePageCheckout_Helper_Data class instead of the Trego_OnepageCheckout_Block_Links class for the isOnepageCheckoutEnabled() method?

Helper snippet from local/Webtex/OnePageCheckout/etc/config.xml:

<helpers>
    <onepagecheckout>
        <class>Webtex_OnePageCheckout_Helper</class>
    </onepagecheckout>
</helpers>

Helper snippet from community/Trego/OnepageCheckout/etc/config.xml:

<helpers>
    <checkout>
        <rewrite>
            <url>Trego_OnepageCheckout_Helper_Url</url>
        </rewrite>
    </checkout>
    <onepagecheckout>
        <class>Trego_OnepageCheckout_Helper</class>
    </onepagecheckout>
</helpers>


texts:
I have set a new view mode on my catalog toolbar and it's work.
But i would like to make it as default list view.
How can I do it?
I try with my local xml adding this:

<catalog_category_default>
    <reference name="product_list_toolbar">
        <action method="setData"><data>_current_grid_mode</data><mode>list</mode></action>
    </reference>
</catalog_category_default>

<catalog_category_layered>
    <reference name="product_list_toolbar">
        <action method="setData"><data>_current_grid_mode</data><mode>list</mode></action>
    </reference>
</catalog_category_layered>

But nothing change!


texts: String in the small description - Luma Theme

texts:
I noticed this string in the small description.
This "nessuno" string is seen only in Italian view while for other views it does not go out.
How can I remove it?
What is this string?


texts: Is it possible to implement "Reviews" 'for the store' instead of 'for products'

texts:
I have recently started to use Magento-CE. I would to implement "Reviews" at the website/store level , not at the product level.
I would like to create a CMS page with the form and the
list of all reviews but don't know what XML code to put there. Could you point me in the right direction?


texts: homepage only loading header and footer?

texts:
I have created a new CMS page called "Homepage" and added some content to it. I have set this new CMS page as the CMS Homepage in Magento 2 admin. but when I go to the base URL I only get the Header and Footer and no homepage content. When I go to baseURL/homepage the content loads fine?

Why is this happening?


texts: Magento2 Custom Observer - Page Creation - getPage() within the observer - is not working for newly created pages

texts:
I have a custom observer to trigger some code when a page is saved/created. It's working great when I save a page - but it cannot see the new page when I create one - it is running the code but the getPage() is not returning a page within the observer.
Should it work that way or have I misunderstood - the code is clearly running the observer but as I say get Page isn't returning the new page?
Here is the events.xml file for the module:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="cms_page_prepare_save">
        <observer name="test_name" instance="BlackRhino\BlackForest\Observer\Pagesaveafter" />
    </event>
</config>

Here is the Pagesaveafter.php
<?php

namespace BlackRhino\BlackForest\Observer;

use Magento\Framework\Event\ObserverInterface;

class Pagesaveafter implements ObserverInterface
{
    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $_page = $observer->getPage();  // you will get page object

        fopen("page-".$_page->getId().".txt","w+");

    }
}

When I create a new page - page-.txt is modified - but when I resave the page - then page-id.txt is created.
Any help would be much appriciated.
Is it because I could be using a better event than "cms_page_prepare_save" - I couldn't see one that stands out on this list: https://meetanshi.com/blog/magento-2-events/


texts: Cron.sh error: PHP Fatal error: Uncaught exception 'Zend_Db_Adapter_Exception' with message 'pdo_mysql extension is not installed'

texts:
The problem occurs in a Magento 1.9.2.4 installation (upgraded from 1.7.2 and then migrated to this new VPS)

Trying to run the cron.sh on a centos VPS (DirectAdmin Controlpanel)

This is returns the following error;

PHP Fatal error:  Uncaught exception 'Zend_Db_Adapter_Exception' with message 'pdo_mysql extension is not installed' in /home/user/domains/domain.com/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php:372
Stack trace:

#0/home/user/domains/domain.com/public_html/lib/Zend/Db/Adapter/Abstract.php(460): Varien_Db_Adapter_Pdo_Mysql->_connect()

#1/home/user/domains/domain.com/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SET NAMES utf8', Array)

#2/home/user/domains/domain.com/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('SET NAMES utf8', Array)

#3/home/user/domains/domain.com/public_html/app/code/core/Mage/Core/Model/Resource.php(179): Varien_Db_Adapter_Pdo_Mysql->query('SET NAMES utf8')

#4/home/user/domains/domain.com/public_html/app/code/core/Mage/Core/Model/Resource.php(110): Mage_Core_Model_Res in /home/user/domains/domain.com/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php on line 372

(same happens with cron.php)

"php -m" is showing PDO /pdo_mysql /pdo_sqlite

Also the modules are showing the phpinfo file

PDO Drivers enabled are mysql, sqlite

Server is running Php 5.6.11 (php-fpm56) & MySQL 5.5.31

i am a bit at a loss here as the extension is installed and from what I understand it should be available for CLI if it shows in php -m?


texts: Magento 2.2.3 hide Sort By Price when customer not logged in

texts:
I am using Magento 2.2.3 and need to hide the Sort By Price on category page in toolbar if the customer is not logged in.

Can someone please elaborate how this can be done.


texts: Composer update fail: [UnexpectedValueException]

texts:
Magento 2 Composer error when trying to install modules [UnexpectedValueException]
https://magento.stackexchange.com/a/316793/70292
During composer update command UnexpectedValueException was occur.
https://prnt.sc/vd2ava
 [UnexpectedValueException]
  RecursiveDirectoryIterator::__construct(MageworxModule/): failed to open dir: No such file or directory

I have tried the above solutions but not works.
I have added 777 permission to app/ pub/ generated/ var/
I have also checked and found that in app/code/MageworxModule module was already available.


texts: Magento 2 How to extend Recently Viewed Products widget

texts:
I want to extend Recently Viewed Products widget so I can add review attribute.
After creating this file: Vendor/MyModule/view/frontend/ui_component/widget_recently_viewed.xml:
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <columns name="widget_columns">
        <column name="review" component="Vendor_MyModule/js/product/review" sortOrder="4" displayArea="details-area">
            <settings>
                <label translate="true">Review</label>
                <bodyTmpl>Vendor_MyModule/product/review</bodyTmpl>
            </settings>
        </column>
    </columns>
</listing>

and clear cache, I got this error in browser console:
Uncaught ReferenceError: Unable to process binding "if: function(){return isMsrpApplicable($row()) }"
Message: isMsrpApplicable is not defined

How to properly extend this widget?


texts: Magento2 : Get Custom Options from Product Id?

texts:
I am trying to get product custom options using next code:

$_objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $_objectManager->get(‘\Magento\Catalog\Model\Product’)->load($id);
$customOptions = $_objectManager->get('Magento\Catalog\Model\Product\Option')->getProductOptionCollection($product);

but its not working for me. It's breaking the page.

Can you please suggest proper solution for it?


texts: Product prize(regular) is showing zero for all products

texts: I'm facing a serious problem. In my website all product prizes are showing zero. I didn't set any special prize or grouped prize in product settings. This is my image which shows like this in 90% of products.Currently I'm using Magento 1.9 version.


texts:
We have tried to add store filter in order list page admin section. But not able to get solution.

How to add store filter in order grid?. Is it possible for this?
Please help.


texts: Good or bad Idea to change magento 2 core files?

texts:
Why is it not recommended to modify the Magento 2 core files?

I'm guessing that when Magento 2 updates it replaces those modified files with the new files so it would be a best practice to create a extension/plugin instead?

Thanks


texts: SQL query: getting customer attributes (M1) - This type of clause was previously parsed

texts:
I'm trying to output customer information:

total sales
number of orders
email
dob
phone
firstname
lastname
country
state
zip code

I am using this to create custom reports using this plugin:
https://www.classyllama.com/blog/magento-reports-clean_sqlreports#report_1

Problem:

I'm getting this error:

This type of clause was previously parsed. (near "LEFT JOIN" at position 970)

My Query:

SELECT
   CONCAT('$', FORMAT(SUM(sales_flat_order.`grand_total`), 2)) AS 'Lifetime Sales',
   COUNT(sales_flat_order.entity_id) AS 'Orders',
   customer_entity.email AS 'Email',
   customer_entity_datetime.value AS 'DOB',
   customer_address_entity_varchar.value as 'PHONE',
   customer_address_entity_varchar.value as 'FIRSTNAME'

FROM `customer_entity`

LEFT JOIN sales_flat_order ON customer_entity.entity_id = sales_flat_order.customer_id

-- ADD DOB (customer_entity_datetime)
LEFT JOIN customer_entity_datetime dob ON customer_entity.entity_id = customer_entity_datetime.entity_id

-- ADD TELEPHONE (customer_address_entity_varchar)
LEFT JOIN customer_address_entity_varchar phone ON customer_address_entity_varchar.entity_id = customer_entity.entity_id
JOIN eav_attribute on eav_attribute.attribute_code="telephone"
WHERE customer_address_entity_varchar.attribute_id = eav_attribute.attribute_id

-- ADD FISTNAME(customer_address_entity_varchar)
LEFT JOIN customer_address_entity_varchar firstname ON customer_address_entity_varchar.entity_id = customer_entity.entity_id
JOIN eav_attribute on eav_attribute.attribute_code="firstname"
WHERE customer_address_entity_varchar.attribute_id = eav_attribute.attribute_id

-- GROUP + SORT
GROUP BY customer_entity.entity_id
ORDER BY SUM(sales_flat_order.`grand_total`) DESC LIMIT 500

I'm very rusty with SQL, I'm not sure how to do multiple LEFT JOINs. The problem here is that I will need to keep hitting the same table customer_address_entity_varchar for address information.

Any ideas?

UPDATE:

Here is the full query that I used after @kiatng answered the post. I reordered the list items and removed orders that were canceled or closed. Also added USA / CAD difference so you could separate reports into countries.

SELECT

   a.firstname as 'FIRST NAME',
   a.lastname as 'LAST NAME',
   o.customer_email AS 'Email',
   o.customer_dob AS 'DOB',
   a.telephone as 'PHONE',
   a.country_id as 'Country',
   a.region as 'State',
   a.postcode as 'ZIP',
   FORMAT(SUM(o.`grand_total`), 2) AS 'Lifetime Sales',
   COUNT(o.entity_id) AS 'Orders'

FROM `sales_flat_order` o
LEFT JOIN `sales_flat_order_address` a
ON a.parent_id = o.entity_id
WHERE o.status !="canceled" AND o.status !="closed" AND o.store_currency_code ="USD"

-- GROUP + SORT
GROUP BY o.customer_id,o.customer_email,o.customer_dob,a.telephone,a.postcode,a.country_id,a.region,a.firstname, a.lastname
ORDER BY SUM(o.`grand_total`) DESC
LIMIT 500


texts: Scroll to Top after Adding Product to Cart?

texts:
I'd like the user to be scrolled to the top of the product page upon successfully adding a product to their cart, so that they can see the success message.

What would be the best way to accomplish this?


texts:
Hey i want to add new field in magento product form, that will be passed and displayed in order (for every single product) and for client on cart/checkout page.
I've created observer in own plugin to display custom message following that's topic: Add custom text to each product in cart - Magento 1.9X
I want to add now input field in "Add to cart" form, where client can add custom message. That's i understand i need to create some event, but i don't know how.
Thanks for help.


texts:
I set a session using Mage::getSingleton("core/session")->setCustomPriceValue($myvalue); in my frontend phtml file.

To get the value I called Mage::getSingleton("core/session")->getCustomPriceValue(); in one of my block, Mage_Adminhtml_Block_Sales_Order_Create_Totals_Shipping...

But I cant get the value there.

I tried with Mage::getSingleton("adminhtml/session") too. But it also fails! :(

Can someone point out why?


texts: How to restore items' Qtys for canceled orders

texts:
If an order is being canceled, its items should be restored into the inventory. How can this be implemented?

Thanks


texts: How to pass current value of Ui form field in js file

texts:
I want to pass the value of checkbox in custom js file, I am using UI component to create a chechbox.
So I have to pass this value to js file and then use that value in Model.
I am not able to pass the value
<field name="is_new_category_allowed">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="label" xsi:type="string">Do you want to create new Category</item>
                    <item name="visible" xsi:type="boolean">true</item>
                    <item name="formElement" xsi:type="string">checkbox</item>
                    <item name="valueMap" xsi:type="array">
                        <item name="true" xsi:type="number">1</item>
                        <item name="false" xsi:type="number">0</item>
                    </item>
                    <item name="validation" xsi:type="array">
                        <item name="required-entry" xsi:type="boolean">true</item>
                    </item>
                </item>
            </argument>
        </field>


texts: How are strings replaced with variables from tables?

texts: For example, an extension would have this: Variable {day} will be replaced with the estimated delivery value from the corresponding CSV column under an input field.  I understand that it probably works in a similar way as translations, but how exactly can I replace {day} with a variable from a table in database?


texts: Error while upgrading from 2.3.3 to 2.3.4

texts:
After typing below in CLI I ran composer update.

composer require magento/product-community-edition 2.3.4 --no-update

Loading composer repositories with package information
Updating dependencies (including require-dev)
The "http://repo.packagist.org/p/zendframework/zend-barcode%24ddcc1cb490598ed29ea4ff3bb37037db35d582ff2b08a096bef4c88dd8e572e5.json" file could not be downloaded: failed to open stream: Connection refused
http://repo.packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - friendsofphp/php-cs-fixer v2.10.5 requires php ^5.6 || >=7.0 <7.3 -> your PHP version (7.3.12) does not satisfy that requirement.
    - friendsofphp/php-cs-fixer v2.10.4 requires php ^5.6 || >=7.0 <7.3 -> your PHP version (7.3.12) does not satisfy that requirement.
    - friendsofphp/php-cs-fixer v2.10.3 requires php ^5.6 || >=7.0 <7.3 -> your PHP version (7.3.12) does not satisfy that requirement.
    - friendsofphp/php-cs-fixer v2.10.2 requires php ^5.6 || >=7.0 <7.3 -> your PHP version (7.3.12) does not satisfy that requirement.
    - friendsofphp/php-cs-fixer v2.10.1 requires php ^5.6 || >=7.0 <7.3 -> your PHP version (7.3.12) does not satisfy that requirement.
    - friendsofphp/php-cs-fixer v2.10.5 requires php ^5.6 || >=7.0 <7.3 -> your PHP version (7.3.12) does not satisfy that requirement.
    - Installation request for friendsofphp/php-cs-fixer ~2.10.1 -> satisfiable by friendsofphp/php-cs-fixer[v2.10.1, v2.10.2, v2.10.3, v2.10.4, v2.10.5].


texts: How to add serial number column in magento sales report grid

texts:
I have to show Sr.No column in magento sales report grid

Now my report grid is like

I have to show Sr.No depend on PO.No like below(PO number showing 4 times means it have 4 product in that order)

Please let me know how to do this?


texts: How to call Purchase Order Number payment method in another place?

texts:
Can we call Purchase Order Number payment method display on one-page checkout above of "REVIEW YOUR ORDER" table?

<?php echo $this->getChildHtml('purchase_order'); ?>


texts: magento coupon code is behaving strangely?

texts:
we are using coupon codes to give discount for customers.

we created coupon code with 50 $ discount for orders with amount less than 500 $

but when one customer buy one product and when he applied that coupon code, he get  "50 $" discount. that's fine

but when we buy 2 products , he will get less than "50 $" discount.

sometimes 26, 34, 48 $ ...etc.

any idea on what's wrong?


texts: how i can get parameter value in plugin into magento 2 observer

texts:
i have plugin for customer account create

public function aroundExecute(
        \Magento\Customer\Controller\Account\Create $subject,
        \Closure $proceed
    )
    {
        $getid = $subject->getRequest()->getParam('param_id');

        return $proceed();
    }

the URL

http://localhost/magento/customer/account/create/?param_id=20

  I'm getting the value 20 in that plugin

  I want to pass the value to customer registration success observer

  how i can do this????


texts: Magento: Change the order of “Additional Information” attributes

texts:
Is there a way to change the order of the attributes displayed on the Product View Page under the "Additional Information" section?

I find that every time I select an attribute to be displayed on the Product View Page, it gets added to the bottom of the list.

Thanks for the help!


texts:
I'm using magento 2.4.0 and trying to get information about products cross-sell by product id but I see some error in magento.
getById causes my browser to crash, some very large object loading there
$this->productRepositoryInterface->getById ($productId)
I saw that it worked in previous magento versions, does anyone know how to fix it or when there will be improvements in magento?
My code:
 public function getCrosssellProductsList($productId)
    {
        $crossSellProduct = [];
        try {
            $product = $this->productRepositoryInterface->getById($productId);
            $crossSell = $product->getCrossSellProducts();

            if (count($crossSell)) {
                foreach ($crossSell as $productItem) {
                    $crossSellProduct[] = $productItem->getId();
                }
            }
        } catch (\Exception $exception) {
            $this->logger->error($exception->getMessage());
        }

        return $crossSellProduct;
    }


texts: Issue in saving Category images in fresh installed Magento 2.3

texts:
I'm facing issue in saving category Images in default setup of Magento 2.3.

I've not made any customization and didn't install any custom extension. I got this error:

  A technical problem with the server created an error. Try again to continue what you were doing. If the problem persists, try again later.

Kindly help me.


texts:
I have no clue how to modify files in magento. I found some php files to create order in magento programatically but i have no clue where to place these files to make them run.
I am pitty confuse by the architecture of magento. Please help me with that?


texts: How to auto populate city and state on checkout page while entered the pincode in magento 2?

texts:
Hello Folks,
I am new in Magento 2, I am adding some custum code for changes on checkout page to auto populate the city and state while entered the pincode.
Can you help me which js file should I change to override the data.


texts:
In magento I have two built in packages RWD and Default. I've noticed that RWD has a folder called scss and the Default package doesn't.
Whats the difference in the two packages ?
I found a video that looks at the Default package which copies the css and images into another theme directory and edits the files. Is this the correct way for the default package?


texts: Running 2.2.7 Community Edition all my emails, besides new account, are being sent by my sever user user@server.domain.com instead of what I have set in email address configuration. This issue appeared without changing any email settings that I know of. Possibly after an update though? Maybe I'm missing a setting?


texts: Magento 2 REST API: Show In-stock products first in product listing API

texts:
I am looking into a headless magento approach. I am using the following API to list the products in a given category:

  V1/products?searchCriteria[filter_groups][0][filters][0][field]=category_id&searchCriteria[filter_groups][0][filters][0][value]=:category_id

I need to sort these results, so the In-stock products come first, then are followed by the out of stock ones.

I have also managed to add their stock status in extension_attributes as follows:

"extension_attributes": {
            "qty": "Out of Stock"
  }

Any suggestions on how I can achieve this?


texts:
I have created a custom module which shows some custom product listing and banner data. I have created a system setting to set those things in homepage or use default one. Now what i want if admin select use custom module homepage then existing content will be unset or remove and new content will be shown. below is my cms_index_index code. which insert that block in cms page content area and things come up but how can i remove existing content before showing those things.

<?xml version="1.0"?>
<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

    <body>

        <referenceContainer name="content">
            <block class="Hello\Pageconfig\Block\Pageconfig" ifconfig="pageconfig/settings/use" name="hello.configured.homepage"/>
        </referenceContainer>
    </body>
</page>


texts: Magento : Assigning products to (new) websites programmatically do I need to run an index and which one?

texts:
In Magento When assigning products to (new) websites programmatically do I need to run an index and which one?
When using
Mage::getModel('catalog/product_website')->addProducts(array($set_to_store_id), $product->getId());

Can I then programmatically trigger an index? (for the current $product)

And if I would want to do it in the backend which index is it?