Skip to content

Instantly share code, notes, and snippets.

View mschultheiss83's full-sized avatar

Martin Schultheiß mschultheiss83

View GitHub Profile
{
name: 'greenwellness/wellnessbon'
description: 'Definitie voor Green Wellness Wellnessbon.'
license: 'proprietary'
'minimum-stability': 'dev'
config:
<?php if ( Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getEnableQtyIncrements() ){ ?>
<select class="input-text qty" name="qty" id="qty">
<?php $i = (Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getMinSaleQty()?Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getMinSaleQty():1); ?>
<?php do { ?>
<option value="<?php echo $i?>">
<?php echo $i?>
<?php $i+= Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQtyIncrements() ?>
</option>
<?php } while ($i <= (int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getMaxSaleQty()) ?>
</select>
<?php
/*
Author: Tegan Snyder <[email protected]>
Example of running a Dataflow profile via command line
you can change the profile_id to the one you want to
run and issue:
time php manual-dataflow-profile.php
note you may need to increase the memory_limit in php cli's php_cli.ini
RHEL linux copy /etc/php.ini to /etc/php_cli.ini and make changes there then restart Apache.
<?php
ini_set('display_errors', 1);
ini_set('log_errors', 1);
error_reporting(E_ALL);
require 'app/Mage.php';
Mage::app('admin', 'store');
/* @var $customers Mage_Customer_Model_Resource_Customer_Collection */
$customers = Mage::getResourceModel('customer/customer_collection');
$customers->addAttributeToSelect('*');
$customers->setPageSize((isset($argv[1]) && is_numeric($argv[1]))?$argv[1]:2000);
#!/bin/bash
LOG=var/log/del_unused_img.log
function search_db() {
COUNT=$(mysql -uYOURUSER -pYOURPASSWORD YOURDB --execute="SELECT count(*) FROM catalog_product_entity_media_gallery WHERE value = \"$1\"")
echo $(echo ${COUNT} | cut -d" " -f2)
}
echo "Start: "\n >> ${LOG}
echo $(date) >> ${LOG}
@mschultheiss83
mschultheiss83 / gist:9a35b077da256d0d8606
Last active August 29, 2015 14:01
Magento - loadMedialGallery by Product Id and Store Id
<?php
$backend = Mage::getResourceModel('catalog/product_attribute_backend_media');
$attributeId = Mage::getResourceModel('eav/entity_attribute')->getIdByCode('catalog_product', 'media_gallery');
$container = new Varien_Object(array(
'attribute' => new Varien_Object(array('id' => $attributeId))
));
$product = new Varien_Object(array(
'id' => 519,
<?xml version="1.0"?>
<!-- license -->
<config>
<global>
<!-- global config -->
</global>
<frontend>
<events>
<!-- disble logs -->
<controller_action_predispatch>

Magento SQL Snippets

Clear Temporary Data Tables

TRUNCATE `log_customer`;
TRUNCATE `log_quote`;
TRUNCATE `log_summary`;
TRUNCATE `log_url`;
TRUNCATE `log_url_info`;
# original from http://activecodeline.com/git-ignore-gitignore-file-for-magento-project
# tested with Magento 1.4.0.1
# put it into magento install dir
app/code/community/Phoenix/
app/code/core/
app/design/adminhtml/default/default/
app/design/frontend/base/

Magento Code Snippets

Download extension manually using mage

./mage config-set preferred_state stable
./mage clear-cache
./mage sync
./mage download community Module_Name