Skip to content

Instantly share code, notes, and snippets.

@kiennt2
kiennt2 / magento - test share wishlist page
Created December 18, 2014 09:24
magento - test share wishlist page
<?php echo Mage::getUrl('*/shared/index', array('code' => $this->getWishlistInstance()->getSharingCode())); ?>
@kiennt2
kiennt2 / youtube playlist with jquery
Last active May 28, 2018 13:12
youtube playlist with jquery
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
//-------------------------------------------------
// youtube playlist jquery plugin
@kiennt2
kiennt2 / Magento - Fix 4096 css selector limit in IE when merge css files
Created November 11, 2014 07:28
Magento - Fix 4096 css selector limit in IE when merge css files
<!--[if lte IE 9]>
<?php
$items = $this->_data['items'];
foreach($items as $item){
if($item['type']=='skin_css'){
echo $this->__('<link rel="stylesheet" type="text/css" href="%s"/>',$this->getSkinUrl($item['name']));
}
}
?>
<![endif]-->
@kiennt2
kiennt2 / list produce result that looks like 1.1, 1.2, 1.3 (instead of just 1, 2, 3, …) with css
Last active August 29, 2015 14:08
list produce result that looks like 1.1, 1.2, 1.3 (instead of just 1, 2, 3, …) with css
ol {
list-style-type: none;
counter-reset: item;
margin: 0;
padding: 0;
}
li {
display: table;
counter-increment: item;
@kiennt2
kiennt2 / Responsive Equal Height Blocks With JavaScript Fallback
Created September 30, 2014 10:37
Responsive Equal Height Blocks With JavaScript Fallback
<html lang="en" class="no-js">
<head>
<meta charset="utf-8" />
<title>Flexbox Based Responsive Equal Height Blocks With JavaScript Fallback demo by Osvaldas Valutis</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="Demo of Flexbox Based Responsive Equal Height Blocks With JavaScript Fallback" />
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:300,400,700">
@kiennt2
kiennt2 / magento - install & update scripts
Last active February 11, 2025 19:46
magento - install & update scripts
<?php
/** @var $installer Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */
$installer = $this;
$installer->startSetup();
$targetStore = "uk";
$allStores = Mage::app()->getWebsites();
@kiennt2
kiennt2 / Fix youtube + iframe z-index on IE
Created August 25, 2014 08:38
Fix youtube + iframe z-index on IE
$(document).ready(function () {
$("iframe").each(function(){
var ifr_source = $(this).attr('src');
var wmode = "wmode=transparent";
if(ifr_source.indexOf('?') != -1) $(this).attr('src',ifr_source+'&'+wmode);
else $(this).attr('src',ifr_source+'?'+wmode);
});
});
@kiennt2
kiennt2 / magento - product - get all attribute by attribute group
Last active August 29, 2015 14:02
magento - product - get all attribute by attribute group
<?php
$setId = $_product->getAttributeSetId();
$attrGroups = Mage::getModel('eav/entity_attribute_group')->getResourceCollection()->setAttributeSetFilter($setId)->setSortOrder()->load();
foreach ($attrGroups as $group) {
if($group->getAttributeGroupName() == 'Coravin'){
$attributes = Mage::getResourceModel('catalog/product_attribute_collection')->setAttributeGroupFilter($group->getId())->addVisibleFilter()->checkConfigurableProducts()->load();
if ($attributes->getSize() > 0) {
foreach ($attributes->getItems() as $attribute) {
echo $attribute->getStoreLabel('admin');
@kiennt2
kiennt2 / magento - display product review on product detail page
Last active August 29, 2015 14:02
magento - display product review on product detail page
<block type="page/html_pager" name="product_review_list.toolbar">
<action method="setLimit"><limit>6</limit></action>
</block>
<block type="core/template" name="product_review_list.count" template="review/product/view/count.phtml" />
<block type="review/product_view_list" name="product_customer_reviews" as="product_customer_reviews" template="review/product/view/list.phtml">
<block type="review/form" name="product.review.form" as="review_form">
<block type="page/html_wrapper" name="product.review.form.fields.before" as="form_fields_before" translate="label">
<label>Review Form Fields Before</label>
<action method="setMayBeInvisible"><value>1</value></action>
</block>
@kiennt2
kiennt2 / magento - get category nav & display anywhere
Created June 10, 2014 17:17
magento - get category nav & display anywhere
<?php
$rootcatId= Mage::app()->getStore()->getRootCategoryId();
$categories = Mage::getModel('catalog/category')->getCategories($rootcatId);
//Mage::registry('current_category') ? $currentCategory = Mage::registry('current_category')->getId() : $currentCategory='';
//var_dump($currentCategory);
function get_categories($categories) {
Mage::registry('current_category') ? $currentCategory = Mage::registry('current_category')->getId() : $currentCategory='';
$array= '<ul>';
foreach($categories as $category) {
$cat = Mage::getModel('catalog/category')->load($category->getId());