Magento 2.3 migration issue, configurable products causing 503 error

I’m facing those issues after data migration from Magento 1.9.4 to Magento 2.3 :

  • configurable products are causing 503 server error on front-end.
  • categories with configurable products are causing 503 server error.
  • searching for a configurable product is causing 503 server error.

  • PHP LOGS

    [21-Mar-2019 03:16:01] WARNING: [pool example.com] child 57516 exited on signal 11 (SIGSEGV) after 1.659686 seconds from start [21-Mar-2019 03:16:01] NOTICE: [pool example.com] child 57576 started 
  • DOMAIN LOGS:

    AH01067: Failed to read FastCGI header, referer: https://example.com/ (104)Connection reset by peer: AH01075: Error dispatching request to: , referer: https://example.com/

  • Magento 2.3 fresh install and default theme

  • The products have unique URL’s
  • I managed to have them all working by opening and saving one single random product. Reindexing will make them crash again.

• Magento LOGS :

main.ERROR: Warning: SessionHandler::read(): open(/var/lib/php/sessions/sess_ub6spo4jcfmsh0itec4jahoik8, O_RDWR) failed: Permission denied (13) in /var/www/vhosts/example.com/httpdocs/vendor/magento/framework/Session/SaveHandler/Native.php on line 22 

Environment : Ubuntu 18.04.2 LTS‬ Plesk Onyx – Version 17.8.11 Update #45 PHP 7.2.16 – FPM Application Served by Apache Nginx : Proxy mode + Smart static files processing

PHP Settings : max_input_vars = 10000 max_input_nesting_level = 800 precision = 14 output_buffering = 44096 memory_limit : 10GO max_execution_time : 180000 max_input_time : 180000

As a non AASP – I am looking other suppliers who supply Apple products, accessories as well as parts

I am humbly asking and seeking the assistance from someone who can help me to direct me to the right firms and suppliers, who provide Apple products, parts and accessories. I want to be able to resell Apple products for our business use. We repair tons of apple products (from iPhone, MackBook Pro, Air, iMac, etc) so currently doing a research where I can buy refurbished and genuine parts and accessories from for our business and customers needs.

I have done some research of course and it requires to buy from Apple when you have gained your AASP. Unfortunately, I have not yet have this so therefore I cant buy from Apple.

Currently I buy from ifixit and OWC but looking for other suppliers.

Much appreciated.

Thanks

Magento 2 – Buy minimal 2 products

We are using Magento 2.1

we have a cheap baby product in 10 different colors. And sometimes people order just one of it. With the shipping costs included this is not profitable.

Now we would like that they can’t order a single one of this specific product anymore. A minimum of 2 need to be ordered. But it can be 1 yellow and 1 blue … or just 2 blue ….

What is the best way to set this up? I can’t figure it out what the best option is ….

Magento 2.3 – Configurable Products Error : “AH01067: Failed to read FastCGI header”

I have an issue with Magento 2.3 when I try to access any configurable product on front-end and every time I try to make a search on front-end.

Environment :

  • Ubuntu 18.04.2 LTS‬
  • Plesk Onyx – Version 17.8.11 Update #45
  • PHP 7.2.16 – FPM Application Served by Apache
  • Nginx : Proxy mode + Smart static files processing

PHP Settings :

  • max_input_vars = 10000
  • max_input_nesting_level = 800
  • precision = 14
  • output_buffering = 44096
  • memory_limit : 10GO
  • max_execution_time : 180000
  • max_input_time : 180000

Domain logs show those errors:

AH01067: Failed to read FastCGI header, referer: https://mywebsite.com/ 

As well as another error

(104)Connection reset by peer: AH01075: Error dispatching request to : , referer: https://mywebsite.com/ 

Unable to get newly inserted Product’s Id using After Plugin for Catalog Product save controller method

I have created interceptor for catalog product controller’s save action

<type name="Magento\Catalog\Controller\Adminhtml\Product\Save">     <plugin name="ricky_catalog_save_product"             type="Ricky\Catalog\Plugin\Product\Save" sortOrder="10"     /> </type> 

My plugin class is below

namespace Ricky\Catalog\Plugin\Product;   class Save {      public function afterExecute(           \Magento\Catalog\Controller\Adminhtml\Product\Save $  subject,            $  result)     {          $  productId = $  subject->productId; // This is not working          /**          echo $  result->getProduct->getId(); die("prodid");          echo $  subject->getProduct->getId(); die("prodid");          Both throw exception: Undefined property $  getProduct         **/           /** $  productId is provided in excute method in Save class              in Magento\Catalog\Controller\Adminhtml\Product\Save **/     } } 

For some reasons I have to use Plugin (Interceptor Design Pattern), I know I can get newly created prouduct id by using observer for catalog_product_save_after event. But please provide solution for plugins.

I am asking this after visiting This Solution

Thanks for help 🙂

Magento 2: How can I relate/link custom module data to products like Up Sell or Cross Sell?

I have created modules to store complex information like Dangerous Good Informations (UN-No, Proper Shipping Name, Class, Packing Group etc) or Customs Numbers (Taric Codes).

Now, I want to relate/link these pieces of information to my products.
For that, I would like to use the same method/way like it is used to linking Up-Sell or Cross Sell products.
Please help.

Most viewed products by category not working

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

public function __construct(     \Magento\Catalog\Block\Product\Context $  context,     \Magento\Checkout\Model\ResourceModel\Cart $  checkoutCart,     \Magento\Catalog\Model\Product\Visibility $  catalogProductVisibility,     \Magento\Checkout\Model\Session $  checkoutSession,     \Magento\Framework\Module\Manager $  moduleManager,     \Magento\Catalog\Model\CategoryFactory $  categoryFactory,     \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $  productCollectionFactory,     \Magento\Store\Model\Store $  _storeManager,     \Magento\Reports\Model\ResourceModel\Product\CollectionFactory $  mostViewedCollectionFactory,     Registry $  registry,     array $  data = [] ) {     $  this->_checkoutCart = $  checkoutCart;     $  this->_catalogProductVisibility = $  catalogProductVisibility;     $  this->_checkoutSession = $  checkoutSession;     $  this->moduleManager = $  moduleManager;     $  this->_categoryFactory = $  categoryFactory;     $  this->_productCollectionFactory = $  productCollectionFactory;     $  this->_storeManager = $  _storeManager;     $  this->mostViewedCollection = $  mostViewedCollectionFactory;     $  this->registry = $  registry;     parent::__construct(         $  context,         $  checkoutCart,         $  catalogProductVisibility,         $  checkoutSession,         $  moduleManager,         $  data     ); }  protected function _prepareData() {     $  storeId = $  this->_storeManager->getStore()->getId();     $  productreg = $  this->_coreRegistry->registry('product');     if($  categoryIds = $  this->registry->registry('cat_ids')) {         $  categoryId = $  categoryIds[1];     }     /* @var $  product \Magento\Catalog\Model\Product */      $  this->_itemCollection = $  productreg->getRelatedProductCollection()->addAttributeToSelect(         'required_options'     )->setPositionOrder()->addStoreFilter();      if ($  this->moduleManager->isEnabled('Magento_Checkout')) {         $  this->_addProductAttributesAndPrices($  this->_itemCollection);     }     $  this->_itemCollection->setVisibility($  this->_catalogProductVisibility->getVisibleInCatalogIds());      $  count = 8 - count($  this->_itemCollection);     $  this->_itemCollection->load();      if($  categoryId) {         $  collectionCat = clone $  this->mostViewedCollection->create();         $  collectionCat->clear();         $  collectionCat->addAttributeToSelect(             ['name','price','small_image']         )->addCategoriesFilter(['eq' => $  categoryId]         )->addViewsCount(         )->setStoreId(             $  storeId         )->addStoreFilter(             $  storeId         )->setPageSize(             $  count         );          foreach($  collectionCat as $  item)         {                if($  item->getSku() != $  productreg->getSku()) {                 try {                     $  this->_itemCollection->addItem($  item);                 } catch (\Exception $  e) {                 }             }         }         return $  this;     }  } 

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

Magento 2: Get recently reviewed Products on Category Page

On the product view page the reviews get loaded via the following code:

$  _items = $  block->getReviewsCollection()->getItems(); 

This is what the getReviewsCollection function looks like:

public function getReviewsCollection() {     if (null === $  this->_reviewsCollection) {         $  this->_reviewsCollection = $  this->_reviewsColFactory->create()->addStoreFilter(             $  this->_storeManager->getStore()->getId()         )->addStatusFilter(             \Magento\Review\Model\Review::STATUS_APPROVED         )->addEntityFilter(             'product',             $  this->getProduct()->getId()         )->setDateOrder();     }     return $  this->_reviewsCollection; } 

This is later used in the following way:

foreach ($  _items as $  _review):     ...     ...     foreach ($  _review->getRatingVotes() as $  _vote):         ...         ... 

I’m trying to replicate this in order to display the recently reviewed products on the category pages. My code so far looks like this:

public function __construct(     \Magento\Catalog\Api\ProductRepositoryInterface $  productRepository,     \Magento\Framework\Registry $  registry,     \Magento\Review\Model\ResourceModel\Review\CollectionFactory $  reviewCollection,     \Magento\Store\Model\StoreManagerInterface $  storeManager,      \Magento\Framework\View\Element\Template\Context $  context,     array $  data = [] ) {     $  this->productRepository = $  productRepository;     $  this->registry = $  registry;     $  this->reviewCollection = $  reviewCollection;     $  this->storeManager = $  storeManager;     parent::__construct($  context, $  data); }  public function getCollection() {     $  category = $  this->registry->registry('current_category');     $  collection = $  category->getProductCollection();      foreach( $  collection as $  product ) {          $  prod = $  this->productRepository->getById($  product->getId());          $  urlKey = $  prod->getData("url_key");         $  url = $  this->getUrl($  urlKey);          // this is the method from the magento         // core function (getReviewsCollection()) mentioned above         $  reviewCollection = $  this->reviewCollection->create()             ->addStoreFilter(                 $  this->storeManager->getStore()->getId()             )->addStatusFilter(                 \Magento\Review\Model\Review::STATUS_APPROVED             )->addEntityFilter(                 'product',                 $  prod->getId()             )->setDateOrder();          $  reviews = $  reviewCollection->getItems();          if( !empty($  reviews) ){             foreach ($  reviews as $  review){                 // this is where the code breaks                 foreach( $  review->getRatingVotes() as $  rating ){                     // do stuff here                 }             }         }      } } 

Inside the getCollection function I use the same method to retrieve the review collection as in the getReviewsCollection method from the magento core. I can successfully retrieve an array of \Magento\Review\Model\Review objects.

But my code breaks as soon as I try to iterate over the reviews and use the $ review->getRatingVotes() method inside the inner most foreach loop. getRatingVotes() returns null and I get an Invalid argument supplied for foreach() exception.

I decided to investigate the getRatingVotes() method but I cannot find where it is defined. I did a search of the whole codebase inside VSCode as well as via grep. The only place where it occurs is inside the .phtml template file of the reviews list.