The Stack Overflow podcast is back! Listen to an interview with our new CEO.

New answers tagged

0

To get the actual child product objects (not just strings of their IDs) use this: $childProducts = $product->getTypeInstance()->getUsedProducts($product); To get their IDs or other properties, use the above with a loop: foreach ($childProducts as $childProduct) { echo $childProduct->getId(); }


0

Not sure if i understood your question completely, but you could use n98-magerun2 and then export the result: n98-magerun2 dev:module:list


0

$objectManager = $bootstrap->getObjectManager(); $stockRegistry = $objectManager->create('Magento\CatalogInventory\Api\StockRegistryInterface'); $stockItem = $stockRegistry->getStockItemBySku($sku); $stockItem->setQty($qty); $stockItem->setIsInStock((bool)$qty); $stockRegistry->updateStockItemBySku($sku, $stockItem);


1

Though it is old question, I’m not sure whether Marius got its answer. I believe Marius can answer it better. I would like to answer it in short. Why Magento 2 suggests to use DI instead of helper? Making isolation in unit testing possible/easy Explicitly defining dependencies of a class Facilitating good design (single responsibility principle (SRP) for ...


1

_cache folder at pub/static is created when you enable CSS/Js minify or merge. During Static content deply if this merge/minify setting enables then the merge and minify CSS and js is generates at the store at pub/static/_cache and it creates Website Speed.


0

First, you need to inject collection factory class public function __construct( ... \Magento\Catalog\Model\ResourceModel\Category\CollectionFactory $collecionFactory ) { $this->_collectionFactory = $collecionFactory; parent::__construct(...); } After that inside your method, you can do this, $categoryTitle = 'Men'; $collection = $this-&...


0

Ditch composer and install using the latest zip from here That did the job for me


0

I use this to compile LESS locally. // Load gulp and plug-ins var gulp = require('gulp'), less = require('gulp-less'), concat = require('gulp-concat'), rename = require('gulp-rename'), gutil = require('gulp-util'), sourcemaps = require('gulp-sourcemaps'); function styles_l() { return gulp.src('frontend/...


0

You could achive this using a plugin: app/code/Product/SetWeight/registration.php <?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'Product_SetWeight', __DIR__ ); app/code/Product/SetWeight/etc/module.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3....


Top 50 recent answers are included