Skip to content

Instantly share code, notes, and snippets.

View tonyoconnell's full-sized avatar

Tony O'Connell tonyoconnell

View GitHub Profile
@tonyoconnell
tonyoconnell / gist:2351492
Last active August 21, 2023 17:35
Install Magento 1.8 With Sample Data By SSH
mkdir demo
cd demo
wget http://www.magentocommerce.com/downloads/assets/1.8.1.0/magento-1.8.1.0.tar.gz
wget http://www.magentocommerce.com/downloads/assets/1.6.1.0/magento-sample-data-1.6.1.0.tar.gz
tar -zxvf magento-1.8.1.0.tar.gz
tar -zxvf magento-sample-data-1.6.1.0.tar.gz
mv magento-sample-data-1.6.1.0/media/* magento/media/
mv magento-sample-data-1.6.1.0/magento_sample_data_for_1.6.1.0.sql magento/data.sql
mv magento/* magento/.htaccess .
chmod o+w var var/.htaccess app/etc
a {
text-indent:-999em;
outline:none;
background: url(button.jpg) no-repeat 0 0;
width:100px; height:50px;
display:block;
}
@tonyoconnell
tonyoconnell / gist:5563176
Created May 12, 2013 11:08
magento autologin
// => if you know the customer id
$customer = Mage::getModel('customer/customer')->load($id);
// => if you know the customer email address
$customer = Mage::getModel('customer/customer')->loadByEmail('some@email.com');
if($customer->getId())
{
Mage::getSingleton('customer/session')->setCustomerAsLoggedIn($customer);
}
@tonyoconnell
tonyoconnell / gist:4988720
Created February 19, 2013 18:49
git clean
git clean -f
If you want to also remove directories, run git clean -f -d.
If you just want to remove ignored files, run git clean -f -X.
If you want to remove ignored as well as non-ignored files, run git clean -f -x.
Note the case difference on the X for the two latter commands.
Unless you specify -f and clean.requireForce is set to "true" (the default) in your configuration, nothing will actually happen, with a recent enough version of git.
<button class="button" onclick="window.location='/new' "><span><span>Read More</span></span></button></div>
@tonyoconnell
tonyoconnell / gist:3714057
Created September 13, 2012 12:40
Magento : Add static block to PHTML
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('MYBLOCK')->toHtml() ?>
@tonyoconnell
tonyoconnell / gist:3699551
Created September 11, 2012 15:13
Magento Customer Name
<?php echo $this->__(Mage::getSingleton('customer/session')->getCustomer()->getName()); ?>
@tonyoconnell
tonyoconnell / gist:3696197
Created September 11, 2012 05:35
Insert Static Blocks into Template Files
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('your_cms_block_identifier')->toHtml() ?>
@tonyoconnell
tonyoconnell / gist:3692081
Created September 10, 2012 16:52
Embed a page
{{block type="cms/page" page_id="your-cms-page-id" template="cms/content.phtml"}}
@tonyoconnell
tonyoconnell / gist:3337662
Created August 13, 2012 07:12
Featured carosel
<p class="featured-social">{{block type="catalog/product_list" category_id="49" template="catalog/product/featured.phtml"}}</p>