Skip to content

Instantly share code, notes, and snippets.

❤️
In a relationship with Magento 2

Andresa Martins andresams

❤️
In a relationship with Magento 2
Block or report user

Report or block andresams

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@andresams
andresams / tinydump
Created Jan 1, 2018 — forked from ceckoslab/tinydump
Simple PHP script, that creates a dump of Magento DB with smaller footprint ... the script just excludes the data some of the log tables, but keep the the schema of these tables.
View tinydump
<?php
define('DS', DIRECTORY_SEPARATOR);
function _getExtractSchemaStatement($sqlFileName, $db)
{
$dumpSchema = 'mysqldump' . ' ';
$dumpSchema .= '--no-data' . ' ';
$dumpSchema .= '-u ' . $db['user'] . ' ';
$dumpSchema .= '-p' . $db['pass'] . ' ';
$dumpSchema .= '-h ' . $db['host'] . ' ';
@andresams
andresams / exemplo-de-dados-enviados
Created Mar 8, 2016
Exemplo de como os dados das preferências são enviados para a API do Mercado Pago
View exemplo-de-dados-enviados
Array
(
[client_id] => 277949545368493
[client_secret] => tLT5X4mXvu3QjmAbPgymzFdeLha4WkyR
[amount] => 306.8
[reason] => Pedido-15842
[currency_id] => BRL
[payment_method_id] => visa
[payer_email] => santosmanu123@gmail.com
[external_reference] => 15842
@andresams
andresams / trecho-mercado-pago-preferencias.php
Created Mar 8, 2016
Código do envio de dados para API do Mercado Pago.
View trecho-mercado-pago-preferencias.php
<?php
#Código de seleção destes dados do cliente e inserção do pedido acima
$data['client_id']=Configuration::get('MERCADOC_CLIENT_ID');
$data['client_secret']=Configuration::get('MERCADOC_CLIENT_SECRET');
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, 'MercadoPago Prestashop Brasil v2');
@andresams
andresams / new_gist_file.php
Created Dec 22, 2015
Magento get html static block by ID inside of .phtml files
View new_gist_file.php
<?php
echo $this->getLayout()->createBlock('cms/block')->setBlockId('block_identifier')->toHtml();
?>
@andresams
andresams / get-store-info-magento.php
Created Nov 30, 2015
Gets current store information from Magento. Store ID, store name, store status, store code, website id, store group id, store sort order, store locale, store home url
View get-store-info-magento.php
<?php
// Gets the current store's details
$store = Mage::app()->getStore();
// Gets the current store's id
$storeId = Mage::app()->getStore()->getStoreId();
// Gets the current store's code
@andresams
andresams / opencart_redirect_url.php
Created Nov 4, 2015
Redireciona Opencart para uma url ou módulo dentro de um controlador
View opencart_redirect_url.php
<?php
#Sempre adiciona o token no final da URL
$url .='token=' . $this->session->data['token'];
#gera url para determinada ação do controlador do módulo
$url = $this->url->link('catalog/product/edit', $url , 'SSL');
#redireciona na resposta
$this->response->redirect($url);
@andresams
andresams / magento_index.sh
Last active Nov 2, 2015
Atualizar índices do Magento manualmente via SSH. Útil quando os índices ficam travados em "processing" (processando)
View magento_index.sh
#Executar comandos individualmente na shell
php shell/indexer.php -reindex catalog_product_attribute
php shell/indexer.php -reindex catalogsearch_fulltext
php shell/indexer.php -reindex catalog_category_flat
php shell/indexer.php -reindex cataloginventory_stock
php shell/indexer.php -reindex catalog_category_product
php shell/indexer.php -reindex catalog_product_price
php shell/indexer.php -reindex tag_summary
php shell/indexer.php -reindex catalog_url
@andresams
andresams / zopim.js
Created Nov 2, 2015
Abre uma janela com o chat do zopim
View zopim.js
function abrir_zopim(chave_zopim)
{
var myWindow = window.open("https://v2.zopim.com/widget/popout.html?key="+chave_zopim,"","width=500,height=500");
}
You can’t perform that action at this time.