Last active
August 23, 2019 00:41
-
-
Save jonatanrdsantos/ad82d19bd8cad9760a0a to your computer and use it in GitHub Desktop.
Magento helps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//display all keys in magento registry | |
$class = new ReflectionClass('Mage'); | |
$prop = $class->getProperty('_registry'); | |
$prop->setAccessible(true); | |
$registry = $prop->getValue(); | |
var_dump( | |
array_keys($registry) | |
); | |
/* | |
ChildHtml uses in Magento | |
*/ | |
//Display ChildHtml | |
echo $this->getChildHtml('child_block'); | |
//Pass value to ChildHtml | |
$this->getChild('child_block')->setData('product_id', "$productId"); | |
echo $this->getChildHtml('child_block', false); | |
/* | |
* Here $productId is your dynamic value and you need to pass "false" (Block Caching No) as additional parameter in childHtml(). | |
* By default it takes "true" (Block Caching Yes). | |
*/ | |
// get option from magento atribute | |
Mage::getSingleton('eav/config')->getAttribute('catalog_product', 'deliverytime')->getSource()->getOptionText($groupsKey); | |
?> | |
Magento ask to login again, again and again after you logged in: | |
To resolve this, you just need comment this following lines: | |
Open file: app/code/core/Mage/Core/Model/Session/Abstract/Varien.php | |
and change: | |
<?php | |
// session cookie params | |
$cookieParams = array( | |
'lifetime' => $cookie->getLifetime(), | |
'path' => $cookie->getPath(), | |
// 'domain' => $cookie->getConfigDomain(), | |
// 'secure' => $cookie->isSecure(), | |
// 'httponly' => $cookie->getHttponly() | |
); | |
?> | |
fucking notices like: | |
Notice: Undefined offset: 0 in /var/www/project/app/design/frontend/........ | |
<?php | |
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING); | |
ini_set('display_errors','off'); | |
?> | |
lista de links legais | |
http://www.catgento.com/magento-useful-functions-cheatsheet/ | |
using remote media | |
mysql> update core_config_data set value = 'http://dressto.com.br/media/' where path = 'web/unsecure/base_media_url'; | |
mysql> update core_config_data set value = 'http://dressto.com.br/media/' where path = 'web/secure/base_media_url'; | |
rsync | |
rsync -avO -e 'ssh' [email protected]:public_html/media/ /storage/aroeira/media/ --exclude=catalog/product/cache --exclude=import --exclude=tmp | |
// Update admin password | |
UPDATE admin_user SET password = MD5('suporte') WHERE username = 'admin'; | |
<?php | |
//Integrity constraint violation: 1052 Column 'increment_id' in where clause is ambiguous | |
//http://stackoverflow.com/questions/26920895/how-to-properly-add-a-shipping-description-column-in-magento-order-grid | |
//http://stackoverflow.com/questions/15343967/searching-sales-order-grid-redirects-to-dashboard-in-magento-1-7 | |
// The increment_id column need to have the additional | |
// 'filter_index'=>'main_table.increment_id', | |
// So the Grid column now looks like this: | |
$this->addColumn('order_id', array( | |
'header' => Mage::helper('sales')->__('Order Id'), | |
'align' =>'left', | |
'index' => 'increment_id', | |
'filter_index'=>'main_table.increment_id', | |
)); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment