Forum Replies Created
- AuthorPosts
-
June 28, 2023 at 7:32 am in reply to: Magento 2 product image is visible in Magento admin, but not visible in frontend #9633
abctest483MemberTry running following command:
php bin/magento catalog:images:resizeHope it helps and solve your issue..
June 20, 2023 at 9:34 am in reply to: How to solve Uncaught ReferenceError: require is not defined #9890
abctest483MemberYou upload your JS to Assets in Shopify. That then lets you reference them in your code. You can assure yourself that no matter what you did in Magento, there exists an equivalent in Shopify. I think once you carefully and closely examine how Shopify templates render, you’ll quickly drop Magento and wonder how you lasted so long with that clunker.
abctest483MemberTry Your composer.json as below line , I solved this way
"require-dev": { "pdepend/pdepend": "~2.7.1", to ==> "pdepend/pdepend": "^2.10", }June 1, 2023 at 9:15 am in reply to: WordPress asking for my FTP credentials to install plugins #9489
abctest483MemberSpecific Case and Solution
- Good answers above. Especially Matt Woodward (https://stackoverflow.com/a/53166416/3502900). Will be sharing a specific case and solution.
- WordPress is prompting you for your FTP credentials because the file permissions are incorrect for your WordPress setup.
PROBLEM = MANUALLY COPYING WORDPRESS FILES
I used rsync to copy over wordpress files from one cpanel with wordpress to another.
As I executed the rsync as "root" user, the copied files (but not directories!) got assigned to user "root".
FIX YOUR FILE PERMISSIONS
This will find all incorrectly assigned files. Check the list. If wordpress php files are among them, you have your problem.
find /home/yourcpanel/www -user root -printf "type="%Y/"depth="%d\ \ %u\:%g\ \ %p\\nNow assign files to the correct user and group. In this case the cpanel name "yourcpanel" was the correct user. It might be different in your case. Check your SSH user, for example.
find /home/yourcpanel/www -type f -user root -group root -printf "type="%Y/"depth="%d\ \ %u\:%g\ \ %p\\n -exec chown yourcpanel:yourcpanel {} \;May 25, 2023 at 5:52 am in reply to: How can I bind-mount Magento 2 files from Docker using docker-compose? #9892
abctest483MemberAttention, before performing these actions, please save your changes so that you can later copy them to the Magento 2 files folder.
To make Magento 2 files visible, you need to change the path to the ‘magento_data’ folder to:
volumes: - './magento_data:/bitnami/magento'To do this, please edit the ‘docker-compose.yml’ file
version: '2' services: mariadb: image: docker.io/bitnami/mariadb:10.4 environment: # ALLOW_EMPTY_PASSWORD is recommended only for development. - ALLOW_EMPTY_PASSWORD=yes - MARIADB_USER=bn_magento - MARIADB_DATABASE=bitnami_magento volumes: - 'mariadb_data:/bitnami/mariadb' magento: image: docker.io/bitnami/magento:2 ports: - '80:8080' - '443:8443' environment: - MAGENTO_HOST=localhost - MAGENTO_DATABASE_HOST=mariadb - MAGENTO_DATABASE_PORT_NUMBER=3306 - MAGENTO_DATABASE_USER=bn_magento - MAGENTO_DATABASE_NAME=bitnami_magento - ELASTICSEARCH_HOST=elasticsearch - ELASTICSEARCH_PORT_NUMBER=9200 # ALLOW_EMPTY_PASSWORD is recommended only for development. - ALLOW_EMPTY_PASSWORD=yes volumes: - './magento_data:/bitnami/magento' depends_on: - mariadb - elasticsearch elasticsearch: image: docker.io/bitnami/elasticsearch:7 volumes: - 'elasticsearch_data:/bitnami/elasticsearch/data' volumes: mariadb_data: driver: local magento_data: driver: local elasticsearch_data: driver: localChanges in docker-compose.yml compared to the original:

After modifying the path in the docker-compose.yml file, rebuild the containers using the following command:
docker-compose up -d --buildA folder named "magento_data" has appeared next to the docker-compose.yml file, where the files for Magento 2 are stored:

abctest483MemberI had this issue too.
Clear cache, then just swap/activate themes to a wordpress standard theme, then swap back to yours. Happy Days!
abctest483MemberThat package might be part of Magento’s own repository. Add it to your composer.json like this:
{ "repositories": [ { "type": "composer", "url": "https://repo.magento.com/" } ] }Have a look at their documentation if you have more questions about this repository
abctest483Member<nobr>your text</nobr>(not css but easier in some cases)March 21, 2023 at 10:31 am in reply to: #1273 – Unknown collation: ‘utf8mb4_unicode_520_ci’ #10682
abctest483MemberIn Addition
For large .sql files, I recommend using HeidiSQL (a free and open-source database tool) and pressing Ctrl+O to load the file by browsing from the folder.
After that press Ctrl+f and replace the
"utf8mb4_unicode_520_ci"(in my case) with"utf8mb4_unicode_520_ci"and save the file by pressing Ctrl+s.Finally, rerun the DB upload process, and cheers.
February 24, 2023 at 5:53 am in reply to: How to render an enabled CMS block in phtml file in magento 2? #9898
abctest483MemberOverride form.phtml file in your child theme and then Call your static block in that override form.phtml file:
<?php echo $this->getLayout() ->createBlock('Magento\Cms\Block\Block') ->setBlockId('your_block_identifier') ->toHtml(); ?>February 22, 2023 at 8:55 am in reply to: Magento – How Do I Get All The Invoices Of A Sales Order With A HTTP GET Request To The API? #9900
abctest483MemberGo to the API documentation, and find "invoices".
The request should look something like this:
/V1/invoices searchCriteria[filterGroups][0][filters][0][eq] searchCriteria[filterGroups][0][filters][0][id] searchCriteria[filterGroups][0][filters][0][invoice_id]February 17, 2023 at 1:12 am in reply to: How to render an enabled CMS block in phtml file in magento 2? #9897
abctest483MemberTo render an enabled CMS block in a phtml file in Magento 2, you can use the following code:
<?php $blockId = 'your_block_identifier'; // Replace with your block identifier $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $block = $objectManager->create('Magento\Cms\Block\Block')->setBlockId($blockId); if ($block->getIsActive()) { echo $block->toHtml(); } ?>Here’s a breakdown of the code:
Define the identifier of the CMS block you want to render. This can be found in the CMS block list in the Magento admin panel.
$blockId = 'your_block_identifier';Create an instance of the CMS block using the ObjectManager
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $block = $objectManager->create('Magento\Cms\Block\Block')->setBlockId($blockId);Check if the block is active (enabled)
if ($block->getIsActive()) {If the block is active, render the block’s HTML using the toHtml() method.
echo $block->toHtml();Note that using the ObjectManager directly is not best practice, and it is recommended to use dependency injection instead. Additionally, you should make sure to sanitize the $blockId input to avoid security vulnerabilities.
February 10, 2023 at 11:54 am in reply to: #1273 – Unknown collation: ‘utf8mb4_unicode_520_ci’ #10687
abctest483MemberAccording to my experience, the destination’s MySQL server is an older version than the source. The required database collation is not present on the destination server.
To fix this, we can make a small change to the backup file. Replace "utf8mb4 0900 ai ci" with "utf8mb4 general ci" and "CHARSET=utf8mb4" with "CHARSET=utf8" in the database backup file.
Replace the below string:
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;with:
ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;Save your file and restore the database.
February 10, 2023 at 4:37 am in reply to: How To Include CSS and jQuery in my WordPress plugin? #9997
abctest483MemberDid you mean the js and css files or code? If you have very little scripts or styling used, you can simply use them inline. But it’s recommended to use following wordpress plugin functions if you want to include files.
wp_register_script()
wp_enqueue_style()Hope it helps.
February 10, 2023 at 1:38 am in reply to: How to add filter on item collection to get the Sales rep(total Quantity and Total no of Orders) of those Sale Managers which are logged in #9902
abctest483MemberAs you mentioned in your question you only want to get the order info based on a certain sales rep. To do that you need to somehow find a unique identify for the currently logged in sales rep and add a filter for that .
For example:
$collection = $this->_itemCollectionFactory->create()->getCollection(); $collection->getSelect()->columns(array('total_orders' => new \Zend_Db_Expr('COUNT(order_id)'))) ->columns(array('total_qty' => new \Zend_Db_Expr('ROUND(SUM(qty_ordered))'))) ->group('sku'); $collection->getSelect()->limit(3); $collection->addFieldToFilter('store_id', 2); $collection->addFieldToFilter('sales_rep_identifier', $loggedInSalesRepIdentifier);The label
sales_rep_identifierand the value$loggedInSalesRepIdentifierare just examples, you may have to adjust the format in which the data is stored if it doesn’t currently have a field to check natively what sales rep did it, and adjust the values there accordinglyIf you’re using some kind of prebuilt system then maybe there are other labels for the identifier you could use, without more information on the specific database structure it’s impossible to answer exactly, but essentially you need to filter by the unique sales rep identifier, and if that doesn’t exist now in the database it should somehow but added
- AuthorPosts