This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function ($, window) { | |
var intervals = {}; | |
var removeListener = function(selector) { | |
if (intervals[selector]) { | |
window.clearInterval(intervals[selector]); | |
intervals[selector] = null; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php $plcsCol = Mage::getModel('catalog/product_link')->getCollection()->addFieldToFilter('link_type_id',Mage_Catalog_Model_Product_Link::LINK_TYPE_CROSSSELL)->addFieldToFilter('product_id',$_product->getId())->getData();//get crosssell product IDs attached to parent product ?> | |
<?php $csIDs = array_column($plcsCol,'linked_product_id');//map cs IDs to array, use array to filter collection by IDs ?> | |
<?php $_crossSellProducts = $_product->getCrossSellProductCollection()->addAttributeToFilter('entity_id', array('in'=>$csIDs))->addAttributeToSelect('*'); //ensures our crosssell collection is limited to ONLY attached crossells of parent.. calling getCrossSellProductCollection without filtering seems to return the ENTIRE product catalog collection.. | |
//replace addAttributeToSelect('*') with whatever fields you need from product flat catalog.. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function getProductCollection(){ | |
if($_category = Mage::registry('current_category')){ | |
$_categoryId = $_category->getId(); | |
$_productCollection = Mage::getResourceModel('catalog/product_collection'); | |
$_productCollection->joinTable(array('cp'=>'catalog/category_product'), 'product_id=entity_id', array('*') ,'cp.category_id='.$_categoryId, 'inner'); //join the table we need, filtered on Category ID | |
$_productCollection | |
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes()) //attributes needed from products using default config, or select your own | |
->addAttributeToFilter('status', 1) //ensure its enabled |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Get Layout Handles Used | |
var_dump(Mage::app()->getLayout()->getUpdate()->getHandles()); | |
//Get loaded layout blocks | |
var_dump(array_keys(Mage::app()->getLayout()->getAllBlocks())); | |
//Add to Global Messages | |
Mage::getSingleton('core/session')->addSuccess('Success Message'); | |
Mage::getSingleton('core/session')->addError('Error Message'); | |
Mage::getSingleton('core/session')->addWarning('Warning Message'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//ADD THIS TO END OF YOUR JQUERY FILE OR RUN IT AFTER JQUERY IS LOADED | |
// Prototype.js loads -> then jquery.js loads -> then run this | |
//alternatively, upgrade and load jquery 3 first then prototype.js and you shouldn't need this fix. | |
if(Prototype.BrowserFeatures.ElementExtensions){var disablePrototypeJS=function(o,e){var t=function(e){e.target[o]=void 0,setTimeout(function(){delete e.target[o]},0)};e.each(function(e){jQuery(window).on(o+".bs."+e,t)})},pluginsToDisable=["collapse","dropdown","modal","tooltip","popover"];disablePrototypeJS("show",pluginsToDisable),disablePrototypeJS("hide",pluginsToDisable)} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FILE PATH: app/code/core/Mage/Core/Model/Session/Abstract/Varien.php | |
// session cookie params | |
$cookieParams = array( | |
'lifetime' => $cookie->getLifetime(), | |
'path' => $cookie->getPath(), | |
- 'domain' => $cookie->getConfigDomain(), | |
+ 'domain' => $cookie->getDomain(), | |
'secure' => $cookie->isSecure(), | |
'httponly' => $cookie->getHttponly() | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default | |
catalog_category_default (* also used in directory.xml) | |
catalog_category_layered (* also used in directory.xml) | |
catalog_product_compare_index | |
catalog_product_gallery | |
catalog_product_send | |
catalog_product_view (* also used in customeralert.xml, tag.xml) | |
catalog_seo_searchterm_popular | |
catalog_seo_sitemap_category | |
catalog_seo_sitemap_product |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$custom_option1 = array('label'=>'Custom1','value'=>$value1); | |
$custom_option2 = array('label'=>'Custom2','value'=>$value2); | |
$product->addCustomOption('additional_options', serialize(array($custom_option1,$custom_option2))); | |
$product->setHasOptions(true); | |
$cart->addProduct($product, $params); | |
$cart->save(); | |
//USE 'additional_options' if you need the CustomOption to show up on checkout/cart, as $item->getCustomOptions() only looks at 'additional_options' and 'option_ids' | |
$item->getOptionByCode('option_ids'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filepath: app/etc/modules/ | |
<?xml version="1.0"?> | |
<config> | |
<modules> | |
<My_Module> | |
<active>true</active> | |
<codePool>local</codePool> | |
</My_Module> | |
</modules> | |
</config> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var editQty = (function(){ | |
function editValue(e) { | |
var input = e.target.nextElementSibling || e.target.previousElementSibling; | |
input.value = counter(e.target.classList.contains('plus'),input.value); | |
} | |
function counter(add,x) { | |
return add ? ++x : (x > 1 ? --x : x); | |
} |
OlderNewer