Skip to content

Instantly share code, notes, and snippets.

@tangar76
tangar76 / MagentoCatalogImportExport_Model_Import_Product.php.diff
Last active February 5, 2021 08:27
Fixed stock status to "Out of Stock" after product import even product allowed backorders. .../module-catalog-import-export/Model/Import/Product.php
--- /vendor/magento/module-catalog-import-export/Model/Import/Product.php
+++ /vendor/magento/module-catalog-import-export/Model/Import/Product.php (Unsaved)
@@ -3062,7 +3062,9 @@
$stockItemDo = $this->stockRegistry->getStockItem($row['product_id'], $row['website_id']);
$existStockData = $stockItemDo->getData();
- if (isset($rowData['qty']) && $rowData['qty'] == 0 && !isset($rowData['is_in_stock'])) {
+ if (isset($rowData['qty']) && $rowData['qty'] == 0 && !isset($rowData['is_in_stock'])
+ && empty($existStockData['backorders']) // backorders not set or set to 0
+ ) {
@tangar76
tangar76 / help.md
Last active February 5, 2020 20:36
Valet deployment
@tangar76
tangar76 / snippet.js
Created December 12, 2018 14:44
Get product IDs on category page (Magento admin)
jQuery('#catalog_category_products_table tbody td.col-entity_id').map(function() { return jQuery(this).text().trim(); }).get().join();
@tangar76
tangar76 / __content.md
Last active October 5, 2018 08:21
Firecheckout M2 - customization examples
@tangar76
tangar76 / __content.md
Last active October 5, 2018 08:13
Firecheckout M1 - customization examples
@tangar76
tangar76 / ssh-too-many-auth
Last active August 10, 2018 11:57
Too many authentication failures for *username*
# connect to SSH
ssh -o IdentitiesOnly=yes username@hostname -p NN
# transfer file via terminal
scp -i ~/.ssh/key_file -P NN -o IdentitiesOnly=yes /home/user/file username@hostname:/home/target/dir
@tangar76
tangar76 / .eslintrc
Created July 10, 2018 10:42
ESLint settings for Sublime
{
"extends": [
"./.eslintrc-reset",
"./.eslintrc-magento"
]
}
$layout = $this->getLayout();
$layout->getNode()->asXML();
git reset --soft HEAD^ # use --soft if you want to keep your changes
git reset --hard HEAD^ # use --hard if you don't care about keeping the changes you made
grep --include=\*.php -rnw 'app/code/' -e "echo "