Skip to content

Instantly share code, notes, and snippets.

@mokanfar
mokanfar / All Attribute Codes Global.txt
Last active June 29, 2019 20:37
Magmi Magento Import Necessary Columns
name
short_description
sku
price
weight
color
notes
product_category_type
erp_sku
dimensions
//find sku in json object list return arg[1] of that object
const filterIt = (sku, attr) => {
let arr = list.filter(function(asdf) {
return asdf.SKU == sku;
});
return arr[0][attr];
};
//ramda find without for each
R.find(R.propEq('a', 2))(xs)
/*
====================================
Small Screen - Tablet
====================================
*/
@media screen and (min-width: 768px) and (max-width: 991px) {
@mokanfar
mokanfar / magento-snippets.phtml
Last active November 27, 2018 19:52
Magento Snippets #2
magento product phtml data sku attribute get data
<?php echo $_product->getProductUrl() ?>
<?php echo $_product->getId() ?>
<?php echo $_product->getSku() ?>
###Customer ID Final Price Customer Group
<?php
require_once 'app/Mage.php';
Mage::app();
//to overwrite limit but you need first to increase your memory limit
$collection = Mage::getModel('catalog/product')->getCollection()
@mokanfar
mokanfar / filter_unique_rows_script.sh
Last active October 23, 2018 23:01
Matched Rows, Unique Rows Merge Filter Bash Scripts for CSV files
#!/usr/bin/env bash
echo "filename 1 (file that has more rows):"
read file1
echo "filename 2:"
read file2
echo "common field name:"
read fieldname
#echo "file1: ${file1}.csv file2: ${file2}.csv common field name: ${fieldname}"
if [ -f $PWD/temp.db ]; then
@mokanfar
mokanfar / list_all_gallery_images_magento_product_by_sku.php
Last active August 24, 2018 17:58
get all images associated with an array of product sku's programatically in Magento [first one is base/main image]
<?php
require_once 'app/Mage.php';
Mage::app();
//to overwrite limit but you need first to increase your memory limit
$collection = Mage::getModel('catalog/product')->getCollection()
->addAttributeToSelect('*') // select all attributes
->setPageSize(5000) // limit number of results returned
->setCurPage(1); // set the offset (useful for pagination)
// we iterate through the list of products to get attribute values
@mokanfar
mokanfar / Default (Windows).sublime-keymap
Last active July 29, 2018 08:47
Laptop User Key Bindings Sublime Text
[
{
"keys": [
"ctrl+b"
],
"command": "show_overlay",
"args": {
"overlay": "command_palette"
}
},
@mokanfar
mokanfar / bulk_set_array_of_skus_attribute_programatically_in_magento.php
Last active July 18, 2018 00:45
Magento update from list of skus an attribute programatically
<?php
require_once 'app/Mage.php';
Mage::app();
$skus = array("ARRAY OF SKUS HERE");
$n=array();
foreach ($skus as $item) {
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $item)->getId();
array_push($n, $product);
}
@mokanfar
mokanfar / gist:c13a524c2b900da80143d81a52ee945f
Created June 15, 2018 23:44
Magento correct upgrade path
git clone https://github.com/OpenMage/magento-mirror.git
cd public_html/shop
curl https://raw.githubusercontent.com/github/gitignore/master/Magento.gitignore > .gitignore
git init
git add --all
git commit -m 'backup'
git status
rsync
cd ..
ls