Skip to content

Instantly share code, notes, and snippets.

View yogeshdubey2006's full-sized avatar
🏠
Working from home

Yogesh Dubey yogeshdubey2006

🏠
Working from home
View GitHub Profile
@yogeshdubey2006
yogeshdubey2006 / translate.ssh
Created February 25, 2019 11:32
Magento 2 - Translate Checkout
# After much head banging and trying I finally figured out what the problem was. Localizing inside a theme such as # app/design/frontend/Company/theme/i18n/en_US.csv
# does appear to get incorporated into the knock-out translations in the checkout. Why? I'm not sure, but I did come up with a solution that worked by creating an entire language pack.
# Step 1, create a CSV of all translatable phrases used in the store. Run the following in ssh:
php bin/magento i18n:collect-phrases -o en_US.csv -m
# Step 2, create a language pack such as
# app/i18n/CompanyName/en_US/ instructions on creating dictionaries and language packs are available in the Magento 2 developer documentation at http://devdocs.magento.com/guides/v2.2/config-guide/cli/config-cli-subcommands-i18n.html
# Step 3, Update the phrases in the language pack to match the translation and localization needs
@yogeshdubey2006
yogeshdubey2006 / owl-carousel-grid-plus-responsive.js
Created January 25, 2019 08:22
OwlCarousel - Initialize owl carousel on mobile. Destroy carousel on desktop and listen for window resize to rebuild/destroy
@yogeshdubey2006
yogeshdubey2006 / tax.phtml
Created January 23, 2019 05:50
Magento - Hide TAX summary from cart/checkout pages
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
@yogeshdubey2006
yogeshdubey2006 / customer_account_create.xml
Created January 17, 2019 07:15
Magento 2 - show address field in registration form
<!-- Create this file in your custom theme:
app/design/frontend/YOUR_PACKAGE/YOUR_THEME/Magento_Customer/layout/customer_account_create.xml
So, you need to set the action method called setShowAddressFields like true, like that sample: -->
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="customer_form_register">
<action method="setShowAddressFields">
<argument name="show.address.fields" xsi:type="boolean">true</argument>
@yogeshdubey2006
yogeshdubey2006 / media-queries.css
Created January 14, 2019 05:43
CSS - responsive media queries
/** Media Queries ***********************************/
/****************************************************/
/****************************************************/
@media (min-width: 576px) {
}
@media (min-width: 768px) {
}
@media (min-width: 992px) {
@yogeshdubey2006
yogeshdubey2006 / functions.php
Created January 7, 2019 12:32
WordPress - upload SVG images through media library.
<?php
/* WordPress is not allow to upload SVG images through WP media library. Please add below script in functions.php.
* so that you can upload SVG images through browse media upload functionality.
*
*/
function cc_mime_types($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'cc_mime_types'); ?>
@yogeshdubey2006
yogeshdubey2006 / addtocart.phtml
Created January 7, 2019 06:00
Magento 2 - add plus minus buttons on product page
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="author" content="yogeshdubey2006@gmail.com">
<title>Magento 2 - plus minus shopping quantity buttons</title>
<script type="text/javascript" src="https://code.jquery.com/jquery-git.min.js"></script>
<style type="text/css">
* {
box-sizing: border-box;
@yogeshdubey2006
yogeshdubey2006 / magento-product-plus-minus-buttons.html
Created January 3, 2019 12:23
Magento - plus minus shopping quantity buttons
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="author" content="yogeshdubey2006@gmail.com">
<title>Magento - plus minus shopping quantity buttons</title>
<script type="text/javascript" src="https://code.jquery.com/jquery-git.min.js"></script>
<style type="text/css">
* {
box-sizing: border-box;
@yogeshdubey2006
yogeshdubey2006 / disabled-right-click.html
Created January 3, 2019 11:55
Javascript - no right clicking allowed!
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="author" content="yogeshdubey2006@gmail.com">
<title>No Right Clicking Allowed</title>
<style type="text/css">
* {
box-sizing: border-box;
-moz-box-sizing: border-box;
@yogeshdubey2006
yogeshdubey2006 / catalog-search-form.phtml
Created January 3, 2019 11:44
Magento - show simple calatog search form on CMS page.
<?php
/* There is no widget available for this, but pasting the following code into a CMS page or Static Block will allow you to
* put a search block where you want to have it:
* You may need to add some CSS to display it to your needs.
*/
<form id="search_mini_form_cms" action="{{store url='catalogsearch/result'}}" method="get">
<div class="input-box">
<label for="search_cms">Search:</label>
<input id="search_cms" type="search" name="q" value="" class="input-text required-entry" maxlength="128" placeholder="Search entire store here..." autocomplete="off">
<button type="submit" title="Search" class="button search-button"><span><span>Search</span></span></button>