Skip to main content

Posts

Showing posts from March, 2016

[magento] flush test data

-- reset categories TRUNCATE TABLE `catalog_category_entity`; TRUNCATE TABLE `catalog_category_entity_datetime`; TRUNCATE TABLE `catalog_category_entity_decimal`; TRUNCATE TABLE `catalog_category_entity_int`; TRUNCATE TABLE `catalog_category_entity_text`; TRUNCATE TABLE `catalog_category_entity_varchar`; TRUNCATE TABLE `catalog_category_product`; TRUNCATE TABLE `catalog_category_product_index`; INSERT  INTO `catalog_category_entity`(`entity_id`,`entity_type_id`,`attribute_set_id`,`parent_id`,`created_at`,`updated_at`,`path`,`POSITION`,`level`,`children_count`) VALUES (1,3,0,0,'0000-00-00 00:00:00','2016-03-23 00:25:34','1',1,0,1),(2,3,3,0,'2016-03-23 00:25:34','2016-03-23 00:25:34','1/2',1,1,0); INSERT  INTO `catalog_category_entity_int`(`value_id`,`entity_type_id`,`attribute_id`,`store_id`,`entity_id`,`value`) VALUES (1,3,32,0,2,1),(2,3,32,1,2,1); INSERT  INTO `catalog_category_entity_varchar` (`value_id`,`entity_type_id`,`a...

[php] install php7.0

sudo apt-get install software-properties-common sudo add-apt-repository ppa:ondrej/php sudo apt-get install php7.0 -y --force-yes sudo apt-get install php7.0-common php7.0-cgi php7.0-cli php7.0-fpm php7.0-dev php7.0-curl php7.0-gd php7.0-intl php7.0-pgsql php7.0-json php7.0-sqlite3 php7.0-mysql php7.0-opcache php7.0-xml -y --force-yes

[magento] guide

Magento development guide For 1.x : http://devdocs.magento.com/guides/m1x/magefordev/mage-for-dev-1.html For 2.0 : http://devdocs.magento.com/guides/v2.0/extension-dev-guide/bk-extension-dev-guide.html

[ubuntu] Split p12 to public / private pem keys

Usually X.509 Certificates are downloaded using a browser and managed by the browser itself. Anyway it is possible to export your certificate in a file PKCS12 (which will probably have the extension .p12 or .pfx). The procedure to export the certificate vary from browser to browser, for example Internet Explorer starts with "Tools − > Internet Options − > Content"; Netscape Communicator has a "Security" button on the top menu bar; Mozilla starts with "Edit − > Preferences − > Privacy and Security − > Certificates" and Firefox has "Edit − > Preferences − > Advanced − > Certificates − > manage certificates − > backup". Unfortunately PKCS12 format is not accepted by Globus security infrastructure, but you can easily convert it into the supported standard (PEM). This operation will split your *.p12 file in two files: the certificate (usercert.pm) and the private key (userkey.pm). The conversion can be performed with open...

[magento] Create a script to show all categories with tree structure

<?php define('MAGENTO', realpath(dirname(__FILE__))); require_once MAGENTO . '/../web/app/Mage.php'; Mage::app(); $category = Mage::getModel('catalog/category'); $tree = $category->getTreeModel(); $tree->load(); $ids = $tree->getCollection()->getAllIds(); $categories = array(); $result = array(); if ($ids) {     foreach ($ids as $id) {         $category->load($id);         $categories[$id]['name'] = $category->getName();         $categories[$id]['path'] = $category->getPath();     }     foreach ($ids as $id) {         $path = explode('/', $categories[$id]['path']);         $string = '';         foreach ($path as $pathId) {             $string.= $categories[$p...

[ubuntu] Keep a script running all day - supervisord

prepare a script to be run apt-get update -y apt-get install supervisor service supervisor restart (check if works) cd /etc/supervisor/conf.d/ vim any.conf -- any.conf -- [program:name] command=sh /path/to/script.sh autostart=true autorestart=true stderr_logfile=/var/log/name.err.log stdout_logfile=/var/log/name.out.log -- end of any.conf -- supervisorctl reread (if changed, supervisorctl update) supervisorctl (to check if works)