texts: grid joinTable alias problem in order by

texts:
I made in customers admin grid a join with sales_flat_order table:

protected function _preparePage()
{
    $this->getCollection()->joinTable('sales_flat_order',
                                        'customer_id = entity_id',
                                        array('ordered' => new Zend_Db_Expr('SUM(subtotal_invoiced)'),),
                                        null,
                                        'left');
    $this->getCollection()->getSelect()->group('entity_id');
    return parent::_preparePage();
}

protected function _prepareColumns()
{
    $this->addColumnAfter('ordered', array(
        'header'    => Mage::helper('customer')->__('Ordered'),
        'index'     => 'ordered',
    ),'name');
    return parent::_prepareColumns();
}

It works fine, until I try to use sort by field ordered. Magento put into query

ORDER BY sales_flat_order.SUM(subtotal_invoiced)

and this produces SQL error

FUNCTION sales_flat_order.SUM does not exist.

How can I remove sales_flat_order from ORDER BY so it would be just ORDER BY SUM(subtotal_invoiced)? In select it doesn't put that, it stays SUM(subtotal_invoiced) AS ordered, I don't know why it put in ORDER BY this.


texts:
Is there away i can delete all product or at least find them in the backend interface ?

There must be away to export products with no images in dataflow and then import them back in but this time delete entries ?

Thank you


texts: Is there a way to check whether a GUEST customer has subscribed to newsletter, in that particular session?

texts:
I have to hide the newsletter subscription form from customers who already subscribed.

For registered and loggedin customer i'm able to check the subscription status using the following method:

$customerSession = Mage::getSingleton("customer/session");
$email = $customerSession->getCustomer()->getEmail();
$subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
    $status = $subscriber->isSubscribed(); // status = 1 if subscribed.

But I want to hide it for guest customers also (obviously for that particular session alone).

How could I do that?
Can anyone help?


texts: Translating js notifications to other languages

texts:
There are some javascript messages in the file vendor/magento/module-ui/view/base/web/js/lib/validation/rules.js.

Like the message Minimum length of this field must be equal or greater than 8 symbols. when the customer sets password during registration.

I need to translate all such messages to Persian.

How can I do that?

Edit 1

My csv file

"Minimum length of this field must be equal or greater than %1 symbols.","ﺡﺩﺎﻘﻟ ﻁﻮﻟ ﺮﻣﺯ ﻊﺑﻭﺭ %1 کﺍﺭﺍکﺕﺭ ﺎﻧگﻝیﺱی ﺏﺯﺭگ ﻭ کﻭچک ﻭ ﺱیﻢﺒﻟ ﻡی ﺏﺎﺷﺩ"


texts: Requesting controller action via Curl request

texts:
I am sending a CURL request to a controller action and construct() function is working(calling) but it doesn't call the execute() function of the controller.

For now, I am calling the execute() function within the construct() myself as below. Also, let me know if it is not a recommended way.

public function __construct(
    \Magento\Framework\App\Action\Context $context,
    \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
) {
    parent::__construct($context);
    $this->resultJsonFactory = $resultJsonFactory;
    $this->execute();
}

Any help will be appreciated. Thanks in Advance :)


texts: How do you manage installation of paid modules with composer?

texts:
We are using a popular magento module for payment gateway and when we wanted to install it on a magento2 project we received the module as a zip file.

When I asked about a composer package they replied that being a paid module you cannot install it via composer.

Is there no way to manage paid modules via composer in magento2 marketplace?


texts: Remove 'Print Shipping Labels' action from Sales/Shipments Grid

texts:
I am trying to remove the 'Print Shipping Labels' mass action from the Sales->Shipments grid in the admin area. This grid is setup as a UI component. I have created the following blank file inside my custom extension:

app/code/Vendor/ExtensionName/view/adminhtml/ui_component/sales_order_shipment_grid.xml

I cant work out what XML is needed to remove the action. Does anyone know if its possible to remove a mass action from a uicomponent grid using XML?


texts: How to exclude an item from the best-sellers magento

texts: I have a free gift item but it gets into the best sellers category. is there an easy way to exclude it for getting into the best sellers?


texts: Magento 2 - Deploying local to live, why rsync doesn't work

texts:
I've recently deployed a magento 2 from local to live environment, local was working fine and everything was running smoothly. I've also enabled production mode, but i've not turned on css or js compression.

When i did an rsync from my local machine to the live box, the build stopped working, I had to run the:

bin/magento

Command on the live server, to recompile the theme by doing a static content deploy:

bin/magento setup:static-content:deploy

Before this the theme doesn't work, after works fine.

What's changing from rsyncing the files to the server, why can't i run it on a build server and sync it. Sorry for the so many 'whys?' but i'd like to understand how to do it without running any commands on the server. Or is this not possible?

Thanks.


texts: Customer redirected to login page after successful login

texts:
I'm having the following problem: the customer logs in, is redirected to main page, but gets redirected back to login page. There is no error message.

On failed login with wrong credentials there is an error message displayed.

Login to admin works ok.

EDIT: this seems to be related to the website restrictions funtionality (Magento EE)

EDIT2: It is not the form key issue. Looks like that Magento does not recognise that the customer is logged in. If the website restrictions is disabled, the login appears to work (no error message, user redirected to front page, as should), but actually does not: the user simply in not logged in, login link is displayed etc.


texts:
I want to add in some coupon codes, but all the online tutorials talk about this Promotions tab in the menu which I do not have.

I am using Magento 1.9.3.1

I am also the admin with full rights.

Edit - Additional image


texts: RequireJS module - abstract dependency injection in Magento 2

texts: I am searching for a way to extend a JS file which is used as dependency in other JS files for the whole project. The file in use is Magento_Ui/js/form/element/abstract and I need to replace it with new file Custom_Ui/js/form/element/abstract and then enforce that every other file to use my new file instead of the original one. Only other files, because my new file will extend the original abstract file. Is that possible? So in practice I need to replace abstract algorithms for the Magento form UI element and make it in the most portable and stable way.


texts:
I want to add field sort order in admin grid and in frontend part (sort by). I make module "news" and want to sort my news by title.

Please guide me how to do it

protected function _prepareCollection()
{
    $collection = Mage::getModel('mdnews/news')->getCollection();
    $this->setCollection($collection);
    return parent::_prepareCollection();
}
protected function _prepareColumns()
{
    $helper = Mage::helper('mdnews');

    $this->addColumn('news_id', array(
    'header' => $helper->__('News ID'),
    'index' => 'news_id',
    'width' => '100px',
    ));

   $this->addColumn('title', array(
    'header' => $helper->__('Title'),
    'index' => 'title',
    'type' => 'text',
   ));

   $this->addColumn('category', array(
    'header' => $helper->__('Category'),
    'index' => 'category_id',
    'options' => $helper->getCategoriesList(),
    'type'  => 'options',
    'width' => '150px',
   ));

   $this->addColumn('created', array(
    'header' => $helper->__('Created'),
    'index' => 'created',
    'type' => 'date',
   ));

   return parent::_prepareColumns();
}


texts:
I have a requirement of a client to add an employee pin prior to processing a credit card payment via the admin order screen.

Validating the pin isn't an issue but I am having a hard time figuring out how to utilize my custom form instead of the default magento cc-form with the Magento 2 xml and template system on the admin side.

Any assistance or example that overrides the standard cc-form in the administration order section would be greatly appreciated.

In Magento 1.x I would set a custom form template for the admin via:

class Packagename_Modulename_Block_Form_Customform extends Mage_Payment_Block_Form
{
    protected function _construct()
    {
        parent::_construct();
        $this->setTemplate('somefolder/form/customform.phtml');
    }
}


texts: How to patch Magento 2 Information Leakage scan result?

texts:
I scanned the Magento 2 site from the official magento scanner and here's the result.

Any ideas on how and what specific patch to apply for this one?

Thanks!


texts: Magento 2.2.5 - what are the mysql tables where shipping and billing address is stored?

texts: I want to know the name of the tables where the Shipping and Billing addresses are stored in Magento 2.2.5 for the registered customers


texts:
I came across a free extension recently that created a small "locate" menu item in the admin menu bar. When clicked it would popup a small auto-complete textbox allowing you to find and navigate to admin sections quickly.

I can't remember bookmarking it, and I've tried searching for it but to no avail. Has anyone heard of this extension?


texts:
I have added a mass action to Sales->Invoice Grid. It is working fine when I select a single item from the grid. But on multiple selects it throws the following error:

  Fatal error: Uncaught TypeError: Argument 1 passed to Magento\Sales\Model\Order\Invoice\Item::setOrderItem() must be an instance of Magento\Sales\Model\Order\Item, null given, called in /var/www/html/magento/vendor/magento/module-sales/Model/ResourceModel/Order/Invoice/Relation.php on line 54 and defined in /var/www/html/magento/vendor/magento/module-sales/Model/Order/Invoice/Item.php on line 129

Here is the mass action controller:

    <?php

namespace Vendor\MassActionCancel\Controller\Adminhtml\Invoice;

use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection;
use Magento\Backend\App\Action\Context;
use Magento\Ui\Component\MassAction\Filter;
use Magento\Sales\Model\ResourceModel\Order\CollectionFactory;
use Magento\Sales\Api\OrderManagementInterface;

class CancelInvoice extends \Magento\Sales\Controller\Adminhtml\Order\AbstractMassAction
{

    protected $orderManagement;

    public function __construct(
        Context $context,
        Filter $filter,
        CollectionFactory $collectionFactory,
        OrderManagementInterface $orderManagement,
        \Magento\Framework\App\RequestInterface $request,
        \Magento\Sales\Model\Order\Invoice $invoiceModel,
        \Magento\Framework\Message\ManagerInterface $messageManager
    ) {
        parent::__construct($context, $filter);
        $this->collectionFactory = $collectionFactory;
        $this->orderManagement = $orderManagement;
        $this->request = $request;
        $this->invoiceModel = $invoiceModel;
        $this->messageManager = $messageManager;
    }

    protected function massAction(AbstractCollection $collection)
    {
        $invoice_not_canceled = array();
        $invoice_canceled = array();
        $itemsArray = $this->request->getPostValue('selected');
        foreach ($itemsArray as $key => $invoiceId) {
            $invoice = $this->invoiceModel->load($invoiceId);
            if(!$invoice->isCanceled()){
                $invoice->cancel();
                $invoice->setState(\Magento\Sales\Model\Order\Invoice::STATE_CANCELED);
                $invoice->save();
                $invoice_canceled[] = $invoiceId;
            }
            else{
                $invoice_not_canceled[] = $invoiceId;
            }
        }
        if(!empty($invoice_not_canceled)){
            $this->messageManager->addSuccess(__('Following Invoices could not be canceled: '.implode(',', $invoice_not_canceled)));
        }
        if(!empty($invoice_canceled)){
            $this->messageManager->addSuccess(__('Following Invoices canceled: '.implode(',', $invoice_canceled)));
        }
        return $this->resultRedirectFactory->create()->setPath('sales/invoice/');
    }
}

It is called when save() method is called for the second item. Also the error is not thrown always but at random times.


texts:
I have used the below script for my database creation in magento2. The file location is app\code\Ingram\Webshop\sql\webshop_setup\mysql4-install-1.0.0.php

<?php
$installer = $this;
$installer->startSetup();
$installer->run(“
CREATE TABLE `reseller_authentication` ( `r_id` INT NOT NULL AUTO_INCREMENT , `App_id` VARCHAR(255) NOT NULL , `Reseller_id` VARCHAR(255) NOT NULL , `Secret_key` VARCHAR(255) NOT NULL , `created_time` DATETIME NOT NULL , `update_time` DATETIME NOT NULL , PRIMARY KEY (`r_id`)) ENGINE = InnoDB;
“);
$installer->endSetup();

and my config.xml file is

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd">
     <default>
        <webshop>
            <module>
                <is_enabled>1.0.0</is_enabled>
            </module>
        </webshop>
    </default>
    <global>
        <models>
            <Webshop>
                <class>Ingram_Webshop_Model</class>
                <resourceModel>Webshop_mysql4</resourceModel>
            </Webshop>
            <Webshop_mysql4>
                <class>Ingram_Webshop_Model_Mysql4</class>
                <entities>
                    <Webshop>

Webshop_Reseller_Authentication

                    </Webshop>
                </entities>
            </Webshop_mysql4>
        </models>
    </global>
</config>

Then i have run the command php bin\magento setup:upgrade in command prompt. But I not getting table created at the magento database. I would be really helpful if anybody giving suggestion on this!


texts:
I have in my CustomTheme a default.xml file. I tried to get the xml to work and used some of the samples I found here on StackExchange. Non of them are working for me?
So apparently I have done something wrong or something else is interfering the xml file to be applied.

My default.xml resides in:

app/design/frontend///Magento_Theme/layout/default.xml

I cleared all cache, static files, the files in the /var and run setup:static-content:deploy

But nothing appears!

I tried several things like removing the footer links, and moving the shopping card like in this post:Magento 2 Block/Element order   This is my latest trial default.xml the block is prepared in the cms_block.
Using Magento 2.1.2

<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
 * 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">
    <body>
        <referenceBlock name="footer">
            <block class="Magento\Cms\Block\Block" name="footer_social_links_block">
            <arguments>
                <argument name="block_id" xsi:type="string" translate="true">dth_footer_social_links</argument>
            </arguments>
            </block>
        </referenceBlock>
 </body>
</page>


texts: Why are my Magento Model and Helper overrides not being run?

texts:
I'm trying to override the core Magento class Mage_Payment_Model_Info in order to solve an error.

To be clear, the override I am talking about has been entirely written by me, and is extending a core Magento model class.  The override is not showing up in the stack trace generated by the error, the core version is. A list of solutions I have tried so far is as follows. None have been fully successful.

Successfully able to override a block that is also part of this process and that override appears in the stack trace.
Checked for any conflicts.  I found some but when I changed my override extends so it extends from the potential conflict class it has no effect.
Made the code in my override very similar to the original so I know it is not a result of the code I have changed.
Added log statements to both my override and the original so I can confirm which version is being run.
The code for the override is as follows:

class Work_Rewrites_Model_Payment_Info extends Mage_Payment_Model_Info {
    public function getMethodInstance()
    {
        Mage::log("In rewrite payment info model");
        if (!$this->hasMethodInstance()) {
            if ($this->getMethod()) {
                $instance = Mage::helper('payment')->getMethodInstance($this->getMethod());
                if ($instance) {
                    $instance->setInfoInstance($this);
                    $this->setMethodInstance($instance);
                    return $instance;
                }
            }
            //return false;
            Mage::throwException(Mage::helper('payment')->__('The requested Payment Method is not available.'));
        }

        return $this->_getData('method_instance');
    }
}

Revlevant code from the config file is as follows:

    <config>
        <global>
            <models>
                <rewrites>
                    <class>Work_Rewrites_Model</class>
                </rewrites>
                <payment>
                    <rewrite>
                        <info>Work_Rewrites_Model_Payment_Info</info>
                    </rewrite>
                </payment>
            <models>
        <global>
    <config>

Thanks for your help


texts: Everyday at the same time my website goes down for a few minutes

texts:
It gets put into maintenance mode. It has to be some type of job or module conflict or huge mysql query. I looked and there were no cron jobs running at that time. My new relic instance is saying that this are the process hogs at the time of outage.

Breakdown table
Category    Segment % Time  Avg calls
(per txn)   Avg
time (ms)
WebTransaction  /pagecache/request/process  77.0    1.0 352
Database    Redis hget  11.8    54.6    54.4
Database    MySQL core_session update   2.8 0.533   12.7
Database    MySQL core_session insert   2.5 0.467   11.6
Database    MySQL other 0.8 3.0 3.7
Database    MySQL log_url insert    0.5 1.0 2.34
Database    Redis connect   0.5 2.0 2.14
Database    MySQL sales_flat_quote select   0.5 2.18    2.07

my reports say it's a module:

a:3:{i:0;s:0:"";i:1;s:1526:"#0 /var/www/mine/releases/20170630191905/app/code/core/Mage/Core/Model/App.php(848): Mage_Core_Model_App->throwStoreException()
#1 /var/www/mine/releases/20170630191905/app/Mage.php(353): Mage_Core_Model_App->getStore(NULL)
#2 /var/www/mine/releases/20170630191905/app/code/community/Aoe/Scheduler/Helper/Data.php(281): Mage::getStoreConfig('system/cron/err...')
#3 /var/www/mine/releases/20170630191905/app/code/community/Aoe/Scheduler/Model/Schedule.php(260): Aoe_Scheduler_Helper_Data->sendErrorMail(Object(Aoe_Scheduler_Model_Schedule), 'exception 'Mage...')
#4 /var/www/mine/releases/20170630191905/app/code/community/Aoe/Scheduler/Model/Schedule.php(605): Aoe_Scheduler_Model_Schedule->runNow(true)
#5 /var/www/mine/releases/20170630191905/app/code/community/Aoe/Scheduler/Model/Observer.php(39): Aoe_Scheduler_Model_Schedule->process()
#6 /var/www/mine/releases/20170630191905/app/code/core/Mage/Core/Model/App.php(1358): Aoe_Scheduler_Model_Observer->dispatch(Object(Varien_Event_Observer))
#7 /var/www/mine/releases/20170630191905/app/code/core/Mage/Core/Model/App.php(1337): Mage_Core_Model_App->_callObserverMethod(Object(Aoe_Scheduler_Model_Observer), 'dispatch', Object(Varien_Event_Observer))
#8 /var/www/mine/releases/20170630191905/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('default', Array)
#9 /var/www/mine/releases/20170630191905/cron.php(78): Mage::dispatchEvent('default')

I did recently truncate the log visitor url table and it seemed to shorten the outages. But based on the above stuff it appears there's a lot more going wrong with the DB and or the AOE module.

I know i'm not providing a whole lot of information but if anyone has any ideas please. Thanks in advance.

Data.php line 281

public function sendErrorMail(Aoe_Scheduler_Model_Schedule $schedule, $error)
{
    if (!Mage::getStoreConfig(self::XML_PATH_EMAIL_RECIPIENT)) {
        return;
    }

schedule.php line 260

    Mage::helper('aoe_scheduler')->sendErrorMail($this, $e->__toString());

schedule.php line 605

public function process()
{
    if (!$this->canRun(false)) {
        return $this;
    }
    $this->runNow(!$this->isAlwaysTask());
    return $this;
}


texts: Magento 2: How can we migration only customers and orders data using Data Migration tool?

texts:
In my current Magento 2 instance I have added products and categories manually as well as all the settings.

Is it possible to migrate only orders and customers data from my old site using Data Migration tool?


texts: How to add Simple product with custom options to cart?

texts:
I have a simple product with custom options. After popup, I select custom options of this product, and click add to cart.

I get params like that: product=167&options%5B4%5D=10&qty=1.

Now I want to add product to cart programmatically, how can I do it?


texts: Magento 1.9 Suddenly will not accept an SKU starting with a letter

texts:
I'm currently running a staging copy of a live Magento 1.9 site. On this staging site I have noticed that if I attempt to add a new product with an SKU that begins with a letter (character between A-Z) (e.g. HOS2019), I get an error of

  Please enter a valid number in this field.

If I begin the SKU with a number, the product is accepted and saved with no issue.

The live copy of this site accepts a product a letter at the beginning of the SKU with no issue, so I know something is not quite right with this staging copy of the site.

I was just wondering if anyone had ever come across a problem such as this, and what code I could possibly look at to try and resolve this - or indeed what code I could compare with the live version of this site to try and find the fault.

Many thanks for any light anyone can shed on this.


texts: M1.9: Create new Admin theme which will fallback to already created custom admin theme

texts:
I already have custom Admin theme app/design/adminhtml/default/mycustom created and in use. But now, for some stores, I want to use another Admin theme, which will fallback to mycustom theme. I already tried defining parent theme in etc/theme.xml, but it seems like it's not working:

<theme>
    <parent>default/mycustom</parent>
</theme>

This is my theme.xml file:

<?xml version="1.0"?>
<!--
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magento.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magento.com for more information.
 *
 * @category    design
 * @package     default_default
 * @copyright   Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
-->
<theme>
    <parent>default/custom_backend</parent>
</theme>

Is it possible? I know that in Magento 2 it is, but I need it for Magento 1.9.


texts: How to Hide Cash On Delivery In OneStepCheckout On base of Shipping Postal Code

texts:
I want to hide Cash On Delivery On base Of Shipping Postal Code....
I m Using One OneStepCheckout....
I used Payment Observer

    <events>
        <payment_method_is_active>
            <observers>
                <paymentfilter_payment_method_is_active>
                <type>singleton</type>
                <class>checkdelivery/observer</class>
                <method>filterpaymentmethod</method>
                </paymentfilter_payment_method_is_active>
            </observers>
        </payment_method_is_active>
        </events>

Code
----------------
 public function filterpaymentmethod(Varien_Event_Observer $observer) {
         if($observer->getEvent()->getQuote() && ($observer->getEvent()->getQuote()->getId())):
        /* call get payment method */
        $quote = $observer->getData('quote');
        $method = $observer->getData('result');
        $methodInstance = $observer->getData('method_instance');
        $checkout = Mage::getSingleton('checkout/session')->getQuote();
        $billAddress = $checkout->getBillingAddress();
        $pindata = Mage::getStoreConfig('checkdelivery/general/pincode');
        $pincodearray = explode(",", $pindata);
        $trimedZip = $billAddress->getPostcode();
        $cartItems = $checkout->getAllItems();

        //$totalCartItem = Mage::helper('checkout/cart')->getItemsCount();
        //$condition = array();
        if ($methodInstance->getCode() == 'cashondelivery') { //if method is cache on delivery
                if (!in_array($trimedZip, $pincodearray)) {//if  post pin not matched to given pin
                    $method->isAvailable = false;
                }
            }
    return;
        endif;

    }

It s Hide Payment Method ..When OneStepCheckout Is Loading....
But Here One Step checkout Is Updating Every Time When You Change Pin....
Its Uses Ajax...
Basically I want to hide COD...In One Step....
So Finally I Want Rewrite Model Of Payment Method....
I want To know that which Model Have All Details Of Payment Method....
How to Do this.....


texts:
SUPEE-6788 Technical details says that APPSEC-1063 issues should be resolved following way:

$collection->addFieldToFilter('(field1-field2)', array('eq'=>3));

Should be changed to:

$expression = '(field1-field2)';
$condition = $this->_getConditionSql($expression, array('eq'=>3));
$this->_select->where(condition);

Say we have situation:

$collection->addFieldToFilter('(qty_shipped - qty_returned)', array("gt" => 0));

The proposed change doesn't make sense to me, since the object $collection is not involved. What is proper way to modify/fix this issue?


texts: Extending (rewriting) both a model/abstract and model/observer in the same config

texts:
I'm trying to extend locally a community extension's Model/Abstract.php and Model/Observer.php at the same time.

The logs show that with the below local configuration the local observer and community abstract are used. How to change it so the local one is used in both cases?

<global>
    <models>
        <Compasser_Diogenes_page>
            <rewrite>
                <abstract>Kaska_Diogenesext_Model_Abstract</abstract>
            </rewrite>
            <rewrite>
                <observer>Kaska_Diogenesext_Model_Observer</observer>
            </rewrite>
        </Compasser_Diogenes_page>
    </models>


texts: Magento2 : Retrieve Multiselect Values in system.xml

texts: I have created a system.xml file with a multiselect type field somewhere in my admin system config. I just want to know on how to retrieve the selected values in that field?


texts: "Go To Shopping Cart" opens in a new window

texts:
After selecting an item in the store, it gives two options: "continue shopping" or "Go To Shopping Cart". If I select the "Go To Shopping Cart", it opens in a new window. How can I fix it? I need it to stay in the same window and just open new page.
Thanks


texts: Adding products with same configurable attributes to cart

texts:
I am trying to add products with identical configurable attributes, but with different values of a custom option

<input class="swatch-input" name="super_attribute[left][151]" value="" data-validate="{required:true}" aria-required="true" aria-invalid="true" style="visibility: hidden; position:absolute; left:-1000px">
<input class="swatch-input" name="super_attribute[right][151]" value="" data-validate="{required:true}" aria-required="true" aria-invalid="true" style="visibility: hidden; position:absolute; left:-1000px">

\Magento\Checkout\Controller\Cart\Add

$options = $params['options'][1];
$attributes = $params['super_attribute'];

foreach ($options AS $key => $option) {

    $storeId = $this->_objectManager->get('Magento\Store\Model\StoreManagerInterface')->getStore()->getId();
    $product = $this->_objectManager->create('Magento\Catalog\Model\Product')->setStoreId($storeId)->load($params['product']);

    $attribute = '';
    $value = '';
    $params['options'] = array();
    $params['super_attribute'] = array();

//  left = 1 - right = 2
    $params['options'][1][0] = $option;

    if ($key == 0) {
        $attribute = $attributes['left'];
    }

    if ($key == 1) {
        $attribute = $attributes['right'];
    }

    foreach ($attribute AS $attrid => $value) {
        $params['super_attribute'][$attrid] = $value;
    }

    $this->cart->addProduct($product, $params);

}

$this->cart->save();

Array ( [super_attribute] => Array ( [90] => 5 ) [qty] => 2 [options][1][0] => 1)

Array ( [super_attribute] => Array ( [90] => 5 ) [qty] => 4 )[options][1][0] => 2)

Then i get a mysql error:

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`magento2`.`quote_item_option`, CONSTRAINT `QUOTE_ITEM_OPTION_ITEM_ID_QUOTE_ITEM_ITEM_ID` FOREIGN KEY (`item_id`) REFERENCES `quote_item` (`item_id`) ON DELETE CASCADE), query was: INSERT INTO `quote_item_option` (`product_id`, `code`, `value`) VALUES (?, ?, ?)

Can anybody help me


texts: Magento2 : Cache file path displayed in home page


texts: Getting all the listing page blank in Magento 2.3

texts:
I installed Magento 2.3 on my local system, but ongoing to the listing page it's showing blank. I have checked the error log, exception log, system log, debug log but nothing are there. I tried this also Magento2 website showing all blank pages but doesn't helped me. I'm attaching a snapshot of my listing page(Gear) here for your reference.

.

Edit: After enabling developer mode it's giving me error like

I have overriden my catalog_category_view.xml. here is my Magento_Catalog/layout/catalog_category_view.xml

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

    <body>
        <referenceContainer name="content">
            <!--DO NOT MODIFY :: Frontend event tracker code START-->
            <block class="Magento\Framework\View\Element\Template" name="shoptimize.category.tracker" template="Magento_Catalog::tracker/category-tracker.phtml">
            </block>
            <!--DO NOT MODIFY :: Frontend event tracker code START-->
        </referenceContainer>
    </body>
</page>


texts: Magento 2: How to translate %changes in email templates

texts:
There are some email templates that use variable %changes and I'm not able to translate the text (password) it outputs. How do I translate it? I have tried CSV file with no luck.

Here is an example from the email template:

{{trans "New %changes for %user_name" changes=$changes user_name=$user.name}}


texts: CORS error - HTML and fonts not working properly with CloudFront CDN

texts:
I have been trying to get my magento store working with AWS CloudFront for static and media folders. I have one CloudFront distribution for each of the folders. Media files are working fine as well as most of the static files.
The only things that is failing is html and fonts - I get a CORS error. I have been trying to figure out the issue, but have no idea how to proceed. I have validated the CORS headers - they seem to be ok.
My .htaccess in pub/static/ below:
<IfModule mod_headers.c>
<FilesMatch .*\.(ico|jpg|jpeg|png|gif|svg|js|css|html|json|swf|eot|ttf|otf|woff|woff2)$>
   Header set Cache-Control "max-age=604800, public"
   Header set Access-Control-Allow-Origin "*"
   Header always set Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"
   Header set Access-Control-Max-Age "604800"
   Header set Access-Control-Allow-Headers "Host, Content-Type, Origin, Accept"
</FilesMatch>
   <FilesMatch .*\.(zip|gz|gzip|bz2|csv|xml)$>
       Header append Cache-Control no-store
   </FilesMatch>
</IfModule>

Anyone has any idea where should I start investigating or what might be the problem?
The below works for CSS files and all others. HTML matches the same rule, so I am not sure why only HTML files are showing this error.
I have used this link as a guide: mageplaza.com/kb/setup-amazon-cloudfront-cdn-in-magento-2.html They mention something about the HTML files not working properly, but they do not explain what do they mean behind that...


texts: Assign guest order to customer Magento 1.9

texts:
I want to assign a quest order to a customer, using a custom script.
I tried the following, do not get any error, but it is not assigned.

What am I missing?

CODE:

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

require('../app/Mage.php'); // this is assuming your script is located in the Magento root dir
Mage::app();

$toCustomer = Mage::getModel('customer/customer')->setWebsiteId(Mage::app()->getStore()->getWebsiteId())->loadByEmail($customerEmail);
$orderbyid = Mage::getModel('sales/order')->loadByIncrementId('123456');

$orderbyid->setCustomerId($toCustomer->getId());
$orderbyid->setCustomerFirstname($toCustomer->getFirstname());
$orderbyid->setCustomerLastname($toCustomer->getLastname());
$orderbyid->setCustomerEmail($toCustomer->getEmail());
$orderbyid->save();
?>


texts:
After upgrading Magento to 2.2.8 the Tax page in Admin-Stores-Configuration-Sales-Tax is not displayed.
What could be wrong, do I need to add some settings somewhere?


texts:
am trying to insert a variable (?) into an email template that only includes Shipping Line 1, so the text will say something like:

Your order has been shipped to 123 Smith Street

which is sufficient, rather than including the street, town, zip and country.

Can someone please offer any advice?

thanks in advance.


texts:
i had installed a  Extension called

  yotpo review extension

and the extension installed successfully in backend. but i dont know how to bring this extension in frontend for every products as STAR REVIEW. kindly help me out here.


texts: Error if i want to create new customer account

texts:
CREATE NEW CUSTOMER ACCOUNT

Invalid Form Key. Please refresh the page.

please Dear can i help me to solve this problem

Thanks.


texts: Magento 2 - dataPost.js override - get error

texts:
I creating module for guest wishlist on Magento 2.
There is mage library contains many js files.
One of them is dataPost.js in directory mage.
I need overwrite function postData in it.
This is jQuery Widget.

What I have:

  requirejs-config.js

var config = {
  map: {
   '*': {
     'mage/dataPost': '<VENDOR_MODULE>/js/wishlist-data-post'
    }
 }
};

  VENDOR_MODULE/js/wishlist-data-post.js

define([
  'jquery',
  'jquery/ui',
  'mage/template',
], function($) {
  'use strict';

  $.widget('custom.dataPost', $.mage.dataPost, {
    postData: function(params) {
      e.preventDefault();
      debugger;
      return this._super();
    }
  });

  return $.custom.dataPost;
});

I get error:

  Uncaught TypeError: base is not a constructor

I cannot do it like there because it isn't Magento_UI: Magento2 customer account navigation wishlist Items how to display in phtml

No right answer: https://stackoverflow.com/questions/40713696/not-able-to-override-collapsible-js-in-magento-2

What I doing wrong?


texts: Magento 2 Add special_to_date on products page

texts:
When there is a special price I'd like to show a text and "special_to_date" attribute under the products price.

I tried the following in a template file.. But it shows nothing.

$_product->getResource()->getAttribute('special_to_date')-
>getFrontend()->getValue($_product);


texts:
I am trying to login a user throw API and after that use token on frontend in browser. Some tests passed, some not. Does anybody did something like this: Login user throw web API "/rest/default/V1/integration/customer/token" or something similar to get a token which could be used as cookie PHPSESID? in order to continue as web user.

Than you in advance.


texts:
I want to change the layout of the creditmemo productstable inside a creditmemo email.
Inside the following file: /app/design/frontend/theme/theme/template/email/order/creditmemo/items.phtml

There I can only find the following code:

<?php if($_item->getOrderItem()->getParentItem()) continue; else $i++; ?>
<tbody<?php echo $i%2 ? ' bgcolor="#FFFFFF"' : '' ?>>
<?php echo $this->getItemHtml($_item) ?>
</tbody>
<?php endforeach; ?>

But where can I find the <?php echo $this->getItemHtml($_item) ?> code, to change the layout?

Many thanks!


texts: Magento 2: How to get Customer collection filter by Full name like admin grid?

texts: How to get Customer collection filter by Full name or by keyword like admin grid of magento 2?


texts: How to submit a form to controller using ajax with magento 2 validation

texts:
My form is like this

<form  data-mage-init='{"validation":{}}' id="donation-request-form" method="post" data-hasrequired="* Required Fields">

                <input type="text" class="form-control fname" id="first_name" name="first_name" placeholder="First Name" data-validate='{"required":true}'>

                    <input type="text" class="form-control" id="last_name" name="last_name" placeholder="Last Name">

        <input class="btn-orange" type="submit" value="Request Donation" onclick="SendForm()">

</form>

This is my SendForm() function


texts: What exactly is included in the System backup found under System>Tools>Backups?


texts: Disable Full Page Cache Only For CMS Pages

texts:
For some reason I want to disable Full Page Cache for CMS pages including Home Page.
I have created my custom module for this but some reason it is not working.

config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Custom_HeaderFix>
            <version>1.0.0</version>
        </Custom_HeaderFix>
    </modules>
    <global>
        <models>
            <headerFix>
                <class>Custom_HeaderFix_Model</class>
            </headerFix>
        </models>
    </global>
    <frontend>
        <events>
            <controller_action_predispatch_cms>
                <observers>
                    <headerCache>
                        <type>singleton</type>
                        <class>headerFix/observer</class>
                        <method>processPreDispatch</method>
                    </headerCache>
                </observers>
            </controller_action_predispatch_cms>
        </events>
    </frontend>
</config>

Observer.php

<?php

class Custom_HeaderFix_Model_Observer {

    public function processPreDispatch(Varien_Event_Observer $observer) {
        $action = $observer->getEvent()->getControllerAction();

        if ($action instanceof Mage_Cms_PageController) {
        $cache = Mage::app()->getCacheInstance();

        // Tell Magento to 'ban' the use of FPC for this request
        $cache->banUse('full_page');
        }
    }

}

My code is working on CMS pages but not for home page


texts: How to apply 2 shopping cart price rules in magento

texts:
I wanted to know that how can i apply 2 shopping cart price rules at the same time. For example i have a coupon which will allow you discount of 15% (any cart amount ). Secondly if the cart total is still more then Rs 750 then we will allow a discount of rs. 50 also. Please help.
Thanks


texts: On index page i get error Breadcrumbs::getProductName() must be of the type string, null returned in readcrumbs.php:101

texts:
Ok, this is the full error actually:
TypeError: Return value of Magento\Catalog\ViewModel\Product\Breadcrumbs::getProductName() must be of the type string, null returned in /var/www/html/vendor/magento/module-catalog/ViewModel/Product/Breadcrumbs.php:101

When I open index page it shows this error and long stack trace of 70 files.
I inspected the source magento files and its this function, which seams alright. So I am confused what is doing it.
public function getProductName(): string
    {
        return $this->catalogData->getProduct() !== null
            ? $this->catalogData->getProduct()->getName()
            : '';
    }

I am using latest magento 2.4.1
I tried disablin all 3-rd party modules. Changes nothing.


texts: How to call a custom attribute in homepage.phtml in Magento 2.2.0?

texts:
I have created Products attribute name as Electronics, I want to call that attribute in my HomePage which is homepage.phtml I don't know how to do that, please help me.
Thanks A lot.


texts:
I've created a custom module that holds a simple phtml file, block class to include elements into the phtml file and a default.xml within my Module/view/frontend/layout.

However I am struggling to add my phtml to my page using the default.xml within my module, however I can add this using the default.xml within my theme.

Heres the contents of my xml within my module:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<body>
    <referenceBlock name="autosmart.logo" remove="true"/>
    <referenceContainer name="header.container">
        <block class="Autosmart\DistributorSearch\Block\DistributorSearch" name="distributor.search" template="distributor-search.phtml"></block>
    </referenceContainer>
</body>
</page>

Do I need to do anything to use this module default.xml rather than having to add my phtml to the page using my theme default.xml?


texts: Magento 2 Extension usage restriction for multiple project

texts:
I am creating an extension, but I want to restrict the extension usage in multiple projects. Like if a customer purchased the extension for one project, but he should never use the same extension to any other projects.

I heard there has a licence Key concept, but I am not much clear about the concept.So kindly share your ideas and thoughts to make the extension work only for the purchased domain

Thanks in advance


texts: Form key validator not working on custom phtml file?

texts:
For wishlist I created custom phtml file. When added product on logged in customer then it calls function i.e wishlist/index/add which is in

  vendor\magento\module-wishlist\Controller\Index\Add.php

Below is not working

if (!$this->formKeyValidator->validate($this->getRequest())) {
    return $resultRedirect->setPath('*/');
}

If I comment then I get the output.

I tried, in custom file I put

  $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
  $FormKey = $objectManager->get('Magento\Framework\Data\Form\FormKey');

<input name="form_key" type="hidden" value="<?php echo $FormKey->getFormKey();?>">


texts: Magento Certification - multi-answer multiple choice questions

texts: For those of you that have taken the test or know about it - I notice there are questions that require you to choose 4 correct answers out of 6. If I get 3 right and 1 wrong, am I given any marks at all?


texts: Magento2 static-content:deploy not generating admin

texts:
When using:

bin/magento setup:static-content:deploy

Only the blank and luma theme will be generated but not the admin one.

Does anyone know if there is a setup somewhere to specify the themes?


texts:
I'm working on some Magento 2 extension that requires reading files from the file system.
When running the php sniffer using the ECGM2 standards, it complains about the fact that I'm using functions like basename or dirname.

  The use of function dirname() is forbidden

or

  The use of function basename() is forbidden

What wrapper should I use instead of those to get the the same effect?

[EDIT]
Here is some code, but it's not that relevant to the question.
I have a collection class that extends the \Magento\Framework\Data\Collection\Filesystem class and I want to list this collection in a grid (ui-components) and one of the actions in the grid is a download action.
For this, I need to get the actual name of the file so I can send it to the download action.

    // here $file is dynamic and it can be
    // folder/filename.xml or folder/subfolder/file.tar.gz
    //so there is no strict number of folders and subfolders.
    $file = $downloader->getRelativePath($packageName);
    $relativeFile = UmcFilesystem::VAR_DIR_NAME . '/' .$file;
    $absoluteFile = $rootDir->getAbsolutePath($relativeFile);
    if ($rootDir->isFile($relativeFile) && $rootDir->isReadable($relativeFile)){
        //I don't want to use `explode` just for the sake of avoiding basename
        $fileName = basename($absoluteFile);
        $this->fileFactory->create(
            $fileName,
            null,
            DirectoryList::VAR_DIR,
            'application/octet-stream',
            $rootDir->stat($relativeFile)['size']
        );

        $resultRaw = $this->resultRawFactory->create();
        $resultRaw->setContents($rootDir->readFile($relativeFile));
        return $resultRaw;
    } else {
       ...
    }


texts: Removing Item from collection and update toolbar - [Hide out of stock item in layer navigation ( configurable )]

texts:
I'm trying to hide out of stock products in layer navigation.
This can be done using this code:
http://colin.mollenhour.com/2009/07/14/hiding-out-of-stock-items-in-layered-navigation/

The issue is that the above code is not filtering out of stock for configurable products:
Suppose I have a configurable product based on size and all the simple for that size are are out of stock ... the product is not filtered ( as for Coling comment this is difficult to implement because of OO query implementation )

So I would like to use a not pure SQL approach removing products from collection "on the fly" (this is expensive in performance but let say I don't care) ...

... at this point the issue is that the toolbar is still showing all the products count ... any way to workarround this issue ?

Thanks


texts: What development server settings need changing (DB or code)?

texts:
I have a script that downloads a copy of the production database and imports it to my development machine. I also rsync the production code to a staging server every so often. There are certain files that I'm ignoring, and a few changes I always have to make to local database. A few of the things I would like to achieve on my development machine are:

Use the development database
Never email customers
Never charge credit cards
All urls should be local
Turn off caching
Turn off Google Analytics
Turn on demo store notice
Enable DEVELOPER_MODE

Please feel free to add more that make sense.


texts: Magento 2.1 Backend and Frontend "Please read Magento System Requirements."

texts:
I've just upgraded from Magento 2.0.7 CE to Magento 2.1.0 CE on an Ubuntu 14.04.1 LTS server. After installing PHP 7.0.11 and MySQL 5.6.30, as well as enabling PHP 7 using: sudo a2enmod php7.0 via the command line.

PHPmyadmin is still working fine, as is the database connection. The issue is Magentos front/backend which reads "Magento supports PHP 5.6, 7.0.2, and 7.0.6 or later. Please read Magento System Requirements."

I am unaware of any issues with PHP 7.0.11, so I'm not fully sure why it's not working. I upgraded using Composer, and installed the nescessary PHP 7 specific packages before I was able to install the upgrade.

I have checked /var/log/apache2/error.log, /var/log/mysql/error.log, /var/log/system.log and /var/log/exception.log (Was a new file).

Nothing seems out of the ordinary apart from being unable to access my Magento 2.1 frontend. I have restarted apache2 as well as rebooting the whole server with no success. Have I missed any information out to cause this issue?

Thanks for your time


texts: When does the Special Price “To Date” actually expire?

texts:
My client is having a Black Friday sale from 11/29/13 to 12/2/2013. Do I need to select 12/2/2013 or 12/3/2013 for it still be showing on 12/2/2013 but not 12/3/2013?

Thanks in advance!


texts: Sorting of Categories based on a attribute of product item

texts:
In my project, by default, I have some categories which are visible in frontend as shown below:

 category-1
     sub-category-1
     sub-category-2
 category-2
     sub-category-1
 category-3
 category-4
 category-5

The above categories should be sorted based on a attribute value item_branch which will be assigned to each product (not category or sub-category). This attribute can have following values:

X
Y
Z

So, the sorted product list should look like this: (many to many relationship)

X
  category-1
     sub-category-2
  category-2
     sub-category-1
  category-3
Y
  category-1
     sub-category-1
     sub-category-2
Z
  category-2
     sub-category-1
  category-3
  category-4
  category-5

To achieve the above sorting, I have two approaches in my mind.

First one is to create a dropdown attribute in admin panel (with possible values as X,Y and Z) and assign to a group in attribute sets.
Second is to add a new Catalog as item_branch with a categories X, Y and Z  and while creating a product, I will assign both categories. i.e category-1 and Y (for example).

In the above approaches, which one is better one? or is there any more better approach?

Please explain it with some php code.. as I am new to php.


texts: How can I set the billing and shipping addresses on an order that I am creating programatically?

texts: I am creating a duplicate order that has been previously placed by a specific customer. How can I set the same billing and shipping address on the new order that I am creating programatically?


texts: Import & Export all categories using csv file (without extension)

texts: I want to import all the categories in magento using CSV file, I tried to do  using extension http://www.magentoworks.net/importexport-magento-category-extension/ it works but i want to do it using Dataflow-Profiles. Is there any way to do using Dataflow-Profiles?


texts: when proceed to checkout take very long and getting proxy error

texts:
I have magento 2.2. so far work fine, but in the last week when I trying to add product to cart and click to proceed to checkout the page take very long time to load and after that getting proxy error.

If need more info please let me know


texts: How can I edit the order in magento 2 using API.I have created the order using the magento 2 API. But i have not found any api related to edit order.


texts: Magento 2 : Getting error in adding product grid using ui component

texts:
Added product grid using ui component, but getting an error

  ReferenceError: require is not defined

What is the meaning of this code in templates/modulename/edit/assign_products.phtml

<script>
    require('mage/apply/main').apply();
</script>


texts: when joining two sales tables: Unknown column 'sales_flat_order_item.order_id' in 'on clause'

texts:
I am using this query

select product_id, customer_id
from cp8_sales_flat_order
left join cp8_sales_flat_order_item
on sales_flat_order_item.order_id = sales_flat_oder.entity_id

but I am getting this error.

Unknown column 'sales_flat_order_item.order_id' in 'on clause'

and if I swap the order of the last line, then it is entity_id column that is not known.
but can't see why.


texts: Most viewed products by category not working

texts:
I want to add some automated products to the related products and had this working great however suddenly it has become stuck showing the same products. I have used a category Id that I put in the registry from breadcrumbs here to filter the most viewed collection however no matter what this seems to be stuck on the same products. The category ID in the code below is changing fine on each product however the collection remains the same on each page.

public function __construct(
    \Magento\Catalog\Block\Product\Context $context,
    \Magento\Checkout\Model\ResourceModel\Cart $checkoutCart,
    \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility,
    \Magento\Checkout\Model\Session $checkoutSession,
    \Magento\Framework\Module\Manager $moduleManager,
    \Magento\Catalog\Model\CategoryFactory $categoryFactory,
    \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory,
    \Magento\Store\Model\Store $_storeManager,
    \Magento\Reports\Model\ResourceModel\Product\CollectionFactory $mostViewedCollectionFactory,
    Registry $registry,
    array $data = []
) {
    $this->_checkoutCart = $checkoutCart;
    $this->_catalogProductVisibility = $catalogProductVisibility;
    $this->_checkoutSession = $checkoutSession;
    $this->moduleManager = $moduleManager;
    $this->_categoryFactory = $categoryFactory;
    $this->_productCollectionFactory = $productCollectionFactory;
    $this->_storeManager = $_storeManager;
    $this->mostViewedCollection = $mostViewedCollectionFactory;
    $this->registry = $registry;
    parent::__construct(
        $context,
        $checkoutCart,
        $catalogProductVisibility,
        $checkoutSession,
        $moduleManager,
        $data
    );
}

protected function _prepareData()
{
    $storeId = $this->_storeManager->getStore()->getId();
    $productreg = $this->_coreRegistry->registry('product');
    if($categoryIds = $this->registry->registry('cat_ids')) {
        $categoryId = $categoryIds[1];
    }
    /* @var $product \Magento\Catalog\Model\Product */

    $this->_itemCollection = $productreg->getRelatedProductCollection()->addAttributeToSelect(
        'required_options'
    )->setPositionOrder()->addStoreFilter();

    if ($this->moduleManager->isEnabled('Magento_Checkout')) {
        $this->_addProductAttributesAndPrices($this->_itemCollection);
    }
    $this->_itemCollection->setVisibility($this->_catalogProductVisibility->getVisibleInCatalogIds());

    $count = 8 - count($this->_itemCollection);
    $this->_itemCollection->load();

    if($categoryId) {
        $collectionCat = clone $this->mostViewedCollection->create();
        $collectionCat->clear();
        $collectionCat->addAttributeToSelect(
            ['name','price','small_image']
        )->addCategoriesFilter(['eq' => $categoryId]
        )->addViewsCount(
        )->setStoreId(
            $storeId
        )->addStoreFilter(
            $storeId
        )->setPageSize(
            $count
        );

        foreach($collectionCat as $item)
        {
            if($item->getSku() != $productreg->getSku()) {
                try {
                    $this->_itemCollection->addItem($item);
                } catch (\Exception $e) {
                }
            }
        }
        return $this;
    }

}

I've tried clone and clear like seen in other collections to try and reset but really was just guessing there but it didn't seem to change the results. I have also disabled all caches with same results on each page.


texts: How to request for token in REST Api in magento 2?

texts:
I have consumer key and secret key for Rest API in magento2

How Can I get token from magento side?


texts: Backend Category count is right but displaying products

texts: I am a bit confused as to why my category has the right product count for the category, but when I look at Category Products there are 0 products in there. Why is this happening? When I go to the Front-end all the products are there.


texts: Guest/temp accounts- remove change password link

texts:
We have an e-commerce site powered by Magento. Products are displayed without prices, until a user logs in to their account, when the prices are displayed. We have a temporary guest account that potential customers are given details of, so they can log in and see prices. This guest account has the potential for a guest user to change the password to the account, which would render the account useless to others. Is there anyway to disable the 'change password' link on this one account?
Thanks in advance


texts: I am trying to add a new value to an existing custom option programmatically but not happening

texts:
I am able to get all the values but not able to add new
tried an answer from this question but doesn't seems to work

$obj = Mage::getModel('catalog/product');
$product_id = $obj->getIdBySku('WSW01943');
$product = $obj->load($product_id);

$collection = $product->getOptions();
foreach ($collection as $value) {
    $optionType = $value->getType();
    if ($optionType=="radio") {
        $values = $value->getValues();
    }
}


texts: Magento 2.1 data migration SUPER privilege error

texts:
When running the data migration tool

php bin/magento migrate:data vendor/magento/data-migration-tool/etc/ce-to-ce/1.9.1.0/config.xml

We get the following error:

[Zend_Db_Statement_Exception]

SQLSTATE[HY000]: General error: 1419 You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable), query was: CREATE
   TRIGGER trg_catalog_compare_item_after_insert AFTER INSERT ON catalog_compare_item FOR EACH ROW
  BEGIN
  INSERT INTO m2_cl_catalog_compare_item (`catalog_compare_item_id`, `operation`) VALUES (NEW.catalog_compare_item_id, 'INSERT')ON DUPLICATE KEY UPDATE operation = 'INSERT';
  END

Unfortunately, as we are on a Shared Server they cannot provide this privilege or configure this variable from the hosting's end.

Is there something we can change to make this work?

Thanks!


texts: Magento 2 : How to overrride catalog_product_view.xml

texts:
I am new with Magento 2. I wan't to change the page of detailed product: hide Qty box I do that with removing the label and maken an input as hidden. my problem is that I can't arrive to know how to override catalog_product_view.xml correctly.

Here is My code.

<body>
    <referenceContainer name="content">
        <container name="product.info.form.content" as="product_info_form_content">
            <block class="Magento\Catalog\Block\Product\View" name="product.info.addtocart" as="addtocart" template="Magenticians_AddModule::catalog/product/view/addtocart.phtml"/>
        </container>
    </referenceContainer>
</body>


texts: I am unable to install Magento on WAMP server

texts:
I am following the link: "https://insync.co.in/how-to-install-magento-on-wamp-server-localhost-localcomputer/" for installtion of MAgento on WAMP server however when I click on Magento Folder It shows error. I have check all requirements for MAgento setup and it's look good.

Apache 2.4.27
PHP 5.6.31
Mysql 5.7.19
Wamp 3.1.0


texts: Magento 2: How to override adminhtml CSS?

texts:
I would like to implement a CSS file that contains only the styles that I'd like to override for the default admin theme. For example, let's say I want to change the textarea font to Consolas and my overriding CSS file is called custom.css, then in this file I would have the following code:

textarea { font-family: Consolas, monospace; }

What is the best way to go about doing something like this in Magento 2?

I have looked into creating a new theme, but that seems to require you to copy over all the CSS files from the theme you're overriding, which I'd like to avoid since I just want to add a CSS file containing only the styles I'd like to override.


texts:
i downloaded magento 2 in github:https://github.com/magento/magento2. when i run setup, it's give me a message:

  Whoops, it looks like setup tool dependencies are not installed.

  Please run 'composer install' under /setup directory.

but when i following to do this done, it's display a blank page.
i don't know
anyone to see the error and can help me solve this.
thanks for read.


texts:
In Description image not showing frontend

<img src="{{media url=" wysiwyg="" a.png"}}"="" alt="" data-pin-nopin="true">

I add description image in backend but frontend  it's not showing. Even i set File Permission also 777 But no result


texts: How to create second Tool Tip in checkout/onepage/payment.phtml

texts:
The default tooltip in checkout/onepage/payment.phtml shows the pop for CVV security codes for credit cards.

We have another tooltip we need to display. However, I don't see an easy way to add another and get it to pop up. I have tried renaming "payment-tool-tip" and adding more javascript. I have tried renaming the second function. It's noto working for me. Can yo suggest something please?

Current tooltip:

<a href="#" id="payment-tool-tip-close" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Close')) ?>"><?php echo $this->__('Close') ?>

<img src="<?php echo $this->getSkinUrl('images/cvv.gif') ?>" alt="<?php echo Mage::helper('core')->quoteEscape($this->__('Card Verification Number Visual Reference')) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Card Verification Number Visual Reference')) ?>" />

I want to add the following as a second tool tip that will also pop up upon clicking the new link on the page:

<a href="#" id="second-tool-tip-close" title="<?php echo $this->__('Close') ?>"><?php echo $this->__('Close') ?>

Second Tool Tip
Second tool tip description.

I have tried adding a second js function and changed 'payment-tool-tip' to 'second-tool-tip.' I also tried renaming a second js function to toggleSecondToolTip with 'second-tool-tip' to no avail. The second tool tip never pops up. Obviously, I'm not fluent in js.


texts:
Does Magento support multiple values for same filter natively?

I'm aware there are plugins that enable store customer to apply multiple values of the same filter criteria; I used some of those in the past, now I disabled them all and still URL like filter_name=949_822_821_948_944_820_939 works.

Thanks


texts: After updating to Magento 2.2.6 On Product Page Caption text coming default

texts:
After updating to magento 2.2.6 on product detail page a caption text comes.
Will anyone let me know the file name of this caption text in directory because I don't want this text.

Screenshot: http://prntscr.com/l2il8n


texts: Use a dropdown select for the shipping address on the Onepage Checkout

texts:
In Magento 2, I would like to be able to select the shipping address with a dropdown, similar to how you can if you choose to change the billing address.

This is how it currently works:

I would like it to work similarly to when you change the billing address, with a dropdown:

I can see the dropdown for the billing address is set in:
app/code/Magento/Checkout/view/frontend/web/template/billing-address/list.html

But I can't find the knockout template for the shipping address section, I thought it would be on of the files in:
app/code/Magento/Checkout/view/frontend/web/template/shipping-information/
or
app/code/Magento/Checkout/view/frontend/web/template/shipping-information/

But I couldn't find any here which worked.

Any ide


texts: How to insert core template into product view page before price?

texts:
I am trying to insert my core template file in product view page before price using layout xml.

I've tried this.

<catalog_product_view>
    <reference name="content">
        <block type="core/template" name="myblock" as="myblock" template="mymodule/mytemplate.phtml"/>
    </reference>
</catalog_product_view>

But it displays at the bottom of the content just before footer.

And then I try to add before="product.info.simple"

<catalog_product_view>
    <reference name="content">
        <block type="core/template" name="myblock" as="myblock" template="mymodule/mytemplate.phtml" before="product.info.simple"/>
    </reference>
</catalog_product_view>

But it displays above the content just after breadcrumb.

So, anybody know how to make it displays just before the price?


texts:
We have a main site at example.com. Logging into example.com/admin works fine there.

But on a testing site at test.example.com/admin I cannot log into the admin without first deleting all example.com cookies. Then I can log in, but as soon as I log into example.com/admin my next click on the test server kicks me back to the login page.

I don't know if this affects customer logins.

Is there some configuration in the main site or testing site that would solve this problem?


texts: Error after Deleting Unused Categories that came with theme

texts:
I was deleting the categories that came with a theme I purchased for Magento 2, and adding in my own, but now when I visit the site I get this error:

Exception #0 (Magento\Framework\Exception\NoSuchEntityException): No such entity with id = 233


texts: Magento 2 customer CAPTCHA Login Not Showing Up

texts:
I have added all possible captcha forms in Stores->Configuration->Customers->Customer Configuration->CAPTCHA see screen shoot bellow:

Clear cache,flush yet the login page doesn't show it.

Anyone any idea is this a bug?


texts: Magento 2 - Extend catalogAddToCart widget

texts:
What i am trying to do is extend the catalogAddToCart widget so i can write some custom code without modifying the widget itself. So I've doen the requirejs file here:

  Vendor/default/Magento_Catalog/requirejs-config.js

Inside of this is:

var config = {
map: {
    '*': {
        myAddToCart: 'Magento_Catalog/js/my-catalog-add-to-cart'
    }
}
};

And then added my js file to this locaiton:

  Vendor/default/Magento_Catalog/web/js/my-catalog-add-to-cart.js

with the following in it:

define([
    'jquery',
    'mage/translate',
    'jquery/ui'
], function ($, $t) {
    'use strict';
    $.widget('myCatalogAddToCart', $.mage.catalogAddToCart, {
        open: function() {
            console.log( "open" );
        }

    });
});

I've then tried to call this widget in:

  Vendor/default/Magento_Catalog/templates/product/view/addtocart.phtml

<script type="text/x-magento-init">
    {
        "#product_addtocart_form": {
            "Magento_Catalog/js/validate-product": {},
            "Magento_Catalog/js/my-catalog-add-to-cart":{}
        }
    }
</script>

However all i get from this, is an error!!

  Uncaught TypeError: base is not a constructor at Function.$.widget

Im not 100% sure where i am going wrong, but something isn't right, obviously and I'm not sure what I have done wrong.

Any help?


texts: how to connect android application with magento

texts:
I am developing an android application with backend magento, I already created User and Role in System-web services-SOAP but when I run this url on browser
http://www.my_website_name.com/index.php/api/v2_soap.

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>WSDL</faultcode>
<faultstring>
SOAP-ERROR: Parsing Schema: can't import schema from 'http://schemas.xmlsoap.org/soap/encoding/'
</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

I have one more URL which is also connected to magento with same SOAP api and all as above and i can easily able to fetch data from the magento.

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>Sender</faultcode>
<faultstring>Invalid XML</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


texts:
I am working on a multi-store configuration.

Store > Configuration > General > Web > Session Validation Settings > Use SID on Storefront is set to "Yes"

Store > Configuration > General > Web > Url Options > Add Store Code to Urls is set to "Yes"

Why I am not getting SID in frontend URL. I need SID in my all frontend URLs.


texts: How Magento 2 converts the namespace path to actual file path?

texts:
I know in Magento 2.x versions the namespace is converted to actual file path to load classes runtime.

For example, \Magento\Catalog\Model\Product is converted to path\to\webroot\magentorootdir\vendor\magento\module-catalog\Model\Product.php, but how this conversion done ? Is there any built-in function for this?, if yes, then where is it ? Can that function be called in a dirty playground script ?


texts:
We're running Magento 2.3.1 on AWS EC2(t2.medium) Instance with an ELB. Webserver is nginx. Sometimes, we receive the "Upstream sent too big header while reading response header from upstream."-Error in our logs. After researching this issue, I found out that the most popular solution seems to be adjusting the fastcgi buffer size. I've done that without any effect.

To determine the current fastcgi response sizes, I did:

$ awk '($9 ~ /200/) { i++;sum+=$10;max=$10>max?$10:max; } END { printf("Maximum: %d\nAverage: %d\n",max,i?sum/i:0); }' /var/log/nginx/access.log

Maximum: 1613895
Average: 51433

Due to the huge amount of response sizes, I am not sure if the issue is nginx related. My guess is that the current buffer size rules are fine and Magento might has a bug with huge response sizes?

My current buffer sizes are:

fastcgi_pass   fastcgi_backend;
fastcgi_buffers 8 32k;


texts:
I want to change the language from my page. I did it but only in specific site. I explain:

-I installed the language what i want and it works.

But where if the data is static, my code.. Dont translate...

I understand that only translate the modules, Am i wrong?


texts: How to reverse first name and last name globally

texts:
Can someone please tell me how can change customer name format globally?

I want to show customer name as Last name First name instead of First name then Last name.

I ask this because I'm doing an e-commerce site in Japanese.


texts: Magento2.0.7 how to add header and footer to checkout page?

texts:
My override file

Mystore/mytheme/Magento_Checkout/layout/override/checkout_index_index.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
   <!-- <referenceBlock name="minicart" remove="true"/> -->
    <!-- <referenceContainer name="header.panel" remove="true"/> -->
  <!--  <referenceBlock name="top.search" remove="true"/> -->
    <referenceBlock name="catalog.compare.link" remove="true"/>
    <referenceBlock name="catalog.topnav" remove="true"/>
   <!-- <referenceContainer name="footer-container" remove="true"/> -->
</body>
</page>

It is not adding header to checkout page.Suggest some solution.


texts:
I have site in Magento 2.2.

But after move site one server to another server it's stopped working.

Show me below error in exception.log file.

[2019-06-13 10:13:36] main.CRITICAL: Warning: Use of undefined constant MCRYPT_RIJNDAEL_256 - assumed 'MCRYPT_RIJNDAEL_256' (this will throw an Error in a future version of PHP) in /home/elitemm5/public_html/britanica/vendor/magento/framework/Encryption/Encryptor.php on line 394 {"exception":"[object] (Exception(code: 0): Warning: Use of undefined constant MCRYPT_RIJNDAEL_256 - assumed 'MCRYPT_RIJNDAEL_256' (this will throw an Error in a future version of PHP) in /home/elitemm5/public_html/britanica/vendor/magento/framework/Encryption/Encryptor.php on line 394 at /home/elitemm5/public_html/britanica/vendor/magento/framework/App/ErrorHandler.php:61)"} []

Any type of help will be appreciated.

Thanks!


texts: how to import 800 mb sql file in localhost using xampp

texts:
I have been trying to import my magento website database which size is 800 mb in phpmyadmin xampp and having error

''You probably tried to upload a file that is too large. Please refer to documentation for a workaround for this limit.''


texts: Is it possible to use knockout js in static blocks?

texts:
I am working in Magento 2 static blocks. Inside the static block I want some content to be dynamic.

Is there any way to use knockout js in static block?


texts:
I'm using Magento ver.1.6.2.0.

I'm adding some items into the cart without logging-in. After that I am logging in. After getting logged in, Cart shows 0 items.

When I check in chrome developer tool-> resources->cookies. Cookie 'Frontend' is not created. Is it may be a problem?

I could not get idea. Can anyone help here?


texts: Set configurable products to In Stock while creating

texts:
Currently when I am creating a new configurable product, it is by default set to out of stock, even though I have added quantity to each of the configurable products. To set the product as in stock I have goto each of the products and change the stock status.
Is there any way to set the configurable product as in stock while creating the product itself.
I am using Magento 2.3.3


texts: I want to enable or disable Module according to system.xml field value

texts:
I want to enable or disable module according to the yes/no field value of system configuration file. i have developed one system configuration setting in that i have created in admin-side. please anyone can have solution for it. then please send me the solution.

Thank you in Advance.


texts:
I am developing a m2 module.

Should i put all of my interfaces in an api directory?

Core magento sees to do this but im not sure if this is official guidelines or not.


texts:
How to disable module programmatically using UpgradeData script?

Edit 2

Code that I'm trying to use to disable modules:

<?php
namespace Config\Bakalland\Setup;

use Magento\Framework\Setup\UpgradeDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Config\Model\ResourceModel\Config;
use Magento\Framework\Module\StatusFactory;

class UpgradeData implements UpgradeDataInterface
{

    /**
     * @var StatusFactory
     */
    protected $moduleStatusFactory;

    /**
     * UpgradeData constructor
     *
     * @param StatusFactory $moduleStatusFactory
     */
    public function __construct(StatusFactory $moduleStatusFactory)
    {
        $this->moduleStatusFactory = $moduleStatusFactory->create();
    }

    /**
     * @param ModuleDataSetupInterface $setup
     * @param ModuleContextInterface $context
     */
    public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {
        $setup->startSetup();
        if (version_compare($context->getVersion(), '2.1.22', '<')) {
            $this->moduleStatusFactory->setIsEnabled(false, ['Magento_Downloadable', 'Magento_Paypal', 'Magento_Vault']);
        }

        $setup->endSetup();
    }

}


texts: PDF invoice items file location in Magento 2

texts:
I am working on Magento 2 pdf invoice and trying to change layout of default invoice.As I have seen in default Magento pdf there are six column for displaying items in pdf

Products
SKU
Price
Qty
Tax
Subtotal

When I have checked in admin email template it is calling layout for displaying all items

{{layout area="frontend" handle="sales_email_order_invoice_items" invoice=$invoice order=$order}}

and in phtml file

vendor/magento/module-sales/view/frontend/templates/email/invoice/items.phtml

there are only three column

                <?= /* @escapeNotVerified */  __('Items'); ?>

                <?= /* @escapeNotVerified */  __('Qty'); ?>

                <?= /* @escapeNotVerified */  __('Subtotal'); ?>

I am not getting which file is exactly called when

{{layout area="frontend" handle="sales_email_order_invoice_items" invoice=$invoice order=$order}}

layout is loaded.Please help me if anybody know about it.


texts: Magento 2: How can i get the aggregation for a variant in graphql

texts:
Current Situation
Often in a shop you need to show the available sizes to your clients. However this value is in many cases associated to a simple-product, which is linked to a configurable product. If you run a graphl-query like this, then you will only get the aggregations for the configurable product but not the variants. This means that you also can not show the attribute "size"
  products(pageSize: $pageSize, currentPage: $currentPage, filter: $filter, sort: $sort) {
    aggregations {
      attribute_code
      count
      label
      options {
        label
        value
        count
        __typename
      }
      __typename
    }

Question
Is there a way to list all variants attributes or maybe also better, to merge all variant attributes to the parent, so that an attribute like "size" will become available in the graphql-aggregation.
Possible solution modifying some core files
Assume that 178(size) is a variant attribute, we could force the indexer to put that into the configurable product.
# Model/Indexer/Fulltext/Action/Full.php
# Line 379

if (isset($relatedProducts[$productData['entity_id']])) {
                    $childProductsIndex = $this->getChildProductsIndex(
                        $productData['entity_id'],
                        $relatedProducts,
                        $productsAttributes
                    );
                    if (empty($childProductsIndex)) {
                        continue;
                    }
                    $sizes = [];
                    foreach ($childProductsIndex as $cI => $cV) {
                        if (array_key_exists('178', $cV)) {
                            $sizes[] = $cV['178'];
                         }
                    }
                    $productIndex[$lastProductId]['178'] = implode(',', $sizes);
                    $productIndex = $productIndex + $childProductsIndex;
                }

And then also force the data mapper to handle 'size' like a multiselect value as it is comma-separated.
# Model/Adapter/BatchDataMapper/ProductDataMapper.php
# Line 275

  if ($attribute->getName() == 'size') {
            $attributeValues = $this->prepareMultiselectValues($attributeValues);
        }

This is just a theoretical approach so far.


texts: Magento 1.9.2.3 Product Custom Options - Filters Not Working - Prototype.js error

texts:
I cant able to use Custom Options, drop-down showing error in prototype.js:612

and my prototype.js:

https://justpaste.it/61c3a


texts: Convert(re-write) array_filter code into foreach loop

texts:
I have an array $arrItems['items'] in which 5 more arrays (associate array) and each array contain 5 element (with the keys: f_name, l_name, contact, address, seller_id).

I want to get all those arrays (from $arrItems['items']) in which element of seller_id is 1 like "seller_id"=>"1,2,3" OR "seller_id"=>"3,2,1" OR "seller_id"=>"4,6,2" OR "seller_id"=>"5,3,4" OR "seller_id"=>"2,1,2" Array given below

$currentUser=1;
        $arr= array_filter($arrItems['items'], function($e) use ($currentUser) {
            return in_array($currentUser, explode(",", $e["current_seller_id"]));
        });

actually am apply filter on Order Items Collection.
Then it filter perfectly but not set array in order grid. Order Grid is buffering not display data.
When i write same code in foreach loop then data in order items grid set perfectly But my foreach loop not filter right. it return some extra array where seller_id not exist. My Foreach loop code is there :

$seller_order_arr = [];
    foreach ($arrItems['items'] as  $row) {
        if (strpos($row['current_seller_id'] ,",") > 1 && $row['current_seller_id'] != null){
            $seller_order_arr[] = $row;
        }
        if($row['current_seller_id'] == $currentUser){
            $seller_order_arr[] = $row;
        }
    }
    $arrItems['items'] = $seller_order_arr;

anyone help me to re-write array_filter code in foreach code.


texts: render multiple times content upon clicking on search of grid

texts:
I have tab on customer admin, and my tab layout file conains,
<container name="root">
    <block name="some.anothername"
           template="Some_Module::random.phtml"/>
    <block class="Some\Module\Block\Adminhtml\Grid\Listing" name="some.name"/>
    <block name="some.anothername"
           template="Some_Module::random2.phtml"/>
    <block name="some.anothername"
           template="Some_Module::random3.phtml"/>
</container>

which works ok, I can see my random.phtml content then grid then random2.phtml then random3.phtml but whenever I am searching on grid or click on "reset filter" at that It render  2 times content of phtml(all) file, by default everything looks ok but whenever I am searching it render multiple time,. Does anyone has this type of problem? How can I fix this?
Any hint will be appreciated.


texts:
Does anyone have experience using ReactJS when making a custom Magento template? Or does anyone know if it is viable?

I would like to leverage ReactJS to make a single-page website.


texts: Attributes values are not showing at admin panel after adding them from database magento2

texts:
I have created a new product attribute warehouse_country and inserted values from database. But these vales are not showing at admin panel.See image 1

And I want to use this attribute for layered navigation filter but not able to change "Use in Layered Navigation". this is disabled. See image 2


texts:
I want to create a complex swatch that consists of html code I can style and includes not just the attribute value (like size or color) but also the price and maybe the attribute unit like (cm, m, ...).

How would I do this?

The result would maybe look like this, imagine some sort of cable:

1m

$7

    ($7 per m)

3m

$18

    ($6 per m)

5m

$25

    ($5 per m)

These prices are set fix for each virtual product.


texts: Copy price attribute value into newPrice attribute

texts:
I have nearly 2000 items, I would like to copy 'price' attribute value to 'newPrice' attribute value for all the items, within table catalog_product_entity_decimal (I think this is the right table)

eg. attribute_id of price is 60, entity_id = 1 and value = 50

attribute_id   entity_id   value
60              1           50
60              2           56

newPrice - attribute_id = 75

Final Result:

attribute_id   entity_id      value
    60              1           50
    60              2           56
    75              1           50
    75              2           56

For the subsequent entity_id 1,2,3,4 and so on

SQL query from phpmyadmin? If this is the correct/safe way, what could be mysql query?

any other suggestion?

Thank you


texts: How to remove autofilling of meta descriptiion in Magento 1.9

texts:
For SEO purposes, I do not want meta descriptions and meta keywords filled in. I want them blank so Google will choose meta descriptions for search results.

How do I stop Magento from auto filling blank meta descriptions?


texts: How we can set a timer for shopping, let say user need to shop with in 10min other wise his cart will be expire, with in that 10 min the product stock will be reserved for that specific user.


texts: External image details getting added in order email template in Magento 2

texts:
I am trying to add product image in the sales order email template with overriding in the path

  /app/design/frontend/vendor/Mytheme/Magento_Sales/templates/email/items/order/default.phtml.

Code Written:

    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $_product = $objectManager->get('Magento\Catalog\Model\Product')->load($_item->getProductId());
    $imageHelper  = $objectManager->get('\Magento\Catalog\Helper\Image');
    $image_url = $imageHelper->init($_product, 'product_thumbnail_image')->setImageFile($_product->getFile())->resize(100, 100)->getUrl();?>
<img src="<?php echo $image_url;?>"/>

Unfortunately, I am getting this in the mail. originals source is overridden by src which is getting generated. Not able to get an image in the mail.

Inspected element:

<img data-imagetype="External" **src="/actions/ei?u=http%3A%2F%2F...%3A1080%2FQPwebstore%2Fpub%2Fmedia%2Fcatalog%2Fproduct%2Fb%2Fa%2Fballpen_with_stylus1.jpg&amp;d=2019-04-16T13%3A15%3A46.063Z"**
 **originalsrc="http://......./pub/media/catalog/product/b/a/ballpen_with_stylus1.jpg"** data-connectorsauthtoken="1" data-imageproxyendpoint="/actions/ei" data-imageproxyid="" class="x_product-image-photo" width="200" height="200" alt="Stylus Pen" style="border:0; height:auto; line-height:100%; outline:none; text-decoration:none">

Kindly help me to resolve this issue..


texts: Magento 2 custom shipping charges based on Category

texts:
i was facing hard-time while creating a custom shipping charges.there is a demand that the shipping charges will be based on categories I.E different shipping charges applicable for different categories  product.

till now i have not found any luck on this. is there anyone who have already tried that and has some knowledge regarding this will be a great help thank you!


texts: Migrating data to a new and clean installation in version 2.x

texts:
I would like to migrate all my Magento data to a new installation on version 2.3. We are currently on version 2.2.0 which has the Webkul Marketplace Extension.

Basically, all I want to extract from the current installation is
1. Vendor data from the Marketplace Extension
2. Customer data + orders
3. Users and roles
4. Products and all related data

Is there a way I can extract this from my database or from magento itself?


texts:
When trying to create a product, the error "The value of attribute "SKU" must be unique" shows, but there is no product with this SKU on the products list.

Any ideas what's going on here?


texts:
I am looking to add an image upload when creating/editing admin users.
I am trying to figure out the best way to do this.
I have already added a custom text field to this form using a plugin.
Magento\User\Block\User\Edit\Tab\Main
Here is the code for the modlue
db_schema.xml
<?xml version="1.0"?>
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
    <table name="admin_user">
        <column xsi:type="varchar" name="supplier_name" nullable="true" comment="Supplier Name"/>
        <column xsi:type="varchar" name="supplier_logo" nullable="true" comment="Supplier Logo"/>
    </table>
</schema>

di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
        <type name="Magento\User\Block\User\Edit\Tab\Main">
                <plugin name="admin_user_field" type="Mage\ExtendUsers\Plugin\Block\Adminhtml\User\Edit\Tab\Main" sortOrder="1"/>
        </type>
</config>

Main.php
<?php

namespace Mage\ExtendUsers\Plugin\Block\Adminhtml\User\Edit\Tab;

class Main
{
    /** @var \Magento\Framework\Registry  */
    protected $_coreRegistry;

    public function __construct(\Magento\Framework\Registry $registry)
    {
        $this->_coreRegistry = $registry;
    }

    /**
     * Get form HTML
     *
     * @return string
     */
    public function aroundGetFormHtml(
        \Magento\User\Block\User\Edit\Tab\Main $subject,
        \Closure $proceed
    ) {
        /** @var $model \Magento\User\Model\User */
        $model = $this->_coreRegistry->registry('permissions_user');

        $form = $subject->getForm();
        if (is_object($form)) {
            $fieldset = $form->addFieldset('amdin_supplier_name', ['legend' => __('Supplier')]);
            $fieldset->addField(
                'supplier_name',
                'text',
                [
                    'name' => 'supplier_name',
                    'label' => __('Supplier Name'),
                    'id' => 'supplier_name',
                    'title' => __('supplier_name'),
                    'required' => false
                ]
            );

            $fieldset->addField(
                'supplier_logo',
                'image',
                [
                    'name'  => 'supplier_logo',
                    'label' => __('Supplier Logo'),
                    'title' => __('Supplier Logo'),
                    'required'  => false,
                ]
            );

            $form->addValues(
                [
                    'supplier_name' => $model->getData('supplier_name'),
                    'supplier_logo' => $model->getData('supplier_logo'),
                ]
            );
            $subject->setForm($form);
        }
        return $proceed();
    }
}

When I save the form it save the data for both fields in the database.
I was looking into creating an event on admin_user_save_before to grab the upload information.
Is this the best way to go about it or is there a better way.
Another issue i am facing is that once and image has been added and I try and edit the form and resave I get this error message.
Exception #0 (Exception): Notice: Array to string conversion in /var/www/html/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php on line 3105

Which then disappears if I remove the image upload field.


texts:
when I try to save a product I get this error:

Fatal error: Call to undefined method Magento_Db_Adapter_Pdo_Mysql::dropTemporaryTable() in /magento/app/code/core/Mage/CatalogRule/Model/Action/Index/Refresh.php on line 149.

The product is correctly saved but it hangs on this error and it don’t redirect to success page and shows this fatal error.

Please help !!


texts: How to call a 3rd party API from a controller? Magento 2

texts:
I built a custom module. Its admin tables with CRUD functionality. I am putting a new button on the grid via the Ui_component listing XML file. When this button gets clicked I want to call a 3rd party API to load data into the current table.

This is the code for the button:

<item name="refresh" xsi:type="array">
            <item name="name" xsi:type="string">add</item>
            <item name="label" xsi:type="string" translate="true">refresh</item>
            <item name="class" xsi:type="string">primary</item>
            <item name="url" xsi:type="string">*/*/refreshAction</item>
        </item>

The refraction controller is where I need help with the code to make the API call. For now, I just want to echo out the response, once I get the API call to return a successful response I will deal with actually saving the data to the table.
The code I have now that's returning a 500 internal server error looks like this:

public function execute()
{
 $this->_curl->get('https://online.jil.com/api/index.aspx?action=GetAllDIDs');
    $response = $this->_curl->getBody();
    echo $response;
}


texts: Magento 2 set email template for customer_account_information_change_email_template

texts:
I've been building on a Magento 2.1.7 store for a while now and changed all Magento email templates using the built-in editor, however, I can't seem to find the config value for which template to use when a customer changes its email address, I've looked around in every store config page possible.

All I can see is the value being created in vendor/magento/module-customer/etc/config.xml:30

Does anybody know how to set this template in the store configuration?

Thanks in advance!


texts:
I  want run a magento function that would run at every hour , i am written code in config.xml but i did not working.here the code in config.xml

<crontab>
            <jobs>
                <stockalert_autosend>
                <schedule><cron_expr>* */1 * * *</cron_expr></schedule>
                <run><model>stockalert/observer::backinstock</model></run>
            </stockalert_autosend>
            </jobs>
        </crontab>

I assume that there issue in  * */1 * * * Please help me


texts: Is there any free Page speed extension for magento

texts: kindly suggest me for page speed extension for magento. Because my magento website loading very slowing due to javascript and css codings


texts: How to get store information (e.g Store Base Url) of another store in a multi-store setup for Magento 2

texts:
I have multiple stores on my Magento 2 installation. So I have store 1 base url as http://mystore1.com and store 2 base url as http://mystore2.com. How do i get the base url of store 2 dynamically on a phtml file in store 1.

Note: $block->getBaseUrl() will only return the current store url. Is there a function like getBaseUrl of store id = 2 ?


texts: I am new to magento, please tell me How can I add a sorting option to my product listing page which will automatically calculate percentage discount using Special Price and Original Price and will sort according to the discount percentage


texts: Magento 2: What is difference between Cache Clean & Cache Flush?

texts:
In Magento 2 we have 2 commands

php bin/magento cache:flush
php bin/magento cache:clean

What's the exact difference between them? I'm generally using cache:flush. I never used cache:clean. So, when to use which command & in which situation?


texts: Pass array(values) in magento event driven programming

texts:
My custom module controller CartController.php's add method

public function addAction()
{
  ..........
  $params = array(); //array of important data
  //here in event dispatcher, along with other data, i want to send $params to my even observer
  Mage::dispatchEvent('checkout_cart_add_product_complete', array('product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse()),$params);
  ........
}

My custom module's config.xml

<config>
   ........
   <frontend>
     ........
     <events>
        <checkout_cart_add_product_complete>
            <observers>
                <frontendconfigurableproductmatrix>
                    <type>singleton</type>
                    <class>frontendconfigurableproductmatrix/observer</class>
                    <method>addToCartEvent</method>
                </frontendconfigurableproductmatrix>
            </observers>
        </checkout_cart_add_product_complete>
    </events>
    .........
 </frontend>
 ..........
</config>

Now, in my observer file Observer.php

 public function addToCartEvent($observer) {
       $params = Mage::app()->getFrontController()->getParams();
       print_r($params); //prints nothing

       //but this below is printing data
       $request = Mage::app()->getFrontController()->getRequest();
       print_r($request); //prints data
 }

How do i pass this $param array from my controllers addAction method event dispatcher to my observer file ?


texts: I need to export magento orders per product ( I want to get all the orders for a specific product) How could I do it?


texts: 413 Request Entity Too Large EM Slideshow

texts:
I'm using EM Slideshow Compact Extension, when i try to upload an image (1,10MB) and save the slideshow it gives me a 413 error: Request Entity Too Large.
Any solution?


texts: Magento 2 - Customer Attribute not being saved

texts:
Below is code for creating customer attribute.

namespace Namespace\Modulename\Setup;

use Magento\Customer\Model\Customer;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Customer\Setup\CustomerSetupFactory;
use Magento\Framework\Setup\ModuleDataSetupInterface;

class InstallData implements InstallDataInterface
{

    private $customerSetupFactory;

    /**
     * Constructor
     *
     * @param \Magento\Customer\Setup\CustomerSetupFactory $customerSetupFactory
     */
    public function __construct(
        CustomerSetupFactory $customerSetupFactory
    ) {
        $this->customerSetupFactory = $customerSetupFactory;
    }

    /**
     * {@inheritdoc}
     */
    public function install(
        ModuleDataSetupInterface $setup,
        ModuleContextInterface $context
    ) {

        $setup->startSetup();
        $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);

        $customerSetup->addAttribute(\Magento\Customer\Model\Customer::ENTITY, 'attribute_code', [
            'type' => 'text',
            'label' => 'Status',
            'input' => 'select',
            'source' => 'Namespace\Modulename\Model\Customer\Attribute\Source\AttributeData',
            'required' => false,
            'visible' => true,
            'position' => 333,
            'system' => false,
            'user_defined' => false,
            'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
            'backend' => ''
        ]);

        $attribute = $customerSetup->getEavConfig()->getAttribute('customer', 'attribute_code')
        ->addData(['used_in_forms' => [
                'customer_account_edit'
            ]
        ]);
        $attribute->save();

        //Your install script
    }
}

Attribute is displayed on customer edit page in admin but when I set value and save customer, data for custom attribute is not being saved.

Am I missing anything here?


texts: Update simple products with parent configurable product price

texts:
I am trying to update all my simple products linked to a configurable product with the configurable product price.

Note: I am not trying to update the configurable options with the parent price, but the linked products.

How can this be achieved?


texts: How to redirect to same or homepage after logged in?

texts:
I want to keep homepage or same page after customer logged in their account. Could anyone please tell where I have to change code in customer page. Please check my code:

<?php if( $isLoggedIn ) { ?>

    <a id="quick_sigup_link" style="positon:relative;" href="<?php echo $this->getUrl('customer/account/login'); ?>">
     Hello. User
     My Account


texts:
I want to check that user is logged in or not in order to hide add to cart button for guest users. I have created a module in which I have override addtocart.phtml file and added the below code:

<?php

$test = \Magento\Framework\App\ObjectManager::getInstance();
$context = $test->get('Magento\Framework\App\Http\Context');
$isLoggedInn = $context->getValue(\Magento\Customer\Model\Context::CONTEXT_AUTH);
?>

<?php if( $isLoggedInn ) : ?>

<?php echo "text"; ?>

<?php endif; ?>

It's working but is it a right approach because I have use object manager directly in phtml file.


texts: How to add third party API's to Magento 2?

texts:
I would like to add a third party API, that performs a http request when the user adds their car reg and the resulting returned ID can be matched to products on our DB.

I'm looking for any documentation or tutorials that show the right way to perform this in Magento 2?

Thanks.


texts: Create a Custom module that has a categories tree Magento 2

texts:
I am trying to create a module where the admin can add items in a tree like the when adding categories like this image.

Has someone created one I can work off or is there any resources out there I can't seem to find any?