This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mage::getModel("catalog/product") | |
->loadByAttribute('sku', "XXX") | |
->getData(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
require( | |
['jquery', 'Magento_Customer/js/customer-data', 'domReady!'], | |
function($, customerData){ | |
$(function(){ | |
customerData.get('customer').subscribe(function(customer) { | |
alert("Name is" + customer.fullname); | |
}); | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require __DIR__ . '/app/bootstrap.php'; | |
/* $redis = new Credis_Client('redis'); */ | |
$redis = new Credis_Client('localhost'); | |
$i = 0; | |
$json = array(); | |
foreach($redis->keys('*') as $key) { | |
$data = array(); | |
$data['key'] = $key; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"require": { | |
"magento/module-bundle-sample-data": "100.1.*", | |
"magento/module-theme-sample-data": "100.1.*", | |
"magento/module-catalog-sample-data": "100.1.*", | |
"magento/module-customer-sample-data": "100.1.*", | |
"magento/module-cms-sample-data": "100.1.*", | |
"magento/module-widget-sample-data": "100.1.*", | |
"magento/module-catalog-rule-sample-data": "100.1.*", | |
"magento/module-sales-rule-sample-data": "100.1.*", | |
"magento/module-review-sample-data": "100.1.*", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
update cataloginventory_stock_status set qty=ceil((RAND()*100)) ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); | |
$productCollection = $objectManager->create("\Magento\Catalog\Model\ResourceModel\Product\Collection"); | |
foreach($productCollection as $product) { | |
$productRepository = $objectManager->create("\Magento\Catalog\Api\ProductRepositoryInterface"); | |
$q = rand(0, 1000); | |
$p = $productRepository->getById($product->getId()); | |
$p->setStatus(($q > 0 ? 1 : 0)); | |
$p->setStockData(array( | |
'qty' => $q, | |
'is_in_stock' => ($q > 0 ? 1 : 0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$docker = new \Docker\Docker(); | |
$imageManager = $docker->getImageManager(); | |
$context = new \Docker\Context\Context('/path/to/docker/Dockerfile'); | |
$inputStream = $context->toStream(); | |
$buildStream = $imageManager->build($inputStream, [ | |
't' => "meinimage", | |
'rm' => true, | |
'nocache' => false | |
], ImageManager::FETCH_STREAM); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$objectManager = $this->getObjectManager(); | |
$appState = $objectManager->get('Magento\Framework\App\State'); | |
$appState->setAreaCode(\Magento\Framework\App\Area::AREA_ADMINHTML); | |
$productCollection = $objectManager->create("\Magento\Catalog\Model\ResourceModel\Product\Collection"); | |
$productCollection->addAttributeToSelect('*'); | |
foreach ($productCollection as $product) { | |
var_dump($product->getData()); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# sudo apt-get install build-essential libncurses-dev libpython2-dev libx11-dev libxtst-dev xorg-dev | |
# sudo apt-get build-dep vim | |
./configure --with-features=huge \ | |
--enable-multibyte \ | |
--enable-rubyinterp=yes \ | |
--enable-pythoninterp=yes \ | |
--with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define([ | |
'Magento_Swatches/js/swatch-renderer', | |
], function (Renderer) { | |
Renderer.prototype.originalMethod = Renderer.prototype._RenderSwatchOptions; | |
Renderer.prototype._RenderSwatchOptions = function(config) { | |
return this.originalMethod(config); | |
}; | |
return Renderer; | |
} | |
); |