Skip to content

Instantly share code, notes, and snippets.

View rodde177's full-sized avatar

rodde177

  • sthlm
View GitHub Profile
@rodde177
rodde177 / gist:42d5dd87fcc7564ab3e5
Last active August 29, 2015 14:16
Get minimum quantity increment for grouped products in Magento
<?php foreach ($_associatedProducts as $_item): ?>
<tr>
<td>
<?php $stockItem = $_item->getStockItem(); ?>
<?php echo $stockItem->getMinSaleQty(); ?>
</td>
</tr>
<?php endforeach; ?>
tar czvf - / | ssh root@newlocation "tar -xzv -C / -f -"
@rodde177
rodde177 / gist:b2d8d1c8b3b7f853c016
Created March 10, 2015 07:55
Magento check API role
<?php
$apikey = Mage::getModel('api/user')->load(1)->getApiKey();
print_r($apikey);
$roles = Mage::getModel('api/roles')->getCollection();
foreach($roles as $role):
echo '<br/>Role : '.$role->getId()." | ".$role->getRoleName();
endforeach;
?>
@rodde177
rodde177 / gist:b778882f96f36f44c02d
Last active August 29, 2015 14:16
Copy file over SSH
scp min_backup.tar.gz ssh root@11.1.1.11:/var/www
sudo tar -xvpzf /path/to/backup.tar.gz -C /media/whatever --numeric-owner
@rodde177
rodde177 / gist:38c565b845845f8d5275
Created March 12, 2015 08:44
Change db user permission
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON dbname.* to dbuser@localhost IDENTIFIED BY 'pwd';
@rodde177
rodde177 / gist:deb407b49fa7772241c6
Created March 13, 2015 08:17
Add meta tag for google GWT
<reference name="head">
<block type="core/text" name="meta.gwt">
<action method="setText">
<text>
<![CDATA[<meta name="google-site-verification" content="some_hashed_string"/>]]>
</text>
</action>
</block>
</reference>
@rodde177
rodde177 / gist:65a54bbbc2958770713b
Created March 23, 2015 09:28
Change order number
use mydb;
SELECT store_id, name FROM core_store;
select * from eav_entity_store;
UPDATE `eav_entity_store` SET `increment_last_id` = '400000340' WHERE `entity_type_id` = '5' AND `entity_store_id` = '7';
postqueue -p
check if postfix is down, restart if needed
sudo /etc/init.d/postfix restart
check mail queue
mailq
<?php
$order_id = $this->getOrderId();
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
$total = $order->getGrandTotal();
?>
<?php echo $order_id; ?>
<?php echo $total; ?>