#StackBounty: #magento2 #magento-2.1 #catalogsearch #performance #indexer Improve performance – Catalog Search Fulltext

Bounty: 50

Do you have some suggestion how can I improve the performance of the catalogsearch_fulltext indexer for Magento 2.1.X

I already set this indexer to ‘Update By Schedule’ so only the updated products are refreshed thanks to Mview pattern.

I have ElasticSearch as search engine, but it is not really related to it.

I have around

  • 20k products
  • 7k products visible in search by store
  • 31 stores
  • less than 10 new custom searchable attributes

For a full re-index, Magento took around 10 minutes by stores, so around 5 hours for all stores.

I plan to re-index each store in parallel and increase the server CPU and memory because each catalog search index seems independent by stores.

I try to import products with a differential approach, but sometime my customer needs a full product import.

Edit: I did a POC thanks to https://github.com/amphp/parallel reducing from 5 hours to 14 min using the c5.9xlarge EC2 instance with 36vCPU. But I want to know if there is alternative solution. (>1000$ per month)


Get this bounty!!!

#StackBounty: #magento2 #magento-2.1 #paypal-express Paypal express checkout magento 2 – Shipping address is invalid when place order u…

Bounty: 50

I am using magento 2.1.13 and facing issue with paypal express checkout.

When I place and order using China, Japan, and Us. it’s working but when I place an order using Russian country with their address it’s showing me error “we can’t place an order” I check debug log and it’s showing “Shipping address is invalid.” I try to many more address from Russia but same issue is there. here is paypal log.

 array (
  'url' => 'https://api-3t.sandbox.paypal.com/nvp',
  'DoExpressCheckoutPayment' => 
  array (
    'TOKEN' => 'EC-33D21907WX527562D',
    'PAYERID' => 'UTZY4EHG8787G',
    'PAYMENTACTION' => 'Authorization',
    'AMT' => '13.00',
    'CURRENCYCODE' => 'USD',
    'BUTTONSOURCE' => 'Magento_Cart_Community',
    'NOTIFYURL' => 'https://mysite/paypal/ipn/',
    'RETURNFMFDETAILS' => 1,
    'SHIPPINGAMT' => '5.00',
    'ITEMAMT' => '8.00',
    'TAXAMT' => '0.00',
    'L_NUMBER0' => NULL,
    'L_NAME0' => 'Calming oz',
    'L_QTY0' => 1,
    'L_AMT0' => '8.00',
    'BUSINESS' => NULL,
    'EMAIL' => 'pratik.kk@yahoo.com',
    'FIRSTNAME' => 'Pratik',
    'LASTNAME' => 'asasas',
    'MIDDLENAME' => NULL,
    'SALUTATION' => NULL,
    'SUFFIX' => NULL,
    'COUNTRYCODE' => 'RU',
    'STATE' => '',
    'CITY' => 'Nizhnelunohodsk ',
    'STREET' => 'Svetlaya ul. Apt 191',
    'ZIP' => '877561 ',
    'PHONENUM' => '35535353',
    'SHIPTOCOUNTRYCODE' => 'RU',
    'SHIPTOSTATE' => 'AD',
    'SHIPTOCITY' => 'Nizhnelunohodsk ',
    'SHIPTOSTREET' => 'Svetlaya ul. Apt 191',
    'SHIPTOZIP' => '877561 ',
    'SHIPTOPHONENUM' => '35535353',
    'SHIPTOSTREET2' => '',
    'STREET2' => '',
    'SHIPTONAME' => 'Pratik asasas',
    'ADDROVERRIDE' => 1,
    'METHOD' => 'DoExpressCheckoutPayment',
    'VERSION' => '72.0',
    'USER' => '****',
    'PWD' => '****',
    'SIGNATURE' => '****',
  ),
  'response' => 
  array (
    'TOKEN' => 'EC-33D21907WX527562D',
    'SUCCESSPAGEREDIRECTREQUESTED' => 'false',
    'TIMESTAMP' => '2018-07-03T11:30:03Z',
    'CORRELATIONID' => 'd23e3f82f3c47',
    'ACK' => 'Failure',
    'VERSION' => '72.0',
    'BUILD' => '000000',
    'L_ERRORCODE0' => '10424',
    'L_SHORTMESSAGE0' => 'Transaction refused because of an invalid argument. See additional error messages for details.',
    'L_LONGMESSAGE0' => 'Shipping address is invalid.',
    'L_SEVERITYCODE0' => 'Error',
  ),


Get this bounty!!!

#StackBounty: #magento2 #magento-2.1 #shopping-cart-price-rules #coupon Magento cart price rules conditions not working properly

Bounty: 50

I have a discount of free shipping which I want to apply when the shipping address is in the U.S. and the subtotal is $100 or over.

I am trying to exclude Hawaii and Alaska from receiving the free shipping but even after excluding it, its still giving the free shipping to Alaska and Hawaii.

enter image description here

Can someone help? Am I doing it wrong?


Get this bounty!!!

#StackBounty: #magento-2.1 #sorting #php-7 How to convert Magento 2 Sort By Dropdown to Horizontal List

Bounty: 50

I was trying to Convert Magento 2 Drop down to Horizontal list.

Code Path:

/app/design/frontend/Vendor/Theme/Magento_Catalog/templates/product/list/toolbar/sorter.phtml

Actual Code:

getAvailableOrders() as $_key => $_order): ?> " isOrderCurrent($_key)): ?> selected="selected" > escapeHtml(__($_order)) ?>

What I tried :


Did some research on this and found this LINK

But Couldn’t able to find the Solution. Please help me on this.

Actual Display

Actual Display

Expected Result : On Click Products should sort according to the selection

Expected

Sorter.phtml File

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

?>
<?php
/**
 * Product list toolbar
 *
 * @var $block MagentoCatalogBlockProductProductListToolbar
 */
use MagentoCatalogModelProductProductListToolbar;
?>
<?php if ($block->getCurrentDirection() == 'desc'): ?> <a title="<?= /* @escapeNotVerified */ __('Set Ascending Direction') ?>" href="#" class="action sorter-action sort-desc" data-role="direction-switcher" data-value="asc"> <span><?= /* @escapeNotVerified */ __('Set Ascending Direction') ?></span> </a> <?php else: ?> <a title="<?= /* @escapeNotVerified */ __('Set Descending Direction') ?>" href="#" class="action sorter-action sort-asc" data-role="direction-switcher" data-value="desc"> <span><?= /* @escapeNotVerified */ __('Set Descending Direction') ?></span> </a> <?php endif; ?> </div>


Get this bounty!!!

#StackBounty: #magento2 #magento-2.1 #database #sales-order Random integrity constraint errors saving orders in Magento 2.1 after payment

Bounty: 50

I have a system that generates quotes, then submits the quotes, which processes a payment. The system is pretty standard: nothing really complicated is going on. The quotes have a single product in them.

After the payment is processed, Magento saves the Order and the payment. However, sometimes we get an exception:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (sales_order_address, CONSTRAINT SALES_ORDER_ADDRESS_PARENT_ID_SALES_ORDER_ENTITY_ID FOREIGN KEY (parent_id) REFERENCES sales_order (entity_id) ON DELETE CASCADE) in /var/www/html/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:228

This error suggests to me that it is trying to save the sales_order_address for a non-existent sales_order record, but why would that happen?

The payment was processed successfully on the backend but there is nothing recorded in the database to indicate that. Retrying the same quote again with the same input data usually results in success – the error appears to be transient.

How can I figure out what is causing the sales_order record to be deleted? How is this even possible? I tried searching the Magento code for a transaction rollback that swallows an exception, but didn’t find any. We are using a third-party Stripe payment module but the order-saving part happens after the payment was successfully placed. From what I can see whatever error is happening here is entirely in the core code. The error is happening on the latest (2.1.11) version.


Get this bounty!!!

#StackBounty: #magento-2.1 #database #upgrade #magento2.2.2 Upgrading M2.1.9 to Magento 2.2.2 is very slow

Bounty: 50

We are trying to upgrade a Magento 2.1.9 site to Magento 2.2.2
We have more than 130k products and the process seems to be stuck for more than 3 hours on

Upgrading data..
Module 'Magento_Backend':
Module 'Magento_Catalog':

I used xdebug to profile what process takes so long and apparently problem is:

if (version_compare($context->getVersion(), '2.2.2') < 0) {
            $this->upgradeWebsiteAttributes->upgrade($setup);
        }

Having many products and many attributes the process takes ages. Actually it’s still stuck there so it’s been 3 days. The database size it’s 47GB


Get this bounty!!!

#StackBounty: #magento-2.1 #database #configurable-product #stock #indexing Magento2 – index modes issue

Bounty: 200

We have this Magento 2.1 project running Production mode with “Update on save” mode for all indexes

Our customer manages catalog himself, and reported us some stock issues. Problem was changing quantity for a new product was not working. Process apparently ends fine, regarding the admin message (“Product was saved ok”) but stock was not changed. We look in Magento log files, but we don’t see any related report there

Our solution, finally, was to change indexes to “Update by schedule” and then force a reindex by console command. This solution, as far as I understand, means there is something wrong with that partial reindex fired when saving a product with “Update on save” index mode. What I am asking is for a confirmation about this… should not this problem be reported in Magento log files?

Assuming there is something wrong with our catalog data, I’d like to trace the problem, so I’d like to know which processes (the complete code trace) are fired after a product save in admin, with “Update on save” index mode. In this case, I suppose catalog_inventory ones are the most relevant

Apart from that, and checking the catalog, we’ve noticed some configurable products were sharing simple products, which is rare & we are not sure if could be the origin of the problem (although we assume system wouldn’t let to do that if that’s not allowed). Maybe this could have registered some wrong data in catalog database tables, and causing the problems with partial reindex? If that’s the case… Where can I find in database which data is pending to be processed in the next full reindex process?


Get this bounty!!!

#StackBounty: #magento-2.1 #product #cart #custom-options #image How to set value of an image custom option programmatically Magento 2?

Bounty: 50

I’m trying to set a image Custom Option in a php script before adding the product to cart. Relevant code looks like this:

$specialId = 123;
$customOptions[$specialId] = "Special instruction custom option";

// $imageId = 124;
// $url = 'http://example.com/url/to/image.png';
// $customOptoins[$imageId] = $url;

$params = [
    'product' => $product_id,     //product Id
    'qty'     => $qty,            //quantity of product
    'options' => $customOptions   //custom options
];

$this->_cart->addProduct(
    $_product,
    $params
);

I’m starting with an image url as the code implies. I think I have to use MagentoFrameworkApiDataImageContentInterface, MagentoCatalogModelWebapiProductOptionTypeFileProcessor and maybe curl, but I’m unsure how to proceed.


Get this bounty!!!