Skip to content

Instantly share code, notes, and snippets.

View WENKz's full-sized avatar

Quentin Grisard WENKz

View GitHub Profile
@WENKz
WENKz / log_visitor.sql
Created September 15, 2015 09:13
Create table log_visitor and log_visitor_info for magento
CREATE TABLE IF NOT EXISTS `log_visitor` (
`visitor_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Visitor ID',
`session_id` varchar(64) DEFAULT NULL COMMENT 'Session ID',
`first_visit_at` timestamp NULL DEFAULT NULL COMMENT 'First Visit Time',
`last_visit_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'Last Visit Time',
`last_url_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'Last URL ID',
`store_id` smallint(5) unsigned NOT NULL COMMENT 'Store ID',
PRIMARY KEY (`visitor_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Log Visitors Table' AUTO_INCREMENT=1 ;
@WENKz
WENKz / validate-magento-form
Created October 27, 2015 08:31
class validation magento form
'validate-no-html-tags' => 'HTML tags are not allowed'
'validate-select' => 'Please select an option.'
'required-entry' => 'This is a required field.'
'validate-number' => 'Please enter a valid number in this field.'
'validate-number-range' => 'The value is not within the specified range.'
'validate-digits' => 'Please use numbers only in this field. Please avoid spaces or other characters such as dots or commas.'
'validate-digits-range' => 'The value is not within the specified range.'
'validate-alpha' => 'Please use letters only (a-z or A-Z) in this field.'
'validate-code' => 'Please use only letters (a-z), numbers (0-9) or underscore(_) in this field, first character should be a letter.'
'validate-alphanum' => 'Please use only letters (a-z or A-Z) or numbers (0-9) only in this field. No spaces or other characters are allowed.'
@WENKz
WENKz / user_agent.php
Created November 3, 2015 15:07
connaitre info sur l'utilisateur
<?php
$user_agent = getenv("HTTP_USER_AGENT");
/*** Après on fait ce qu'on souhaite de l'information :
* affichage, stockage dans une base de données ...
**/
echo $user_agent;
@WENKz
WENKz / loading.js
Created November 27, 2015 09:36
Magento loading popup admin backend
Element.show('loading-mask');
Element.hide('loading-mask');
@WENKz
WENKz / créer tag
Created December 7, 2015 13:11
créer tag
subversion > Copy > Copy to
remote folder X
skip selected folder X
browse
magento/tags créa tu tag
description + button copy
@WENKz
WENKz / optionFiltre
Created January 12, 2016 13:30
Option pour valider une valeur dans une requete sql magento
Here you have a list with options you can use, with examples:
Equals: eq
$_products->addAttributeToFilter('status', array('eq' => 1));
Not Equals – neq
$_products->addAttributeToFilter('sku', array('neq' => 'spiderman'));
Contains – Like – like
@WENKz
WENKz / add_productCat.php
Created February 4, 2016 12:05
Ajouter produit a une categorie
<?php
error_reporting(E_ALL | E_STRICT);
define('MAGENTO_ROOT', getcwd());
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
require_once $mageFilename;
ini_set('display_errors', 1);
define('STORE_ID', 3);
@WENKz
WENKz / export.php
Created February 8, 2016 09:49
Récupérer prix expédition a partir d'un numéro de commande
<?php
error_reporting(E_ALL | E_STRICT);
define('MAGENTO_ROOT', getcwd());
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
require_once $mageFilename;
ini_set('display_errors', 1);
define('STORE_ID', 3);
Mage::app()->setCurrentStore(3);
@WENKz
WENKz / product_redirection_permanent.php
Created May 31, 2016 13:24
product_redirection_permanent
<?php
error_reporting(E_ALL | E_STRICT);
define('MAGENTO_ROOT', getcwd());
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
require_once $mageFilename;
ini_set('display_errors', 1);
define('STORE_ID', 3);
Mage::app()->setCurrentStore(3);
@WENKz
WENKz / special_price.csv
Last active June 22, 2016 07:33
solde ! set special_price and from to (magento)
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 1 column, instead of 2. in line 1.
sku;special_price;special_from_date;special_to_date
BALA-0007;14,9;2016-06-22;2016-08-02