Skip to content

Instantly share code, notes, and snippets.

View larascasse's full-sized avatar

FLorent Berenger larascasse

View GitHub Profile
@larascasse
larascasse / gist:9688140
Created March 21, 2014 15:00
[Magento] Remove cart2Quote
DELETE FROM `core_config_data` WHERE `path` LIKE '%quoteadv%';
DELETE FROM `core_config_data` WHERE `path` LIKE '%carriers/qquoteshiprate%';
DELETE FROM `core_resource` WHERE `code` LIKE '%quoteadv%' ;
DELETE FROM `eav_attribute` WHERE `attribute_code` LIKE '%allowed_to_quote%'
DELETE FROM `eav_attribute` WHERE `attribute_code` LIKE '%group_allow_quote%'
DROP TABLE `quoteadv_crmaddon_messages`;
DROP TABLE `quoteadv_crmaddon_templates`;
DROP TABLE `quoteadv_extraoptions`;
<?php
/**
* Optimized version of attribute source options model
*
* That allows to preload options once and reuse them instead of doing calls to db all the time
*
*/
class EcomDev_Optimization_Model_Resource_Attribute_Source_Table
extends Mage_Eav_Model_Entity_Attribute_Source_Table
<?php
class EcomDev_Optimization_Model_Rule_Observer extends Mage_CatalogRule_Model_Observer
{
protected $_preloadedPrices = array();
public function beforeCollectTotals(Varien_Event_Observer $observer)
{
$quote = $observer->getQuote();
$date = Mage::app()->getLocale()->storeTimeStamp($quote->getStoreId());
@larascasse
larascasse / gist:82511c440e82d4da4c7e
Last active August 29, 2015 14:07
Magento Duplicate category
INSERT INTO catalog_category_product
SELECT {{NEWCATEGORY}} as category_id, tablea.product_id, 999 as position
FROM `catalog_category_product` tablea
LEFT OUTER JOIN `catalog_category_product` tableb
ON tablea.product_id = tableb.product_id
AND tableb.category_id = {{NEWCATEGORY}}
WHERE tablea.`category_id` = {{OLDCATEGORY}} AND tableb.position is NULL
@larascasse
larascasse / gist:0ef2a46415f0aef29275
Created September 30, 2015 07:54
Pumicer object csv export customization
private function csvAction(){
$this->disableLayout();
$this->disableViewAutoRender();
$obj_list = new YourObject_List();
$obj_list->load();
/* @var $obj Object_YourObject */
$out = array();
@larascasse
larascasse / config-haproxy.sh
Created February 9, 2012 11:36 — forked from jsermeno/config-haproxy.sh
Node.js server and Web Sockets on Amazon EC2 with Express.js and Socket.IO - http://catchvar.com/nodejs-server-and-web-sockets-on-amazon-ec2-w
# HAProxy config
mkdir /etc/haproxy
cat > /etc/haproxy/haproxy.cfg << EOF
global
maxconn 4096
defaults
mode http
level street_address
city 3ème Arrondissement Paris
state Île-de-France
sw_lat 48.86710531970849
parent_hash[city] 3rd arrondissement of Paris
accuracy 8
sw_lng 2.354801119708498
parent_hash[accuracy] 5
parent_hash[ne_lat] 48.8711592
parent_hash[sw_lat] 48.8564786
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
MyCustomNavController* navController = (MyCustomNavController*)self.parentViewController;
if( [scrollView.panGestureRecognizer translationInView:self.view].y < 0.0f ) {
[navController setExpanded:YES animated:YES];
} else if ([scrollView.panGestureRecognizer translationInView:self.view].y > 0.0f ) {
[navController setExpanded:NO animated:YES];
}
}
<?php
require_once 'app/Mage.php';
Mage::app('default');
$productIds = array(100, 101, 102);
$option = array(
'title' => 'Test Option',
'type' => 'file',
'is_require' => 1,
@larascasse
larascasse / gist:7869671
Last active December 30, 2015 18:49
Magento _ cron import
<?php
//STEP 1: Save the below file as Cron_Import.php on the Magento base folder.
//STEP 3: Test this on your SSH login to check if this works on command line. Use the below command
//wget -T0 -t1 -O - http://<www.example.com>/Cron_Import.php/?files=3XSEEEE.csv
//uncommentwhen moved to server - to ensure this page is not accessed from anywhere else
//if ($_SERVER['REMOTE_ADDR'] !== '<your server ip address') {
// die("You are not a cron job!");
//}