snipt

Ctrl+h for KB shortcuts

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-05-24T05:08:43
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-05-22T09:23:19
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-09T12:40:30
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

SQL

Exclude all base images from gallery

1
2
3
UPDATE mag_catalog_product_entity_media_gallery_value 
SET disabled = 1 
WHERE position = 1
https://snipt.net/embed/654c489e8fcb2bceb2e10260d6f94c10/
/raw/654c489e8fcb2bceb2e10260d6f94c10/
654c489e8fcb2bceb2e10260d6f94c10
sql
SQL
3
2019-06-08T06:05:30
True
False
False
Jul 21, 2013 at 02:39 AM
/api/public/snipt/68838/
exclude-all-base-images-from-gallery
<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="k">UPDATE</span> <span class="n">mag_catalog_product_entity_media_gallery_value</span> </span><span id="L-2"><a name="L-2"></a><span class="k">SET</span> <span class="n">disabled</span> <span class="o">=</span> <span class="mi">1</span> </span><span id="L-3"><a name="L-3"></a><span class="k">WHERE</span> <span class="k">position</span> <span class="o">=</span> <span class="mi">1</span> </span></pre></div> </td></tr></table>
"base image", exclude, gallery, magento

Text only

Magento: Edit TinyMCE CSS

1
2
3
4
Edit this file:
MY_PROJECT\js\mage\adminhtml\wysiwyg\tiny_mce\themes\advanced\skins\default\content.css

Or try to make it the right way: http://magebase.com/magento-tutorials/adding-custom-css-and-custom-style-options-to-the-wysiwyg-editor/ (didn't try...)
https://snipt.net/embed/508ad356e9125c9fb8df5e19d3fa78b1/
/raw/508ad356e9125c9fb8df5e19d3fa78b1/
508ad356e9125c9fb8df5e19d3fa78b1
text
Text only
4
2019-03-14T11:49:09
True
False
True
Apr 29, 2013 at 06:20 AM
/api/public/snipt/60247/
magento-edit-tinymce-css
<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>Edit this file: </span><span id="L-2"><a name="L-2"></a>MY_PROJECT\js\mage\adminhtml\wysiwyg\tiny_mce\themes\advanced\skins\default\content.css </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a>Or try to make it the right way: http://magebase.com/magento-tutorials/adding-custom-css-and-custom-style-options-to-the-wysiwyg-editor/ (didn&#39;t try...) </span></pre></div> </td></tr></table>
css, magento, tinymce, wysiwyg

Text only

Displaying Magento custom product attributes on the frontend

1
2
3
Displaying Magento custom product attributes on the frontend

<?php echo $_product->getAttributeText('theme_color')  ?>
https://snipt.net/embed/c69f6109f7bdf8f3cbd2676b75b70a2a/
/raw/c69f6109f7bdf8f3cbd2676b75b70a2a/
c69f6109f7bdf8f3cbd2676b75b70a2a
text
Text only
3
2019-06-04T13:22:23
True
False
False
/api/public/snipt/27970/
displaying-magento-custom-product-attributes-on-the-frontend
<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>Displaying Magento custom product attributes on the frontend </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>&lt;?php echo $_product-&gt;getAttributeText(&#39;theme_color&#39;) ?&gt; </span></pre></div> </td></tr></table>
magento