0

I have downloaded magento2 site from server, and now I am installing it in my localhost.

During composer install command I am facing this error

Could not apply patch! Skipping. The error was: Cannot apply patch patches/composer/amasty_catwalk_compatibility.patch

                                                                                                   
[Exception]                                                                                      
Cannot apply patch Catwalk compatibility 
(patches/composer/amasty_catwalk_compatibility.patch)! 

enter image description here

I am sharing the patch file which is mentioned in the error message patches/composer/amasty_catwalk_compatibility.patch here

diff --git a/Plugin/Ajax/Ajax.php b/Plugin/Ajax/Ajax.php
index da37968..eca32a0 100644
--- a/Plugin/Ajax/Ajax.php
+++ b/Plugin/Ajax/Ajax.php
@@ -266,6 +266,10 @@ class Ajax
      */
     private function addCategoryData($htmlCategoryData, $layout, &$responseData)
     {
+        if ($this->design->getDesignTheme()->getCode() == 'Catwalk/default') {
+            $responseData['image'] = $this->getBlockHtml($layout, 'category.image');
+            $responseData['description'] = $this->getBlockHtml($layout, 'category.description');
+        }
         if (in_array($this->design->getDesignTheme()->getCode(), $this->customThemes)) {
             $responseData['image'] = $this->getBlockHtml($layout, 'category.image');
             $responseData['description'] = $this->getBlockHtml($layout, 'category_desc_main_column');
diff --git a/view/frontend/web/js/amShopbyAjax.js b/view/frontend/web/js/amShopbyAjax.js
index b25df6e..6160038 100644
--- a/view/frontend/web/js/amShopbyAjax.js
+++ b/view/frontend/web/js/amShopbyAjax.js
@@ -347,6 +347,10 @@ define([
             if (data.image) {
                  if (imageElement.length !== 0) {
                      imageElement.replaceWith(data.image);
+                     let newImageElement = $('.category-image img');
+                     let background_url = newImageElement.attr('src')
+                     $('.category-image').css('background-image', 'url(' + background_url + ')');
+                     newImageElement.hide();
                  } else {
                      imageElement.prependTo("column.main");
                  }
@@ -358,6 +362,7 @@ define([
             if (data.description) {
                 if (descrElement.length !== 0) {
                     descrElement.replaceWith(data.description);
+                    $('.category-top-table-cell').removeClass('active');
                 } else {
                     if (imageElement.length !== 0) {
                         $(data.description).insertAfter(imageElement.selector);

Can you suggest me what is wrong here?

1 Answer 1

1

The error message suggests that the patch file amasty_catwalk_compatibility.patch cannot be applied successfully. The patch file contains modifications to two files: Plugin/Ajax/Ajax.php and view/frontend/web/js/amShopbyAjax.js. It seems that the patch is failing because the target files in your Magento 2 installation do not match the expected code.

To resolve this issue, you can try the following steps:

1)Ensure that the patch file (amasty_catwalk_compatibility.patch) is placed in the correct location: patches/composer/ within your Magento 2 installation directory.

2)Verify that the target files mentioned in the patch file (Plugin/Ajax/Ajax.php and view/frontend/web/js/amShopbyAjax.js) exist in your Magento 2 installation. Check if the file paths and names are correct.

3)Compare the content of the target files in your installation with the code modifications specified in the patch file. It's possible that the target files have been modified or are different from the expected code, which can cause the patch to fail. Make sure the code snippets mentioned in the patch file match the corresponding sections in your target files.

4)If the target files are different or have been modified, you have a few options:

Manually apply the code modifications mentioned in the patch file to the corresponding files in your Magento 2 installation. Contact the developer or source of the patch for an updated version that matches your Magento 2 installation. Disable or remove the patch if it's not critical for your installation.

Remember to take proper precautions before modifying any files in your Magento 2 installation, such as creating backups or using version control systems.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.