Solved: Tracking Virtual PageView via Google Tag Manager

  What is the requirement of Virtual Page Views? While working on a single page website(SPA) or any JavaScript based(ReactJS, AngularJS, BackBoneJS, etc) websites, the interactions of user actions are not straight forward and most of the content is rendered via JavaScript AJAX calls, without reloading the page. Virtual Pageview: It’s not really a page […]

Web performance Optimization

We optimize your website by analyzing the pattern of the website. By using improved methods of optimization we makes your web pages fly while rendering. Some of the points from our checklist are: By improving your code, optimizing JS for non-blocking while rendering. Sharing the web page load(I/O) by using a CDN and Seprate Session […]

Get list of product attribute in Magento

# Get list of colors from Magento Installation Let’s create a file called getcolors.php on Magento root folder. require_once ( “app/Mage.php” ); umask(0); Mage::app(“default”); Mage::getSingleton(“core/session”, array(“name” => “frontend”)); $attribute = Mage::getSingleton(‘eav/config’)->getAttribute(‘catalog_product’, ‘color’); if ($attribute->usesSource()) { $options = $attribute->getSource()->getAllOptions(false); } print_r($options); When you excute the file getcolors.php either from shell or browser, It will print the […]

Change a product’s attribute value without loading the entire product model

Loading product in a collection and saving them again and again over will take lot of time. To make it quick there is an alternate solution available which uses the same function used by Update attributes action from the product grid: Mage::getModel(‘catalog/product_action’) ->updateAttributes(array($productId), array(‘attribute_code’=>’value’), 0);

Parse query string in shell script

Sometimes we have to integrate multiple languages like node.js/php/shell script into bash shell script and parse query string to array for supplying query string data for manipulation. Here is the simple script which will help you to achieve that goal: #!/usr/bin/env bash declare -A querydict populate_querystring_array () { query=”$1″ while IFS== read arg value do […]

No package ‘opencv’ found

If you are getting this error while compiling certain modules which requires opencv library which is causing the execution to be aborted. For fixing it, you need to install lib-opencv using following command: Ubunntu/Debian – sudo apt-get install libopencv-dev Centos/Red Hat – sudo yum install opencv-devel After you do so, pkg-config –cflags opencv and pkg-config –libs opencv will work […]

Error: /lib64/libc.so.6: version ‘GLIBC_2.14’ not found

Sometimes on your node.js project you have seen problems like “Error: /lib64/libc.so.6: version ‘GLIBC_2.14’ not found” by some npm modules. Error: /lib64/libc.so.6: version ‘GLIBC_2.14’ not found This error comes when the available version of glibc is not compatible by the node module. So, if you still want to work with that module, you need to […]

Better way to load layout blocks outside of Magento

For loading Magento Layout Blocks externally or in a controller without any complexity, use this: From external file, we need to initiate Magento session: Mage::getSingleton(‘core/session’, array(‘name’=>’frontend’)); $session = Mage::getSingleton(‘customer/session’, array(‘name’=>’frontend’)); $layout = Mage::app()->getLayout(); $layout->getUpdate()->addHandle(‘default’)->load(); $layout->generateXml()->generateBlocks(); $top = $layout->getBlock(‘top.links’)->toHtml(); echo $top; From internal controller: $layout = Mage::app()->getLayout(); $layout->getUpdate()->addHandle(‘default’)->load(); $layout->generateXml()->generateBlocks(); $top = $layout->getBlock(‘top.links’)->toHtml(); echo $top;

How to configure libstdc++ with GCC 4.8?

You need to tell your dynamic linker (it’s executed when you run your program) where to find the library. Set LD_LIBRARY_PATH to the path of the library (probably somewhere under /app/gcc/4.8.0/lib or something). Use find /app/gcc/4.8.0 -name “libstdc++.so.6”. Add the directory to your LD_LIBRARY_PATH. e.g with the path I mentioned: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/app/gcc/4.8.0/lib (if you’re using […]

Openresty : Programming with Magento/Mysql – Get Inventory of Products REST API

Skills Requried – LUA, nginx, mysql If you have nginx-openresty installed, open the vhost file of your domain, than follow this: Let your REST API path is http://<your-domain>.com/getstockserv?p=123450,12145 where p is the parameter where all product ids of Magento Products has been supplied. Now add this entry to the vhost file – location ^~ /getstockserv […]

How to add a Volume to EC2 Instance?

Go to EC2 console to create the volume and attach it to the instance, and then we’ll mount the volume to make it available. – under Elastic Block Store, click Volumes. – Click on Create Volume – Select the General Purpose (SSD) volume type. – Wait for your Volume to be available. – Right click […]

How to make nginx works with Geo IP?

NGINX GeoIP Installation: Follow these steps to install GeoIP with nginx: wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP.tar.gz tar -zxvf GeoIP.tar.gz cd GeoIP-1.4.8/ ./configure make make install echo ‘/usr/local/lib’ > /etc/ld.so.conf.d/geoip.conf yum install gcc pcre-devel.x86_64 openssl-devel.x86_64 yum install readline-devel pcre-devel openssl-develWe are using openresty – nginx here:wget http://openresty.org/download/ngx_openresty-1.7.2.1.tar.gz tar xzvf ngx_openresty-1.7.2.1.tar.gz cd ngx_openresty-1.7.2.1 ./configure –with-luajit –with-http_geoip_module gmake gmake installwget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz -O /usr/local/share/GeoIP/GeoIP.dat.gz gunzip /usr/local/share/GeoIP/GeoIP.dat.gz […]

Nginx Openresty Get/Set Cookies using LUA.

To set cookies using lua while using nginx_lua module in openresty/nginx server, use this code: local expires = 3600 * 24  — 1 day ngx.header[“Set-Cookie”] = “session=demo; Path=/; Expires=” .. ngx.cookie_time(ngx.time() + expires) This will set cookie session = demo for 1 day from current time on path /.

Use PHP Functions in LUA Code

explode Based on [PHP explode] Example: explode(” and “,”one and two and three and four”) –> {“one”,”two”,”three”,”four”} Compatibility: Lua 5.0 and 5.1function explode(div,str) if (div==”) then return false end local pos,arr = 0,{} — for each divider found for st,sp in function() return string.find(str,div,pos,true) end do table.insert(arr,string.sub(str,pos,st-1)) — Attach chars left of current divider pos […]