Magento
Last Edited Time
Feb 9, 2022 06:23 AM
date
Jan 3, 2018
slug
magento
status
Published
tags
PHP
Magento
Notebook
Command
summary
早期 Magento 工作常用命令记录
type
Post
Magento
clear magento cache
rm -rf /var/www/sl60/var/cache/*
rm -rf /var/www/sl60/var/session/*
rm -rf /var/www/sl60/var/report/*
Mage::app()->getCacheInstance()->flush();
get Modal Table
Mage::getResourceModel('sales/order')->getMainTable()
encrypt/decrypt credit card
Mage::helper('core')->encrypt('1234')
Mage::helper('core')->decrypt("0:2:92866345d0d804eb:uvUGkSElxow8IA8po/NNeQ==")
get config
$config = Mage::app()->getConfig()->getNode('global/document_db')->asArray();
$config = Mage::getModel('core/config');
$config->getGoopterConfig('language','stores',624);
$storeIds = Mage::App()->getGroup(563)->getStoreIds();
Mage::app()->getConfig()->getResourceConnectionConfig("default_setup")->asArray();
get currency
$currency = Mage::getModel('core/config')->getGoopterConfig('currency', 'stores', $store_id);
$currencyFlag = convertCurrency($currency);
load store by store id
$store = Mage::getModel('core/store')->load(2322);
$s = Mage::getModel('core/store')->load('146','group_id’);
Mage::getModel('core/store_group')->load(146)->getStoreIds();
load product
$productModel = Mage::getModel('catalog/product')->setStoreId($storeId)->load($product['product_id']);
load customer by email & phone
Mage::getModel("customer/customer")->getCollection()->addAttributeToFilter('phone', '6043000683')
$customer = Mage::getModel("customer/customer”);
$customer->setWebsiteId(Mage::app()->getWebsite('admin')->getId());
$customer->loadByEmail('joe@goopter.com’);
Mage::getModel('admin/user')->getCollection()->addFieldToFilter('username','avipizza')->getFirstItem()->getRole();
Mage::getModel('core/config')->getGoopterConfig('name', 'stores', '2322’);
$group = Mage::getModel('core/store_group')->load($group_id);
$store = Mage::getModel('xmlconnect/simplexml_element', '<store_details></store_details>’);
Mage::getModel("customer/customer")->getCollection()->addAttributeToFilter('lastname', array('like'=>"%wong%"))->getFirstItem()->getData();
get customer password hash
$customer = Mage::getModel('customer/customer_api');
$data = $customer->items(array('email' => customeremail));
Enterprise_Pci_Model_Encryption
Mage::helper('core')->getHash('7783797918', 'Ei6lew6nmGtvKNmoqOVDqepxPeAohAjH');
hash('sha256', 'Ei6lew6nmGtvKNmoqOVDqepxPeAohAjH'.'7783797918')
// 41e75b5a6c4f83adb471709b5a5b408f0c6fd2869817803773a11a5909c660fb:Ei6lew6nmGtvKNmoqOVDqepxPeAohAjH
order point reward
$pointsHistory = Mage::getModel('enterprise_reward/reward_history')
->getCollection()
->addFieldToFilter('action', Enterprise_Reward_Model_Reward::REWARD_ACTION_ORDER_EXTRA)
->addFieldToFilter('entity', $oid);
load order and get order items
$o = Mage::getModel('sales/order')->loadByIncrementId(166600003011);
$o->getAllVisibleItems();
insert to table
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
$write->insert(
"sales_flat_order_status_history", array("parent_id" => $parentId, "is_customer_notified" => 8, "is_visible_on_front" => 0, "comment" => 'konitiwa', "status" => "pending",
"created_at" => gmdate('Y-m-d H:i:s'), "entity_name" => "order"));
$write->update('admin_user',array('current_store'=>$grpId,'current_temp_store'=>NULL), array('user_id=?'=>$adminId));
load giftcard account
Mage::getModel('enterprise_giftcardaccount/giftcardaccount')->loadByCode('007LI63HY78P')->getData();
magento api action_type and http method Handler
vi code/core/Mage/Api2/Model/Resource.php
get all functions from one object
get_class_methods