snipt

Ctrl+h for KB shortcuts

Text only

Change all directories to 755 and all files to 644

find . -type d -print0 | xargs -0 chmod 0775 # For directories
find . -type f -print0 | xargs -0 chmod 0664 # For files
https://snipt.net/embed/e99dcbe9ddf096ccab60fe40e413f177/
/raw/e99dcbe9ddf096ccab60fe40e413f177/
e99dcbe9ddf096ccab60fe40e413f177
text
Text only
2
2019-06-25T08:39:08
True
False
False
Jan 27, 2014 at 11:41 AM
/api/public/snipt/108841/
change-all-directories-to-755-and-all-files-to-644
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>find . -type d -print0 | xargs -0 chmod 0775 # For directories </span><span id="L-2"><a name="L-2"></a>find . -type f -print0 | xargs -0 chmod 0664 # For files </span></pre></div> </td></tr></table>
Linux

Text only

Cahnge owner group for all files

chown -R web37:client9 *
https://snipt.net/embed/07e4c73bd7f40bda0d1d1620fbe7ced5/
/raw/07e4c73bd7f40bda0d1d1620fbe7ced5/
07e4c73bd7f40bda0d1d1620fbe7ced5
text
Text only
1
2019-06-25T10:18:39
True
False
False
Jan 27, 2014 at 11:36 AM
/api/public/snipt/108837/
cahnge-owner-group-for-all-files
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>chown -R web37:client9 * </span></pre></div> </td></tr></table>
Linux, linux

PHP

Echo out Name of the user - Magento

1
2
3
4
5
6
7
8
<?php 
    $session = Mage::getSingleton('customer/session');
        if($session->isLoggedIn()) {
        $customer = $session->getCustomer();
        echo $customer->getName();
        echo $customer->getFirstname();
    }
?>
https://snipt.net/embed/a884fcc3cd90a8172d55180eece89d35/
/raw/a884fcc3cd90a8172d55180eece89d35/
a884fcc3cd90a8172d55180eece89d35
php
PHP
8
2019-06-26T14:20:08
True
False
False
Nov 21, 2013 at 03:03 AM
/api/public/snipt/95705/
echo-out-name-of-the-user-magento
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="cp">&lt;?php</span> </span><span id="L-2"><a name="L-2"></a> <span class="nv">$session</span> <span class="o">=</span> <span class="nx">Mage</span><span class="o">::</span><span class="na">getSingleton</span><span class="p">(</span><span class="s1">&#39;customer/session&#39;</span><span class="p">);</span> </span><span id="L-3"><a name="L-3"></a> <span class="k">if</span><span class="p">(</span><span class="nv">$session</span><span class="o">-&gt;</span><span class="na">isLoggedIn</span><span class="p">())</span> <span class="p">{</span> </span><span id="L-4"><a name="L-4"></a> <span class="nv">$customer</span> <span class="o">=</span> <span class="nv">$session</span><span class="o">-&gt;</span><span class="na">getCustomer</span><span class="p">();</span> </span><span id="L-5"><a name="L-5"></a> <span class="k">echo</span> <span class="nv">$customer</span><span class="o">-&gt;</span><span class="na">getName</span><span class="p">();</span> </span><span id="L-6"><a name="L-6"></a> <span class="k">echo</span> <span class="nv">$customer</span><span class="o">-&gt;</span><span class="na">getFirstname</span><span class="p">();</span> </span><span id="L-7"><a name="L-7"></a> <span class="p">}</span> </span><span id="L-8"><a name="L-8"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
magento, username

XML

Magento - Remove category filter

1
2
3
4
5
6
7
<?php //Add this to your local.xml - removes category filter from sideabar. ?>

<catalog_category_layered>
                <block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml">
                 <action method="unsetChild"><child>category_filter</child></action>
                </block>
</catalog_category_layered>
https://snipt.net/embed/c512d85933e9117164da388572ee663f/
/raw/c512d85933e9117164da388572ee663f/
c512d85933e9117164da388572ee663f
xml
XML
7
2019-06-25T08:39:50
True
False
False
Nov 14, 2013 at 11:37 AM
/api/public/snipt/94171/
magento-remove-category-filter
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="cp">&lt;?php //Add this to your local.xml - removes category filter from sideabar. ?&gt;</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="nt">&lt;catalog_category_layered&gt;</span> </span><span id="L-4"><a name="L-4"></a> <span class="nt">&lt;block</span> <span class="na">type=</span><span class="s">&quot;catalog/layer_view&quot;</span> <span class="na">name=</span><span class="s">&quot;catalog.leftnav&quot;</span> <span class="na">after=</span><span class="s">&quot;currency&quot;</span> <span class="na">template=</span><span class="s">&quot;catalog/layer/view.phtml&quot;</span><span class="nt">&gt;</span> </span><span id="L-5"><a name="L-5"></a> <span class="nt">&lt;action</span> <span class="na">method=</span><span class="s">&quot;unsetChild&quot;</span><span class="nt">&gt;&lt;child&gt;</span>category_filter<span class="nt">&lt;/child&gt;&lt;/action&gt;</span> </span><span id="L-6"><a name="L-6"></a> <span class="nt">&lt;/block&gt;</span> </span><span id="L-7"><a name="L-7"></a><span class="nt">&lt;/catalog_category_layered&gt;</span> </span></pre></div> </td></tr></table>
"category filter", magento

PHP

Add to cart / Add to wishlist

1
2
3
<a href="<?php echo $this->helper('catalog/product_compare')->getAddUrl($_product);  ?>" class="action-product-compare" title="<?php echo $this->__('Compare') ?>"></a>
			<a href="<?php echo $product->getProductUrl() ?>" class="action-product-add"><?php echo $this->__('+ add to cart') ?></a>
			<a href="<?php echo $this->helper('wishlist')->getAddUrl($_product); ?>" class="action-product-wish" title="<?php echo $this->__('Add to wishlist') ?>"></a>
https://snipt.net/embed/f2b45fb034f73916c0b95f772a9c9393/
/raw/f2b45fb034f73916c0b95f772a9c9393/
f2b45fb034f73916c0b95f772a9c9393
php
PHP
3
2019-06-25T08:40:04
True
False
False
Nov 05, 2013 at 08:35 AM
/api/public/snipt/91927/
add-to-cart-add-to-wishlist
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="x">&lt;a href=&quot;</span><span class="cp">&lt;?php</span> <span class="k">echo</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">helper</span><span class="p">(</span><span class="s1">&#39;catalog/product_compare&#39;</span><span class="p">)</span><span class="o">-&gt;</span><span class="na">getAddUrl</span><span class="p">(</span><span class="nv">$_product</span><span class="p">);</span> <span class="cp">?&gt;</span><span class="x">&quot; class=&quot;action-product-compare&quot; title=&quot;</span><span class="cp">&lt;?php</span> <span class="k">echo</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">__</span><span class="p">(</span><span class="s1">&#39;Compare&#39;</span><span class="p">)</span> <span class="cp">?&gt;</span><span class="x">&quot;&gt;&lt;/a&gt;</span> </span><span id="L-2"><a name="L-2"></a><span class="x"> &lt;a href=&quot;</span><span class="cp">&lt;?php</span> <span class="k">echo</span> <span class="nv">$product</span><span class="o">-&gt;</span><span class="na">getProductUrl</span><span class="p">()</span> <span class="cp">?&gt;</span><span class="x">&quot; class=&quot;action-product-add&quot;&gt;</span><span class="cp">&lt;?php</span> <span class="k">echo</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">__</span><span class="p">(</span><span class="s1">&#39;+ add to cart&#39;</span><span class="p">)</span> <span class="cp">?&gt;</span><span class="x">&lt;/a&gt;</span> </span><span id="L-3"><a name="L-3"></a><span class="x"> &lt;a href=&quot;</span><span class="cp">&lt;?php</span> <span class="k">echo</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">helper</span><span class="p">(</span><span class="s1">&#39;wishlist&#39;</span><span class="p">)</span><span class="o">-&gt;</span><span class="na">getAddUrl</span><span class="p">(</span><span class="nv">$_product</span><span class="p">);</span> <span class="cp">?&gt;</span><span class="x">&quot; class=&quot;action-product-wish&quot; title=&quot;</span><span class="cp">&lt;?php</span> <span class="k">echo</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">__</span><span class="p">(</span><span class="s1">&#39;Add to wishlist&#39;</span><span class="p">)</span> <span class="cp">?&gt;</span><span class="x">&quot;&gt;&lt;/a&gt;</span> </span></pre></div> </td></tr></table>
magento

PHP

Magento category output

1
2
3
4
<?php $_productCollection=$this->getLoadedProductCollection() ?>
 <?php foreach ($_productCollection as $_product): ?>
       //neki code
 <?php endforeach; ?>
https://snipt.net/embed/7d3e2af2c9a34b6861746f6a33939ad9/
/raw/7d3e2af2c9a34b6861746f6a33939ad9/
7d3e2af2c9a34b6861746f6a33939ad9
php
PHP
4
2019-06-25T08:40:10
True
False
False
Nov 05, 2013 at 07:09 AM
/api/public/snipt/91914/
magento-category-output
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="cp">&lt;?php</span> <span class="nv">$_productCollection</span><span class="o">=</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getLoadedProductCollection</span><span class="p">()</span> <span class="cp">?&gt;</span><span class="x"></span> </span><span id="L-2"><a name="L-2"></a><span class="x"> </span><span class="cp">&lt;?php</span> <span class="k">foreach</span> <span class="p">(</span><span class="nv">$_productCollection</span> <span class="k">as</span> <span class="nv">$_product</span><span class="p">)</span><span class="o">:</span> <span class="cp">?&gt;</span><span class="x"></span> </span><span id="L-3"><a name="L-3"></a><span class="x"> //neki code</span> </span><span id="L-4"><a name="L-4"></a><span class="x"> </span><span class="cp">&lt;?php</span> <span class="k">endforeach</span><span class="p">;</span> <span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
magento

PHP

Magento price formation

1
2
3
4
5
<?php echo  Mage::helper('core')->currency($cijena, true, false);?>

[11/5/13 1:05:29 PM] Sebastijan Placento: umjesto $cijena stavis recimo $_product->getPrice()
[11/5/13 1:05:41 PM] Sebastijan Placento: on ti odma napravi 102.57kn
[11/5/13 1:05:56 PM] Sebastijan Placento: ovisno o valuti na trenutnom shopu tj. viewu
https://snipt.net/embed/cbed18ae1682640f7b138c519c21481a/
/raw/cbed18ae1682640f7b138c519c21481a/
cbed18ae1682640f7b138c519c21481a
php
PHP
5
2019-06-25T08:40:15
True
False
False
/api/public/snipt/91913/
magento-price-formation
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="cp">&lt;?php</span> <span class="k">echo</span> <span class="nx">Mage</span><span class="o">::</span><span class="na">helper</span><span class="p">(</span><span class="s1">&#39;core&#39;</span><span class="p">)</span><span class="o">-&gt;</span><span class="na">currency</span><span class="p">(</span><span class="nv">$cijena</span><span class="p">,</span> <span class="k">true</span><span class="p">,</span> <span class="k">false</span><span class="p">);</span><span class="cp">?&gt;</span><span class="x"></span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="x">[11/5/13 1:05:29 PM] Sebastijan Placento: umjesto $cijena stavis recimo $_product-&gt;getPrice()</span> </span><span id="L-4"><a name="L-4"></a><span class="x">[11/5/13 1:05:41 PM] Sebastijan Placento: on ti odma napravi 102.57kn</span> </span><span id="L-5"><a name="L-5"></a><span class="x">[11/5/13 1:05:56 PM] Sebastijan Placento: ovisno o valuti na trenutnom shopu tj. viewu</span> </span></pre></div> </td></tr></table>
magento