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
#Select all the config data with the current domain in the value | |
select * from core_config_data where value like "%www.old-domain.com%"; | |
#replacing www.old-domain.com with www.new-domain.com | |
update core_config_data set value=REPLACE(value, 'www.old-domain.com', 'www.new-domain.com') | |
where value like "%www.old-domain.com%"; | |
#check if it worked! | |
select * from core_config_data where value like "%www.new-domain.com%"; |
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 | |
Mage::getSingleton('eav/config') | |
->getEntityType(Mage_Catalog_Model_Product::ENTITY) | |
->getAttributeCollection(); | |
?> |
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
<? for($navigation as $item) : ?> | |
<li><a href="<?= $item->href ?>"><?= $item->caption ?></a></li> | |
<? endfor; ?> |
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 | |
/** | |
* Esta funcion devuelve una cadena pasada como parametro | |
* truncada a un maximo de caracteres segun parametro | |
* @param string $string | |
* @param int $maxLength | |
* @return string | |
*/ | |
public function truncateString($string, $maxLength) |
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
function addEvent(obj, evType, fn){ | |
if (obj.addEventListener){ | |
obj.addEventListener(evType, fn, false); | |
return true; | |
} else if (obj.attachEvent){ | |
var r = obj.attachEvent("on"+evType, fn); | |
return r; | |
} else { | |
return false; | |
} |
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 | |
//manera que utilizan muchas extensiones, aunque no es la recomendable, | |
//ya que magento incluye esta funcionalidad en su core | |
$modules = Mage::getConfig()->getNode('modules')->children(); | |
$modulesArray = (array)$modules; | |
if($modulesArray['Module_Name']->is('active')) { | |
echo "module is active."; |
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
INSERT INTO admin_user | |
SELECT | |
NULL user_id, | |
"oreales" firstname, | |
"" lastname, | |
"[email protected]" email, | |
"oreales" username, | |
MD5("xxxxxx") password, | |
NOW( ) created, | |
NULL modified, |
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
#SQLs que dan una respuesta rápida a si un site esta utilizando algunas de las posibilidades SEO que da Magento o no: | |
#total de imagenes de producto en tu tienda | |
SELECT count(*) FROM catalog_product_entity_media_gallery_value; | |
#imagenes que NO tienen texto alternativo (y debieran) | |
SELECT count(*) FROM catalog_product_entity_media_gallery_value WHERE label IS NULL; | |
#imagenes que SI tienen texto alternativo (si son pocas...ese margen de mejora tienes) | |
SELECT count(*) FROM catalog_product_entity_media_gallery_value WHERE label IS NOT NULL; |
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
############################################ | |
## rewrites to https y www | |
#First rewrite any request to the wrong domain to use the correct one (here www.) | |
RewriteCond %{HTTP_HOST} !^www\. | |
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
#Now, rewrite to HTTPS: | |
RewriteCond %{HTTPS} off | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] |
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
SELECT CONCAT(table_schema, '.', table_name), | |
CONCAT(ROUND(table_rows / 1000000, 2), 'M') rows, | |
CONCAT(ROUND(data_length / ( 1024 * 1024 * 1024 ), 2), 'G') DATA, | |
CONCAT(ROUND(index_length / ( 1024 * 1024 * 1024 ), 2), 'G') idx, | |
CONCAT(ROUND(( data_length + index_length ) / ( 1024 * 1024 * 1024 ), 2), 'G') total_size, | |
ROUND(index_length / data_length, 2) idxfrac | |
FROM information_schema.TABLES | |
ORDER BY data_length + index_length DESC | |
LIMIT 10; |