Skip to content

Instantly share code, notes, and snippets.

View zeljkoprsa's full-sized avatar

Željko Prša zeljkoprsa

View GitHub Profile
@zeljkoprsa
zeljkoprsa / wanelo-button
Last active December 22, 2015 21:59
Wanelo button for Magento product page.
<div id="wanelo-button">
<a class="wanelo-save-button"
href="<?php echo $home_url; ?>"
data-url="<?php echo $this->helper('core/url')->getCurrentUrl();?>"
data-title="<?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?>"
data-image="<?php echo $_product->getImageUrl(); ?>"
data-price="<?php echo number_format($_product->getFinalPrice(),2);?>"></a>
<script async="true" type="text/javascript" src="//cdn-saveit.wanelo.com/bookmarklet/3/save.js></script>
</div>
# Install linux update, followed by GCC and Make
sudo yum -y update
sudo yum install -y gcc make
# Install Nginx and PHP-FPM
sudo yum install -y nginx php-fpm
# Install PHP extensions
sudo yum install -y php-devel php-mysql php-pdo \
php-pear php-mbstring php-cli php-odbc \
@zeljkoprsa
zeljkoprsa / magento-canonical
Last active December 20, 2015 12:19
XML code that updates rel canonical for a single product in Magento. You should read this article for more detailed info: http://www.adurolabs.com/blog/technical/how-to-add-rel-canonical-in-magento #RTFM
<reference name="head">
<action method="addLinkRel">
<rel>canonical</rel>
<href>http://awesome.site.com/your-main-product</href>
</action>
</reference>
<?php $_product->getResource()->getTypeId(); ?>
<?php if($_product->getTypeId() == "simple"): ?> Simple <?php endif; ?>
<?php if($_product->getTypeId() == "grouped"): ?> Grouped <?php endif; ?>;
<?php if($_product->getTypeId() == "configurable"): ?> Configurable <?php endif; ?>
<?php if($_product->getTypeId() == "bundle"): ?> bundle <?php endif; ?>
@zeljkoprsa
zeljkoprsa / clear-input.js
Created September 26, 2012 18:40
Input value clear using JavaScript
<input type="text" value="[email protected]" name="email" id="email"
onblur="if (this.value == '') {this.value = '[email protected]';}"
onfocus="if (this.value == '[email protected]') {this.value = '';}" />
@zeljkoprsa
zeljkoprsa / short-description-stripped.phtml
Created March 30, 2012 10:54
Short description stripped
<?php $_shortDescriptionStripped = $this->stripTags($_product->getShortDescription(), null , true); ?>
<?php echo Mage::helper('core/string')->truncate($_shortDescriptionStripped, '280') ?>
@zeljkoprsa
zeljkoprsa / remove_links.xml
Created March 27, 2012 07:10
Add to local.xml bp
@zeljkoprsa
zeljkoprsa / new-products.xml
Created March 2, 2012 13:35
List New Products with toolbar (Grid/List, pagiantion the whole shebang )
<reference name="content">
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
<action method="setCategoryId"><category_id>8</category_id></action>
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
<block type="page/html_pager" name="product_list_toolbar_pager"/>
</block>
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
</block>
</reference>
@zeljkoprsa
zeljkoprsa / magento-category-navigation.phtml
Created February 18, 2011 12:42
Magento Category tree navigation
<?php
$categories = Mage::getModel('catalog/category')->load(1)->getChildren();
$categoryIDs = explode(',',$categories);
?>
<ul>
<?php foreach($categoryIDs as $categoryID): ?>
<li>
<?php $category = Mage::getModel('catalog/category')->load($categoryID);?>
<a href="<?php echo $category->getUrl()?>">
<?php echo $category->getName()?>