MrBoBo69

Shopify Category showcase (fetch from Metafileds)

Feb 5th, 2025 (edited)
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.84 KB | Source Code | 0 0
  1. <link href= "{{"custom-category.css" | asset_url }}" type="text/css" rel="stylesheet">
  2. <style>
  3.  .outboxads_yt-{{ section.id }}{
  4.    --content-align-mo: {{ section.settings.content-align-mo }};
  5.    --border-color: {{ section.settings.border_color }};
  6.    --img-border: {{ section.settings.img_border_wi }}px;
  7.  
  8.    --img-fit: {{ section.settings.object_fit_con }};
  9.  
  10.    --img-width: clamp({{ section.settings.min_size_mobile }}px, 15vw, {{ section.settings.max_size_desktop }}px);
  11.    --img-radius:{{ section.settings.img_radius | divided_by: 2 }}%;
  12. }
  13. </style>
  14.  
  15.  <div class= "custom_cat_contain outboxads_yt-{{ section.id }}">
  16.     {% if section.settings.cus_cat_title %}
  17.      <h3 class= "collage_Title" >{{section.settings.custom_col_title}}</h3>
  18.         <p class= "collage_Description" >{{section.settings.custom_col_description}}</p>
  19.         {% endif %}
  20.          <div class="custom_cat_sec">
  21.           {% for blocks in section.blocks %}
  22.             <div class= "custom_grids">
  23.           <a href="{{ blocks.settings.imagelink }}">
  24.          <img class="collage_Images image_outline objfitCover" src="{{blocks.settings.col_images | img_url: '1080x' }}" loading="lazy">
  25.           </a>
  26.          <p> {{blocks.settings.cat_title}} </p>
  27.      </div>
  28.     {% endfor %}
  29.    </div>
  30. </div>
  31.  
  32. {% schema %}
  33.   {
  34.     "name": "Custom Category Section",
  35.     "settings": [
  36.       {
  37.       "type": "checkbox",
  38.       "id": "cus_cat_title",
  39.       "label": "Enable title description",
  40.       "default": false
  41.       },
  42.        {
  43.        "type": "text",
  44.         "id": "custom_col_title",
  45.         "label": "Section Title"
  46.        },
  47.        {
  48.        "type": "textarea",
  49.         "id": "custom_col_description",
  50.         "label": "Short Description"
  51.        },
  52.       {
  53.       "type": "header",
  54.       "content": "Image Fit"
  55.       },
  56.        {
  57.         "type": "select",
  58.         "id": "object_fit_con",
  59.         "label": "Image fit settings",
  60.         "info": "want source code [https://pastebin.com/s0GUUyur]",
  61.         "options": [
  62.           {
  63.             "value": "contain",
  64.             "label": "Contain"
  65.           },
  66.           {
  67.             "value": "cover",
  68.             "label": "Cover"
  69.           }
  70.         ],
  71.         "default": "cover"
  72.       },
  73.       {
  74.       "type": "header",
  75.       "content": "Grid Size"
  76.       },
  77.       {
  78.         "type": "range",
  79.         "id": "min_size_mobile",
  80.         "min": 70,
  81.         "max": 110,
  82.         "step": 5,
  83.         "unit": "px",
  84.         "label": "For Mobile",
  85.         "default": 80
  86.       },
  87.       {
  88.         "type": "range",
  89.         "id": "max_size_desktop",
  90.         "min": 90,
  91.         "max": 120,
  92.         "step": 5,
  93.         "unit": "px",
  94.         "label": "For Desktop",
  95.         "default": 115
  96.       },
  97.       {
  98.         "type": "range",
  99.         "id": "img_radius",
  100.         "min": 0,
  101.         "max": 100,
  102.         "step": 5,
  103.         "unit": "%",
  104.         "label": "Block Shape Radius",
  105.         "default": 100
  106.       },
  107.       {
  108.       "type": "header",
  109.       "content": "Settings For Mobile"
  110.       },
  111.       {
  112.         "type": "select",
  113.         "id": "content-align-mo",
  114.         "label": "Content align for mobile",
  115.         "options": [
  116.           {
  117.             "value": "start",
  118.             "label": "Left"
  119.           },
  120.           {
  121.             "value": "center",
  122.             "label": "center"
  123.           },
  124.           {
  125.             "value": "end",
  126.             "label": "Right"
  127.           }
  128.         ],
  129.         "default": "start"
  130.       },
  131.       {
  132.       "type": "header",
  133.       "content": "Border settings"
  134.       },
  135.       {
  136.         "type": "color",
  137.         "id": "border_color",
  138.         "label": "Border Color",
  139.         "default": "#e8e8e8"
  140.       },
  141.       {
  142.         "type": "range",
  143.         "id": "img_border_wi",
  144.         "min": 0,
  145.         "max": 4,
  146.         "step": 1,
  147.         "unit": "px",
  148.         "label": "Border size",
  149.         "info" : "To remove border, set it to 0",
  150.         "default": 1
  151.         }
  152.   ],
  153.     "blocks":[
  154.       {
  155.      "name":" Section Block",
  156.       "type":"collage_image",
  157.       "settings":[
  158.           {
  159.            "type": "image_picker",
  160.            "id": "col_images",
  161.            "label": "collage Image",
  162.            "info" : "Use 1:1 size image i.e.600 X 600px"
  163.            },
  164.            {
  165.            "type": "url",
  166.            "id": "imagelink",
  167.            "label": "Image link"
  168.            },
  169.           {
  170.           "type": "text",
  171.           "id": "cat_title",
  172.           "label": "Category Title",
  173.           "info" : "try to use 1 word only"
  174.           }
  175.  
  176.            ]
  177.       }
  178.    ],
  179.     "presets": [
  180.         {
  181.         "name": "Custom Category by OutBoxAds"
  182.         }
  183.         ]
  184.   }
  185. {% endschema %}
  186.  
  187. {% comment %}
  188.  //**Note: All rights and commercial license reserved by outboxads digital services & co. sharing under intellectual property under act B568-C(12).**//
  189. {% endcomment %}
  190.  
Tags: Ruby
Advertisement
Add Comment
Please, Sign In to add comment