Skip to content

Instantly share code, notes, and snippets.

View deivisonarthur's full-sized avatar

Deivison Arthur Lemos Serpa deivisonarthur

View GitHub Profile
@deivisonarthur
deivisonarthur / send-custom-template.php
Last active August 29, 2015 13:56
Como enviar template customizada pelo magento e como setar variáveis na template. Outra opção é como criar invoice auto e ou apos pagamento no modulo de pagamento enviando email de invoice
<?php
public function sendCustomMail($CustomerName, $email, $increment_id, $template) {
// Load from magento config..
$sender = Array('name' => Mage::getStoreConfig('trans_email/ident_sales/name'), 'email' => Mage::getStoreConfig('trans_email/ident_sales/email') );
$storeId = Mage::app()->getStore()->getId();
$translate = Mage::getSingleton('core/translate');
$datetime = new DateTime();
<IfModule pagespeed_module>
ModPagespeed on
ModPagespeedRespectVary on
ModPagespeedXHeaderValue "Powered By mod_pagespeed"
ModPagespeedEnableFilters add_instrumentation
ModPagespeedEnableFilters extend_cache
ModPagespeedForceCaching on
ModPagespeedDisallow *timthumb.php*
ModPagespeedDomain http://thecustomizewindows.com
ModPagespeedDomain http://*.google.com
<?php
## Function to set file permissions to 0644 and folder permissions to 0755
function AllDirChmod( $dir = "./", $dirModes = 0755, $fileModes = 0644 ){
$d = new RecursiveDirectoryIterator( $dir );
foreach( new RecursiveIteratorIterator( $d, 1 ) as $path ){
if( $path->isDir() ) chmod( $path, $dirModes );
else if( is_file( $path ) ) chmod( $path, $fileModes );
}
@deivisonarthur
deivisonarthur / clearmagento.php
Created November 27, 2013 14:16
clearmagento.php?clean=log ou clearmagento.php?clean=var
<?php
$xml = simplexml_load_file("./app/etc/local.xml", NULL, LIBXML_NOCDATA);
$db["host"] = $xml->global->resources->default_setup->connection->host;
$db["name"] = $xml->global->resources->default_setup->connection->dbname;
$db["user"] = $xml->global->resources->default_setup->connection->username;
$db["pass"] = $xml->global->resources->default_setup->connection->password;
$db["pref"] = $xml->global->resources->db->table_prefix;
if($_GET["clean"] == "log") clean_log_tables();
if($_GET["clean"] == "var") clean_var_directory();
function clean_log_tables() {
@deivisonarthur
deivisonarthur / pagespeed.sh
Created November 8, 2013 21:55
mod pagespeed Nginx
# Filter settings
pagespeed RewriteLevel CoreFilters;
pagespeed EnableFilters combine_css,rewrite_css,sprite_images,combine_javascript,recompress_images,resize_images,collapse_whitespace,remove_comments,extend_cache,combine_heads,move_css_above_scripts,make_google_analytics_async,insert_image_dimensions,rewrite_javascript;
#pagespeed EnableFilters add_head,convert_meta_tags,fallback_rewrite_css_urls,flatten_css_imports,inline_css,inline_import_to_link,inline_javascript,rewrite_images,rewrite_style_attributes_with_url;
#pagespeed EnableFilters lazyload_images;
pagespeed UrlValuedAttribute span src hyperlink;
pagespeed UrlValuedAttribute div background image;
<?
public function _getOrderIncrementPrefix ($order_store_id)
{
$order_entity_type = Mage::getModel('eav/entity_type')->loadByCode ('order');
$order_entity_type_id = $order_entity_type->getId ();
$order_entity_type_increment_per_store = $order_entity_type->getIncrementPerStore ();
if ($order_entity_type_increment_per_store)
{
$order_entity_type_pad_length = $order_entity_type->getIncrementPadLength ();
var YY = 2012;
var MM = 12;
var DD = 3;
var HH = 14;
var MI = 5;
var SS = 0;
function atualizaContador() {
var hoje = new Date();
var futuro = new Date(YY,MM-1,DD,HH,MI,SS);
<?php if (!strcmp ($cc_type, 'BOL_ITAU') || !strcmp ($cc_type, 'TEF_ITAU')): ?>
<form id="print-billet-form" method="get" target="_blank" action="https://shopline.itau.com.br/shopline/shopline.asp">
<?php
$sql = " SELECT acquirer_transaction_id FROM payment_return WHERE order_id = " . $_order->getId ();
$resource = Mage::getSingleton ('core/resource');
$connection = $resource->getConnection ('core_read');
$store = $connection->query ($sql);
$children = $store->fetchAll (PDO::FETCH_ASSOC);
?>
<input type="hidden" name="DC" value="?DC=<?=$children[0]['acquirer_transaction_id'];?>" />
# install libs
sudo apt-get install gifsicle
sudo apt-get install imagemagick
sudo apt-get install pngcrush
sudo apt-get install libjpeg-progs
sudo apt-get install pkg-config
sudo apt-get install libpng-dev
# get smush.py
cd /var/apps/macarthur_cms_env/bin/
<?php
//Table names and table prefixes
$tableName = Mage::getSingleton('core/resource')
getTableName('catalog_product_entity');
// if prefix was 'mage_' then the below statement
// would print out mage_catalog_product_entity
echo $tableName;
//Accessing the database connection resource