snipt

Ctrl+h for KB shortcuts

PHP

Load thumbnails in main image area in Magento

            <a href="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()); ?>" title="<?php echo $_product->getName();?>" onclick="$('image').src = this.href; return false;">
https://snipt.net/embed/fd28f1d90c26508a3c26719fa2cb0da1/
/raw/fd28f1d90c26508a3c26719fa2cb0da1/
fd28f1d90c26508a3c26719fa2cb0da1
php
PHP
2
2019-06-10T14:33:24
True
False
False
/api/public/snipt/19446/
load-thumbnails-in-main-image-area-in-magento
<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><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/image&#39;</span><span class="p">)</span><span class="o">-&gt;</span><span class="na">init</span><span class="p">(</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getProduct</span><span class="p">(),</span> <span class="s1">&#39;image&#39;</span><span class="p">,</span> <span class="nv">$_image</span><span class="o">-&gt;</span><span class="na">getFile</span><span class="p">());</span> <span class="cp">?&gt;</span><span class="x">&quot; title=&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">getName</span><span class="p">();</span><span class="cp">?&gt;</span><span class="x">&quot; onclick=&quot;$(&#39;image&#39;).src = this.href; return false;&quot;&gt;</span> </span></pre></div> </td></tr></table>
magento

PHP

Add sku to Product page in magento

<?php echo $this->htmlEscape($_product->getSku()) ?>
https://snipt.net/embed/363f4c34f686cd8b8f0ec3ab624ff034/
/raw/363f4c34f686cd8b8f0ec3ab624ff034/
363f4c34f686cd8b8f0ec3ab624ff034
php
PHP
1
2019-06-12T23:50:02
True
False
False
/api/public/snipt/19256/
add-sku-to-product-page-in-magento
<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><span class="cp">&lt;?php</span> <span class="k">echo</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">htmlEscape</span><span class="p">(</span><span class="nv">$_product</span><span class="o">-&gt;</span><span class="na">getSku</span><span class="p">())</span> <span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
magento

PHP

Quick and dirty Cart total

1
2
3
<?php $cart_count = Mage::getSingleton('checkout/cart')->getSummaryQty(); ?> 
    	
    	<?php if($cart_count == 0) echo '0'; else echo $cart_count; ?> items in your cart
https://snipt.net/embed/6cf9fdcc79eb4e1d8a5f2a7968e9292d/
/raw/6cf9fdcc79eb4e1d8a5f2a7968e9292d/
6cf9fdcc79eb4e1d8a5f2a7968e9292d
php
PHP
3
2019-06-08T23:16:41
True
False
False
/api/public/snipt/18780/
quick-and-dirty-cart-total
<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="cp">&lt;?php</span> <span class="nv">$cart_count</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;checkout/cart&#39;</span><span class="p">)</span><span class="o">-&gt;</span><span class="na">getSummaryQty</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><span id="L-3"><a name="L-3"></a><span class="x"> </span><span class="cp">&lt;?php</span> <span class="k">if</span><span class="p">(</span><span class="nv">$cart_count</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span> <span class="k">echo</span> <span class="s1">&#39;0&#39;</span><span class="p">;</span> <span class="k">else</span> <span class="k">echo</span> <span class="nv">$cart_count</span><span class="p">;</span> <span class="cp">?&gt;</span><span class="x"> items in your cart</span> </span></pre></div> </td></tr></table>
magento