texts: Sort products with most quantity first on product list page in Magento 2

texts:
I want to sort products with quantity in a way items with most quantity should be shown first and items with smaller quantity should be shown later.
here is a similar solution but it is for Magento 1. I tried to change it for M2 but not working yet.
https://magento.stackexchange.com/a/44639/67038
Edit:
I tried it in observer as:
Event name: <event name="catalog_block_product_list_collection">
Method:
public function execute(Observer $observer)
    {
        $collection = $observer->getEvent()->getData('collection');
        try {
                //$websiteId = 0;
            $websiteId = $this->_storeManager->getStore()->getWebsiteId();
        $stockId = 'stock_id';

            $collection->getSelect()->joinLeft(
                array('_inv' => $collection->getResource()->getTable('cataloginventory_stock_status')),
                "_inv.product_id = e.entity_id and _inv.website_id=$websiteId",
                array(
                    'qty'
                )
            );
            $collection->addExpressionAttributeToSelect('qty', 'IFNULL(_inv.qty,0)', array());
            $collection->getSelect()->reset('order');
            $collection->getSelect()->order('qty DESC');

        } catch (\Exception $e) {
                }
        return $this;
    }

But not working, any help will be appreciated.


texts: Create a simple extension which adds 1 field to the category

texts:
I need to create a very simple extension to add just one text field in the category on the backend and show it on the category view on the frontend.

What steps should I take?


texts: How to customise WYSIWYG editor in admin form - Magento 2

texts:
I need to add directionality : 'rtl' to WYSIWYG editor used in all admin forms (Product create/edit, category form).

How can I configure TinyMCE editor since the instruction provided here is not clear enough?

When looked into TinyMCE documentation, it has option like,

tinymce.init({
  selector: 'textarea',
  directionality : 'ltr'
});

Thanks in advance.


texts:
I am building a marketplace in Magento using a third party extension. We have our own products in addition to third party sellers products. Te sellers products are shipping based on a table rate. Our products will ship free. I want to set up a rule that will display the option for free shipping if all of the items in the cart are ours (ie: seller id = null) but if there is a product in the cart that has a seller id associated with it display that sellers table option. Right now, both free shipping and the table rate are showing in one page checkout in the shipping methods panel. What file is the best location to begin setting this up?

Edited to add:
Technically this could be as simple as just not showing the "Free Shipping" Option if there are items in the cart where seller id > 0. I'm just not sure where to accomplish that.


texts: Magento 2 : Where is product url key handled(crud) during product edit?

texts:
I'm debugging url rewrites in M2.

One can change the product url key in catalog/product/edit  in the Search Engine Optimization tab
I'm looking at Magento\Catalog\Controller\Adminhtml\Product\Save::execute yet I see nothing related to url keys.
Q: Who is in charge with of url_rewrites CURD? Where are url_rewrites handled during product update?


texts: Magento 2.2.6 : Authorize.net not working. Giving Below Error

texts:
Argument 1 passed to Magento\Authorizenet\Model\Directpost\Request::__construct() must be
  an instance of Magento\Framework\Intl\DateTimeFactory

This error is getting displayed when I am clicking on the place order button in Magento2.


texts: Get recently viewed products excluding particular product ID in Magento 2

texts:
I need to get recently viewed products for a customer in a product view but excluding the current product the customer is viewing. I have,

class Index extends Action
{
    protected $recentlyViewed;

    public function __construct(
        Context $context,
        \Magento\Reports\Block\Product\Viewed $recentlyViewed
    )
    {
        parent::__construct($context);
        $this->recentlyViewed = $recentlyViewed;
    }

    public function execute()
    {
        $recentProducts = $this->recentlyViewed->getItemsCollection()->getData();
    }
}

This $recentProducts returns particular number of recently viewed products based on the admin configuration. For example, if the limit of recent products is 5, this returns 5 products. But I need 5 products excluding current product.

How can I exclude a particular product by providing it's ID?

Thanks in advance.


texts:
I have a custom module in my magento website where I add products programmatically. I have the requirement to add tier prices to products and I'm using the following code for that.

$tierPrices = array(
                    'all_groups'    => '0',
                    'cust_group'    => '2',
                    'price_qty' => '2',
                    'price'   => $post['tprice'],
                    'website_id' => '1'
                 );
$product->setTierPrice($tierPrices);

This doesn't add tier prices as expected.

Edit

$product = Mage::getModel('catalog/product');
$product->setWebsiteIds(array(1))
        ->setAttributeSetId(14)
        ->setTypeId('simple')
        ->setWeight(0.50)
        ->setStatus(1)
        ->setTaxClassId(2)
        ->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE)
        ->setStockData(array(
                             'use_config_manage_stock' => 0,
                             'manage_stock'=>1,
                             'min_sale_qty'=>1,
                             'is_in_stock' => 1,
                             'qty' => 10000
                           )
                       )
        ->setCategoryIds(array(31));

        $sku =  strtolower($location)."-".str_replace(" ","-",strtolower($data))."-".$i;
        $product->setSku($sku)
                ->setName('test product')
                ->setPrice($post['price'])
                ->setDescription('Test Description')
                ->setShortDescription('description');

  $tierPrices = array(
                'all_groups'    => '0',
                'cust_group'    => '2',
                'price_qty' => '2',
                'price'   => $post['tprice'],
                'website_id' => '1'
             );
  $product->setTierPrice($tierPrices);

  $product->save();

A little help on this is highly appreciated.


texts: Fullpage-Caching and Magento\Customer\Model\Session in Magento 2

texts:
I would like to add a Block with different content when user is logged in or not. Content depends not on customer-data - just logged-in state.

class Grouped extends \Magento\GroupedProduct\Block\Product\View\Type\Grouped
{
    protected $customerSession;

    public function __construct(
       \Magento\Catalog\Block\Product\Context $context,
       \Magento\Framework\Stdlib\ArrayUtils $arrayUtils,
       array $data,
       \Magento\Customer\Model\Session $customerSession
    )
    {
        $this->_isScopePrivate = true;
        parent::__construct($context, $arrayUtils, $data);
        $this->customerSession = $customerSession;
    }

    public function isLoggedIn()
    {
        return $this->customerSession->isLoggedIn();
    }

}

In my phtml-File a just call $this->isLoggedIn() but it is always "false" when fullpage-cache is enabled.

How I could get information about customer-logged-in-state when fullpage cache is enabled on product-view page? How I prevent it from caching or adding two different caching-tags? (not-logged-in or logged-in) I believed in $this->_isScopePrivate but doesn't help..

Pricing, which depends on customer-group, works well on product-view page but don't find any informations why.


texts:
I try to fetch quote item collection and add some filter like this:

$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); // Instance of Object Manager
$newItem = $objectManager->create('Magento\Quote\Model\ResourceModel\Quote\Item\Collection')
          ->addFieldToFilter('quote_id',$data['quote_id'])
          ->addFieldToFilter('store_id',$data['store_id'])
          ->addFieldToFilter('qty',$data['qty'])
          ->addFieldToFilter('sku',$data['sku'])->getFirstItem();
echo "<pre>";print_r($newItem->getData());exit;

but i got an error like this:

  PHP Fatal error:  Uncaught Error: Call to a member function
  getStoreId() on null in
  /var/www/magento/vendor/magento/module-quote/Model/ResourceModel/Quote/Item/Collection.php:98


texts:
I have installed my module in a server in app/code folder and I executed

  bin/magento setup:upgrade

and

  bin/magento di:compile

and after I show this error:

The block is in Block folder.

I use it in front layout

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <referenceContainer name="before.body.end">
            <block class="Oct8ne\Oct8ne\Block\Oct8neJS" template="Oct8ne_Oct8ne::oct8nejs.phtml" name="oct8nejs" cacheable="false"/>
        </referenceContainer>
</page>

In localhost works fine. I tried to flush cache, recompile di, deploy static files, delete var folders... any idea?


texts:
I have read many blogs to understand some of the topics in Magento 2 but still not clear about them.

They are as follows

EAV
Dependency Injection

Could anyone please explain them shortly?

Thanks in advance.


texts:
Is it possible to prevent a customer (under some circumstances) from checking out? I know it is possible to disable checkout from System >> Configuration >> Sales >> Checkout >> Checkout Options >> Disable Onepage Checkout.

I want to know if there's a way to disable checkout for a particular customer.


texts: Magento 2 Account dashboard was messed up after installing magento2-category-sidebar

texts:
I have a problem with my account dashboard. I noticed lately after I installed the Sebwite magento2-category-sidebar extension in the site. If you have ideas please help me.

Here is the sample screenshot:

Thanks,
MazeStricks


texts: How to find Magento version using API (JSON specifically)

texts:
Using the JSON RestAPI, I need to do things slightly differently depending on the version of Magento due to as-yet un-fixed bugs (specifically https://github.com/magento/magento2/issues/18005).

I can find the major and minor version numbers here

https://{{url}}/magento_version

but that doesn't have the build number, and could (should) be disabled in production.

As I currently use the JSON API, I was hoping for something there already, but can't see anything.

(I acknowledge I could build a custom API endpoint, but at present that's a little out of my knowledge after scanning some articles that explain how it all works, plus I might not be able to install that on all the Magento sites I will integrate with.)

So, my question is, with legitimate API access, how can I determine the version of a Magento installation?


texts: Bundle Product Related Issue in Magento 2.1.12

texts: Bundle product is having any limit of add simple product?I was already add 55 products but i want more.Can it is possible?Please Help me.Thanks in advance


texts: Magento custom theme to default theme redirection issue

texts:
First of all I am explaining settings and scenario of my magento.

I have add a link ‘go to form’ on product view page and call my custom controller on click.
I add following code in my controller.

public function indexAction()
{
  $this->loadLayout();
  $block = $this->getLayout()->createBlock(
              'Mage_Core_Block_Template',
               mycompany.mylink,
               array(
               'template' => mycompany/mylinkform.phtml'
                )
         ) ->setData('varNameOne', 1')
           ->setData('varNameTwo', 2');

  $this->getLayout()->getBlock('content')->append($block);
  $this->_initLayoutMessages('core/session');
  $this->renderLayout();
}

On frontend, theme is look like custom theme. If I start template path I can see path like: frontend/default/theme name/..
But on backend theme name is set as ‘Default’.

Now, issue is: ‘go to form’ is open in custom theme which has a path like frontend/default/theme name/template/....    But when I click on this link, my form is open in default theme which has a path like frontend/default/default/template/…

So why this is happening? When I click on link, my form must open in custom theme but I will redirected to default theme and open over there.

I have add .phtml file of form in both the theme.

Please help me on this.

This is a back end theme setting.


texts:
I want to have Category navigation - so instead of going to the product pages user can navigate using the category images and subcategories shown in a grid and also shows the left navigation on same page and then get to the product listing

I have read some posts here and there is also a module however i don't know how to install and use it on our custom theme.

This is link to the module :

https://github.com/pratikmage/magento2-subcategory

I have looked for guides but there are mostly for Magento 1

It's a very common requirement on any eCommerce site and all have it. Also i need this to be loading automatically as we have hundreds of categories and subcategories.


texts:
I want to create product finder page same as listing of products in catalog page.
Here I have product listing page:
In this page I have filter and products as per chosen category.

Now I want the page like here:

So I think I have to create duplicate listing page of catalog module and put only simple page where all sidebar data will display without any products.

Please suggest how to create Product Finder Page?


texts: Moving Block on product page Magento 2.2.7

texts:
I fairly new to this but
I am trying to move a brand logo on my product page from below the product title to below the gallery image.
Normally I would be able to achieve this using my themes
catalog_product_view.xml
and adding
<move element="element.name" destination="product.info.media.image" after="-"/>
However, I think, (I may be wrong) the extension i am using positions the logo from within .php file located within the extensions
Plugin/Catalog/Block/Product/View/BlockHtmlTitlePluginAbstract.php
    /**
 * Add Brand Label to Product Page
 *
 * @param \Magento\Theme\Block\Html\Title $original
 * @param $html
 * @return string
 */
public function afterToHtml(
    \Magento\Theme\Block\Html\Title $original,
    $html
) {
    $logoHtml = $this->generateLogoHtml();

    $html = str_replace('/h1>', '/h1>' . $logoHtml, $html);

    return $html;
}

If I'm correct and the brand logo is positioned from the .php file does anyone know how i would be able to reposition it below the gallery image?


texts: How can I remove js of disabled extensions in my js bundle?

texts:
I am not very deep into Magento, so I might just have missed something.
I am using the JS Bundling feature, and I've read there are quite some issues. As with many other people, the resulting bundle is huge.

I realize that it loads all scripts on every page. But I've noticed something else:
In my bundled js file I see JS Components loaded from e.g. "Temando_Shipping" - even though that plugin is disabled in my store.

How can that be? And how can I disable those plugins js being loaded?


texts: Transactional Email Templates Missing after Upgrade from 1.7 to 1.9

texts: I've recently upgraded my magento 1.7.0.2 to 1.9.2.0. Everything works fine, except when I go to system>transactional emails, I don't see any of my previously created templates. Also, when I click 'Add New Template', the load default template dropdown is empty and even the page is not loaded completely. Please suggest what went wrong here.


texts: Magento 2 error while adding new order status

texts:
I went under Stores -> Order Status -> Create New Status, and when inputting a Stautus Code and Status Label, I get the following error:

  Warning: Invalid argument supplied for foreach() in
  /home/fendow/public_html/vendor/magento/module-sales/Controller/Adminhtml/Order/Status/Save.php
  on line 32

Can someone please give me a hint as to what the reason for this might be?


texts: Magento 2.3 - Paypal express review not work

texts:
When I am on the paypal/express/review page after completed payment in website of paypal I see this type of error on Magento:
"Fatal error: Call to a member function getPayment() on null in vendor/magento/module-paypal/Block/Express/Review.php on line 266"

I saw that the $this->_quote method is to blame. It seems that this value always returns NULL and consequently generates the error.
I tried to create this function in Review.php
public function getQuoteInfo () {
return $this->_quote;
}

The result is always NULL.
Why doesn't Paypal initialize the quote object?
How can i do?
Thanks


texts: Disabling programmatically the flat catalog category not working

texts:
I have an import routine that needs to be run periodically to mass-import categories.

It processes a tree like structure of category data, and creates any categories that don't exist. The difficulty I face is that because flat catalog is enabled on the store, even after the category is created, it thinks it isn't as the index is set to manual.

I read to use the following when retrieving the category collection, to ensure the flat catalog is not used:

$categories = Mage::getModel('catalog/category', array('disable_flat' => true))
                    ->getCollection();

However, I can see that the returned resource is still a flat catalogue one - and my import again fails (it works if I disable the flat catalog in the admin area).

What can I do to resolve this issue?


texts:
On various social medias I've seen the URL http://packages.magento.com/ bandied about.  This appears to be a composer repository (using satis software to host the repository).

What's not clear is

Who runs the repository (i.e. eBay?  A third party?  A third party acting with eBay's blessing?)
How a user can (if at all) get a package listed in this repository
If this is for Magento 1 packages, Magento 2 packages, or both
If this is for Magento 1 packages, how the composer project should be setup to install the packages into Magento 1 (as Magento 1's module system isn't fully compatible with the defacto vendor/* standard)

Does anyone here have any information on the above?


texts: Checkout Form - How to wrap multiple elements in a class - Magento 2

texts:
How do you wrap two checkout form elements inside a div?

For example let's say I wanted to wrap these country and zip/postcode fields in a div with the class of example-class, how would I do this?

What I have tried

I tried to achieve this by adding them as children of <item name="shippingAddress" xsi:type="array"> but that just causes errors on the frontend. Although I did get a blank text input without a label inside .example-class there were errors on the frontend.

The error: Cannot read property 'indexedOptions' of undefined

This is my quick attempt:

Magento_Checkout/web/template/shipping-address/form.html

checkout_index_index.xml

<item name="example-for-adding-class" xsi:type="array">
    <item name="component" xsi:type="string">uiComponent</item>
    <item name="config" xsi:type="array">
        <item name="deps" xsi:type="array">
            <item name="0" xsi:type="string">checkoutProvider</item>
        </item>
    </item>
    <item name="displayArea" xsi:type="string">example-class</item>
    <item name="children" xsi:type="array">

        <item name="region" xsi:type="array">

            <item name="visible" xsi:type="boolean">false</item>
        </item>
        <item name="region_id" xsi:type="array">
            <item name="component" xsi:type="string">Magento_Ui/js/form/element/region</item>
            <item name="config" xsi:type="array">
                <item name="template" xsi:type="string">ui/form/field</item>
                <item name="elementTmpl" xsi:type="string">ui/form/element/select</item>
                <item name="customEntry" xsi:type="string">shippingAddress.region</item>
            </item>
            <item name="validation" xsi:type="array">
                <item name="required-entry" xsi:type="boolean">true</item>
            </item>

            <item name="filterBy" xsi:type="array">
                <item name="target" xsi:type="string"><![CDATA[${ $.provider }:${ $.parentScope }.country_id]]></item>
                <item name="field" xsi:type="string">country_id</item>
            </item>
        </item>
        <item name="postcode" xsi:type="array">

            <item name="component" xsi:type="string">Magento_Ui/js/form/element/post-code</item>
            <item name="sortOrder" xsi:type="string">2</item>
            <item name="validation" xsi:type="array">
                <item name="required-entry" xsi:type="string">true</item>
            </item>
        </item>
        <item name="country_id" xsi:type="array">
            <item name="sortOrder" xsi:type="string">1</item>
        </item>
    </item>
</item>

There has to be an easier way to do this, either I'm missing something or this is the definition of over-engineering. Adding a div over two elements should never be this difficult.


texts:
When I am trying to integrate instagram api, It is asking for access token and also I need the client ID.

When I tried to register the new client it is showing 'Registration Disabled' button instead of 'Register a new client' button.

https://prnt.sc/swbiy4


texts: Magento2 - UPS allowed methods not changing

texts:
I am trying to select a few allowed shipping methods under UPS in the Magento 2 Admin.

I tried selecting the ones I want (e.g. UPS Standard, UPS Three-Day Select, UPS Next Day Air, etc) by holding the CTRL button and clicking each one. The ones I want change blue, and then when I click away they turn grey like they are supposed to. But when I click Save Config, it reverts back to selecting all the UPS Allowed Methods.

How can I fix this?


texts: Magento 2 - How to display the quantity of each product in cart under the add to cart button in the product tile

texts:
I want to display the quantity of each product in cart under the add to cart button in the product tile.

How can we achieve below Figure ?


texts: Add more than 1 non category link to top nav Magento 2

texts:
I Have the following PHP code and I'm trying add more then 1 link to the to nav but the code only display "Test page" and doesn't show "Test page2". I'm assuming I've coded it wrong so anyone have any suggestions?

<?php
namespace testMod\navUpdate\Observer;
use Magento\Framework\Event\Observer as EventObserver;
use Magento\Framework\Data\Tree\Node;
use Magento\Framework\Event\ObserverInterface;
class Topmenu implements ObserverInterface
{

/**
 * @param EventObserver $observer
 * @return $this
 */
public function execute(EventObserver $observer)
{
    /** @var \Magento\Framework\Data\Tree\Node $menu */
    $menu = $observer->getMenu();
    $tree = $menu->getTree();
    $data = [
        'name'      => __('Test page'),
        'id'        => 'test-page',
        'url'       => 'test-page',
    ];
    $node = new Node($data, 'id', $tree, $menu);
    $menu->addChild($node);
    return $this;
}

public function execute2(EventObserver $observer)
    {
        /** @var \Magento\Framework\Data\Tree\Node $menu */
        $menu = $observer->getMenu();
        $tree = $menu->getTree();
        $data = [
            'name'      => __('Test page2'),
            'id'        => 'test-page2',
            'url'       => 'test-page2',
        ];
        $node = new Node($data, 'id', $tree, $menu);
        $menu->addChild($node);
        return $this;
    }

}

?>


texts: Filtering collection of sales/order model

texts:
I want collection of orders which belongs from customer_group_id = 4 or customer_group_id = 5.
I have applied following filter on collection.

->addFieldToFilter('customer_group_id',Mage::getSingleton('customer/session')->getCustomer()->getGroupId())

This will filter the current user's customer_group_id with database's customer_group_id.

But what i want is, I want to filter on customers those who has customer_group_id equal to either '4' or '5'.

My question is, How should i apply this addAttributeToFilter to achieve that collection.


texts: Magento Upgrade Error from v1.4.x tp v1.7.0.2

texts:
I'm getting the following error when try to upgrade my Magento v1.4.1.1 to v1.7.0.2. Getting the following error when perform an upgrade.

a:5:{i:0;s:229:"Error in file: "/home/username/public_html/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php" - SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0-31' for key 'UNQ_BY_CUSTOMER'";i:1;s:986:"#0 /home/username/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(645): Mage::exception('Mage_Core', 'Error in file: ...')
#1 /home/username/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(437): Mage_Core_Model_Resource_Setup->_modifyResourceDb('upgrade', '1.4.0.0.7', '1.6.2.0.1')
#2 /home/username/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(320): Mage_Core_Model_Resource_Setup->_upgradeResourceDb('1.4.0.0.7', '1.6.2.0.1')
#3 /home/username/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(235): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 /home/username/public_html/app/code/core/Mage/Core/Model/App.php(417): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 /home/username/public_html/app/code/core/Mage/Core/Model/App.php(343): Mage_Core_Model_App->_initModules()
#6 /home/username/public_html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#7 /home/username/public_html/index.php(87): Mage::run('', 'store')
#8 {main}";s:3:"url";s:1:"/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:7:"default";}

Can any one have the solution for that error?


texts: Magento2.4 move category.cms to destination content

texts:
I would like to move category.cms block from "category-view" to "columns".
I tried to do this:

mkdir -p app/design/frontend/Vendor/Namespace/Magento_Catalog/layout/
nano app/design/frontend/Vendor/Namespace/Magento_Catalog/layout/catalog_category_view.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <move element="category.cms" destination="content" after="-">
   </body>
</page>

Clear cache and refresh page.

Nothing change from my theme.
I use Magento 2.4 Luma
Thanks


texts: Magento 2.3.4 - How to set the countries allowed by store view?

texts:
On Magento 2.3.4, i am trying to configure the countries allowed by store views but nothing seems to work.

You can see that I have only configured the USA. But after clearing the cache, the list of countries doesn't seem to update on the frontend.

Do you have any idea?


texts: How do I know where to put a js file to override a core js file

texts:
I want to override the js file located in vendor/magento/module-rule/view/adminhtml/rules.js

I know I have to go in my app/design/adminhtml folder, but after that I'm lost.

Also is there something more to do than just adding the file there ?

Thanks.

EDIT: Tried this but it's not working : app/design/adminhtml/default/Magento_Rule/web/js/rules.js


texts: Magento 2.1: Add custom category attribute to topmenu classes

texts:
I have created a custom category attribute and it saves correctly in the database.

I am now trying to add this attribute's value to the topmenu.
So I have created Topmenu.php in my module (m4tthg0_catcolor) so I can override the _getMenuItemClasses. I have tried several ways to get the attribute value but it always return NULL:

namespace m4tthg0\catcolor\Block;
use Magento\Framework\DataObject\IdentityInterface;
use Magento\Framework\View\Element\Template;
use Magento\Framework\Data\TreeFactory;
use Magento\Framework\Data\Tree\Node;
use Magento\Framework\Data\Tree\NodeFactory;
/**
* Html page top menu block
*/

class Topmenu extends \Magento\Theme\Block\Html\Topmenu

{

protected function _getMenuItemClasses(\Magento\Framework\Data\Tree\Node $item)
{
    $classes = [];

    $classes[] = 'level' . $item->getLevel();
    $classes[] = $item->getPositionClass();

    if ($item->getIsFirst()) {
        $classes[] = 'first';
    }

    if ($item->getIsActive()) {
        $classes[] = 'active';
    } elseif ($item->getHasActive()) {
        $classes[] = 'has-active';
    }

    if ($item->getIsLast()) {
        $classes[] = 'last';
    }

    if ($item->getClass()) {
        $classes[] = $item->getClass();
    }

    if ($item->hasChildren()) {
        $classes[] = 'parent';
    }

    $classes [] =$item->getData('color_menu');

    return $classes;
 }
}

How would you do that ?

Magento version: 2.1CE


texts: I want to display services under shipping method (either existing or custom shipping method also fine) in Magento 2


texts: How add js and css on home page (slider) to Magento 2?

texts:
In Magento 1 I include js and css like this:

<action method="addJs"></action>
<action method="addCss"></action>

But in Magento 2 this not works.

How correct add masterslider.min.js and masterslider.css to Magento 2 (slider for home page)?
This html insert to home page (admin-panel):


texts: Are arguments of after plugin mandatory?

texts:
I am writing tiny plugin on Magento\Customer\Controller\Account\Edit:execute(). It's after one. I have just noticed that I am not using any arguments inside my method.

/**
 * Method modify redirection when changing password.
 *
 * @param \Magento\Customer\Controller\Account\Edit $subject.
 * @param \Magento\Framework\View\Result\Page $results
 *
 * @return \Magento\Framework\Controller\Result\Redirect
 */
public function afterExecute(MagentoEdit $subject, $results)
{
    $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
    /** @var $resultRedirect \Magento\Framework\Controller\Result\Redirect */
    return $resultRedirect->setUrl($this->redirect->getRefererUrl());
}

I have tested method with no arguments inserted and it has worked. Is it any mistake or I don't really need arguments in after plugins?


texts: Magento2 2.3.5 Saved Payment Methods still shown in customer dashboard navigation

texts:
I removed the Payment Agreements link succesfully using
''

But I still get a link to "Saved billing agreements"

Does sombody knows how to get rid of this link?

Using Magento 2.3.5-p1

DId not find something.

Please let me know.


texts: Magento Remove attribute filter from a category

texts:
I have this request:

It's possible to remove a filterable attribute from a category?

Example: I have 2 item with 2 attribute set. One item is in category A the other is in category B
These two products have one attribute in common in the attribute set(Eg: example Color).

I want that the filter on Color attribute appear for category A and not for category B.

I need to split the attribute (Eg: ‘color_a’, ‘color_b’) and make one filterable and the other none? Or there is a solution to set only one attribute?


texts: How Can I Add Custom Values(Like Tax) to my All Respective Products Cost at checkout

texts:
All my products have unique value "custom value", at checkout page, checkout price calculated by original price and customs value as my final price.

My Need:

1) sku: 1001, price: 100, custom price: 10, at checkout products value : 110;
2) sku: 1002, price: 200, custom price: 20, at checkout products value : 220;
3) sku: 1003, price: 300, custom price: 30, at checkout products value : 330;
4) sku: 1004, price: 400, custom price: 40, at checkout products value : 440;
5) sku: 1005, price: 500, custom price: 50, at checkout products value : 550;

My site consists 20k products.

Note: Tax not Possible Possible, because tax prepared only based on state and city, but mine every product has unique tax value. So Tax completely not possible

  How can I apply Individual products tax for my products?


texts: Copy sales_flat_quote_item table with foreign keys

texts:
I need to alter sales_flat_quote_item having large amount of data and do not want to hammer add to cart functionality. Then i have decided to alter table by copying data and structure of table.

Successfully copied indexes and foreign keys with following SQL

CREATE TABLE `sales_flat_quote_item_backup` LIKE `sales_flat_quote_item`;
  INSERT INTO `sales_flat_quote_item_backup` SELECT * FROM `sales_flat_quote_item`;

And foreign key is added in back up table

ALTER TABLE `sales_flat_quote_item_backup`
  ADD CONSTRAINT `newconstraint_bk` FOREIGN KEY (`parent_item_id`) REFERENCES `sales_flat_quote_item` (`item_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `newconstraint_bk` FOREIGN KEY (`product_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `newconstraint_bk` FOREIGN KEY (`quote_id`) REFERENCES `sales_flat_quote` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `newconstraint_bk` FOREIGN KEY (`store_id`) REFERENCES `core_store` (`store_id`) ON DELETE SET NULL ON UPDATE CASCADE;

But add to cart functionality stopped working after renaming table sales_flat_quote_item_backup to sales_flat_quote_item


texts:
I am trying to print an array in magento but it does not echo anything.
In the file

app/design/frontend/base/default/template/checkout/cart/shipping.phtml

at around line 87 there is a piece of code something like this

<?php foreach ($_rates as $_rate): ?>

When I try to output the contents of $_rates variable using

<?php echo "<pre>";print_r($_rates->getData());die;?>

I get an error stating Call to a member function getData() on array, I understood from this that $_rates variable is an array. So when I try to use print_r($_rates) to see the content of $_rates nothing is outputted on the screen, I just get a blank screen.

My question is if $_rates is an array then why I am not able to print it on the screen.


texts:
I know we can enable logging call stacks for all the users in Varien_Db_Adapter_Pdo_Mysql class by setting _logCallStack to true (in addition to $_debug true of course).

Is there a way we can we enable call stack for only certain IP, may be in index.php file?


texts:
I'm still learning magento and I have a custom module which will accept certain inputs and save those in an excel sheet. I wonder how I can tell my module to where the excel file should be saved.

I have googled a lot and found nothing except the programmatical way of saving an image.

A little help is greatly appreciated.


texts:
We need to apply the patch of "Authorize.net Direct Post Signature Key patch" in our Magento 2.1.5 version and current patch available for Magento 2.2.x, so is that possible to work with 2.1.5 without any issues?

Thanks


texts: Magento 2 SASS for modules on child themes

texts:
I want to change some styles in single module. I create own child theme for Snowdog and everything it's compiled by frontools.

Have you got some suggestion how i can do it?

Thanks.


texts: HTML block caching regularly is invalidated

texts:
I got a problem on a running magento site (CE 1.8.1.0), which got the BLOCK_HTML cache regulary invalidated (even without product/categories edit). The website was tested on 2 different environment without constating this caching issue, the main difference is that the final server is, in fact, two servers managed with load-balancing. They're plugged on the same database and got the /var folder and /media folder shared

My question is : is there any file generation outside /var and /var/cache that should be shared between the two servers ? After thinking of the issue, and if it's a consequence of the loadbalancing it should be something about files present on one server, but not the other. If it's not a consequence of the load-balancing i'm lost though.


texts: Magento 2 How to include custom library in controller

texts:
I have created custom extension with some library classes. I have placed the libraries in lib/internal/SSOSdk folder. I need to include one of the library class in my controller. I have used the below code but it gives Class not found error.

Here is my code

namespace Company\Sso\Controller\Login;

require_once('lib/internal/SSOSdk/SSO.php');

    class Login extends \Magento\Framework\App\Action\Action
    {
        private $resultPageFactory;

        private $scopeConfig;

        public $storeManager;

        public function __construct(
            \Magento\Framework\App\Action\Context $context,
            \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
            \Magento\Store\Model\StoreManagerInterface $storeManager,
            \Magento\Framework\View\Result\PageFactory $resultPageFactory
        ) {
            $this->resultPageFactory = $resultPageFactory;
            $this->scopeConfig = $scopeConfig;
            $this->storeManager = $storeManager;
            parent::__construct($context);
        }

         public function execute()
        {
            $apiUrl = 'test.com';
            $clientId = '123';
            $clientSecret = '456';

            $params = $_GET;

            $sso = new SSO($apiUrl, $clientId, $clientSecret);
            try {
                if($params['error']){
                    $sso->notifyJs(false, $params);
                }else{
                    $sso->notifyJs(true, $params);
                }
            } catch (Exception $e) {
                $sso->notifyJs(false, $e);
            }

        }
    }

SSO.php

class SSO {

    private $_clientId, $_clientSecret, $_hostUrl;

    public function __construct($hostUrl, $clientId, $clientSecret){
        $this->_hostUrl = $hostUrl;
        $this->_clientId = $clientId;
        $this->_clientSecret =$clientSecret;
    }

    public function setHostUrl($hostUrl){
        $this->_hostUrl = $hostUrl;
    }
    .......

}

How can I do this?


texts: Base images as first image, change positions in bulk - Magento 2.3.5

texts:
We have a large catalog (125K products), with a lot of products where the base image is positioned somewhere in the middle of the gallery.
The selection of base image itself is fine, this should be and remain the base image, we only need to change the position of this image in the gallery.
We know that we can manually change the sorting of the images and place this image in front of the gallery, but is there a way to do it in bulk for all products?
Something like a sql query, that change the position of the base image and place that one in front?
In the screenshots below you see the first, where the base image is in the middle of the gallery and the last image as it should be. Where the base image is placed as first in the gallery.
Before:

After:


texts: Magento 2 Order Email with Single Item Price

texts:
i was wondering how i can have in confirmation email the single item price

like in the image


texts:
I've recently launched a magento ce 1.8.1 store and noticed that slowdown in speed. So I checked on pingdom and noticed there's a long 'wait time' in loading an html/php page.

Hope someone can share some insights and provide some suggestions on this.

Does it have anything to do with the server? That file is only 25.9kB and it's seems to be the first thing/file the site attempts to connect and load when someone visits the site.

Any input would be appreciated. Thanks!


texts:
I'm running a Magento 2.X.X instance on a dedicated CentOS 7 server.

I'm trying to integrate the Linnworks API but it would seem it's a lot more complicated than I thought it would be.

In Linnworks

I went into Settings > Channel Integration
Clicked Add New and selected the Magneto 2 option
Checked autofilled form - all good so hit Step 2
Went into Magento Backend

In Magento

I went into System > Extensions > Integrations
I added my new Linnworks integration with following details:

Name: Linnworks
Callback URL: Copied from the Linnworks site
Identity Link URL: Copied from the Linnworks site

Went into the API tab and manually ticked every box
Hit Save and Activate

This is where the error comes up, it's just a plain-text webpage with this message:

  Something went wrong: "oauth_consumer_key" is required. Enter and try again, "oauth_signature" is required. Enter and try again, "oauth_signature_method" is required. Enter and try again, "oauth_nonce" is required. Enter and try again, "oauth_timestamp" is required. Enter and try again

I've tested this with a vanilla Magento install, no plugins, no additional code and the error persisted.

I did actually test another API (ClickAndDrop) on my local machine and dev server, and that all worked, which made me think it's something server-level. However, I raised a ticket and they made amendments but to no avail.

I'm not really quite sure how to resolve this error or how to even debug.

I've also tried selecting (on Linnworks side) OAuth Manual and Admin login.

Admin login doesn't work, and Magento2 doesn't generate the Access tokens for whatever reason. I was able to get the Access Token like this:

curl -X POST "https://my.store.co.uk/index.php/V1/integration/admin/token" -H "Content-Type: application/json" -d '{"username":"someUser", "password":"somePass"}'

but couldn't get the access token secret, so can't test fully that method.

How do I resolve?

Edit:

It's not a third-party module. It's default Magento 2 API behaviour that's not working o.O - I'm just using Linnworks as an example


texts:
How to add sales_flat_order to the collection ?

     {
        $collection = Mage::getResourceModel($this->_getCollectionClass());
  $collection->getSelect()->join('sales_flat_order_address',
            'main_table.entity_id = sales_flat_order_address.parent_id',
        array('telephone','city','postcode','country_id'))
        ->where("sales_flat_order_address.address_type =  'billing'");
        $this->setCollection($collection);
        return parent::_prepareCollection();

    }

        $this->addColumn('total_refunded', array(
    'header' => Mage::helper('sales')->__('Total rembourse'),
    'index' => 'total_refunded',
    'width' => '25px',
    'align' => 'center',
));

I want to have total_refunded column in my grid from sales_flat_order


texts: Magento 2.3, built in page_cache asked to be refreshed manually, can I automate this?

texts:
I'm running Magento 2.3, the built in page_cache asks to be refreshed manually, how can I automate this?

Should I use a Magento2 cron job?

I created this module, magento2-AutoRefreshCache, and made it available via composer cyberpunkspike/module-autorefreshcache.


texts: Include and compile custom.less file after removing the style-l and style-m css

texts:
I am new in magneto2. I am working on LUMA theme and I have to customize it. So my approach is that I am removing all the existing i.e. style-l.css and style-m.css by writing code in the default_head_blocks.xml file because my design does not match with the current theme structure.

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
   <head>
        <remove src="css/styles-m.css" />
        <remove src="css/styles-l.css" />
        <remove src="css/styles.css" />
   </head>
</page>

Now I want to create a custom.less file so that I can write my custom css code but don't know how to include and compile the less file now because earlier my custom.less file is coming inside the style-l.css file. But Now I have removed it. So my question is how to include and compile a custom.less file after removing the style-l.css and style-m.css.


texts: magento 1.9 How to cancel an order in "Payment review"

texts:
Sometimes an order gets stuck at "Payment review" status/state, and there is no way to cancel it through Magento. From magento I only can change them to "suspect fraud" status/state but I can't cancel them.

I can cancel the orders editing directly in the database the order in the tables sales_flat_order and sales_flat_order_grid.

Is there a way to do it directly with magento? Do I need to add by code a cancel button to the orders in this status/state?

Magento ver. 1.9.2.4


texts: Magento 2 : Language and currency default

texts:
I have create two custom field like language & currency while register customer has to enter that field.

After, login customer have to get pages in what language and currency he had entered in registration.

Thanks in advance


texts:
I am preparing for certification and I came across one of the questions and I wanted to confirm the options. I know option 4 is correct for sure, confused between 1 and 2. I know setup:upgrade does not clear Magento cache. any help will be appreciated
Question
You have to install a new module on the production environment. All the module is adding a new product attribute. You enabled maintenance mode, copied the module code, run bin/magento setup: upgrade and
disabled maintenance mode.
What two risks does this process pose? (Choose two.)

It will clean all caches which will cause performance degradation
The new attribute will be invisible on the storefront until the cache is cleaned manually
It will void all active sessions
It will clean static assets from the pub/static folder


texts:
I'm writing a custom indexer and I need to retrieve the product URL for different stores.

$product->setStoreId(2)->getProductUrl();

still returns the URL with the admin store (backoffice) in it.
Do you have an idea how I can retrieve the store specific product URL?


texts: what are the flat tables created by magento system while indexing?

texts:
How magento creates flat tables and what are the entities that are converted to flat table?

Can you list all the flat tables created by magento?
What are the events which lead to indexing required?


texts: Delete/Update Configurable Product from php

texts:
I am trying to delete a configurable product in my cart wiht shoppingCartProductRemove with Api SOAP v2, but the api return

  Please specify the product's option (s)

There is a way to add/remove/update the product from cart with the id of the cart (quoteId) with an PHP?

I have a mobile app where show your cart and then update/delete an product from the cart via php. I have the Configurable Product id, the quoteId, the attributesOfchild, and the childId.


texts: Miscallaneous Scripts Set in Config->General->Design not showing

texts:
Bit of a strange one.

I have put a script in the miscellaneous scripts section in
Configuration->General->Design, but it is not showing when I look at the page source. I have tried putting <script>code here</script> and just plain text, such as 12345, but when I refresh the website, it does not show in the page source.

I have refreshed caches through Magento admin etc. but it still just does not update. Tried logging out and back in, same thing. The text I enter shows in the database, so it is getting saved back, but just not showing on frontend.

Any ideas?


texts: I want to change breadcrumbs First I want get page title then breadcrumbs

texts:
I am trying to change my breadcrumbs in magento 2 but getting error with blank page. for example I am trying to do like this attachment.

   <?php if ($crumbs && is_array($crumbs)) : ?>

            <?php foreach ($crumbs as $crumbName => $crumbInfo) :?>
    <?php
            $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $title = $objectManager->get('Magento\Framework\View\Page\Title');
    print_r($title);

    ?>
                <li class="item <?php /* @escapeNotVerified */ echo $crumbName ?>">
                <?php if ($crumbInfo['link']) : ?>
                    <a href="<?php /* @escapeNotVerified */ echo $crumbInfo['link'] ?>" title="<?php echo $block->escapeHtml($crumbInfo['title']) ?>">
                        <?php echo $block->escapeHtml($crumbInfo['label']) ?>

                <?php elseif ($crumbInfo['last']) : ?>
                    <?php echo $block->escapeHtml($crumbInfo['label']) ?>
                <?php else: ?>
                    <?php echo $block->escapeHtml($crumbInfo['label']) ?>
                <?php endif; ?>

            <?php endforeach; ?>


texts: What is Mage_Catalog_Block_Product ? Is it the path of price.phtml?

texts:
I need to call $this->getPriceHtml($_product, true); to my newly created block.

I called the product image, name and etc... but I didn't able to call the price.

Here is the code.

<?php
$manufacturer = Mage::registry('current_product')->getManufacturer();

$productCollection = Mage::getModel('catalog/product')->getCollection()
    ->addAttributeToSelect('*')
    ->addAttributeToFilter('manufacturer', $manufacturer);

/** I have tried with this**/
$productCollection = new Mage_Catalog_Block_Product_Abstract;

$productCollection->getSelect()->order('RAND()');
$productCollection->getSelect()->limit(5);

if ($productCollection->getSize() > 0) {
    foreach ($productCollection as $_product):
        ?>

            <a href="<?php echo $_product->getProductUrl() ?>"
               title="<?php echo $this->htmlEscape($_product->getName()) ?>" class="product-image"><img
                    src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail')->resize(228) ?>"
                    width="228" height="228" alt="<?php echo $this->htmlEscape($_product->getName()) ?>"/>

<a
                        href="<?php echo $_product->getProductUrl() ?>"><?php echo $this->htmlEscape($_product->getName()) ?>

                <?php
                $merchant_name = $_product->getAttributeText('merchant_name');
                if ($merchant_name) {
                    ?>

by <?php echo $merchant_name; ?>

                <?php } else if ($_product->getIsEbayaffiliate()) { ?>

by eBay

                <?php } else { ?>

by Home Done

                <?php } ?>

            /** I have tried with this**/
            $this->getPriceHtml($_product, true);

        <?php
    endforeach;
} else {
    echo "There are no products matching the selection";
}
?>

I think I am doing something wrong the class $productCollection = new Mage_Catalog_Block_Product_Abstract;

Any suggestions would be appreciated.


texts: Magento 2: Hide Admin Attributes Based on other Attribute's Value

texts:
I've created some custom yes/no Customer Attributes in the admin area. Now I'm looking to hide some attribute fields if these are set to no

For example, I have a yes/no attribute called branding_enable, if set to no I want to hide the multi select field branding_type right below it:


texts: URL key for specified store already exists

texts:
Using the following command twice fails:

curl -X POST -H "Authorization: Bearer XXXXX" -H "Content-Type:     application/json" -H "Cache-Control: no-cache" -d '{
"category": {
    "includeInMenu": true,
    "name": "AB",
    "id": 0,
    "isActive": true,
    "parentId": 0
}
}' "http://localhost/rest/V1/categories"

Even though I tried changing the "name" field.

Any Idea?


texts: not able to send email with email template

texts:
$emailTemplate  = Mage::getModel('core/email_template')
                        ->loadDefault('test_template');

$emailTemplateVariables = array();
 $emailTemplateVariables['test'] = 'Branko';
 $emailTemplateVariables['name'] = 'Ajzele';
 $emailTemplateVariables['reviewurl'] = Mage::getUrl('test/index/review');

echo $processedTemplate = $emailTemplate->getProcessedTemplate($emailTemplateVariables);

$emailTemplate->send('test@gmail.com','John Doe', $emailTemplateVariables);

output echo

It is time to review Branko

Hi Ajzele

Click this Make a Review

error

2015-06-17T10:17:10+00:00 ERR (3):
exception 'Exception' with message 'This letter cannot be sent.' in /var/www/servicecenters/app/code/local/Aschroder/SMTPPro/Model/Email/Template.php:40


texts:
I want to update some tier prices of a product based on a calculation I run. Basically it is printing costs, depending on a price per page, compared to some fixed prices.

I am using the following code to retrieve the old tier prices, do my calculations and replace some prices with the new price:

# price for digital printing: 0,066 Euro/per page
define('PPP', 0.066);

# $id is set outside of this, it's a valid product ID
$product = Mage::getModel("catalog/product")->load($id);
$data = $product->getData();
$_tierPrices = Mage::getResourceModel('catalog/product_attribute_backend_tierprice')->loadPriceData($id, Mage::app()->getWebsite()->getId());

$dpp = $data['page_count'] * PPP;

$_tierPricesNew = array();

foreach ($_tierPrices as $price) {
    if ($price['price'] > $dpp) {
        $price['price'] = $dpp;
    }

    $price['website'] = '0';
    $price['customer_group_id'] = '0';

    $_tierPricesNew[] = $price;
}

echo '<pre>';
print_r($_tierPricesNew);

The result of this, the content of $_tierPricesNew, looks fine to me:

Array
(
    [0] => Array
        (
            [price_id] => 2342
            [website_id] => 0
            [all_groups] => 1
            [cust_group] => 0
            [price] => 26.4
            [price_qty] => 1.0000
            [website] => 0
            [customer_group_id] => 0
        )

    [1] => Array
        (
            [price_id] => 2343
            [website_id] => 0
            [all_groups] => 1
            [cust_group] => 0
            [price] => 26.4
            [price_qty] => 5.0000
            [website] => 0
            [customer_group_id] => 0
        )

[...]

I am not sure about the additional parameters "website" and "customer_group_id" but they will probably not hurt if present.

When trying to update the prices I run this code:

$soap = new SoapClient('https://magento.host/api/v2_soap/?wsdl=1');
$session = $soap->login('my_user', 'api_key');

$res = $soap->catalogProductAttributeTierPriceUpdate($session, $id, $price);

$soap->endSession($session);

This is basically the example from the documentation.

And while I can obtain a session ID, so login seems to work, but the result of $res is always empty.

Any ideas why this happens? Or how I can debug this?


texts: How do I remove the "Learn More" verbiage next to each product, yet still allow the user to click on the image to go to the product details page?


texts: Keep compatibility with Magento 2.2 Community when using Magento_AsynchronousOperations module

texts:
We are implementing async operations on our Magento 2 module.
Given that the module we are using is Magento_AsynchronousOperations and is only available on Magento 2.2 Enterprise and 2.3 versions, how can we make our code backward compatible with Magento 2.2 Community Edition?

The first issue we are running into is that setup:di:compile fails since we don't have the classes on Magento 2.2 Community

We had two ideas in mind

1 - Use ModuleManager to check if the module is enabled.

By removing all use statements from the class and using the module manager to check if the module is enabled, we built an if-else clause to load the dependencies after the class has been instantiated. e.g.:

<?php

namespace MyModule\Services;

use Magento\Framework\App\ObjectManager;
use Magento\Framework\Module\Manager;

class BulkOperation
{

    const ASYNC_MODULE = "Magento_AsynchronousOperations";

    private $manager;
    private $bulkManagement;
    private $operationFactory;

    public function __construct(
        Manager $manager
    )
    {
        $this->manager = $manager;
    }

    public function canUseAsyncOps()
    {
        if ($this->manager->isEnabled(self::ASYNC_MODULE)) {
            $this->bulkManagement = ObjectManager::getInstance()
                ->get(\Magento\Framework\Bulk\BulkManagementInterface::class);
            $this->operationFactory = ObjectManager::getInstance()
                ->get(\Magento\AsynchronousOperations\Api\Data\OperationInterfaceFactory::class);
            return true;
        }
        return false;
    }
}

However, we want to avoid using the object manager.

2 - Use class_exists if checks and create interfaces to be DI'ed

<?php
namespace MyModule\Services;

if (\class_exists('\Magento\Framework\Bulk\BulkManagementInterface')
    && \class_exists('Magento\AsynchronousOperations\Api\Data\OperationInterface')
    && \class_exists('Magento\AsynchronousOperations\Api\Data\OperationInterfaceFactory')
) {
    interface CustomBulkInterface extends BulkManagementInterface {}
    interface CustomOperationInterface extends OperationInterface {}
    interface CustomOperationInterfaceFactory extends OperationInterfaceFactory {}
} else {
    interface CustomBulkInterface {}
    interface CustomOperationInterface {}
    interface CustomOperationInterfaceFactory {}
}

class BulkOperation
{

    private $customBulk;
    private $customOperation;
    private $customOperationInterfaceFactory;

    public function __construct(
        CustomBulkInterface $customBulk,
        CustomOperationInterface $customOperation,
        CustomOperationInterfaceFactory $customOperationInterfaceFactory
    ) {
        $this->customBulk = $customBulk;
        $this->customOperation = $customOperation;
        $this->customOperationInterfaceFactory = $customOperationInterfaceFactory;
    }

}

Does anybody has another possible solution in mind?


texts: How to override private function in Model (Magento-2)

texts:
My di.xml file

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Customer\Model\ResourceModel\AddressRepository" type="Maha\CreateLastname\Model\ResourceModel\AddressRepository" />
</config>

AddressRepository.php file(override model file)

<?php
    namespace Maha\CreateLastname\Model\ResourceModel;
    class AddressRepository extends \Magento\Customer\Model\ResourceModel\AddressRepository
    {
        private function _validate(CustomerAddressModel $customerAddressModel)  {
            echo "Model Rewrite Working";
            die();
        }
    }

I want override the private function in this code. What can I do? I want to change anything in my code


texts: How to load layout of custom action in customer account controller

texts:
I created new action in customer account controller

app/code/core/Mage/Customer/controllers/AccountController.php

public function createotpAction()
    {
         $this->loadLayout();
          $this->renderLayout();
    }

define layout

app/design/frontend/default/default/layout/local.xml
< ?xml version="1.0"?>
<layout version="0.1.0">
<customer_account_createotp>
    <reference name="content">
            <block type="core/template" name="customer_form_otp" template="customer/form/otp.phtml">
        </reference>
</customer_account_createotp>
</layout>

define content with phtml

app/design/frontend/base/default/template/customer/form/otp.phtml
<?php
    echo 'hello';
?>

when i enter url

magento/customer/account/createotp/

in display theme page with blank content

can anyone help me to solve this issue
Thanks in advance for help


texts: How to get Customer collection that has subscribed to newsletter in Magento 2

texts: I want to retrieve the customer collection that has subscribed to the newsletter, i see this solution but this one is for Magento 1.9 , how can i achieve this in Magento 2?


texts:
I work on a multi store website <=> One website for 2 stores. (Actually I have more websites but it's irrelevant).
Each store have his own default category and categories.
So as Store A has default root Cat id = 2 / And the category 43 (path 2/43).
So as Store B has default root Cat id = 105 / And the category 116 (path 105/116).
Theses categories are well appearing in BO and the ids are correct.
But now I'm getting trouble trying to get the categories.
I'm under the store B, if I'm doing $this->_categoryRepo->get(43) Then I'm getting the error : No entity with id 43.
My guess is that the repository being loaded in the store B he only load the categories from his own store (and this is why he don't know the category 43). But I'm not sure at all. And even if this is my issue, I don't know how I can fix it.
EDIT : I end up figuring he is looking the the id in the flat category store and obviously the id is not there. So is magento 2 multi store broken for cart ? :O


texts:
I'm trying to send a form from a modal and also an image from that form.
the form_data works fine with only serialize(), but I need to attach the image to data, so I did this:
   click: function (data) {
                    var form_data = new FormData();
                    var form = $("#bss-refund-form").serialize();

                    form_data.append('form', form);

                    $.each($('#evidence')[0].files, function(i, file) {
                        form_data.append('evidence', file);
                       });

                    if($('#bss-refund-form').valid()) {

                        $.ajax({
                            showLoader: true,
                            url: url,
                            type: 'POST',
                            data: form_data,
                            processData: false,
                            contentType: false
                        })
                            .done(function () {
                                $("#bss-refund-modal").modal('closeModal');
                                $("#bss-refund-form")[0].reset();
                                location.reload(true);
                                console.log("ok" + form_data);

                            })
                            .fail(function () {
                                $("#bss-refund-modal").modal('closeModal');
                                console.log("bad" + form_data);
                            });
                    }
                }

in the Controller here is the form_key validation.
if (!$this->formKeyValidator->validate($this->getRequest())) {
            $this->messageManager->addErrorMessage("Invalid request!");
            return $resultRedirect->setPath('customer/account/');
        }


texts: Magento 2 in production mode use Dynamic/Developer factory?

texts:
I tried to search deeper in Magento 2 code generation process and found some points, which confused me.
I use Magento v2.0.1-ce in production mode.
Firstly, I found strange dependency in Magento/Framework/App/ObjectManagerFactory.php:120

$definitions = $definitionFactory->createClassDefinition($deploymentConfig->get('definitions'));

I looked in console command setup:config:set help list and found only '--definition-format' parameter. I set it and got

'definition' => array ('format' => 'serialized',),

node in env.php. But it isn't requested param, so $deploymentConfig still return null.
The case in, that without this param, Magento 2 add Code Generation Autoload in autoload's chain.

public function createClassDefinition($definitions = false)
{
    if ($definitions) {
        if (is_string($definitions)) {
            $definitions = $this->_unpack($definitions);
        }
        $definitionModel = self::$definitionClasses[$this->_definitionFormat];
        $result = new $definitionModel($definitions);
    } else {
        $autoloader = new \Magento\Framework\Code\Generator\Autoloader($this->getCodeGenerator());
        spl_autoload_register([$autoloader, 'load']);

        $result = new Runtime();
    }
    return $result;
}

So, question is: what is 'definitions' param in configs and in what way I should set it? Or it is OK, that Magento 2 still use Code Generator Autoload in production mode? Finally, on what depend this param?
Secondly, after switch on production mode, Magento 2 called 'setup:di:compile-multi-tenant' and I found, that file 'global.ser' doesn't generate with this command. As I understand, Magento 2 use this file for determination actual environment mode:
Magento/Framework/App/ObjectManagerFactory.php:126

$env =  $enFactory->createEnvironment();

\Magento\Framework\App\EnvironmentFactory::createEnvironment

public function createEnvironment()
{
    switch ($this->getMode()) {
        case Compiled::MODE:
            return new Compiled($this);
            break;
        default:
            return new Developer($this);
    }
}

\Magento\Framework\App\EnvironmentFactory::getMode

const AREA_GLOBAL = 'global';

private function getMode()
{
    if (file_exists(ConfigLoader\Compiled::getFilePath(Area::AREA_GLOBAL))) {
        return Compiled::MODE;
    }

    return Developer::MODE;
}

\Magento\Framework\App\ObjectManager\ConfigLoader\Compiled::getFilePath

public static function getFilePath($area)
{
    return BP . '/var/di/' . $area . '.ser';
}

On environment depend ObjectManager factory and configs. So, after code generation via 'setup:di:compile-multi-tenant' Magento Object Manager will still work in developer mode?


texts: How to make Wish List items not disappear after customer orders

texts:
I am trying to figure out how to get the customer wish list to KEEP the items in the wish list after the customer puts them in their cart / orders so they can order them again later as well.

Anyone know the file I would edit to do this (ie. comment out the part where it takes the product out of the wish list if it is put in the shopping cart)? or would something like Amasty Favorite Products extension be best?

Thanks.


texts:
My Magento installation is configured to show products regardless of stock (System -> Configuration -> Inventory -> Display Out of Stock Products).

Is it also possible to make products order-able regardless of stock? Basically completely ignoring stock.


texts: How to get widget parameter data in code block

texts:
I want to get parameter's data from widget configuration in Block class.

https://devdocs.magento.com/guides/v2.3/ext-best-practices/tutorials/custom-widget.html

as we know from article, we can get parameter data in phtml file

$block->getData('title')

but how we can get the parameter data in Block class?

Im looking for something like this :

namespace OrangeCompany\Learning\Block\Widget;

use Magento\Framework\View\Element\Template;
use Magento\Widget\Block\BlockInterface;

class Test extends Template implements BlockInterface
{
    protected $_template = "widget/test.phtml";
    $title = $this->getData('title'); // Im looking for something like this
}

is it possible?


texts: Which Payment Methods meets payment security standard?

texts:
Which Payment methods fulfill payment security standard(PCI Compliance)?

Authorize.net
Authorize.net Direct Post
Saved CC
Paypal Express Checkout
Paypal Payment Gateway
Paypal All in one
Ogone
Sage Pay
Ogone Direct


texts: How to skip checkout step & shipping address magento 2

texts: I  want that customer  that belong to group 1 pass his order without filling the information of shipping address so how to proceed please


texts: How to mass update custom dropdown customer attribute to all customers? PHP or SQL

texts:
I created a new customer attribute (Drop Down) and added it to the registration form.

Attribute details found in eav_attribute table:

Everything work as expected, attribute is added to the customer when new account is registered or an existing account was edited and the attribute was added. I can find that in the table customer_entity_int:

Now, I have about 90,000 customers and I need to set a value of this attribute.

How can I update all the customers custom drop down attribute with the above value? Any method would suit me, PHP or SQL.


texts:
How can I get current url without utm parameters for example? I need this in phtml templates.
Thank you.

EDIT

EXAMPLE:

From url

www.example.com/post?utm_source=google&utm_medium=cpc&utm_campaign=campaign

I need to get only

www.example.com/post


texts: How to get grand total without tax in Magento2 shopping cart page?

texts:
Hi please help me on this it's little urgent thanks in advance,

How to get grand total without tax in Magento2 shopping cart page

let me explain it,
i have added product in backend with price : 10 rs ( inclusive of tax 10 % manually calculated from my side ) ,
tax class : 10% tax
so tax is 1rs for that product,
now i need in checkout page & in cart page should look like ;

Subtotal : 10 rs

tax ( 10% ) : 1rs

Grand total : 10 Rs

pls help me in th


texts: Error installing Magento 2.3.2: An abstract factory could not create an instance of magentoframeworkencryptionencryptor

texts:
I am installing magento 2 via a docker image :

  quay.io/alexcheng1982/apache2-php7:7.2.12

I keep getting this message:

 An abstract factory could not create an instance of
magentoframeworkencryptionencryptor(alias:

Magento\Framework\Encryption\Encryptor).

I understand from this question that the issue is caused by not having php-libsodium installed in my apache image

Consequently,following this comment, I added libsodium to the image:

I.e ;

RUN apt-get update -y
RUN apt-get install libsodium-dev -y
RUN docker-php-ext-install sodium

However I am still getting the error.

I checked my phpinfo() and indeed sodium has been added:

PHPINFO PAGE;

     sodium
sodium support  enabled
libsodium headers version   1.0.8
libsodium library version   1.0.8

Two question:

Is this indeed the cause of the problem?

If so, could the reason for the failure be that I did not install the latest version of libsodium. I note from the other question that version 1.0.17 was installed and this seemed to do the trick.

the version I installed is: 1.0.8

this is how i installed version 1.0.8

RUN apt-get update -y
    RUN apt-get install libsodium-dev -y
    RUN docker-php-ext-install sodium

is there a way to install a later version ?


texts:
In my store > main category filters are ok (type, size, price), but when access by subcategory, appears only the filter (type product). I need the same filters appear in all categories / subcategories.

What's the problem and how an i fixed it?


texts:
I want to use string functions and do not depend on severs configuration in terms of overloading and default char-set.

Say,  when I call strtoupper($param) it should be mb_strtoupper($param, 'UTF-8') in many cases.

This is definitely the framework responsibility.
But I can't find the right wrapper in M2.

There are some functions in
\Magento\Framework\Stdlib\StringUtils $string
but not all.

M2 core code sometimes calls mb_
\vendor\magento\module-dhl\Model\Carrier.php
\vendor\magento\module-catalog-import-export\Model\Import\Product.php
sometimes iconv_
\vendor\magento\module-paypal\Model\Report\Settlement.php

What is the right and recommended approach?


texts:
I would like to override (call the below model file from my custom module called Demo_Customprice

/vendor/magento/module-catalog/Model/Product/Option/Value.php

How could we achieve this?


texts: pass variable from ajaxcontroller to block class

texts:
hi i have an AjaxController

<?
class TEST_Productstab_AjaxController extends Mage_Core_Controller_Front_Action {

    public function indexAction() {

        $type = $this->getRequest()->getParam('type');
        $cat = $this->getRequest()->getParam('cat');

        //i have to pass $type and $cat to block class, anything like setData($type), so i can save the value?

    }
}
?>

and a block class

<?php
class TEST_Productstab_Block_Productstab extends Mage_Core_Block_Template
{
   public function methodBlock()
   {
     //i have to get $type and $cat in this class, anything like getData($type), so i can get teh value here?

     echo $type."<BR>";
     echo $cat;
   }
}
?>

How can i pass $type & $cat to methodBlock function , so i can print the output by calling $this->methodBlock() in phtml

thanks


texts: What is a "Javascript Component" in Magento 2

texts:
In the Magento 2 documentation, they state

  In Magento 2, there are two ways to initialize a JS component

However, they never really explain what a JS component is, and it's not clear from the documentation if "components" are a custom system in Magento 2, a RequireJS module, or something else.

What are the "JS Components" that programmers can initialize with the data-mage-init attribute or the text/x-magento-init script tags.


texts: Store Locator: Google Maps Not Displaying

texts:
I am using Magento Community Ver. 1.9.0.1 and tried to implement the Store / Dealer locator extension.
Link to Extension in Magento Connect: http://www.magentocommerce.com/magento-connect/store-dealer-locator.html

I registered as a developer on Google and got the Google API for Google Maps and created the Google API Url.

My problem is my stores show on the store locator page but the map does not.
Link to Store Locator page: http://hi-schoolworld.com/datta_storelocator/

I tried embedding a Google Map in a page to test whether my API Url was incorrect but that map is showing up just fine.
Link to Embedded Map example: I've exceeded my link limit...Click on Store Locator in the top navigation (hi-schoolworld dot com /map)

I have tried contacting the developer without success so now I turn to the community...Help me StackExchange, you're my only hope!


texts: Issues with adding image attribute to category - Magento 2

texts:
I've added attribute to my category following this guide (https://belvg.com/blog/how-to-add-image-attribute-to-a-category-in-magento-2.html).

Looks like I am on right way, but when I try to upload image, I receive 404 error in my chrome console:

POST http://mywebsite.com/admin/VendorName_CategoryImage/category_thumb/upload/key/48f549e227d66a94210827868a615957af8239355508cfad904f1da8444baaef/?isAjax=true 404 (Forbidden)

I think that troubles in my app/code/VendorName/CategoryImage/view/adminhtml/ui_component/category_form.xml:

<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <fieldset name="content">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="label" xsi:type="string" translate="true">Content</item>
                <item name="collapsible" xsi:type="boolean">true</item>
                <item name="sortOrder" xsi:type="number">90</item>
            </item>
        </argument>
        <field name="image_thumb">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="dataType" xsi:type="string">string</item>
                    <item name="source" xsi:type="string">category</item>
                    <item name="label" xsi:type="string" translate="true">Mobile Image</item>
                    <item name="visible" xsi:type="boolean">true</item>
                    <item name="formElement" xsi:type="string">fileUploader</item>
                    <item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
                    <item name="previewTmpl" xsi:type="string">Magento_Catalog/image-preview</item>
                    <item name="required" xsi:type="boolean">false</item>
                    <item name="sortOrder" xsi:type="number">40</item>
                    <item name="uploaderConfig" xsi:type="array">
                        <item name="url" xsi:type="url" path="VendorName_CategoryImage/category_thumb/upload"/>
                    </item>
                </item>
            </argument>
        </field>
    </fieldset>
</form>

Thanks for any help!


texts: Magento 2.3 is not running under windows 10 with PHP Version 7.2.13.


texts: How can I disable cache for particular section or block in magento 2?

texts: I am making a online payment method, which is taking previous cart details if Full page cache is enabled. How can we make it non cache-able? I want to make my HTML content non - cache-able.


texts: Speed up customer login, checkout and payment

texts:
I have a Magento website www.moandco.com which is OK speed wise until a client chooses to login. The login process takes around a minute to complete. Once logged in browsing the catalog is extremely slow as is checking out. When paying using the secure trading payment gateway the website produces a timeout error after payment is taken as the server doesn't respond in time.

The website uses customer groups to show different products and different price to different customers. There are about 2000 products and 10 customer groups.

I have spoken to the hosting company siteground and they say the issue is not server related. They say that the issue is due to MySql not responding quick enough to complex queries and that they need to be optimised.

I have spoken to the developer who has says the coding is fine and that the issue is with the server. He has a test platform and it never times out with the customer login taking around 20 seconds even tho his hosting is not optimised for Magento in any way.

I am after some advice on what I need to do to get the website to work properly. With the host and the developer blaming each other I am caught in the middle. Any tips on how I might optimise Magento or improve performance so that logged in customers get a better user experience would be appreciated.

Thanks!


texts: How can I know from which file the table error is coming for?

texts:
I updated some modules and went up this "SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento_prod.amazon_nding_authorization' doesn't exist, query was: DESCRIBE amazon_nding_authorization"
I can't seem to find where it wants that table and why. How can I know this? I did a grep searching for "amazon_nding_authorization" the whole files, how can I find this?
Thanks! Best regards,
Rui Silva


texts: Where is situated xml file, that consist of name of module and name of view in Magento 1.9? This file is downloaded one of the first and loads all the pages. Sorry for stupid question :)


texts: How do I display a Configurable Product even when its' Simple Products are "Out of stock"?

texts:
I'm trying to display the configurable product even if its' associated simple products are sold out. When the simple products are all "Out of Stock", the configurable item disappears. I'd like it to remain "Visible" even if it's not orderable.

Help!


texts:
I've gone through about 50 different pages and posts of people having the same issue, but none seem to be caused by what ever is casing my issue.

I've got my module, registered the route and it's loading the layout XML all fine as the page template is the correct one. I can also log in my controller and action just fine. If I change my block type to a built in Magento type like core/template It gives me an error caused by the code in my template phtml file so the template file is working. It just seems to be the block type throwing me off.

I keep looking through tutorials and guides but I'm failing to see any difference sin my approach. I see not many people putting their block in a sub folder in the Blocks folder, but I am calling the block with lookbook_view. I also tested by moving the view block out of m Lookbook folder and placing it directly in the Block folder (and renaming the class) but this also did not work

app/design/frontend/base/default/layout/lookbook.xml

<lookbook_lookbook_view translate="label">
    <label>Single Lookbook Page</label>
    <remove name="right"/>
    <remove name="left"/>

    <reference name="root">
        <action method="setTemplate">
            <template>page/1column.phtml</template>
        </action>
    </reference>
    <reference name="content">
        <block type="lookbook/lookbook_view" name="lookbook_view" template="lookbook/view.phtml"/>
    </reference>
</lookbook_lookbook_view>

app/code/local/Test/Lookbook/etc/config.xml

<config>
    <global>
        <blocks>
            <lookbook>
                <class>Test_Lookbook_Block</class>
            </lookbook>
        </blocks>
    ....
</config>
...
<frontend>
    <routers>
        <lookbook>
            <use>standard</use>
            <args>
                <module>Test_Lookbook</module>
                <frontName>lookbook</frontName>
            </args>
        </lookbook>
    </routers>
    <layout>
        <updates>
            <lookbook>
                <file>lookbook.xml</file>
            </lookbook>
        </updates>
    </layout>
</frontend>

app/code/local/Test/Lookbook/Block/Lookbook/view.php

class Test_Lookbook_Block_Lookbook_View extends Mage_Core_Block_Template{

   public function getCurrentLookbook()
   {
       echo 'test';die();

       return Mage::registry('current_lookbook');
   }
}


texts: How to create a cart with custom price using API in magento 2.3

texts:
I need to create a custom price as the product main price the custom price need to add as the checkout total and subtotal i'am using API to create the cart in that api itself the price is can't updated.
Is there any way to update the price.


texts: send email after custom status change : Admin

texts:
I would appreciate if anybody can help me in sending email once the status of customer is changed from PENDING - > APPROVED from the Magento Admin Panel

I want to send to customer that your status is approved now.


texts:
I have created a template in which I need to place the "contact us" form.

I can currently think of two ways to do this:
1)

echo $this->getLayout()->createBlock('customer/form_edit')->setTemplate('contacts/form.phtml')->toHtml();

2)

Create a cms block with an id "contact_form"

and content:

{{block type="core/template" name="contactForm" form_action="/contacts/index/post" template="contacts/form.phtml"}}

then call it my template with:

echo $this->getLayout()->createBlock('cms/block')->setBlockId('contact_form')->toHtml();

What would be the difference between those two approaches, and is there a better one?


texts: "Please Wait" stuck page while Creating category Magento 1.14.2.3

texts:
Please help me with this issue I have been stuck with for quite a few days now.

The issue: Every time when I goto Magento admin panel (EE 1.14.2.3) under Manage categories and try to save a new category, the please wait gif pops up, the browser tab shows the loading/submission icon near the favicon for a few secs but does not actually refreshes. But the please wait gif stays there until I close the tab or reload the page. For now, this is the only place of the Admin panel where I encountered the issue. Tried the same in manage attributes and it did not hang up. The category is not created when I go back.

The problem seems to be related to the upgrade of 1.14.2.2 to 1.14.2.3 version. As reverting to the prior vers in other environments makes the issue go away.

There are no errors in the browser console, in the Magento logs and the server logs. Also I have tried the following:
Extending the php execution time
Changing index mode to run manual
Cache is always set to No and Error display on.

What I have found during debugging is that after redirecting to Manage Category form there is a bit of js for form.submit in form.phtml (child call from adminhtml/def/def/template/catalog/category/edit.phtml). This js is supposed to deal with submitting the form for new categories. But right after redirecting to Manage Category, there is an ajax call immediately, and this Ajax call for some reason is wiping out this js part. The onload ajax is supposed to update content by fetching existing categories I believe. I have tried commenting the onload ajax call and tried to submit the form, but it still hangs up with the "please wait" screen, leading me to believe it is probably something with header, http or the js library.

If anybody has encountered something similar I would really appreciate some pointers on how I can debug this! Thanks.


texts: Set Category Product Position of Products

texts:
I have a php script in magento that programmatically creates products in a for each loop as below:

$i = 0;
foreach ($array as $product) {
    createProduct($params);
    $i++;
    if($i == $count){
        // finish and continue
    }
}

function createProduct($params){
    $product = new Mage_Catalog_Model_Product();
    $product->setCreatedAt(strtotime('now'));
    $product->setAttributeSetId(11);
    $product->setName(xxxxxx);
    $product->setPrice(xxxxx);
    $product->setDescription(xxxxxxx);
    $product->setCategoryIds(array(xx,xxx));
    // and so on...

    try {
        $product->save();
    }
    catch (Exception $ex) {
        // catch error
    }

With each product i need to be able to set the category product position (see below)

How can this be done? I want to use the $i in the for each loop to be the position


texts: What are the different parts of an image URL, and how to generate new sizes?

texts:
I have an image URL like this:

  http://example.com/media/catalog/product/cache/1/thumbnail/65x65/9df78eab33525d08d6e5fb8d27136e95/r/a/random-product_8.jpg

What is the meaning of the "9df78eab33525d08d6e5fb8d27136e95" and why is it the same for all images?

Also, how can I programmatically create a new size of images (say 120x120) for all of my products?


texts: Custom admin form works in localhost not works in server in magento 2

texts:
Custom admin form  show in localhost  not display in server in magento 2

I have follow this reference to create a custom form in admin https://www.maximehuran.fr/en/layouts-and-forms-on-magento-2-admin/

In LocalHost:

In Server:


texts:
We are seeing this Magento 2 - 2.3.1. Warning "JQMIGRATE: Migrate is installed with logging active, version 1.4.1" on fresh 2.3.1 install

JQMIGRATE: Migrate is installed with logging active, version 1.4.1
jquery-migrate.js:45 JQMIGRATE: jQuery.attrFn is deprecated
migrateWarn @ jquery-migrate.js:45
jquery-migrate.js:47 console.trace
migrateWarn @ jquery-migrate.js:47

Is this a normal message or can we disable this?

(there was no prior M2 version, direc 2.3.1 install via composer)


texts: How to add additional info to salesOrderEntity Magento 1.9?

texts:
this :

$order = Mage::getSingleton('sales/order')->loadByIncrementId($order_id);
var_dump($order);

will return the details of an order by increment_id, however I only get customer_id, what to do in order to return for example the date of birth ? (without fetching information about the customer with the customer_id)


texts: Magento 2: How I can add Configurable products to cart from homepage and category view with choose a option dropdown as shown below?

texts: How to add the choose a option in homepage grid and category view grid?


texts:
I'm trying to leave just one type of URL for product pages, it looks like this:

http://example.com/category/subcategory/product-name

But Magento automatically creates two more:

http://example.com/product-name
http://example.com/category/product-name

How to prevent this?

I tried truncating core_url_rewrite table and reindexing catalog, but it doesn't help.

(question continues my previous thread in which I've found how to make desired URL type default one)


texts: How to get complete order array in observer with event checkout_onepage_controller_success_action

texts:
i need a complete order array with all items in observer.

here is event : etc/frontend/events.xml

<?xml version="1.0" encoding="UTF-8"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/Event/etc/events.xsd">
<event name="checkout_onepage_controller_success_action">
    <observer name="webhive_sps_controller_success_action" instance="WebHive\SPS\Observer\MyObserver"  />
</event>

Observer file: Observer/Myobserver.php

<?php

namespace WebHive\SPS\Observer;

use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\DataObject as Object;

class MyObserver implements ObserverInterface {

/*protected $_objectManager;

public function __construct(\Magento\Framework\ObjectManager $objectManager)
{
    $this->_objectManager= $objectManager;
}*/

/**
 * @override
 * @see ObserverInterface::execute()
 * @used-by \Magento\Framework\Event\Invoker\InvokerDefault::_callObserverMethod()
 * @see \Magento\Framework\App\Action\Action::dispatch()
 * https://github.com/magento/magento2/blob/dd47569249206b217e0a9f9a9371e73fd7622724/lib/internal/Magento/Framework/App/Action/Action.php#L91-L92
    $eventParameters = ['controller_action' => $this, 'request' => $request];
    $this->_eventManager->dispatch('controller_action_predispatch', $eventParameters)
 * @param \Magento\Framework\Event\Observer $observer
 * @return void
 */
public function execute(\Magento\Framework\Event\Observer $observer) {

     $event = $observer->getEvent();
     $orderIds = $event->getOrderIds();

    $order_id = $orderIds[0];
    echo $order_id;                  // prints current order id (e.g : 7)
    // Here i need some function like getOrderDetails that prints order array
}
}


texts: Not getting Shipment id in getShipment () in vendor/magento/module-sales/Block/Order/Email/Shipment/Items.php

texts:
I am not getting Shipment data in getShipment() in below file while sending shipment tracking information email from admin
in vendor/magento/module-sales/Block/Order/Email/Shipment/Items.php

Any thoughts please ?


texts: How to override the cart block in magento 2?

texts: When I try to override the cart block, the front end templates on the cart page disappear except the header and the footer.


texts: I want to add sign in form of magento 2 checkout step

texts: I want to add sign in form of magento 2 to my checkout step and want to show sign in form when checking out how to call template of sign in form in my custom checkout step.


texts:
Hi the default Magento search uses /catalog/product/list.phtml

How can I create a custom version of this file "list_search.phtml" and tell the search to use this file instead?


texts: Product image not changing when user selects a different color

texts:
I've uploaded different images for each simple product I have, depending on the color. (Not using swatches)

However, when the user selects a color from the drop down list, the product image is not changing to show the new color. Is this the default functionality? And if so, how can I change it?


texts:
I have install ssl on my site , Everything  works fine on https but I want to use secure urls only for checkout and registration area pages.

For that I have set base url to http://mydomain and Use Secure URLs in Frontend to Yes.

But Some of my urls (category pages) are still redirected to https (after giving 302 Moved Temporarily). And same with all ajax requests through out the site.

I checked .htaccess file and found no rule to redirect for those particular urls or any other url.

I also checked my server configuration for redirect of urls but there  also no rules were applied. I also replace my .htaccess file default .htaccess but it makes no difference.

Does anyone have idea what could be the cause of it?


texts: How disable Paypal express checkout or require a shipping price

texts:
My problem is: When someones click on shopping cart and then click on paypal express checkout it goes to paypal page and no needs that the buyer select the shipping method neither select it itself...

So with that anyone can avoid shipping price. And I do not want that.

What can I do?

I see in some videos on youtube where people goes to paypal settings in magento and choses something like, send shipping information to paypal; but I do not have that configuration options only can set my paypal tokens.
I guess that is because my country is Portugal in settings.

My idea is disable ONLY paypal express and keep paypal standard. But I do not know how to do that...

And I have 2 shipping options: payment on delivery and paypal, and I want enable paypal only for courier (CTT Correios) shipping method and disable  for payment on delivery.

How can I do That 2 things?


texts:
How I can add critical path css rending in
<style>body{color:#202020}</style> in header?

I did research but not getting clear picture. I can add meta and custom css file in default_head_blocks.xml but not sure about adding style tags in header section.


texts: Magento 2: How to get related product custom option using graphQl?

texts:
I want to get related products with custom option data using GraphQl. I am using the below GraphQl query to get related product custom options data. can anyone help with this?

{
  products(filter: {sku: {eq: "24-WG09"}}) {
    items {
      id
      name
      special_price
      price {
        regularPrice {
          amount {
            value
          }
        }
      }
      related_products {
        id
        name
        url_key
        image {
          label
          url
        }
        price {
          regularPrice {
            amount {
              value
            }
          }
        }
      }
    }
  }
}

Let me know if you need more detail.


texts: Prevent login from login observer in magento2

texts:
Trying to prevent registered users from logging in based on their customer group id. I have this working in magento 1, however I haven't been successful in replicating it on magento2. Any help is appreciated.

Magento 1

public function customerlogin($observer)
{
   $customer = $observer->getEvent()->getCustomer();
   $session = Mage::getSingleton('customer/session');

   if ($customer->getData('group_id') == 2)
   {
    $session->setId(null)
       ->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID)
       ->getCookie()->delete('customer');

    Mage::throwException(__('Login not allowed'));
    return;
}

}

Magento 2 - unfinished

public function execute(\Magento\Framework\Event\Observer $observer)
{
    $event      = $observer->getEvent();
    $customer   = $event->getCustomer();
    if($customer->getGroupId() == '2'){
        $this->messageManager->addNotice(__('Login not allowed'));
        //prevent login
    }
}


texts:
I'm working on a custom module. I need a admin config section with dynamic options. The idea is to have a list of all enabled shipping methods. Next to each method i need a select dropdown with shipping methods loaded from an external system. How can create an admin config section with dynamic data?

Ive created an screenshot to clear things up on what i need:

I need a row for each enabled magento shipping method, and a dropdown next to it.


texts: How to properly secure my Magento 2 site?

texts: I have my Mage2 site set up on an EC2 and use ssl access, plus a custom admin url and the permissions are all correct. However, I want to add .htaccess to my admin. What file do I need to add this too? The root .htaccess? And can I use order deny,allow or is there a better way? What other things should I be focused on (I have added captcha to admin and forced password change) to increase security?


texts: Magento 2 filtering product collection and sorting

texts:
Considering below I can display products with true value of my custom attribute in ascending order based on position. How can I have products with false right after these in ascending too?

if ($subject->getCurrentOrder() == 'CustomAttribute') {
            $collection ->addAttributeToFilter('myCustomAtt',1)->setOrder('position', 'asc');
            $collection->load();
        }

Is there any way to append $collection ->addAttributeToFilter('myCustomAtt',0)->setOrder('position', 'asc'); at the end of the $collection?


texts: another problem i've having with magento is trying to get around the fact that you have to input stock.is there a way to allow for unlimited stock? or even the option to disregaurd the stock all together ?


texts: A strange question: price is $0.68000000000000005

texts:
My Magento2 is ver. 2.2.0-dev.
When I set product's price to $0.68, after save the price will be $0.68000000000000005.
But when the price is $0.5, it's ok.


texts: Magento cms home page and products not shown on the multi store website on different domain

texts:
i m working on admin multisite magento installation which is not having its own frontend.
In this installation i have configured 2 websites store and store view.

Admin Magento installation is present on, for eg. domain1.com with directory structure like this .
../public_html/magento_admin

Please Note that Everything works fine when i configure store1 as directory like below

../public_html/magento_admin/store1/ and

access with url http://..../magento_admin/store1

But problem arises when i configure the store1 on different domain for eg. domani2.com and access store1 by url http://domain2.com/

After configuring store1 for domain2.com theme, menus, header, footer is shown correctly, but the cms home page is not showing on the home page.
and if i click any category then it tells there is no product for corresponding selected product category. what may be wrong ?

For store1, i have set the skin, media, js to admin url like

.../magento_admin/skin/

.../magento_admin/media/

.../magento_admin/js/

and store1 base url to

...domain2.com/

i have copied the .htaccess and index.php file in root of ....domain2.com/
and have changed following lines in index.php

$mageRunCode = 'store1_code';

$mageRunType = 'website';

What could be the problem ?


texts: Which file is responsible for Email template variables in magento

texts: We need to update the email template variables in transaction emails in Magento, I don't know which model is responsible for this. Can you please help us to know this file?


texts: Magento 2 - Showing iframe in admin configuration panel

texts:
I want the users who download and install my extension from the marketplace to go through a registration/login flow. Since the normal system.xml file supports only static pages and doing the entire thing using FE models is too complicated, I'm wondering if I can instead show everything in an iframe?

Showing everything in an iframe gives me lot of advantages like -

Flexibility over design. Magento buttons/elements are ugly.
Being able to use the same iframe my other eCommerce offerings
Much much less engineering time since our team is much more comfortable with JavaScript/CSS than PHP/XML etc

So my question is how to implement the iframe and are there any disadvantages that I'm missing?

I see its possible for Magento 1


texts:
I am getting "

  DateTime::__construct(): Failed to pass time string (17/06/2019)
  0(1):Unexpected character

  error while saving product.

See the Screen shot below Image Here

What can be the issue and how to resolve it?


texts: Magento 2 How to update block programmatically?

texts: How can i update block content programmatically?


texts: How can get All Attribute of a specific Group in magento2

texts:
In constructor inject dependency

protected $productAttInterface;
\Magento\Catalog\Api\ProductAttributeManagementInterface $productAttInterface

$this->productAttInterface=$productAttInterface;

and get all attributes of a specific attribute set

$attributeSetId=16;    //This is Attribute Set Id

return $this->productAttInterface->getAttributes($attributeSetId);

Now i want to get all attributes of a specific group . I make a group and add 5 attributes. I want to just get these 5 attributes not all.
Can anyone guide me how get attributes of specific group by giving  group_name or group_id ?