Skip to content

Instantly share code, notes, and snippets.

View ravixp's full-sized avatar

Cycle XP ravixp

  • Edinburgh
  • 08:25 (UTC +01:00)
View GitHub Profile
@ravixp
ravixp / block-adobe-activation-hosts.etc
Last active February 5, 2018 16:23
Adobe: Block the annoying Adobe Activation message
#<block-adobe>
127.0.0.1 activate.adobe.com
127.0.0.1 practivate.adobe.com
127.0.0.1 ereg.adobe.com
127.0.0.1 wip3.adobe.com
127.0.0.1 activate.wip3.adobe.com
127.0.0.1 3dns-3.adobe.com
127.0.0.1 3dns-2.adobe.com
127.0.0.1 adobe-dns.adobe.com
127.0.0.1 adobe-dns-2.adobe.com
@ravixp
ravixp / clearfix.css
Last active July 12, 2017 17:58
CSS: clearfix works fine from IE 8 and up
.clearfix:after {
content: "";
display: table;
clear: both;
}
@ravixp
ravixp / grid.css
Last active July 12, 2017 17:57
CSS: Responsive Grid with the different media breakpoints
/*========================================================
GRID SYSTEM - Simple and Basic
=========================================================*/
*,
*:before,
*:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
margin: 0;
@ravixp
ravixp / check-if-customer-group-id-logged.php
Last active July 12, 2017 18:05
Magento 1: Check if the specific customer group ID is logged
<?php /*############################################## #Customer Group logged ################################################### */ ?>
<?php $login = Mage::getSingleton( 'customer/session' )->isLoggedIn(); //Check if User is Logged In ?>
<?php $groupId = Mage::getSingleton('customer/session')->getCustomerGroupId(); //Get Customers Group ID ?>
<?php if( $login AND ($groupId == 4) ) : // Customer Group ID is 4. //LOGGED ?>
<?php /*############################################## START #Customer Group logged ################################################### */ ?>
<!-- Content for Customer Group ID 4 Logged -->
<?php else: //NOT LOGGED ?>
@ravixp
ravixp / skip-maintenance-flag-index.php
Last active July 12, 2017 18:02
Magento 1 : Skip Maintenance Flag with IP address filters
/* Start - Add these to index.php */
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
$allowed = array('188.39.236.202','127.0.0.1');
/* End - Add these to index.php */
@ravixp
ravixp / remove-category-filter-local.xml
Last active July 12, 2017 17:55
Magento 1: Remove the category filter on the layered navigation category page on local XML
<!-- Category Layered Starts-->
<catalog_category_layered>
<reference name="catalog.leftnav">
<action method="unsetChild"><alias>category_filter</alias></action>
</reference>
</catalog_category_layered>
<!-- Category Layered Ends-->
@ravixp
ravixp / format-date-time.php
Last active July 12, 2017 17:47
Magento 1: Format Date and Time using Configuration options
<!-- Date Short Type -->
<?php
// Short Type
//Output will be: 18/3/17
?>
<?php
$today = '2017-03-18';
$date = Mage::helper('core')->formatDate($today, Mage_Core_Model_Locale::FORMAT_TYPE_SHORT, false);
echo $date;
?>
@ravixp
ravixp / useful-commands.md
Last active September 12, 2017 13:42
GIT: Useful Commands

On the develop website

To see the git history

$ git log

To check the git status

$ git status
@ravixp
ravixp / add-saving-amount-percentage.php
Last active July 12, 2017 17:46
Magento 1: Add the saving amount and the discounted percentage
<?php if($_finalPrice < $_price): ?>
<?php
$_discounted_percentage = 100 - round(($_finalPrice / $_price) * 100);
$_saving_amount = number_format(($_price - $_finalPrice), 2);
?>
<p class="saving-price">
<span class="price-label"><?php echo $this->__('Your Save: '); ?></span>
<span class="price">
<span class="saving-amount">
@ravixp
ravixp / add-msrp-price.php
Last active July 12, 2017 17:40
Magento 1: Add MSRP price inside price.phtml file
/* Get MRSP price Magento 1 */
<?php $_msrpPrice = $this->helper('core')->currency($_product->getMsrp(),true,true) ?>
<span class="price@>
<span class="label"><?php echo $this->__('MSRP Price:') ?></span>
<span class="price"><?php echo $_msrpPrice ?></span>
</span>