Friday, 31 August 2018

odd / even Cycle in SHOPIFY

{% cycle %}  tag Description : 

Loops through a group of strings and outputs them in the order that they were passed as parameters. Each time cycle is called, the next string that was passed as a parameter is output.
cycle must be used within a for loop block.

Input
{% cycle 'one', 'two', 'three' %}
Suppose you have multiple collection of Block and you want to have different design for Odd and even collection, Row Design is attached below
  


Collection 1 (odd)

Collection 2 (even)

Collection 3 (odd)

Collection 4 (even)
 


So for this kind of design you are going to have 2 snippets  i.e. One for odd and another for even
<div class="container {% cycle 'odd','even' %}">
 {% assign mod = forloop.index | modulo: 2 %}
                    {%if mod == 0 %}
                        // attach snippet of even collection here
                        even - right side
                    {%else%}

// attach snippet of odd collection here
                        odd - left side
                    {%endif%}
</div>

So, You don’t have to apply any js for it, As we have used cycle beside container class, you gonna have class odd and even alternatively and apply css according to that class


Stay updated

Thanks

Friday, 27 July 2018

How to load external link data, in our existing page popup / as a content?


You can use tow things
1) embed
2) iframe

embed can cause some major functionality issues, better to to use iframe

embed syntex:
<embed src="https://www.google.com"/>

iframe syntax :
<iframe scrolling="yes" user-agent="Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3" src="https://www.google.com"></iframe>

Don't forget to mention user-agent attribute otherwise it can cause issue such as
"Error: Cannot set user agent for iframe with location different to this page" - content.js

comment your issues, will help you to solve it

EXPLORE PROGRAMMING
Thanks

Wednesday, 20 June 2018

Solutions of facing problems while fatching IDs in Shopify - Liquid

Hello,
blog on shopify liquid code,

use of "{{forloop.index}}" ,

input : 
{% for product in collections.frontpage.products %}
    {{ forloop.index }}
{% else %}
    // no products in your frontpage collection
{% endfor %}
  
 output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

  • if you are facing problems while assigning IDs and names of  "<divs>" or anchor tags at the time of placing tabify or accordion , you should use id = {{forloop.index}} in your cart or product loops . 
  • Dont assign {{product.id}} or {{block.id}} as an IDs of  "<div> / <a>" , it is very hard to get those things when you started applying your Custom jQuery or start making / adding own functionalities. it would be easy when you have used {{forloop.index}}, As it is going to be easy to target and fetch in jquery

Wednesday, 18 April 2018

Access Localhost in Mobile or any another device

your laptop or PC and Mobile should be connected to same network

Write "ipconfig" in CMD
Find IPV4 Address in PC or laptop

Copy paste that IPV4 Address in mobile

If you are having access denied issue then do as follows:
Path >> C:\wamp64\bin\apache\apache2.4.27\conf\extra\httpd-vhosts (For wamp server)
File name: httpd-vhosts.conf


# Virtual Hosts
#
<VirtualHost *:80>
  ServerName localhost
  ServerAlias localhost
  DocumentRoot "${INSTALL_DIR}/www"
  <Directory "${INSTALL_DIR}/www/">
     Options FollowSymLinks  // Copy This Code
       AllowOverride All   // Copy This Code
       Require all granted  // Copy This Code
  </Directory>
</VirtualHost>


 then restart your Wamp

Access that Address in Mobile Again :)
Thank You

Thursday, 29 March 2018

Pattern Program using C


#include <stdio.h>
int main()
{
   int i,j,k,m,space, rows;
   scanf("%d\n",&rows);
   for(i=0; i<=rows; i++)
   {
       for(space=0; space<=rows-i; ++space)
       {
           printf("  ");
       }
       for(j=i;j>=0;j--)
       {
           printf("%d ",j);
           m=j;
           if(m==0)
           {
               for(k=1;k<=i;k++)
               {
                   printf("%d ",k);
               }
           }
       }
       printf("\n");
   }
   return 0;
}

Output:  

Infinite scroll on collection page in Shopify

 Hello, Collection page structure is as followed {% paginate collection.products by 48 %} <div class="collection-content"> ...