Skip to content

Instantly share code, notes, and snippets.

View Amakata's full-sized avatar

Yoshihisa Amakata Amakata

View GitHub Profile
@Amakata
Amakata / add_attribute_option_value.php
Created August 28, 2017 06:02
属性のオプション値がなければオプション値を追加をセットアップスクリプトじゃないところでしたい場合
$attribute_code = '';
$value = '';
$attribute = Mage::getSingleton('eav/config')->getAttribute(Mage_Catalog_Model_Product::ENTITY, $attribute_code);
if (in_array($attribute->getFrontendInput(), array('select')) && strlen($value) > 0) {
$values = Mage::getResourceModel('eav/entity_attribute_option_collection')->setAttributeFilter(
$attribute->getId())
->setStoreFilter()
->addFieldToFilter('tdv.value', array('in' => $value))
->load();
@Amakata
Amakata / setIsSuperMode.php
Created August 28, 2017 06:10
Magentoで、カートから注文にデータ変換するところで、設定可能商品の子商品が明細に出ちゃう問題への対策は、setIsSuperModeを呼ぶこと
$parent->getProduct()->setIsSuperMode(true);
@Amakata
Amakata / pandoc-filter.sh
Created August 29, 2017 15:32
pandocのfilter Tableのwidthを0でリセットするをjqで記述
jq '(.blocks[] | select(.t == "Table") .c[2]) |= [0,0,0]'
@Amakata
Amakata / gist:b902bdd5cf0b45b5fcf50bd4ac76fd5e
Last active April 13, 2018 20:53
macでiscisi経由でntfsを編集できるようにする。
# System Integrity Protection 解除
事前にリカバリモードでSystem Integrity Protectionを解除
```
csrutil disable
```
作業がおわったら
```
csrutil enable
```