texts: I want to load product collection randomly but cache is not allowing to do so in magento 2

texts:
I can load random product collection and show on homepage while disabling cache.But when i enable cache random order disperse in magento 2. How can i achieve random order while enabling cache.
  $category = $this->categoryRepository->get($category_id);
    if(isset($category) && $category) {
        $collection->addMinimalPrice()
            ->addFinalPrice()
            ->addTaxPercents()
            ->addAttributeToSelect('*')
            ->addAttributeToSelect('image')
            ->addAttributeToSelect('small_image')
            ->addAttributeToSelect('thumbnail')
            ->addAttributeToSelect($this->_catalogConfig->getProductAttributes())
            ->addUrlRewrite()
            ->addAttributeToFilter('is_saleable', 1, 'left')
            ->addAttributeToFilter('is_new_product', 1, 'left')
            ->addCategoryFilter($category)
            ->addAttributeToSort('created_at','desc');
    } else {
        $collection->addMinimalPrice()
            ->addFinalPrice()
            ->addTaxPercents()
            ->addAttributeToSelect('name')
            ->addAttributeToSelect('image')
            ->addAttributeToSelect('small_image')
            ->addAttributeToSelect('thumbnail')
            ->addAttributeToSelect($this->_catalogConfig->getProductAttributes())
            ->addUrlRewrite()
            ->addAttributeToFilter('is_saleable', 1, 'left')
            ->addAttributeToFilter('is_new_product', 1, 'left')
            ->addAttributeToSort('created_at','desc');
    }

    $collection->getSelect()
            ->order('RAND())
            ->limit($count);

    return $collection;
}


texts:
If I add a product that costs 4.20 (without tax) to the cart 100 times, the tax calculation is wrong: 420*0.08 = 33.6, but Magento says 420*.08 = 34.00, as can be seen here:

I have checked this issue and it seems to affect all products.

Any idea what might lead to this error?


texts: Automatic URLs generated by magento 2 has missing characters

texts:
At magento 1 for example, if my category name is "Armação", the url automatically generated for this category is "armacao". The magento 1 automatically did it for special characters.
In magento 2 I dont know how to use it. There is a configuration to do it or magento 2 not support it?
Magento 2 example:
Category: Armação
Link after save: arma-o
I have this problem with all magento 2(v2.3.5) links. Please help me to solve this problem!


texts: SUPEE 11086 patches for Magento Version 1.9.0.1 where can we get?

texts: I don't see the latest security patch update SUPEE 11086 for Magento version 1.9.0.1. Will it not needed for the mentioned version?.


texts:
<actionsColumn name="actions" class="Vendor\Module\Ui\Component\Listing\Column\SelectActions">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="indexField" xsi:type="string">id</item>
                </item>
            </argument>
        </actionsColumn>

and my class for dropdown action is

public function prepareDataSource(array $dataSource)
    {
        if (isset($dataSource['data']['items'])) {
            foreach ($dataSource['data']['items'] as & $item) {
                $item[$this->getData('name')] =
                    [
                    'sendmail' => [
                        'href' => $this->urlBuilder->getUrl(
                            self::URL_PATH_MAIL,
                            [
                                'entity_id' => $item['entity_id']
                            ]
                        ),
                        'id' => 'click-me',
                        'label' => __('Send Mail')
                    ],
                    'view' => [
                        'href' => $this->urlBuilder->getUrl(
                            static::URL_PATH_VIEW,
                            [
                                'entity_id' => $item['entity_id']
                            ]
                        ),
                        'label' => __('View'),

                    ],
                    'delete' => [
                        'href' => $this->urlBuilder->getUrl(
                            static::URL_PATH_DELETE,
                            [
                                'entity_id' => $item['entity_id']
                            ]
                        ),
                        'confirm' => [
                            'title' => __('Delete'),
                            'message' => __('Are you sure you want to delete a record')
                        ],
                        'label' => __('Delete'),
                    ]
                    ];
            }
        }

        return $dataSource;
    }

Grid show dropdown action

I want to open a popup modal when click on send Mail.
My try is when I use uicomponent

<item name="component" xsi:type="string">Vendor_Module/js/grid/columns/Sendmail</item>

Then action column disappear from grid. My Sendmail.js file code is

require(
    [
        'jquery',
        'Magento_Ui/js/modal/modal'
    ],
    function (
        $,
        modal
    ) {
        var options = {
            type: 'popup',
            title: 'Contact Form',
            buttons: [{
                text: $.mage.__('Close'),
                class: '',
                click: function () {
                    this.closeModal();
                }
            }]
        };

        var popup = modal(options, $('#popup-modal'));
        $("#click-me").on('click', function () {
            $("#popup-modal").modal("openModal");
        });

    }
);

For modal html code is in view/base/web/templates/sendmail.html

<div id="popup-modal" style="display:none;">

//form code

</dive>

this sendmail.js code working on frontend site i have test on phtml file it work but is not work with grid.
Can anyone guide me little how to show popup modal in dropdown action?
Thanks in advance.


texts:
I have a module which use to add a custom tab in customer section in admin. I have created custom tab successfully. Now I want to add some custom attributes that I have added through installation file of my module to this custom tab. What is the best way for doing this?

My current ideas are these

Add these custom attributes through the file local/Mysite/Mymodule/Block
/Adminhtml/Mymodule/Edit/Tab/Mycustomform.php(this file use to render my
custom tab content)
Define a phtml file to render the content of my custom tab in above
mentioned file(through _construct() method) and then using some html and php script display my attributes.

Which method is better? Is there any other better method to achieve this? Please share your thoughts...


texts: Relative Difficulty Of Required Functionality

texts:
I need to extend Magento 2.1 to allow products to be added to cart by the square foot (flooring). However the products are sold by the carton. Therefore I need an extension that will allow the visitor to provide square footage, while the site converts up to the next full carton. Of course, each product that is sold this way would have a SFperCarton attribute set to a numeric value greater than zero.

I have a lot of experience as a software developer, however I have almost no experience with PHP. I am looking for community's opinion on the relative difficulty for creating this extension for Magento 2.1.

Also, are there any good resources that anyone knows of to get me started?  Any help would be greatly appreciated.


texts: Magento 2: Magento UI is not working properly. After deleting all products

texts:
I have Deleted all Products from magento 2 using a SQl Command.
and after that my Magento UI is not Working properly.

How can I fix this problem?
I have tried to with CLI Commands.
php bin/magento cache:Flush
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
php bin/magento cache:Flush
I have deleted the older frontend and compiled

app\pub\static\frontend

but i can see same UI shown above.


texts: keep recently viewed products for guest users

texts:
I have a recently viewed block, it works fine with registered users and with guest users, but when guest users close the browser and enter the web again, the recently viewed products are empty.

I need to keep the recently viewed for guest users in a cookie to retrieve them when comes back to the page.

But I do not find where the function getRecentlyViewedProducts() is, or any other code to store and retrieve recently viewed products.

I know that logged users save their recently viewed products in report_viewed_product_index, but I'm not sure how are stored with guest users... maybe in session?

magento version: 1.9.2.4

Edit:

I changed the configuration of the cookie in the magento admin>system>config>web>Session Cookie Management.

I had cookie path empty, cookie domain empty, use http only set to no and a low time of cookie (3600). Now this is the new configuration, and seems to work correctly.

It's strange because the cart worked properly when close and reopen, I only lost the recently viewed items... but now everything seems ok.


texts: Magento 1.9 - Cron not work when is uncommented

texts:
I have a problem about cron of Magento 1.9.2.4. The problem  is that the cron not running. I write in my .htaccess this line

Order allow,deny
        Allow from all

Cron charge immediately the blank page without bringing price updates and rules to the site.

I have already set my cron from cPanel, but still does not work. Why?

Thanks


texts: How to get total amount with discounts (all rules applied) before Order Review?

texts:
I have cart rules applied by payment methods.

And my custom Credit Card payment send authorization request in step five (before Order Review).

But Cart Rules are applied at Order Review only (step 6).

I'm trying like below but $amount is wrong (with no discounts).

public function authorize(Varien_Object $payment, $amount)

How to get price discounts in this case?


texts:
I have fresh install Magento 1.8.1.0, I set some countries to not required to enter post code on checkout page, the "*" sign is not display in frontend for those selected countries.

But After I clicked Continue without entering post code, I still get the javascript pop up alert saying ""Zip/Postal Code" is a required value."

I tried to change the post code field to

<?php echo $this->__('Zip/Postal Code') ?>

    <input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text" />

But I still get pop up alert.

How to fix this?


texts: How to change template of category page depending on category level in code?

texts:
I had a project where there was no pattern and I applied all changes of categories layout in Admin area (Catalog->Manage Categories->Custom Design tab). Now I need to have the following:
Parent category will have a grid of all subcategories with their thumbnails and titles.

Subcategories will look pretty much as default ones - Name, description and product list/grid

So I would like to do this and wonder what is the right way.


texts: magento 2 add slick slider to recently viewed products

texts:
I am trying to add slick slider to recently viewed products on product page in

  app/design/frontend/_YOUR_VENDOR_/YOUR_THEME/Magento_Catalog/web/template/product/list/listing.html

How can i add it ?


texts: magento got invalid login or password error for customer

texts:
i added one customer programmatically and send mail to that customer for new password and also in admin side i found that customer but when customer try to login with email id and password got error 'Invalid login or password' here is my code what is problem with this?

define('MAGENTO_ROOT', getcwd());
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
require_once $mageFilename;
Mage::init();
Mage::setIsDeveloperMode(true);
ini_set('memory_limit', '-1'); //for unlimited memory being more trickey
ini_set('display_errors', 1);
Varien_Profiler::enable();
umask(0);
Mage::app('default');

$customer_email = 'test@testemail.com';  // email adress that will pass by the questionaire
$customer_fname = 'test_firstname';      // we can set a tempory firstname here
$customer_lname = 'test_lastname';       // we can set a tempory lastname here
$passwordLength = 10;                    // the lenght of autogenerated password

$customer = Mage::getModel('customer/customer');
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
$customer->loadByEmail($customer_email);
/*
* Check if the email exist on the system.
* If YES,  it will not create a user account.
*/

if(!$customer->getId()) {

   //setting data such as email, firstname, lastname, and password

  $customer->setEmail($customer_email);
  $customer->setFirstname($customer_fname);
  $customer->setLastname($customer_lname);
  $customer->setPassword($customer->generatePassword($passwordLength));

}
try{
  //the save the data and send the new account email.
  $customer->save();
  $customer->setConfirmation(null);
  $customer->save();
  $customer->sendNewAccountEmail();
}

catch(Exception $ex){

}


texts:
I'm having some difficulties with redirecting a customer, after they login.
I'm using the

<customer_login>

event, which is firing my specified function properly.

Here is my function:

public function customerLoginObserve($observer)
{
    //customer is able to login, but no redirection occurs
    $url = 'http://myurl.com';
    $session = Mage::getSingleton('customer/session');
    $session->setAfterAuthUrl($url);
    $session->setBeforeAuthUrl('');

    // Also tried the line below, the UI freezes, and when refreshing the page, customer is logged in:
    //$observer->getEvent()->getFront()->getResponse()->setRedirect($url)->sendResponse();

    //This one also did not work in the login event (freezes UI), but when fired from
    //other events, works as expected.
    //$observer->getEvent()->getResponse()->setRedirect($url)->sendResponse();
    //exit;
}

EDIT: There doesn't seem to be any errors in the system.log and exception.log
If I try to redirect with any of the sendResponse(), that's where the code stops.

Here are a few links that I've looked into, which did not work for me:

Redirect user after login

Magento redirect from all pages if not logged in

Any help appreciated!


texts: How can I get customer custom attributes from $order?

texts:
I need to get custom attributes from my customers using the $order object.

I tried to do something like $order->getCustomerCustomAttribute(); for a custom_attribute but it didn`t worked. Is there a specific format to get it?


texts:
Since I have a task which have to migrate a site /au to /asia (I know customer's store_id  website_id need to be changed), i'm wondering if I need to change the store_id in sales_flat_order table,

If I don't change the store_id of sales_flat_order table, what problems will be underlying?

If I change the store_id of sales_flat_order table, what other data I also need to change/update?

Anyone knows that?


texts: Magento 2 - Disable Payment Method based on Customer Attribute

texts:
I have a custom offline payment method that I want to show based on a customer attribute value.  Eventually I want to check that value against the total and if it is less than the total then disable the method.  But first thing is first, I can't seem to get the customer attribute.  I am testing with group_id which in this case is 1.  This is what I have:

etc > events.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="sales_order_save_before">
        <observer name="payroll_split_payment_before_save" instance="Vendor\Module\Observer\QuoteToOrderObserver" />
    </event>

    <event name="payment_method_is_active">
        <observer name="payroll_payment_method_is_active" instance="Vendor\Module\Observer\DisablePayment" />
    </event>
</config>

and my Observer:

<?php

namespace Vendor\Module\Observer;

use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
use Psr\Log\LoggerInterface;

class DisablePayment implements ObserverInterface
{
  protected $_customerRepositoryInterface;
  protected $_logger;

  public function __construct(
    // --> delete this line and replace with answer below \Magento\Customer\Api\CustomerRepositoryInterface $customerRepositoryInterface,
    LoggerInterface $logger
  ) {
    // --> delete this line and replace with answer below $this->_customerRepositoryInterface = $customerRepositoryInterface;
    $this->_logger = $logger;
  }

  /**
   * @param Observer $observer
   *
   * @return void
   */
  public function execute(
    \Magento\Framework\Event\Observer $observer
    )
  {

    $result = $observer->getEvent()->getResult();
    $method_instance = $observer->getEvent()->getMethodInstance()->getCode();
    $quote = $observer->getEvent()->getQuote();

    if($method_instance == 'payroll')
    {
      $customer = $this->_customerRepositoryInterface->getById($quote->getCustomer()->getId());
      if($customer->getCustomAttribute('group_id')->getValue() == 1)
      {
        $result->setData('is_available', false);
      }
    }
  }
}

I get this error:

'Uncaught Error: Call to a member function getValue() on null in DisablePayment.php

What am I doing wrong?


texts:
I added a module to automatically update shopping cart by Ajax which works fine.
Basically, when I change the item qty in the shopping cart, it will automatically update the shopping cart subtotal and cart summary.
But when I update the item qty on minicart, it only reload/update the cart summary but not the shopping cart items qty and subtotal. How can I fix this?
Ajax Update
Created a new module:
app/code/Learning/AutoUpdateCart/registration.php
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
     \Magento\Framework\Component\ComponentRegistrar::MODULE,
     'Learning_AutoUpdateCart',
     __DIR__
);

app/code/Learning/AutoUpdateCart/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Learning_AutoUpdateCart" setup_version="1.0.0" />
</config>

app/code/Learning/AutoUpdateCart/view/frontend/layout/checkout_cart_index.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="content">
            <block class="Magento\Framework\View\Element\Template" name="cart.auto.update.qty"  template="Learning_AutoUpdateCart::js.phtml" after="-"/>

    </referenceContainer>
</body>

app/code/Learning/AutoUpdateCart/view/frontend/templates/js.phtml
<script>
require ([
        'jquery'
    ],
    function ($) {
        $(window).on("load", function () {
            require([
                'Learning_AutoUpdateCart/js/cartQtyUpdate'
            ]);
        });
    });

app/code/Learning/AutoUpdateCart/view/frontend/web/js/cartQtyUpdate.js
define([
'jquery',
'Magento_Checkout/js/action/get-totals',
'Magento_Customer/js/customer-data'
], function ($, getTotalsAction, customerData) {

$(document).ready(function(){
    $(document).on('change', 'input[name$="[qty]"]', function(){
        var form = $('form#form-validate');
        $.ajax({
            url: form.attr('action'),
            data: form.serialize(),
            showLoader: true,
            success: function (res) {
                var parsedResponse = $.parseHTML(res);
                var result = $(parsedResponse).find("#form-validate");
                var sections = ['cart'];

                $("#form-validate").replaceWith(result);

                /* Minicart reloading */
                customerData.reload(sections, true);

                /* Totals summary reloading */
                var deferred = $.Deferred();
                getTotalsAction([], deferred);
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    });
});
});

app/code/Learning/AutoUpdateCart/view/frontend/web/requirejs-config.js
var config = {
   map: {
       '*': {
           ajaxQty: 'Learning_AutoUpdateCart/js/cartQtyUpdate'
        }
   }
};


texts: How to add an admin internal action to a page link

texts:
I'm new to Magento, but I've set up some controllers and phtml files that are working.

However, I have a phtml file containing a link:

Do you already have an account?
Connect Account?

The "mycompany/dashboard" url fires the respective controller elsewhere on the site, but the link doesn't work in this phtml file. Why?


texts: Magento2 : How to save system config programmatically

texts:
I made a module to add configuration fields to system (system.xml).

Some of these fields are dynamic arrays (cf here) which are generated using an extend of \Magento\Config\Model\Config\Backend\Serialized\ArraySerialized _afterload() function.

I would like to save these arrays programmatically.

How can it be done?
(Saving the entire system configuration can be an option...)

Thanks for your help,


texts: Understanding how magento merges layout XML data

texts:
How does Magento handle layout XML files?

For example if I have created a theme app/design/frontend/example/theme and copy an XML file from the base/default/layout directory in my theme's layout directory:

Does it override the whole file? Meaning will I have to copy the XML file into my theme to begin overriding things, or
Does it merge with the base/default and override only the changes I have made in my XML file?


texts: How can i disable module manually in Magento 2

texts:
I'd like to know if its possible to manually disable a module by changing some code like in Magento 1.
I know the SSH way.


texts: Efficient way to access current result count in left block

texts:
Tried a few different approaches to this but still not sure of the best option for something which should be relatively simple. I want to output the current product result count, instead of within the toolbar, in the layered navigation (left block).

I realise that I need to use an instance of catalog/product_list_toolbar to be able to access $this->getTotalNum(), but creating a new block with the same block class doesn't work. I've tried the below but it seems to result in a slower page load and count results inconsistent with what's in the toolbar:

<?php $customBlock = $this->getLayout()->getBlock('product_list'); ?>
    <?php echo $customBlock->getLoadedProductCollection()->count(); ?>

Thanks for any pointers.


texts: How to show In-Stock label for configurable product on products page

texts:
i have products page for simple product and configurable product like this :

as you can see from above image, there is no In-Stock label for configurable product, but when i click view details there is In-Stock label, is there any way to show the In-Stock label in products page for configurable product?


texts: How to show Price Countdown in home page?

texts:
I install Price Countdown in my store and it just shows in product page but I want to show it in home page in box of sales product but I don't know which part of the extension's code show the countdown.

Any body can help me?


texts: Received an unathorized message on the admin notification inbox

texts:
First of all, this is my first question so excuse me if I'm a bit clunky. I'm currently using magento 1.8.0.0. On our production site, today we received 3 unathorized messages on our admin notification inbox. The content of the messages are not relevant, it's just gibberish. They aren't being pulled from any RSS feed i'm subscribed to. Someone is using this functionality to spam my site. What troubles me is the possibility that someone found a security hole and is trying to gain access to the server and/or database.

I'm no security expert and I don't really know how to approach the situation. First thing I did was a complete backup of the database and file system. Then I've checked the system and exception logs, but haven't found anything relevant.

Any ideas?


texts:
I override the \Magento\Catalog\Block\Product\View it's working but I am trying to inject class means it's not working please tell me what I did wrong and tell me how to do this without injecting the core class

    <?php
    namespace Eventbefore\Block\Product;

    use Magento\Framework\Session\SessionManagerInterface;
    use Magento\Framework\Stdlib\Cookie\CookieMetadataFactory;
    use Magento\Framework\Stdlib\Cookie\PublicCookieMetadata;
    use Magento\Framework\Stdlib\CookieManagerInterface;

    class View extends \Magento\Catalog\Block\Product\View{

        protected $logger;

        protected $objectManager;

        protected $_curl;

        public function __construct(
            CookieManagerInterface $cookieManager,
            CookieMetadataFactory $cookieMetadataFactory,
            SessionManagerInterface $sessionManager,
            \Magento\Framework\ObjectManagerInterface $objectManager,
            \Magento\Framework\HTTP\Client\Curl $curl)
        {
            $this->_curl = $curl;
            $this->objectManager = $objectManager;
            $this->_cookieManager = $cookieManager;
            $this->_cookieMetadataFactory = $cookieMetadataFactory;
            $this->_sessionManager = $sessionManager;
             //parent::__construct($context);
        }
}

Error:

  Eventbefore\Block\Product\View

      Missed required argument urlEncoder in parent::__construct call. File: /opt/lampp/htdocs/rumin/app/code/Cart/Eventbefore/Block/Product/View.php


texts:
I'm currently developing a Magento 2.0 theme. I'm trying to change the behaviour of the Tax class on the frontend. The file I need to change is located in app/Code/Magento/Tax/view/base/templates/pricing/adjustment.phtml.

How can I override this view from my Magento theme?

Thanks


texts: magento 2 adding product to catagory using rest

texts:
i am trying to add products to a specific category but i have two issues.

when adding it to category it overrides the previous category but i would like to keep it in both categories and not removing it from the previous category.
how can i remove the category that was assigned if condition was not met.

    if (($product['price'] * 1.20) < $old_price_check) {
    $customData[] = array('attribute_code' => 'category_ids', 'value' => ["86"]);
} else {
    $customData[] = array('attribute_code' => 'category_ids', 'value' => ["86"]);
}


texts: How to migrate product images before using Data Migaration tool from magento 1 to magento 2

texts:
I wish to migrate data from magento 1 to magento 2 using data migration tool.
I know the procedure for migration using data migration tool.
But i am having doubt on, how to migrate the product images &other media files from magento 1 to magento 2.
I have copied the media folder from magento 1 and replaced it in magento 2 pub/media folder.
Before start data migration, can anyone guide me how do i migrate product or other images to magento 2.
Thanks in advance.


texts:
How to get image from database and display it in magento?

my imgs.php is:

  $a = $_SESSION['id'];
  $ob = Mage::getModel('management/file')->getCollection();
        $res = $ob->addFieldToFilter('task_id',$a);
    //  $res = $ob->addFieldToFilter('comment_id',$id);
        //$img = "";
        foreach($res as $val)
        {
            $img = $val->getFile();
            //$name = $val->getfilename();
            $Type = $val->getType();
            $type = "Content-type: ".$Type;
            header($type);
            print_r($img);
        }

in phtml:

    <img height="30px" width="30px" src="imgs.php?Id=<?php print_r($id);?>"/>

save image:

   $targetDir = Mage::getBaseDir('media') . DS . 'plupload' ;
   if (!file_exists($targetDir)) {
        @mkdir($targetDir);
    }

    if (isset($_REQUEST["name"])) {
    $fileName = $_REQUEST["name"];
    } elseif (!empty($_FILES)) {
    $fileName = $_FILES["file"]["name"];
    } else {
    $fileName = uniqid("file_");
    }
    $filePath = $targetDir . DS . $fileName;


texts: setup:di:compile ignores third party type definition (Monolog)

texts:
I have a DI configuration for a custom exception handler:

<type name="My\Logger\Handler\ExceptionHandler">
    <arguments>
        <argument name="formatter" xsi:type="object">My\Logger\Formatter\LogstashFormatterVirtual</argument>
    </arguments>
</type>

<type name="Monolog\Formatter\LogstashFormatter">
    <arguments>
        <argument name="applicationName" xsi:type="string">Magento</argument>
    </arguments>
</type>

This works fine in developer mode, but if I run bin/magento setup:di:compile, I get the following error as soon as the exception handler would be instantiated:

Missing required argument $applicationName of Monolog\Formatter\LogstashFormatter.

How can I ensure that compilation includes the Monolog type?


texts:
For design purposes we have a sub-category called Brands which list all the brands. However we would like the urls to ignoer /brands/ part so domain.com/brands/brand_name would be domain/brand_name instead.
We use this for products as well and we would like the tree to look like domain.com/brand_name/product_name

Where can we make such changes? Note that we also have additional categories and we just want to make changes to "brands"


texts:
Is it possible to create a function from within a Magento installer script?  I currently have the following code:

$installer = $this;
$installer->startSetup();
$installer->run("
         DROP function IF EXISTS {$this->getTable('getLatestActivity')};
         CREATE FUNCTION {$this->getTable('getLatestActivity')} (activityid int) RETURNS int(11)
         BEGIN

         set @rank = 0;

         set @matchingId := (select id from (
         SELECT   @rank := @rank+1 AS rank, t_act.id, t_act.date
         FROM      activityupdates ut_act
         LEFT JOIN activityupdates AS t_act ON t_act.ticked = 1
             AND t_act.date <= ut_act.date AND t_act.customer_id = ut_act.customer_id AND t_act.type = ut_act.type
         WHERE ut_act.id = activityid
         ORDER BY t_act.date DESC
         )ranked
         where ranked.rank = 1);
         return @matchingId;
         END;
     ");

But I get an exception thrown SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 4 - not very helpful.

To get this running in PHPMyAdmin, I've had to add lines regarding DELIMITERS, but I think thats a drawback of the GUI rather than the FUNCTION requiring them.  If I include them, I just get an exception about defining a DELIMITER instead.

$installer->run("

         DROP function IF EXISTS `{$this->getTable('getLatestActivity')}`;
         DELIMITER $$
         CREATE FUNCTION `{$this->getTable('getLatestActivity')}` (activityid int) RETURNS int(11)
         BEGIN

         set @rank = 0;

         set @matchingId := (select id from (
         SELECT   @rank := @rank+1 AS rank, t_act.id, t_act.date
         FROM      activityupdates ut_act
         LEFT JOIN activityupdates AS t_act ON t_act.ticked = 1
             AND t_act.date <= ut_act.date AND t_act.customer_id = ut_act.customer_id AND t_act.type = ut_act.type
         WHERE ut_act.id = activityid
         ORDER BY t_act.date DESC
         )ranked
         where ranked.rank = 1);
         return @matchingId;
         END$$

         DELIMITER ;

     ");

Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELIMITER $$ CREATE FUNCTION getLatestActivity (activityid int)


texts: Magento 2: Disable all methods when free shipping method is applicable

texts:
We're using following table rates for our store and these are working fine.

When weight is 0-1(kg) , rate will be 4.5
When weight is 1.1- ~ (kg), rate will be 4.9

We also enabled Free shipping when price is greater than $100. Now when price is greater than $100, it shows both table rates and free shipping. We need to just show the free shipping when it is applicable and discard table rates when price is greater than $100. How can we achieve this?

Using Cart rule, it still shows the table rate method and just set the price to 0. How can I show the Free Shipping as method?


texts: Mystery error, 'Class 'Mage_[X]_Helper_Data' not found' (on v1.9.x)

texts:
I have a custom module, 'Stl', which I'm using for both a separate model and a SOAP API interface.

In my SOAP API class, for some reason I keep hitting this error message at random with different functions:

<SOAP-ENV:Fault>
    <faultcode>SOAP-ENV:Server</faultcode>
    <faultstring>Class 'Mage_Stl_Helper_Data' not found</faultstring>
</SOAP-ENV:Fault>

This happens for instance when I call functions (in my PHP implementation, in Api.php) like $this->_fault(); or Mage::getModel('mec_stl/product')->save()---but not, say, Mage::getModel('mec_stl/product')->setData().

I've read various people say this Mage_[X]_Helper_Data usually happens if you either don't have your helper class defined, or if you have it improperly defined. The annoying thing is that I have defined the class in my module, and I think correctly, as 'Mec_Stl_Helper_Data':

For app/code/local/Mec/Stl/etc/config.xml:

<?xml version="1.0"?>
<config>
    <!-- ... -->
    <global>
        <helpers>
            <mec_stl>
                <class>Mec_Stl_Helper</class>
            </mec_stl>
        </helpers>
        <!-- ... -->
    </global>
</config>

For /app/code/local/Mec/Stl/Helper/Data.php:

<?php

class Mec_Stl_Helper_Data extends Mage_Core_Helper_Abstract {

}

The blastedly annoying thing with Magento is I have no idea where this is being triggered or how/why.

Any thoughts?


texts: How to set confign min|maxDate in frontend magento2?

texts:
have a nice date!!. In magento2 i tried set input type date and add confign min|maxDate. but is not success. Pls tell me how to set config.

this my code:

<input type="date" value="04-07-2016" class="type-date  hasDatepicker mage-error" max="20-07-2016" min="20-07-2011" name="date-854" aria-invalid="true">

<script>
 require(["jquery","mage/calendar", "mage/validation"],
 function($){
       var min = $(this).attr('min'),
           max = $(this).attr('max');
       $('input[type=date]').calendar({
            buttonText:"<?php echo __('Select Date') ?>",
            dateFormat: "dd-mm-yy",
            singleClick : true,
            minDate: min,
            maxDate: max,
         });

    $('#contact-form').validation();

});
</script>


texts: Price difference between the unit price and row total in magento cart page

texts:
Hi I am working on magento 1.9.2.4. Have implemented magento porto theme and webkul marketplace extensions. I have 2 currency USD(base currency) and INR(display currency). The product is added in the display currency by the seller. When the buyer adds the product to cart there is s small difference between the unit price and subtotal.

Unit price calculation

<?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>

Subtotal Price calculation

<?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()) ?>

If the product price is Rs.299 the subtotal is being displayed as Rs.299(correct). The Unit price is shown as Rs. 298.69 which may be result of double conversion with truncation.

I tried with turning the theme as well as well the webkul extensions, the results did not change.

The application can be checked at link


texts: how pass parameter to object manager get

texts:
I have a ProductFactory , it's construction must manual pass a parameter, But I don't know how to pass it.
I use

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
 $objectManager->get(ProductFeedCaptureFactory::class, ['instanceType' => $type]);

The ProductFactory code below:

class ProductFactory
{
/**
 * Object Manager instance
 *
 * @var \Magento\Framework\ObjectManagerInterface
 */
protected $_objectManager = null;
/**
 * Instance name to create
 *
 * @var string
 */
protected $_instanceName = null;

/**
 * Factory constructor
 *
 * @param \Magento\Framework\ObjectManagerInterface $objectManager
 * @param string $instanceType  ftp、http、file
 *
 */
 public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager,  $instanceType )
 {
 }
}

But I got an exception :

  Missing required argument $instanceType

How I fix it ?
Thanks.


texts: Magento 2.2.3 - CSS and JS not loading on browser

texts:
Hello,

I'm facing an issue that my CSS files are not loading since I made changes in theme table on my DB. I have changed TYPE from 1 to 0 on my theme row in order to load my default_head_blocks.xml (in theme directory). I know this is a very common question, maybe a duplicate question. But none of the solutions works for me.

I have tried following things:

All Magento commands from config:import, setup:upgrade, static:content to cache:flush.
I do have .htaccess file in my pub/static folder.
My 'rewrite_module of apache' is enable.
My folder has 777 permission.
I remove comments from my CSS file and tried minify version as well.

Probably, someone marked my question as a duplicate but I have tried almost every solution available on the Google and none of them works. Any help would be appreciated.


texts:
We are a distributor and we have two price rules,
Standard
Bulk
so if you buy 1-4 or 1-9 you get standard trade price, however if you buy 5 or more or 10 or more then you get bulk

But i can't find how do it on drop down.
So with our products they have flavours. so if there are 10 flavours, they can buy 1 of each one, as long as there is 10 more they will get the discount.

Please can someone advice on this as its core to our business.


texts: Magento 2 : Chekcout cart page qty with increase and decrease icon

texts:
I want to customize the checkout cart as my own choice. I want to see checkout cart will show "+ -" to increase & decrease quantity by clicking + & - options. So I need someone's help who can help out from this issue.

Thanks


texts: Base url and Whatsapp button (script embed with secure and unsecure url)

texts:
I'm trying to integrate Whatsapp button on my magento website.

I added the following code to my head.phtml

<script type="text/javascript">if(typeof wabtn4fg==="undefined"){wabtn4fg=1;h=document.head||document.getElementsByTagName("head")[0],s=document.createElement("script");s.type="text/javascript";s.src="<?php echo Mage::getBaseUrl() ?>js/whatsapp/whatsapp-button.js";h.appendChild(s);}</script>

I get the following console error when I visit secure url pages because .js url is always http://

  Mixed Content: The page at
  'https://www.mywebsite......' was loaded over
  HTTPS, but requested an insecure script
  'http://www.mywebsite..../whatsapp-button.js'. This
  request has been blocked; the content must be served over HTTPS.

Is there a way to get secure base url on secure pages and unsecure base url on unsecure pages?


texts: why delete() function is not deleting the value after filtering the collection in magento?

texts:
I am trying to delete a data from the table.

I am using this code snippet

$categoryModel= Mage::getModel('blog/category')
        ->getCollection()
        foreach ($categoryModel as $cat) {
                $cat->delete();
        }

and it is deleting the complete table.

but I dont want to delete the complete table so I filter the data with some attribute and tried this code

$categoryModel= Mage::getModel('blog/category')
        ->getCollection()
        ->addFieldToFilter('article_id', $articleId);
        foreach ($categoryModel as $cat) {
                $cat->delete();
        }

but it is not deleting anything.
How can I delete the data according to some field.


texts:
We have added price filters in layered navigation section its working fine in the test site, but not working properly in live.

What is the issue exactly? I am unable to find.


texts: In this Model what they are mentioning as getTypeId()

texts:
In this Model they had mentioned the getTypeId() but for what they mentioned as type id i can't understand can anyone please explain me.

  $orderItem->getProduct()->getTypeId()

what will be the result in this TypeId().

Folder Path : /var/www/html/development/amt/vendor/magento/module-inventory-shipping-admin-ui/Model

<?php
    /**
     * Copyright Â© Magento, Inc. All rights reserved.
     * See COPYING.txt for license details.
     */
    declare(strict_types=1);

    namespace Magento\InventoryShippingAdminUi\Model;

    use Magento\InventorySalesApi\Model\GetSkuFromOrderItemInterface;
    use Magento\InventoryApi\Api\Data\StockInterface;
    use Magento\InventoryApi\Api\StockRepositoryInterface;
    use Magento\InventoryConfigurationApi\Api\GetStockItemConfigurationInterface;
    use Magento\InventoryConfigurationApi\Model\IsSourceItemManagementAllowedForProductTypeInterface;
    use Magento\Sales\Api\Data\OrderInterface;

    /**
     * Is source inventory of certain order is manageable
     */
    class IsOrderSourceManageable
    {
        /**
         * @var GetSkuFromOrderItemInterface
         */
        private $getSkuFromOrderItem;

        /**
         * @var GetStockItemConfigurationInterface
         */
        private $getStockItemConfiguration;

        /**
         * @var StockRepositoryInterface
         */
        private $stockRepository;

        /**
         * @var IsSourceItemManagementAllowedForProductTypeInterface
         */
        private $isSourceItemManagementAllowedForProductType;

        /**
         * @param GetSkuFromOrderItemInterface $productRepository
         * @param GetStockItemConfigurationInterface $getStockItemConfiguration
         * @param StockRepositoryInterface $stockRepository
         * @param IsSourceItemManagementAllowedForProductTypeInterface $isSourceItemManagementAllowedForProductType
         */
        public function __construct(
            GetSkuFromOrderItemInterface $productRepository,
            GetStockItemConfigurationInterface $getStockItemConfiguration,
            StockRepositoryInterface $stockRepository,
            IsSourceItemManagementAllowedForProductTypeInterface $isSourceItemManagementAllowedForProductType
        ) {
            $this->getSkuFromOrderItem = $productRepository;
            $this->getStockItemConfiguration = $getStockItemConfiguration;
            $this->stockRepository = $stockRepository;
            $this->isSourceItemManagementAllowedForProductType = $isSourceItemManagementAllowedForProductType;
        }

        /**
         * Check if source manageable for certain order
         *
         * @param OrderInterface $order
         * @return bool
         */
        public function execute(OrderInterface $order): bool
        {
            $stocks = $this->stockRepository->getList()->getItems();
            $orderItems = $order->getItems();
            foreach ($orderItems as $orderItem) {
                $productType = $orderItem->getProduct()->getTypeId();
                if (!$this->isSourceItemManagementAllowedForProductType->execute($productType)) {
                    continue;
                }

                /** @var StockInterface $stock */
                foreach ($stocks as $stock) {
                    $inventoryConfiguration = $this->getStockItemConfiguration->execute(
                        $this->getSkuFromOrderItem->execute($orderItem),
                        $stock->getStockId()
                    );

                    if ($inventoryConfiguration->isManageStock()) {
                        return true;
                    }
                }
            }

            return false;
        }
    }


texts: How to retrieve the Category name, Category URL and Category image using Category-Id?

texts: As we know that in the Category Management page we can upload an image and give a URL for each category. I want to retrieve the Category name, Category URL and Category image using only the Category Id that I already have with me. Is it possible to do so?


texts: Magento 2 - How to get base URL in layout file?

texts:
I need to add the livereload script which listens on a certain port, e.g.

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../vendor/magento/framework/Module/etc/module.xsd">
<head>
    <script src="http://www.example.com:35729/livereload.js" src_type="url"></script>
</head>

How can I add the base URL instead of www.example.com ?

Thanks.


texts: Calculate shipping costs (with table rates) based on Grand Total of basket? (Magento v1.8)

texts:
I want to use table rates (Price vs Destination) but I want the prices to be calculated based on Grand Total not on Subtotal (which is the default functionality).

I have tried all the settings combinations at Configuration -> Sales -> Tax but neither worked for me.

I want to hardcode it.
I tried this solution --> Magento free shipping calculated on grand total but it didn't work for me.

Thank you


texts: How to retrive top menu html for all stores using cron

texts:
I need to get the top menu html is cron job and need to save it in the db.
I used the the same functionalities as in the core to get the top menu in my cron job function.
But the problem is I need to top menu for each store.

Below is the core function specifying the menu

$this->_menu = new Varien_Data_Tree_Node(array(), 'root', new Varien_Data_Tree());

Is there a way to set the particular store and the respective topmenu html?


texts: Disable extension in one of the store views that uses same theme as others

texts: Is there any way to disable a third party extension for one of the store views. Since, all the store views are using same theme, I can not do it through xml file in layout folder.


texts:
I have noticed some unknown SQL process on my server, which is running almost constantly and taking significant system resources:

attribute_id is always same - 195. and what is very important that there are no tables like at_seo* in my DB.
pls, help me understand which Magento job can trigger it?


texts: Magento2: How to validate Phone number field for specific expression in Customer Registration Form?

texts: I want to validate the Phone number field for the specific Reg exp, the Number type is (999) 999-9999 how to validate in customer registration form in magento2


texts:
Magento 2, shipping method flat rate fix price with the current website currency, without converting to the base currency?

What I'm trying to do is to set the flat rate currency to the current website display currency and not convert it to the base currency.
is that possible in Magento 2? and how can I achieve that?

thanks


texts: Magento 2.4 Import grouped product with custom relation

texts:
I'm using this module https://github.com/50x/Boolfly_ProductRelation
to create custom additional relation in grouped products.
It works well except for the import functionality.
I've tested import with customtype_skus column in CSV. The products are imported but the association is not done.
Any help would be appreciated.
EDIT.
I've already tried adding following code to di. XML as described in vendor/module-catalog-import-export/Model/Import/Product.php:228
"use DI for LinkProcessor class if you want to add additional types"
<type name="Magento\CatalogImportExport\Model\Import\Product\LinkProcessor">
        <arguments>
            <argument name="linkNameToId" xsi:type="array">
                <item name="_customtype_" xsi:type="const">Boolfly\ProductRelation\Model\Catalog\Product\Link::LINK_TYPE_CUSTOMTYPE</item>
            </argument>
        </arguments>
    </type>


texts: Display all the sub-categories in multiple  tag

texts:
I have one main Category (View All Inventory) under which I have around 76 sub-categories. Right now it prints out all the 76 sub-categories in a single
 tag.

<?php $_menu = $this->getHtml('level-top') ?>
<?php if($_menu): ?>

        <?php echo $_menu ?>

<?php endif ?>

I would like to somehow divide all those subcategories equally and display them in multiple
 tag so the drop down menu spreads horizontally across the page instead of displaying them in a single
 tag vertical. How can I achieve it?


texts: Magento1.9 customer can't reset password

texts:
PHP Fatal error:  Uncaught Error: Call to a member function
  getBackend() on boolean in

  app/code/core/Mage/Eav/Model/Entity/Abstract.php:1553

Stack trace:

  app/code/core/Mage/Customer/Model/Resource/Customer.php(332): Mage_Eav_Model_Entity_Abstract->saveAttribute(Object(EW_NativePasswords_Model_Customer_Customer),
  'rp_token_create...')
  app/code/core/Mage/Customer/Model/Customer.php(1390): Mage_Customer_Model_Resource_Customer->changeResetPasswordLinkToken(Object(EW_NativePasswords_Model_Customer_Customer),
  '2e7628921453636...')
  3.app/code/local/My/Customer/controllers/AccountController.php(113): Mage_Customer_Model_Customer->changeResetPasswordLinkToken('2e7628921453636...')


texts: how to create more then one submit_url in ui_component Magento 2

texts: I need to submit data from ui_component to another class so I created two buttons and on one I set the submit_url and works perfectly but in other class I cannot get the data to perform some functionalities. How can I fix this?


texts: Can I change the content in another language website from admin backend

texts: I want to ask if there is a possibility that I can change the content in another language website using admin back-end instead of developer back-end (code)?


texts: Magento : Use custom error message in shipping method

texts:
i have created a shipping method extension in which shipping rate is correctly and even error message is also set when it conditions are sattisfied.

My question is when i am trying to set a the error message it is pulling the default message "Sorry, no quotes are available for this order at this time."

Below is my code

$result = Mage::getModel('shipping/rate_result');
$show = true;
if($show && $price > 0 && !$this->_error){
    $method = Mage::getModel('shipping/rate_result_method');
    $method->setCarrier($this->_code);
    $method->setMethod($this->_code);
    $method->setCarrierTitle($this->getConfigData('title'));
    $method->setMethodTitle($methodName);
    $method->setPrice($price);
    $method->setCost($price);
    $result->append($method);
}else{
    $error = Mage::getModel('shipping/rate_result_error');
    $error->setCarrier($this->_code);
    $error->setCarrierTitle($this->getConfigData('name'));

    if($this->_error){
        $msg = "Shipping rate cannot be calculated.";
    }else{
        $msg = $this->getConfigData('specificerrmsg');
    }
    $error->setErrorMessage($msg);
    $result->append($error);
}
return $result;


texts: How to add order summary to checkout success page?

texts:
I have been looking into adding an order summary on the checkout success page in Magento but I can't seem to find any information on how to do this.

Can anyone point me in the right direction or show me how I could implement this?

Thanks


texts: Magneto 2.1.9 upgrade to 2.2.2 Getting Error

texts:
We are trying to upgrade a Magento 2.1.9 site to Magento 2.2.2 Getting Error ..
" Can anyone help me "

Upgrade Commands
 - composer require magento/product-community-edition 2.2.2 --no-update
Then execute this all commands
 - composer update
 - rm -rf var/di var/generation
 - php bin/magento setup:upgrade
 - php bin/magento setup:di:compile

Error Image message  on this link enter link description here

[Exception]                                                                                Warning: Declaration of Bss\MultiStoreViewPricingCatalogRule\Model\ResourceModel\RuleAdmin::getRulePrices(DateTime $date, $websiteId, $customerGroupId, $productIds, $storeId = NULL) should be compatible w
  ith Magento\CatalogRule\Model\ResourceModel\Rule::getRulePrices(DateTimeInterface $date, $websiteId, $customerGroupId, $productIds) in /var/www/html/app/code/Bss/MultiStoreViewPricingCatalogRule/Model/Res
  ourceModel/RuleAdmin.php on line 106


texts: Magento : How to Implement Automatic Related Products and Category Based Upsell Products

texts: We have 5000 products at our webstore. We can not use magento default feature related products & upsell, cross-sell products. Is there any customize code or modules  which can implement to display automatic related products and category based up-sell & cross-sell products? We are using magento 1.9.2.


texts: What are reasons for a Magento database become huge?

texts: I am not sure if I am allowed to ask this here but I have a curiosity. Is it normal that a Magento with 800 orders to have 600mb? Also there are only 20 products (12 configurable, 3 bundles)


texts: Pass data or arguments to ViewModel in layout

texts:
When we worked directly with blocks, it was easy to pass arguments to the block in layout (e.g. default.xml) like:
<block template="..." class="..." name="...">
    <arguments>
        <argument name="foo" xsi:type="string">bar</argument>
    </arguments>
</block>

When now using view models (I know the advantages of using view models), I don't see a way to pass arguments, hence I often need to reject view models and use the block directly again.
Here is how a view model is used:
<block name="orangeco.new.viewmodel" template="OrangeCompany_Catalog::example.phtml">
    <arguments>
        <argument name="view_model" xsi:type="object" shared="[true|false]">OrangeCompany\Catalog\ViewModel\MyNewViewModel</argument>
    </arguments>
</block>

The view model is a shared instance by default (which is good), so in the shared case it doesn't make any sense to pass arguments in the layout. However, I sometimes want to reuse the block type (and the view model type), hence, passing arguments to the view model like we did with blocks would be desirable.
Is there a way to use view models and be able to customize them via arguments from layout?


texts: Custom FilterList incorrectly sets Collection size in Layered Navigation

texts:
In order to add a  custom filter to the Layered Navigation, I overrode the class Magento\LayeredNavigation\Block\Navigation\Category to load my own FilterList class instead of the one from core.

My custom FilterList simply adds another step when determining which Filter class to apply. The custom Filter class simply applies a stepping of 4 on a decimal attribute (instead of the standard steppings).

But, as soon as I use this custom FilterList class instead of the one from the Magento 2 module, the Layered Navigation always shows the pagination options as well as the wrong Collection size. The filtering is done correctly (only the filtered products show up), but also the pagination shows with the wrong size:

There is a total of 13 products in this category, but the Collection that is used to determine the pagination always has a size of 13, no matter what filter I activate.

This error does not occur when I load the default FilterList class in Magento\LayeredNavigation\Block\Navigation\Category.

The custom FilterList class:

class FilterList extends \Magento\Catalog\Model\Layer\FilterList
{

    const CUSTOM_FILTER_STRING  = 'customString';

    protected $filterTypes = [
        self::CATEGORY_FILTER  => \Magento\Catalog\Model\Layer\Filter\Category::class,
        self::ATTRIBUTE_FILTER => \Magento\Catalog\Model\Layer\Filter\Attribute::class,
        self::PRICE_FILTER     => \Magento\Catalog\Model\Layer\Filter\Price::class,
        self::DECIMAL_FILTER   => \Magento\Catalog\Model\Layer\Filter\Decimal::class,
        self::CUSTOM_FILTER    => \Vendor\Module\Model\Layer\Filter\CustomFilter::class
    ];

    protected function getAttributeFilterClass(\Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute)
    {
        $filterClassName = $this->filterTypes[self::ATTRIBUTE_FILTER];

        if ($attribute->getAttributeCode() == 'price') {
            $filterClassName = $this->filterTypes[self::PRICE_FILTER];
        } elseif (substr($attribute->getAttributeCode(), 0, 9) == 'customStr') {
            $filterClassName = $this->filterTypes[self::CUSTOM_FILTER];
        } elseif ($attribute->getBackendType() == 'decimal') {
            $filterClassName = $this->filterTypes[self::DECIMAL_FILTER];
        }

        return $filterClassName;
    }
}

The etc/frontend/di.xml:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <virtualType name="Magento\LayeredNavigation\Block\Navigation\Category" type="Vendor\Module\Block\LayeredNavigation\Navigation">
        <arguments>
            <argument name="filterList" xsi:type="object">categoryFilterList</argument>
        </arguments>
    </virtualType>

    <!-- Override the Interface class to avoid an Interface Instantiation error from Magento.  -->
    <preference for="Magento\Catalog\Model\Layer\FilterableAttributeListInterface" type="Magento\Catalog\Model\Layer\Category\FilterableAttributeList"/>
</config>


texts: Setting product option default values in Product detail page

texts:
I would like to set default values to product options in product page. I then defined on observer called by catalog_product_load_after

My observer.php is called as I use it also for a setFinalPrice function and it works.

But, I do not manage to access the product options…

public function preconfandprice($observer)
 {
   $_product = $observer->getEvent()->getProduct();
    ...
   $_options = $_product->getOptions();
 }

returns an empty array…


texts: M1 unexpected T_RETURN, expecting T_FUNCTION

texts:
a have a problem after installing an extension.
I get this error:

Parse error: syntax error, unexpected T_RETURN, expecting T_FUNCTION in blablalbala/Autoloader.php

the code in that file is this:

class Zitec_Emkp_Model_Observer_Autoloader extends Zitec_Integrator_Vendor_Autoload
{
    use Zitec_Emkp_Traits_Version;
}

help me get over it.
Thanks!


texts: Magento 2.3.6: How to change shipping address country name of Taiwan instead of Taiwan, province of China?

texts:
I am using Magento2.3.6.
I want to change shipping address country name of  Taiwan instead of Taiwan, province of China. How can I update for it?
I tried to update in app/code/Magento/Config/i18n/en_US.csv. But can't.


texts: How can i configure customer Middle Name/Initial as a required field in Magento 1.9?

texts:
If it is possible Customer Middle Name/Initial is required, Now I use this code to required this field but can not work

<?php if ($this->showMiddlename()): ?>
<?php $isMiddlenameRequired = $this->isMiddlenameRequired(); ?>

        <label for="<?php echo $this->getFieldId('middlename')?>">*<?php echo $isMiddlenameRequired ? ' class="required"' : '' ?><?php echo $isMiddlenameRequired ? '*' : '' ?><?php echo $this->getStoreLabel('middlename') ?>

            <input type="text" id="<?php echo $this->getFieldId('middlename')?>" name="<?php echo $this->getFieldName('middlename')?>" value="<?php echo $this->escapeHtml($this->getObject()->getMiddlename()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->getStoreLabel('middlename')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('middlename') ?>" <?php echo $this->getFieldParams() ?> />

<?php endif; ?>

so if any suggestions guy's so, please tell me.
Thanks.


texts: magento backend can't upload images when media is on cdn

texts:
i've setup magento CE 1.7.0.2 on a webserver nginx on 12.04 ubuntu cloud server.
i've change configuration in order to use cdn for media, skin and js but i have some issues.
for instance i can't upload new images for the product. no error shown, but the link of image is broken. i've just started using magento so maybe i'm doing something wrong but can't figure out what.


texts: How to save advance inventory custom field value in db in Magento 2

texts:
How to save advance inventory custom field value in DB on Magento 2

events.xml

<?xml version="1.0"?>
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
  <event name="cataloginventory_stock_item_save_after">
    <observer name="Vendor_Module::save_custom_data"
         instance="Cm\Preorder\Observer\AfterProductSave"/>
  </event>
</config>

AfterProductSave.php

<?php
namespace Cm\Preorder\Observer;
use Magento\Framework\Event\ObserverInterface;
class AfterProductSave implements ObserverInterface
{
public function __construct(
    \Magento\Framework\App\RequestInterface $request
)
{
    $this->_request = $request;
}
 public function execute(\Magento\Framework\Event\Observer $observer)

 {
$post = $this->_request->getPost();
var_dump($post);
 }

}

Updated

  Cm/Preorder/etc/adminhtml/events.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="catalog_product_save_after">
        <observer name="preorder_button" instance="Cm\Preorder\Observer\AfterProductSave" />
    </event>
</config>

  Cm\Preorder\Observer\AfterProductSave.php

<?php
namespace Cm\Preorder\Observer;

use \Magento\Framework\Event\ObserverInterface;
use \Magento\Framework\Event\Observer as EventObserver;

class AfterProductSave implements ObserverInterface
{
     protected $_scopeConfig;
     protected $_request;
     protected $_objectManager;

     public function __construct(
        \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
        \Magento\Framework\App\RequestInterface $request,
        \Magento\Framework\ObjectManagerInterface $objectmanager

    ) {
        $this->_objectManager = $objectmanager;
        $this->_scopeConfig = $scopeConfig;
        $this->_request = $request;

    }

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

         $_product = $observer->getProduct();  // you will get product object
        $product_id = $_product->getId();
        $preorder_button=$_product->getPreorderButton();
        $preorder_note=$_product->getPreorderNote();

        $display_text= $this->_objectManager->get('Magento\Framework\App\Config\ScopeConfigInterface')->getValue('preorder/display/btn_text');
         $display_note= $this->_objectManager->get('Magento\Framework\App\Config\ScopeConfigInterface')->getValue('preorder/display/pre_order_note');

            $preorder_button = $display_text;

            $preorder_note = $display_note;

        $resource = $this->_objectManager->get('Magento\Framework\App\ResourceConnection');
        $query = "SELECT * FROM `cataloginventory_stock_item` WHERE  `product_id`=$product_id";
        $connection = $resource->getConnection();
         $res = $connection->fetchAll($query);
        if($res)
            {
               $var = array_column($res, 'product_id');
                $key = key($var);
                $id = $var[$key];
                $sql = "UPDATE `cataloginventory_stock_item` SET preorder_button = '$preorder_button' , preorder_note ='$preorder_note' , website_id = 1  WHERE product_id = ".$id;
                $connection->query($sql);
            }
          }
}


texts:
I imported the categories from Magento 1 to Magento 2, after that I can not create categories, the name appears empty in the list.

I already cleaned the caches, reindex but it does not solve.
This happens when you create subcategories and parent categories. If I try to edit an imported category when saving the name does not change.

No error appears in the error logs.

If I enter the database table and change the name of the categories, it works, but by the magento admin nothing is saved.

Magento version: 2.2.3

Can someone help me?


texts:
I am Trying to upload image using rest api but it gives

string(116) "{"message":"Consumer is not authorized to access %resources","parameters":{"resources":"Magento_Catalog::products"}}"

My code is

$configProductData=array(
   "product"=>array(
               "sku"=>"ABC_123456",
              "name"=> "My Product Title Listing",
              "price"=> 425.99,
                "status"=>1,
               "visibility"=> 4,
               "typeId"=> "simple",
                  "weight"=> 15,
                  "mediaGalleryEntries"=>array(
                    "mediaType"=>"image",
                       "label"=> "abc_123456_image",

                       "position"=> 0,
            "disabled"=> false,
            "file"=> "http://www.url.to/product.png",
               "content"=>array(
                   "base64EncodedData"=>"string",
                     "type"=> "string",
                     "name"=> "string"

)

               )

          ),
"saveOptions"=> true

);
$product_url= "http://demo.store.com/magento2/project-community-edition/index.php/rest/V1/products";
$productData = json_encode(array('product' => $configProductData));
$setHaders = array('Content-Type:application/json','Authorization:Bearer '.$adminToken);
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $product_url);
curl_setopt($ch,CURLOPT_POSTFIELDS, $configProductData);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, $setHaders);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);

I can create products without any issue.But image upload is not working


texts:
I would like to programmatically assign a product collection to a category.
This is my product collection for example

$_productCollection = Mage::getModel('catalog/product')
->getCollection()
->joinField('category_id', 'catalog/category_product', 'category_id', 'product_id = entity_id', null, 'left')
->addAttributeToSelect('*')
->addAttributeToFilter('category_id', array(
        array('finset' => '345'),
        array('finset' => '320')
        )
)
->addAttributeToSort('created_at', 'desc');
$_productCollection->getSelect()->group('e.entity_id');

I want these products to be assigned to a category id. Is it possible?


texts: local.xml points to local host but magento says it's on old server

texts:
I recently moved a magento website for a friend. The old local.xml pointed to the old server IP address so I corrected this on the new site to point to localhost. Everything worked fine and seem to be using the DB on the new server as the account on the old server was suspended.

1 day later the old server was taken offline and the database no longer works, seems it was still pointing to the old server. I've cleared the cache, made sure the compiler was turned off and deleted the sessions with no luck.

Here the local.xml to provide any aid

<connection>
                    <host><![CDATA[localhost]]></host>
                    <username><![CDATA[<DB User>]]></username>
                    <password><![CDATA[<password>]]></password>
                    <dbname><![CDATA[<DB Name>]]></dbname>
                    <initStatements><![CDATA[SET NAMES utf8]]></initStatements>
                    <model><![CDATA[mysql4]]></model>
                    <type><![CDATA[pdo_mysql]]></type>
                    <pdoType><![CDATA[]]></pdoType>
                    <active>1</active>
                </connection>


texts: Other way to build bootstrap framework with "else if"?

texts:
I have created a page for header.phtml I tried to change old design to new useful design with Bootstrap with my book. But I have a problem in two lines

  <?php else: ?>

  <?php endif;?>

My php file doesnt work at all. I tried to take it out, but I need them because if customer logged in he would see different links on it.

I putted my code under my comments

So my question, is there another way to do it? Create same page, but with different structure

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

                <?php echo $this->getLayout()->getBlock('header')->getWelcome() ?>

                    <a title="<?php echo $this->__('My Account') ?>" href="<?php echo $this->getUrl('customer/account') ?>"><?php echo $this->__('My Account') ?>

                    <a title="Log Out" href="<?php echo $this->getUrl('customer/account/logout') ?>"><?php echo $this->__('Logout') ?>

                <?php else: ?>

                    <a href="<?php echo $this->getUrl('customer/account/login/')?>">
                <?php echo $this->__('Login') ?>

                    <a href="<?php echo $this->getUrl('customer/account/create/')?>">
                <?php echo $this->__('Create Account') ?>

                <?php endif;?>


texts: Why Object manager can not instantiate Non-injectable?

texts:
Magento 2 uses Object manager to create all objects.

Injectable

Object (typically a singleton) that can be instantiated by the object manager.

Non-injectable

Object that cannot be instantiated by the object manager.

these statements are very confusing.can you any one explain ?


texts: Can't apply custom layout update to block?

texts:
I have a static block identifier named 'can_content_block_ideas' and within that block the following template file is being called {{block type='core/template' template='can/home/featured.phtml}}

Now, that template file contains the class (.featured-product-price) that I want to remove using the Custom Layout Update feature in Magento located here: Categories > Custom Design.

Below is the XML I am trying to use but I just can't figure out how to get it to work.

<reference name="can_content_block_ideas">
    <block type="core/template" name="hide.content">
      <action method="setText">
        <text>
           <![CDATA[
                <style type="text/css">
                    .featured-product-price { display: none; }
                </style>
            ]]>
            </text>
        </action>
    </block>


texts: Magento 2 REST API For Place Order gives "transaction declined" error after successful Payment For Payfort Payment Gateway

texts:
I am using Payfort extension to process credit Card Payments online for Payfort Payment Gateway. For Website it's working Fine and Placing an order after successful payment.
But when I am trying to place an order via API after successful payment via it's iOs/Android SDK.
It's giving me this Error.
Transaction has been declined. Please try again later.
This is How I am passing each information I received from Payfort after Successful Payment in this API.
Endpoint
/rest/V1/carts/mine/set-payment-information
Request
{
"billingAddress": {
"city": "Dubai",
"countryId": "AE",
"customerAddressId": "2885",
"customerId": "3438",
"fax": "+971521231234",
"firstname": "Test",
"lastname": "User",
"postcode": "1111",
"region": "Dubai",
"regionCode": "DXB",
"regionId": "597",
"street": [
"Street 44, Oud Maitha"
],
"telephone": "+971521231234"
},
"cartId": "24361",
"paymentMethod": {
"additional_data": {
"amount": "29995",
"authorization_code": "614835",
"card_number": "411111******1111",
"card_holder_name": "Test User ",
"customer_email": "test.user@test.com",
"customer_ip": "43.241.194.95",
"expiry_date": "2102",
"fort_id": "169996200000452654",
"is_active_payment_token_enabler": false,
"merchant_reference": "XXXXXXXX",
"payment_option": "VISA",
"sdk_token": "c85bf903408b45a19a194710a941607a",
"token_name": "82f62b316c3246908ba29c8f2e683f45"
},
"method": "md_payfort"
}
}
I am getting "True" in the response of this API call.
Then, I am using Create Order API of Magento to Place an Order.
Endpoint
/rest/V1/carts/mine/order
Request
{
"paymentMethod": {
"method": "md_payfort"
},
"shippingMethod": {
"additionalProperties": {},
"carrier_code": "freeshipping",
"method_code": "freeshipping"
}
}
After debug, I found that this error is coming from this file.
vendor/magento/module-payment/Gateway/Command/GatewayCommand.php
And it's because the "execute" method in this class is sending the Payment request again to Payfort and they receive the "Signature mismatch" error from Payfort because of the unauthorized request. It should not send the Payment request again to Payfort.
I am not able to figure out how to prevent Magento to make this Payment request and just Place the Order.
If anyone can help me out to solve this problem and place an order successfully would be really appreciated.


texts:
I'm hanging on this issues for nearly a week and cannot find any sollution. I'm trying to send a REST request to my new Magento2 store. It worked allready, but then the oauth/token forced authentication was activated, now I can't beak through to the backend.
I tried it with the scribe framework v1.8.0, here's my attempt:

public class MagentoApi extends DefaultApi10a {
private static final String BASE_URL = "http://myshopurl.de/";
private static final String AUTHORIZE_URL = "http://myshopurl.de/oauth/oauth_authorize?oauth_token=";
private static final String REQUEST_TOKEN_ENDPOINT = "http://myshopurl.de/oauth/token/request";
private static final String ACCESS_TOKEN_ENDPOINT = "http://myshopurl.de/oauth/token/access";

@Override
public String getAccessTokenEndpoint() {
    return ACCESS_TOKEN_ENDPOINT;
}

@Override
public String getRequestTokenEndpoint() {
    return REQUEST_TOKEN_ENDPOINT;
}

@Override
public String getAuthorizationUrl(OAuth1RequestToken requestToken) {
    return String.format(AUTHORIZE_URL, requestToken.getToken());
}
public static MagentoApi instance() {
    return MagentoApi.InstanceHolder.INSTANCE;
}

private static class InstanceHolder {
    private static final MagentoApi INSTANCE = new MagentoApi();

    private InstanceHolder() {
    }
}
    }

And here my testclient:

public class AuthTest {

    private static final String CONSUMER_KEY  = "MYCONSUMERKEYHERE";
    private static final String CONSUMER_SECRET  = "MYSECRETKEYHERE";

    public static void main(String[] args) throws IOException {
        OAuth10aService service = new ServiceBuilder()
                .apiKey(CONSUMER_KEY)
                .apiSecret(CONSUMER_SECRET)
                .debug()
                .build(MagentoApi.instance());
    final OAuth1RequestToken requestToken = service.getRequestToken();
    System.out.println(service.getAuthorizationUrl(requestToken));
    final String oauthVerifier = in.nextLine();
    final OAuth1AccessToken accessToken = service.getAccessToken(requestToken, oauthVerifier);
    final OAuthRequest request = new OAuthRequest(Verb.GET, The_Magento_Get_Categories_REST_URL, service);
    service.signRequest(accessToken, request);
    final Response response = request.send();
    System.out.println(response.getBody());
 }
}

The result is appearing in this line:
            final OAuth1RequestToken requestToken = service.getRequestToken();

this is the sysout:

Fetching the Request Token...
obtaining request token from http://myshopurl.de/oauth/token/request
setting oauth_callback to oob
generating signature...
using base64 encoder: CommonsCodec
base string is: POST&http%3A%2F%2Fmyshopurl.de%2Foauth%2Ftoken%2Frequest&oauth_callback%3Doob%26oauth_consumer_key%thekey%26oauth_nonce%3D3285773414%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1467397682%26oauth_version%3D1.0
signature is: u4h6pVZw6tU8aj0NdFljBSB3h9o=
appended additional OAuth parameters: { oauth_nonce -> 3285773414 , oauth_signature -> u4h6pVZw6tU8aj0NdFljBSB3h9o= , oauth_callback -> oob , oauth_consumer_key -> thekey, oauth_timestamp -> 1467397682 , oauth_signature_method -> HMAC-SHA1 , oauth_version -> 1.0 }
using Http Header signature
sending request...
response status code: 401
response body: oauth_problem=Consumer+key+has+expired

I'm really begging for help.

Otherwise, is there a possibility to deactivate the authentication via REST at all?

Thank you in advance!

PS: The integration is activated in the backend. I also tried reauthorizing several times.


texts: Magento 2.3.6-p1 upgrade to 2.4.2 - 404 error on both front end and backend

texts:
I recently upgraded one Magento installation on my local from 2.3.6-p1 to 2.4.2, and then I started getting 404 error for all pages on front end and backend, below are the technical details of server, and few tries I already made:
values set in httpd.conf (as I run multiple websites so I place them in subdirectory of /var/www/html)
Listen 192.168.1.119:80
Timeout 600
Include conf.modules.d/*.conf
User apache
Group apache
ServerAdmin root@localhost
<Directory />
    AllowOverride none
    Require all denied
</Directory>
DocumentRoot "/var/www/html"
<Directory "/var/www">
    AllowOverride All
    Order allow,deny
    Allow from all
    # Allow open access:
    Require all granted
</Directory>
# Further relax access to the default document root:
<Directory "/var/www/html">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
    Require all granted
</Directory>

root .htacces file:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/pub/
RewriteCond %{REQUEST_URI} !^/setup/
RewriteCond %{REQUEST_URI} !^/update/
RewriteCond %{REQUEST_URI} !^/dev/
RewriteRule .* pub/$0 [L]
DirectoryIndex index.php
</IfModule>

Note: I added ifmodule statement here to confirm that mod rewrite is
installed and working.

I have cleared all cache and generated folders using the command below:
rm -rf pub/static/frontend/* pub/static/adminhtml/* var/cache/ var/generation/ var/page_cache/ var/view_preprocessed/ var/composer_home generated/

and then recompiled and deployed, but not working for me, can anyone help me for the same.


texts: What should I do to change payment methods if changing the configuration has no effects?

texts:
I am trying to configure accepted payment methods on my (first) Magento 2 website. I disabled "Check Money Order" and enabled "Bank transfer" and "Cash on Delivery" payments through the admin panel. However, the checkout page still displays only the Check/Money Order method (which I disabled). I have already:

flushed/disabled cache
deleted cached static content and preprocessed views
looked for conflicting settings in different scopes
switched back to Blank theme from my custom one
flushed browser cache

Nothing happens with the payment methods.

If it can be useful:

Magento (v. 2.1.3 CE) is currently in development mode (I don't know if this information may be useful).
Other than changing the payment methods, I also edited a few settings about taxes to have the catalog show prices with taxes included. This setting has not produced effects as well. I haven't investigated this issue as much as for the payment methods, anyway.

Am I missing any steps?

Thanks in advance for your advice.


texts: Magento 2: Shipping method radio button is disabled

texts:
In checkout page of Magento 2, all enabled shipping method radio buttons are showing as disabled. Anybody have faced such an issue?

I used latest version: 2.1.3


texts: Change width in custom theme - Magento 2

texts:
I created a new theme inheriting from Luma based on some totorias, the only change I made was to put it in _theme.less
// Widths
@layout__width: '';
@ layout__max-width: 100%;
@ layout-indent__width: 10px;
@ layout__width-xs-indent: 10px;

Actually the screen was 100%, but the header, menu and footer lost the original format and font of Luma. Shouldn't I inherit from the luma theme? Did I miss something?


texts: Magento2 PWA images missing - development environment

texts:
I have followed below URL.

  https://webkul.com/blog/magento2-3-pwa-studio-setup/

Setup is successfully installed and my local environment is connected to PWA application, but all of my images went missing while browsing PWA. as it is taking images url something like below

  https://my-pwa.com:8477/media/catalog/category/timeless.jpg

Any Configuration for changing this or any workaround.


texts:
I have customer id .

Using customer id i want customer address.

so how to get customer address and using country id how to get full name of country


texts:
I'm using Follow Up Email extension from AheadWorks.

There is AW Review Request Per Product template in newsletter templates section contained following line code

{{foreach var="$order.getAllVisibleItems()" template="nsltr:AW Review Request Per Product Row"}}

Now by analyzed above code i check in AW Review Request Per Product Row template which contained following code for product url

{{store url="catalog/product/view" id="$row_item.product.id"}}

so when we generate test email product url returns wrong in email like http://www.localhost.com/catalog/product/view/id/1510/

but i want actual product url like http://www.localhost.com/abc.html

so can anyone help me how to achieve this functionality?


texts: How to change Path of CSS File in Magento 2?

texts:
I want to change the folder name of my Sub-directories of CSS file. For Example, currently it is in /pub/static/version1584394723/frontend/MTheme/layout/en_US/calendar.css. But I want to make my Mtheme folder name to be changed to say Ztheme

i.e /pub/static/version1584394723/frontend/**ZTheme**/layout/en_US/calendar.css

I have simply changed the folder name, but that didn't work.  Apart from changing folder name, I guess I need to change the href also. But don't know how to do that. Can anyone tell me how to edit href?


texts: Magento2 Out of Stock Products are not display in category page

texts:
i have setup my site on magento 241 and out of stock products are not showing on category page, but it is showing on homepage widget section.
i also set display out of stock product options = yes from backend than also not showing .
does anyone have idea how can i solve this problem ?


texts: Magento2.2: attribute 'role': The attribute 'role' is not allowed

texts:
After upgrade from Magento 2.1.9 to 2.2.2

Element 'container', attribute 'role': The attribute 'role' is not allowed.
Line: 31
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><handle id="handle"><container name="root">
   <container name="after.body.start" as="after.body.start" before="-" label="Page Top"/>
   <container name="page.wrapper" as="page_wrapper" htmlTag="div" htmlClass="page-wrapper">
      <container name="global.notices" as="global_notices" before="-"/>
      <container name="main.content" htmlTag="main" htmlId="maincontent" htmlClass="page-main">
         <container name="columns.top" label="Before Main Columns"/>
         <container name="columns" htmlTag="div" htmlClass="columns">
            <container name="main" label="Main Content Container" htmlTag="div" htmlClass="column main"/>
         </container>
      </container>
      <container name="page.bottom.container" as="page_bottom_container" label="Before Page Footer Container" after="main.content" htmlTag="div" htmlClass="page-bottom"/>
      <container name="before.body.end" as="before_body_end" after="-" label="Page Bottom"/>
   </container>
</container>
<move element="catalog.leftnav" destination="category.product.list.additional" before="-"/>
<update handle="empty"/>
<referenceContainer name="page.wrapper">
   <container name="header.container" as="header_container" label="Page Header Container" htmlTag="header" htmlClass="page-header" before="main.content"/>
   <container name="page.top" as="page_top" label="After Page Header" after="header.container"/>
   <container name="footer-container" as="footer" before="before.body.end" label="Page Footer Container" htmlTag="footer" htmlClass="page-footer"/>
</referenceContainer>
<move element="catalog.leftnav" destination="content.top" after="-"/>
<update handle="empty"/>
<container name="root">
   <container name="after.body.start" as="after.body.start" before="-" label="Page Top"/>
   <container name="page.wrapper" as="page_wrapper" htmlTag="div" htmlClass="page-wrapper">
      <container name="global.notices" as="global_notices" before="-"/>
      <container name="main.content" htmlTag="main" htmlId="maincontent" htmlClass="page-main container">
         <container name="columns.top" label="Before Main Columns"/>
         <container name="columns" htmlTag="div" htmlClass="columns layout layout-1-col row">
            <container role="main" name="main" label="Main Content Container" htmlTag="div" htmlClass="col-main col-lg-12 col-md-12 col-sm-12 col-xs-12" after="-"/>
         </container>
      </container>
      <container name="page.bottom.container" as="page_bottom_container" label="Before Page Footer Container" after="main.content" htmlTag="div" htmlClass="page-bottom"/>
      <container name="before.body.end" as="before_body_end" after="-" label="Page Bottom"/>
   </container>
</container>
<referenceContainer name="page.wrapper">
   <container name="header.container" as="header_container" label="Page Header Container" htmlTag="header" htmlClass="header-container" before="main.content"/>
   <container name="page.top" as="page_top" label="After Page Header" after="header.container"/>
   <container name="footer-container" as="footer" before="before.body.end" label="Page Footer Container" htmlTag="footer" htmlClass="page-footer"/>
</referenceContainer>
</handle></layout>


texts: Magento 2 dynamic custom column in UI listing, sorting not working

texts:
I have create two columns "Sending" and "Remaining". The value of them is based on the "In stock" column. When i tried to sort the order of one of column then it doesn't work. It gives me an error.
eq In Stock = 10.
   Entered 3 in "Sending"
   Remaining column will change to 7.

The sorting doesn't work for both columns.


texts:
I have a very simple phtml file like

<?php if ($block->getCondition()): ?>
foo
<?php else: ?>
bar
<?php endif; />

I want to write an automated test to check if block->getCondtion is true we render foo. How can I write a such test?


texts: Specify Default Sort Direction for Specific Collection

texts:
I've created a module that adds a new sort by option called 'Date Enabled'. The aim of this option is to display the products that have the 'Date Enabled' attribute set in descending direction by default, from the newest date to the oldest date.
As seen in the screenshot below, I'm able to display the products in descending direction by default. The problem is that the sort order arrow does not change, and if I dump the $currentDirection variable I can see that the current direction is actually ascending, even though the products are clearly sorted in descending order based on the 'Date Enabled' attribute.

A simple example of the implementation without additional conditions for sort directions is below, I have tried multiple implementations and unfortunately I end up with the same result.
public function aroundSetCollection(
    \Magento\Catalog\Block\Product\ProductList\Toolbar $subject,
    \Closure $proceed,
    $collection
) {
    $currentOrder = $subject->getCurrentOrder();
    $currentDirection = $subject->getCurrentDirection();
    $result = $proceed($collection);

    if ($currentOrder == 'date_enabled') {
        $collection->setOrder('date_enabled', 'desc');
    }

    var_dump($currentDirection);
    return $result;
}

Essentially I need the default sort direction to be 'Descending' when the sort order is 'Date Enabled', and for the sort direction arrow to be pointing downward.
I've tried to set the default direction using the setDefaultDirection method but unfortunately this has no affect. I'm also aware that I can set a default direction via layout files, however this is a global solution and does not help me to achieve a default direction only when the sort order matches 'Date Enabled'.
Any help would be appreciated.


texts: What are the use of getExtensionAttributes() and getCustomAttribute() in Eav Attribute in Magento2

texts:
Using Magento-2.1.3 CE
For a purpose,have created a Customer attribute  which are using at time of  Customer Registration and customer edit page in frontend.
On the edit page,i got the error when i was trying to fetch data of that attribute. and i have post the issue at MSE Custom customer attribute are throwing error at Customer edit Page - Magento2
And got the answer from  Khoa TruongDinh .
Khoa TruongDinh was suggest me to use
$block->getCustomer()->getCustomAttribute('[Custom_Attribute]]') Or
$block->getCustomer()->getExtensionAttributes()->get[Custom_Attribute]();
At last of using $block->getCustomer()->getCustomAttribute([Custom_Attribute]]');
i get this attribute value at edit.phtml
Now question is:

Why we need to  use
$block->getCustomer()->getCustomAttribute('[Custom_Attribute]]')
and
$block->getCustomer()->getExtensionAttributes()->get[Custom_Attribute]();
for getting the value of this custom attribute
What are different between
$block->getCustomer()->getExtensionAttributes()->get[Custom_Attribute]();
and
$block->getCustomer()->getExtensionAttributes()->get[Custom_Attribute]();
Why  magento use Magento\Customer\Model\Data\Customer for customer
edit and register page?

Can anyone of magento SE  give the answer of above questions?


texts: Can't filter 'reports/product_collection' on category

texts:
What I'm basically trying to do is sort a product collection by sales so that the most sold product is on top.

Since there doesn't seem to be a standard way to do this in Magento, I first want to get the product ID's of the most sold products by category, like this;

$category = Mage::getModel('catalog/category')->load({category_id});
$reports = Mage::getResourceModel('reports/product_collection')
                 ->addAttributeToSelect('*')
                 ->addCategoryFilter($category)
                 ->addOrderedQty()
                 ->setOrder('ordered_qty', 'desc');

After which I will do some magic with these ID's and create my products JSON.
However, first I'd have to filter the reports per category, but the stock addCategoryFilter() function doesn't work. If I try to do a ->getSelect() after applying the category filter, and search for something like 'category', I find nothing. The function addCategoryFilter() doesn't seem to do anything.

How can I fix this?


texts:
So I found the code in the module-swatches there is class Called RenderLayered. here is the snipped code :

/vendor/magento/magento-swatches/Block/LayeredNavigation/RenderLayered.php

public function buildUrl($attributeCode, $optionId)
{
    $query = [$attributeCode => $optionId];
    return $this->_urlBuilder->getUrl('*/*/*', ['_current' => true, '_use_rewrite' => true, '_query' => $query]);
}

What is the routepath Params mean here */*/* ?


texts: Solved - How to override checkout_index_index.xml

texts:
I have a problem. I can't override file checkout_index_index.xml in my page.

I need override because this file move logo to another position in the page.

I copied the file in the next directories: -

app/design/frontend/theme/namespace/Magento_Checkout/layout/override/base
app/design/frontend/theme/namespace/Magento_Checkout/layout/override/theme/blank
app/design/frontend/theme/namespace/Magento_Checkout/layout/override/Magento/blank

Any one Please help

Solved

For override I put checkout_index_index.xml in /app/design/frontend/theme/namespace/Magento_Checkout/layout/ and put inside of file this code:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <move element="logo" destination="div.header" before="-"/>
</body>

Thank you All


texts: Multi Site, Multi Domain, Multi Language

texts:
I have 2 sites running on Magento 1.8.1 and each site has a different domain. I would like to have 3 store views for each site.
Each site will have 3 languages.
Each language will use the same TLD. Languages will be denoted by using /en/ in the url.
Here's what I'm trying to get it to look like:
http:website-a.com/en/product.html
http:website-a.com/es/product.html
http:website-a.com/fr/product.html

http:website-b.com/en/product.html
http:website-b.com/es/product.html
http:website-b.com/fr/product.html

I can easily achieve this on only one site by simply using the "Add Store Code to Urls" option in Magento Admin.  However, Magento will not allow me to use the same store code twice. Furthermore, If I decide to run a third website that only has one language, I wouldn't want to insert any store code.

e.g.(http:website-c.com/product.html)
but unfortunately
the "Add Store Code to Urls" option is global and cannot be changed on a
per-site or per-store basis.

So, how would I go about setting this up to work right?  Should I use unique values for each store view and then do rewrites? How would that work? I don't really understand how to write rewrite rules.
Or could I do something in index.php?
Any help is appreciated :)


texts: Images Upload Error In Image Gallery in Magento 2.3.4/5

texts:
In my server side (live), Image gallery not open, i am trying .png/jpg format only. New images are not being uploaded and do not show the already uploaded image.

i have attached with screen shot.

Do not show the already uploaded image

New images are not being uploaded


texts: Apple pay and Google pay not able to see in Magento 2 using Stripe

texts:
I have configured Stripe account and in that I have enabled Apple Pay and Google Pay after configuring on stripe i even enabled from Magento backend but it seems I could not see any Apple Pay and Google Pay button.
Can you please provide any solution?


texts: Magento 2.0 after the instalation backend menu do not work

texts:
The buttons do not work. It seems to me that are some incompatibility of missing configuration with the Browser. My site is in the localhost. I tried in IE11 and Chrome. In IE11 after have added my site into the compatibility view mode and the options of submenus appeared and worked, but without CSS.

I am beginner on Magento.


texts: save the guest address without placing an order

texts:
we have a magento site with version 1.9

some guest added some items to the cart and than they entered

the shipping information and they select payment method and than they will not place order.

they will close the site.

is there any way , so that after guest entered the shipping address

we have to save that shipping address in the admin panel or in the database....


texts:
i am getting this error on developer mode but works in default

Exception #0 (Magento\Framework\Config\Dom\ValidationException): Theme layout update file
XML declaration allowed only at the start of the document
 Line: 31
First line xml, is line 31 before that its html comment

<?xml version="1.0" encoding="UTF-8"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
     <update handle="editor"/>
    <body>
       <referenceContainer name="content">
            <block class="Apptha\Airhotels\Block\Adminhtml\Uploadvideo\Edit" name="airhotels_uploadvideo_edit"/>
        </referenceContainer>
         <referenceContainer name="left">
            <block class="Apptha\Airhotels\Block\Adminhtml\Uploadvideo\Edit\Tabs" name="airhotels_uploadvideo_edit_tabs">
                <block class="Apptha\Airhotels\Block\Adminhtml\Uploadvideo\Edit\Tab\AddVideo" name="airhotels_uploadvideo_edit_tab_addvideo"/>
                 <action method="addTab">
                    <argument name="name" xsi:type="string">addvideo_section</argument>
                    <argument name="block" xsi:type="string">airhotels_uploadvideo_edit_tab_addvideo</argument>
                </action>
                <!--CedAddTab-->
            </block>
        </referenceContainer>
    </body>
</page>

Thanks