New answers tagged

0

According to the error, $this->getChildCategories($category) is returning something unexpected. Frequently, this means null in which case testing for null before entering the foreach would avoid the error. E.g. adding the follwing before the foreach loop: if (!$this->getChildCategories($category)) { return $this; } Its hard to see how a CSS change ...


0

please can you tell me how to run this DELETE FROM oauth_token_request_log; ?


0

Log in to the MariaDB/MySQL shell using the mysql command below. mysql -u root -p Now create a new database for Magento installation. Create the database 'magentodbatabase' and the user 'magentodatabaseuser' with the password 'magentodbpassword'. Run the MySQL queries below. create database magentodbatabase; create user magentodatabaseuser@'localhost' ...


0

If the database is created and the issue still persists then try the command like this i.e. without the quotes ". bin/magento setup:install --base-url=http://127.0.0.1/magento2/ \ --db-host=localhost --db-name=magento --db-user=magento --db-password=magento \ --admin-firstname=Magento --admin-lastname=User --admin-email=user@example.com \ --admin-...


0

There is a comment in \Magento\Framework\Registry that states: Registry usage as a shared service introduces temporal, hard to detect coupling into system. Its usage should be avoided. Use service classes or data providers instead. Note that these deprecations warnings were added Mar 24, 2018. There are still thousands of uses in Magento's core modules. I ...


0

Try the host as 127.0.0.1 and not localhost as technically they are different


1

Scripts in CMS Blocks sounds like something that Magento would block. If it is just the content of the "dontuseie" block that needs to be admin-editable, you could: Render that block in a hidden div. Show the div where applicable using a script included by the supported Magento methods (source code or Scripts and Style Sheets).


0

Create Plugin for it instead of override app/code/Vendor/Module/etc/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"> <type name="Magento\Quote\Model\...


1

You must use json_encode with the second parameter set true, so that it returns an associative array otherwise it will return an array of objects. In your case it will return a multidimensional array. $mydata = json_decode($myresp, true); //mydata is a multidimensional array To find the value in $mydata, you can use $key = array_search('new', array_column($...


0

try this.it worked for me spl_autoload_register(function ($class_name) { $class_name = strtolower($class_name); $path = LIB_PATH.DS."{$class_name}.php"; if(file_exists($path)){ require_once($path); }else{ die("The file {$class_name}.php could not be found."); } });


0

I had the same problem with magento 2.3, where Add to Cart button refreshed the page instead of adding anything in cart. where as website was working properly in Private Browsing on a custom theme. Solutions Didn't Worked: Change max_input_var=10000 max_input_time = 600 max_execution_time = 3600 Flush cache Solution Worked for me: In Configuration >> ...


0

I had the same problem with magento 2.3, where Add to Cart button refreshed the page instead of adding anything in cart. where as website was working properly in Private Browsing on a custom theme. Solutions Didn't Worked: Change max_input_var=10000 max_input_time = 600 max_execution_time = 3600 Flush cache Solution Worked for me: In Configuration >> ...


0

You need to use this code. /*Dynamically generating rows & columns*/ foreach($data["items"] as $productdata) { $temp .= "<tr>"; $temp .= "<td>" . $productdata["sku"] . "</td>"; $temp .= "<td>" . $productdata["name"] . "</td>"; $...


0

You are using plugin to override protected method. plugins cannot override protected method. So use preference instead of using plugin to override protected


0

To include an external CSS file from xml, add https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/css-topics/css-themes.html <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <head> <css src="...


0

I would try to add this method on your block template : protected function _prepareLayout() And then customise your metadata as you want in there. But this is the same thing as updating directly the phtml file as mentionned by @Dhiren Vasoya


0

You can use this code to add css file on your phtml file. <link rel="stylesheet" type="text/css" href="YOURCSSURL" />


0

My solution was different because I really needed that duplicates. I removed the original ID field from the request (by removing all the columns from the select): $select = $collection->getSelect(); $select->reset(Select::COLUMNS); Then I defined alias to the original ID: $select->columns( [ 'my_awesome_alias' => 'main_table.id', ...


0

Since Magento is using an MVC (Model View Controller) architecture, returning pure HTML (or Javascript) code in your plugin won't work. Depending on what you really want to achieve, it might be better to do an Ajax call in the frontend to grab data from the server (or run some custom logic doing something on the server-side) and work with the data returned ...


0

use below code $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $productCollectionFactory = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\CollectionFactory'); $collection = $productCollectionFactory->create(); $collection ->addFieldToSelect('*'); // only need sku, price, id, $collection ->...


1

Your module URL will load based on the "BaseUrl/frontName/controllerName/actionName" So as per your module code, frontName = unit3helloworldblock controllerName = Block actionName = Index So the URL of your module is https://magento2.mgt/unit3helloworldblock/block/index You can also check on this Magento DevDocs: https://devdocs.magento.com/videos/...


0

It sounds like the PriceBox jQuery widget hasn't been initialised yet. From looking through the code it appears this is how it is initialised on the product page: <script type="text/x-magento-init"> { "[data-role=priceBox][data-price-box=product-id-<?= $block->escapeHtml($_product->getId()) ?>]": { ...


1

to update Street1 and Street2 fields you just need to provide an array: $address->setStreet(['123 Main Street', 'Street 2']);


0

So I figured out how to tackle this problem. BTW I have installed a 3rd party module called FOOMAN\PrintOrderPDF (for printing the order list!) and modified on top of it. This is just for testing purposes for now. The logic is the same to modify the Invoice, Shipping and Credit Memos. Modify: foreach ($order->getAllItems() as $item) { ...


1

use getChildHtml('page.main.title'); to display it in your block "my.block" echo $block->getChildHtml('page.main.title'); OR add it after tag <referenceBlock name="page.main.title"> <action method="setPageTitle"> <argument translate="true" name="title" xsi:type="string&...


0

Did you enable the module ? and setup upgrade, cache:clean etc. Start your terminal window, then reach at the root of your installed magento project then do this, bin/magento module:enable Apptha_Marketplace bin/magento setup:upgrade bin/magento setup:di:compile bin/magento setup:static-content:deploy -f bin/magento cache:clean chmod 777 var pub Here in ...


0

app/code/Vendor/Module/etc/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="controller_front_send_response_before"> <observer name="...


Top 50 recent answers are included