Spanish Vocabulary 1

la manzana – apple

el mono – monkey

vegetariano/vegetariana – vegetarian

el cangrejo – crab

el cerdo – pig

el conejo – rabbit

el pengüino – penguin

tú – you (informal)

desayuno – breakfast

sí – yes

el pájaro – bird

la sopa – soup

beber – to drink

leer – to read

querer – to want, love, wish, will, like, cherish

comer – to eat

perdón – excuse me, sorry

la comida – food

tu – your (informal)

usted – you (formal)

nosotros – we

nuestras – our

la leche – milk

hablar – to speak

ser – to be (soy, eres, es, somos, sois, son)

el arroz – rice

los vegetales – vegetables

el león – lion

la pasta – pasta

la tortuga – turtle

el tomate – tomato

el vino – wine

la cerveza – beer

su – his/her

el hombre – man

el huevo – egg

más – more

el limón – lemon

el sal – salt

el jugo – juice

beber – to drink

el ratón – mouse

almuerzo – lunch

azúcar – sugar

el gato – cat

la persona – person

escribir – to write

la fruta – fruit

la salsa – sauce

la naranja – orange

el pato – duck

la mujer – woman

el agua – water

cocinar – to cook

el caballo – horse

ell pollo – chicken

el queso – cheese

la cebolla – onion

el carne – meat

necesitar – to need

cena – dinner

el pan – bread

suyo – your

 

 

Spanish Idioms

Del tal palo tal astilla.

Like father like son.

Consejos vendo y para mí no tengo.

Do as I say, not as I do.

En tierra de ciegos, el tuerto es rey.

In the land of the blind, the one-eyed is king.

Soldado avisado no muere en guerra.

Forewarned is forearmed.

Borrón y cuenta nueva.

Let bygones be bygones.

En boca cerrada no entran moscas.

A closed mouth gathers no flies.

Donde hay humo, hay fuego.

Where there’s smoke there’s fire.

Más vale tarde que nunca.

Better late than never.

Mucho ruido y pocas nueces.

All talk and no action.

Cada loco con su tema.

To each their own.

Camarón que se duerme, se lo lleva la coriente.

You snooze, you lose.

El amor es ciego, pero los vecinos no.

Love is blind, but the neighbors aren’t.

Barriga llena, corazón contento.

A fully belly, happy heart.

 

 

comparing core_config_data

Find core_config_data differences between a production and development db.

SELECT path, value FROM (
SELECT path, value FROM your_dev_db.core_config_data
UNION ALL
SELECT path, value FROM your_prod_db.core_config_data
) tbl
GROUP BY path, value
HAVING count(*) = 1
ORDER BY path


query("select * from core_config_data where path in (
'admin/url/custom',
'admin/url/use_custom',
'carriers/ups/access_license_number',
'carriers/ups/allowed_methods',
'carriers/ups/dest_type',
'carriers/ups/dest_type',
'carriers/ups/negotiated_active',
'carriers/ups/negotiated_active',
'carriers/ups/password',
'carriers/ups/username',
'dev/css/merge_css_files',
'dev/js/merge_files',
'payment/authorizenet/cgi_url',
'payment/authorizenet/cgi_url_td',
'payment/authorizenet/login',
'payment/authorizenet/merchant_email',
'payment/authorizenet/test',
'payment/authorizenet/trans_key',
'payment/cashondelivery/active',
'payment/paypal_direct/cctypes',
'payment/paypal_direct/payment_action',
'payment/paypal_direct/sort_order',
'paypal/general/business_account',
'paypal/wpp/api_password',
'paypal/wpp/api_signature',
'paypal/wpp/api_username',
'paypal/wpp/sandbox_flag',
'shipping/origin/postcode',
'shipping/origin/region_id',
'system/currency/installed',
'web/cookie/cookie_domain',
'web/cookie/cookie_path',
'web/secure/base_js_url',
'web/secure/base_media_url',
'web/secure/base_skin_url',
'web/secure/base_url',
'web/unsecure/base_js_url',
'web/unsecure/base_media_url',
'web/unsecure/base_skin_url',
'web/unsecure/base_url')");

foreach ($result as $row) {
echo "update `core_config_data` set `value` = '" . $row['value'] . "' where `path`='" . $row['path'] . "';" . PHP_EOL;
}
?>

Magento 2 Simple Products and Virtual Products and Hey, There’s No Weight Attribute!

So you’re loving your new Magento 2 store when all of a sudden you realize, your simple products have started turning themselves into virtual products. Magento 2 automagically freely converts simple products to virtual and virtual products to simple based on whether or not the product has a weight.

All you have to do to turn those virtual products back into simple products is provide a value for weight. When you go in to edit the product, though, you may find there is no weight attribute on the screen!

Look in eav_attribute for the weight attribute_code and get its attribute_id (entity_type_id is probably 4). Look in catalog_eav_attribute where attribute_id is the one you just looked up from eav_attribute and set apply_to NULL. Reload product edit page, and you should see weight now

Weight Restored
Weight Restored

Magento 2 Get Paths Programatically

Looking for Mage::getBaseUrl in Magento 2?
Use the DirectoryList class in your constructor to get an instance of DirectoryList.

Magento\Framework\App\Filesystem\DirectoryList $directory_list

For getting your Magento 2 root folder you can use

$this->directory_list->getRoot();

For getting media folder you can use

$this->directory_list->getPath('media');

 

Other possible uses are:

/* Get app folder */
$this->directory_list->getPath('app');
 
/* Get configuration folder */
$this->directory_list->getPath('etc');
 
/* Get libraries or third-party components folder */
$this->directory_list->getPath('lib_internal');
 
/* Get libraries/components that need to be accessible publicly through web-server folder */
$this->directory_list->getPath('lib_web');
 
/* Get public folder */
$this->directory_list->getPath('pub');
 
/* Get static folder */
$this->directory_list->getPath('static');
 
/* Get var folder */
$this->directory_list->getPath('var');
 
/* Get temporary files folder */
$this->directory_list->getPath('tmp');
 
/* Get file system caching directory (if file system caching is used) */
$this->directory_list->getPath('cache');
 
/* Get logs of system messages and errors */
$this->directory_list->getPath('log');
 
/* Get file system session directory (if file system session storage is used) */
$this->directory_list->getPath('session');
 
/* Get directory for Setup application*/
$this->directory_list->getPath('setup');
 
/* Get Dependency injection related file directory */
$this->directory_list->getPath('di');
 
/* Relative directory key for generated code*/
$this->directory_list->getPath('generation');
 
/* Temporary directory for uploading files by end-user */
$this->directory_list->getPath('upload');
 
/* Directory to store composer related files (config, cache etc.) in case if composer runs by Magento Application */
$this->directory_list->getPath('composer_home');
 
/* A suffix for temporary materialization directory where pre-processed files will be written (if necessary) */
$this->directory_list->getPath('view_preprocessed');
 
/* Get template minification dir */
$this->directory_list->getPath('html');
 

Magento Indexers – Programmatically Using Indexers

In some custom modules, you may need to change the index mode from manual to auto or vice versa or you may need to run one of the indexers.

$pCollection
    = Mage::getSingleton('index/indexer')->getProcessesCollection();
foreach ($pCollection as $process) {
    //$process->setMode(Mage_Index_Model_Process::MODE_MANUAL)->save();
    $process->setMode(Mage_Index_Model_Process::MODE_REAL_TIME)->save();
}

$pCollection
    = Mage::getSingleton('index/indexer')->getProcessesCollection();
foreach ($pCollection as $process) {
    $process->reindexEverything();
}

Indexes can be loaded using either the process ID or the process code using the functions:

by ID:

$process = Mage::getSingleton('index/indexer')->getProcessById();

by CODE:

$process = Mage::getSingleton('index/indexer')->getProcessByCode(<process_code>);

 

The process code and ID can be found by checking the table index_process. The Magento provided indexes normally have the following ID and code.

Process Name ID Code
Product Attributes 1 catalog_product_attribute
Product Prices 2 catalog_product_price
Catalog URL Rewrites 3 catalog_url
Product Flat Data 4 catalog_product_flat
Category Flat Data 5 catalog_category_flat
Category Products 6 catalog_category_product
Catalog Search Index 7 catalogsearch_stock
Stock Status 8 cataloginventory_stock
Tag Aggregation Data 9 tag_summary

 

mysqldump from CLI select tables

Suppose you need to take just a few tables from a database, like all the customer tables from a magento install. You just need to set up a few shell variables and you can mysqldump away! You’ll need your mysql database user name and password.

$:DBTODUMP=dbname_here
$:SQL="select group_concat(table_name separator ' ') from information_schema.tables where table_schema='$DBTODUMP' and table_name like 'customer%'"
$:TBLIST=`mysql -u db_user -pPASSWORD -AN -e"$SQL"`
$:mysqldump -u db_user -pPASSWORD $DBTODUMP $TBLIST > customer_tables.sql