Hot answers tagged

167

[EDIT 3 Oct 2018] Update for links to devdocs: 2.0 - https://devdocs.magento.com/guides/v2.0/ui-components/ui-listing-grid.html and https://devdocs.magento.com/guides/v2.0/ui-components/ui-secondary.html 2.1 - https://devdocs.magento.com/guides/v2.1/ui_comp_guide/components/ui-listing-grid.html 2.2 - https://devdocs.magento.com/guides/v2.2/ui_comp_guide/...


68

A quick solution for memory limit in Magento 2 command is directly adding memory limit inside command. For Compilation command, php -dmemory_limit=5G bin/magento setup:di:compile For Deployment php -dmemory_limit=5G bin/magento setup:static-content:deploy You can change as per 5G to max if issue not resolve.


37

You can declare a new primary theme for your admin area by customizing config (e.g. app/etc/local.xml) with the following: <config> <stores> <admin> <design> <theme> <default>your_theme</default> </theme> </design> ...


31

Overview of Adding Product Attribute Programmatically Step 1: Create file InstallData.php Step 2: Define the install() method Step 3: Create custom attribute Step 1: Create file InstallData.php We will start with the InstallData class which located in app/code/Mageplaza/HelloWorld/Setup/InstallData.php. The content for this file: <?php ...


30

Open your PHP Admin database (I tested on php 7) Find & click on the table called: sequence_order_1 (it is located in database itself not in the information_schema ) Click on "Operations" tab & under "AUTO_INCREMENT" edit to desired order number.


29

Magento announced officially on January 20th, 2016, that CE and EE 2.0.1 officially support PHP 7.0.2. Magento Enterprise Edition and Community Edition 2.0.1 are now available and feature important security and functional updates, including official support for PHP7.0.2. Link: https://magento.com/blog/technical/new-magento-20-resources-and-support-...


27

There are many things wrong here and I feel compelled to do a code review with you. See the end for the correct approach. Code review: This line is loading a product with an undefined $sku var: $product = Mage::getModel('catalog/product')->getCollection() ->addAttributeToFilter('sku', $sku) ->addAttributeToSelect('*') ->...


27

not 100% sure about this, but I think you can add code to the head using this: <body> <referenceBlock name="head.additional"> <block class="Pulsestorm\Test\Block\Head" name="pulsestorm.head" as="pulsestorm.head" template="pulsestorm/head.phtml"/> </referenceBlock> </body> I know, it sounds strange to add code ...


26

If you are using the most recent version, M CE 1.9.2.2, there is an extension that will bring it to full PHP 7 compatibility: https://github.com/Inchoo/Inchoo_PHP7. (Disclaimer: I'm the author, though there is much help from the community.) It's also installable through Composer from http://packages.firegento.com/. All incompatibilities mentioned here are ...


24

Go to your database from phpmyadmin, Here _1 is used for store id after tablename. Default Frontend store id is 1. if you have multi store then you have to set query for each store with table name like sequence_order_2 upto sequence_order_.* Enter below query for table sequence_order_1 is used for default store. If you have multiple store you have to set ...


23

The difference is in urls. Url has following structure: <areaFrontName>/<moduleFrontName>/<actionPath>/<actionName> Route "Adminhtml" has moduleFrontName "admin", same as areaFrontName. So all paths under "adminhtml" route will start with admin/admin. If you want to have a more specific url, you should use specific route, like ...


21

No idea about PHP7, but I would guess most of the stuff is still valid in PHP7, you can find more information in the blog of Matthias Geniar ext/mysql: despite it being a very old MySQL extension, I'd reckon it's still very widely used, but it's time everyone moved to pdo_mysql. set_magic_quotes_runtime and magic_quotes_runtime: it seems I've seen ...


21

There is the same saveConfig method: https://github.com/magento/magento2/blob/2.0.0/app/code/Magento/Config/Model/ResourceModel/Config.php#L26-L61 A usage example from the core: https://github.com/magento/magento2/blob/2.0.0/app/code/Magento/Payment/Observer/UpdateOrderStatusForPaymentMethodsObserver.php#L59-L64


20

This is common when referencing a missing helper. In many cases the class name itself is malformed or your shortname referencing it is incorrect, which is why Magento is looking for it in the path Mage_Giftcards_Helper_Data (see example 1 below). For the following examples I have set up a module called MyCompany_MyModule. These are just a few of the many ...


20

This works for us but we haven't yet looked into moving them to a separate location to address 6.) 1.) Place your integration tests under dev/tests/integration/testsuite/Vendor 2.) copy dev/tests/integration/phpunit.dist.xml to dev/tests/integration/phpunit.xml and replace <directory suffix="Test.php">testsuite</directory> &...


19

Short Answer: No. That is not possible with tools shipped with Magento now. Explanation: We have to distinguish code generation and compilation. Compiler does both. For both operations we need to read configuration of all other magento modules, otherwise their output will be incorrect or not full. Compilation for one module does not make sense, as magento ...


19

Example display address fields using customer_account_create.xml: <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceBlock name="customer_form_register"> <arguments> <...


18

Unfortunately you won't be able to work on Magento without knowing at least some PHP so I would recommend that you at least learn the basics of the language (including how to use classes). If you are intending to focus on just styling of the page (no new functionality that would require some code changes) then you should look at how magento layouts and ...


18

I wouldn't use a model or a resource model, but \Magento\Framework\App\Config\Storage\WriterInterface or \Magento\Framework\App\Config\ConfigResource\ConfigInterface (the first delegating to the second). Pretty straight-forward, too: use Magento\Framework\App\Config\Storage\WriterInterface; class SomeClass { public function __construct(...


17

Apparently I fell prey to a common Magento pitfall, so I'm posting the answer in case anyone else is searching this particular error. Basically, the error was coming from the Magento installation I was trying to call via the SOAP API. Initially I thought the error was generated by the client being unable to locate this definitions result, however the real ...


17

Or the oldest one in the book, your file/directory permissions are out of whack causing Magento to write to the system /tmp folder which means config information is cached till you reboot the whole server or go delete the Magento cache out of the system /tmp folder. Issue is described here Can't change Magento base URL, stuck in cache Only including this ...


17

This question may be opinion based but I'm just going to enlight some results from the offical white paper regarding Magento 2 performance and scalability Test Configuration Magento Enterprise Edition 2.0 with PHP7 and Varnish caching Magento Enterprise Edition 1.14.2 with PHP5.6 and Full-Page Caching Comparison between Magento EE 1.14.2 and Magento EE 2....


16

What was previously in eav_entity_store is now covered in sales_sequence_profile and sales_sequence_meta. The table sequence_order_1 gets populated when orders are placed.


16

The $data[] can be used to hold values passed from di.xml's arguments replacement mechanism, when \Magento\Catalog\Block\Product\ListProduct intantiated. In your case this could be populated by <type name="\Magento\Catalog\Block\Product\ListProduct"> <arguments> <argument name="data" xsi:type="array"> ...


16

To get Post data in controller you need to use following in your execute function. public function execute() { $post = $this->getRequest()->getPostValue(); echo "<pre>"; print_r($post); exit; }


14

You will need to add this to the layout xml. Locate your local.xml in your theme layout folder (or create it if it doesn't exist) and set the template per page. For example for the default category pages: <?xml version="1.0"?> <layout version="0.1.0"> [...] <catalog_category_default translate="label"> <reference name="root"&...


14

You can do this from the backend. Go to System > Configuration > Customers > customer configuration > Create new account options and choose the group you want to assign to in the Default Group option This way you don't need to change any code. If you do however want to use code for some specific reason the customer_register_success event is the ...


14

Actual annotation of \Magento\Framework\Api\Search\FilterGroup says (class phpDoc): Groups two or more filters together using a logical OR It means that you need to create two groups with one filter in each.


14

Magento 2 uses Customer Data JS API to represent user session data in browser. All JS widgets are supposed to retrieve customer data from Customer Data JS API. Customer Data is split to sections (cart, wishlist, ...). Every segment is observable, so whenever it is modified, the widget that uses it is re-rendered to display the change. Magento framework is ...


14

To me, that main difference is that the Magento/Framework/View/Element/UiComponent/DataProvider/DataProvider uses the Search API. The following classes are used in this class : Magento\Framework\Api\FilterBuilder Magento\Framework\Api\Search\ReportingInterface Magento\Framework\Api\Search\SearchCriteria Magento\Framework\Api\Search\SearchCriteriaBuilder ...


Only top voted, non community-wiki answers of a minimum length are eligible