Code snippets from different sections of Magento that are very useful.
<script>
//<![CDATA[
Translator.add(
<?php echo Mage::helper('core')->jsonEncode(array(
# import config. | |
# You can change the default config with `make cnf="config_special.env" build` | |
cnf ?= config.env | |
include $(cnf) | |
export $(shell sed 's/=.*//' $(cnf)) | |
# import deploy config | |
# You can change the default deploy config with `make cnf="deploy_special.env" release` | |
dpl ?= deploy.env | |
include $(dpl) |
<block type="cms/block" name="block_name"> | |
<action method="setBlockId"><id>block_code</id></action> | |
</block> | |
{{block type="cms/block" block_id="block_code"}} | |
{{block type="catalog/product_list" category_id="79" template="catalog/product/list_random.phtml"}} |
Aveti aici niste comenzi foarte utile pentru situatiile in care vreti sa evitati sa faceti in mod repetat stash-uri la o serie de fisiere de configurari locale, pe care nu trebuie nici sa le comiteti pe un proiect, si nici sa le puneti in gitignore pentru ca fisierele exista si sunt necesare pe branchurile superioare. | |
In aceste cazuri puteti folosi: | |
### Pentru a opri tracking-ul fisierului | |
```git update-index --assume-unchanged <file>``` | |
On Windows use: | |
```git ls-files -v | grep "^[a-z]"``` |
test
# | |
# Change EAV Attribute Type from dropdown to multipleselect | |
# - copy old attribute values to new table | |
# | |
dropdown attribute_id = 137 | |
UPDATE eav_attribute SET | |
backend_model = 'eav/entity_attribute_backend_array', | |
frontend_input = 'multiselect', |
/** | |
* Create a mock iterator over the given array. | |
* | |
* @param array $a | |
* @param string $class The class to use for the mock, should be/implement/extend Iterator | |
* @param boolean $complete Whether or not to build a complete iteration. This is | |
* used when an exception/break is expected in the middle of the iteration. | |
* @param integer $numElms The number of elements that should be iterated in the case of an | |
* incomplete iteration. | |
*/ |
<?php | |
/** | |
* This code only updates the attributes you want to change. | |
* The first paramater is an array of product IDs, | |
* the second is an array of attribute names and values, | |
* and then the third is the store ID you wish to update. | |
* This is MUCH faster than saving the entire model. | |
* Ref Link: http://stackoverflow.com/questions/3669211/saving-in-magento-taking-a-very-very-long-time | |
*/ | |
<script> | |
//<![CDATA[ | |
Translator.add( | |
<?php echo Mage::helper('core')->jsonEncode(array( | |
'Please use letters only.' => $this->__('Please use letters only.'), | |
'Please use letters only.' => $this->helper('jstranslate')->__('Please use letters only.'), | |
)) ?> | |
); | |
//]]> | |
</script> |