Skip to main content
added 268 characters in body
Source Link
Amit Bera
  • 77.7k
  • 20
  • 124
  • 239
<?php

$_helper = $this->helper('catalog/output'); if (!is_null($this->getProductCollection())) { ?>

<div class="owl-carousel owl-theme" id="carousel_favorite">
    <?php
    $i$_helper = 0;
    foreach ($this->getProductCollection>helper() as $product'catalog/output'):
        ?>;
        <?php if ($product!is_null($this->isSaleable>getProductCollection())) { ?>
            <div class="item">?>

                <?php $_imgSize = 278; ?>
                <div class="product-image">
                    <div class="selection">Coup de cœur #</div>
                    <a href="<?php echo $product->getProductUrl() ?>" >
                        <img class="gondole" id="product-collection-image-<?php echo $product->getId(); ?>"
                             src="<?php echo $this->helper('catalog/image')->init($product, 'small_image')class="owl->resize($_imgSize); ?>"
                             alt="<?php echocarousel $this->stripTags($thisowl->getImageLabel($product, 'small_image'), null, true) ?>" width="<?php echo $_imgSize; ?>" />                        </a>
                    </a>
                </div>
                <divtheme" class="product-info">id="carousel_favorite">
                    <?php
                    echo $this->getChild('favorite_carousel_price')->getPriceHtml($product);
                    ?>
                    <div class="social"><span><span class="icon icon-sharing"></span></span>
                        <br />
                        <ul class="sharing-links">
                            <?php  $_productName$i = urlencode(trim($_helper->productAttribute($product, $product->getName(), 'name'))) ?>0;
                            <?php  $_productImageUrl =foreach urlencode(trim($this->helper('catalog/image')->init($product, 'image'))) ?>
                            <?php $_productUrl = urlencode(trim($product->getProductUrl>getProductCollection())) ?>
                            <li>
                                <?php $_u = 'p[url]=' . $_productUrl . '&p[images][0]=' . $_productImageUrl . '&p[title]=' . $_productName . '&p[summary]=' . urlencode(trim($_helper->productAttribute($_product,as nl2br($product->getShortDescription()), 'short_description'))); ?>
                                <a href="<?php echo 'http://www.facebook.com/sharer.php?s=100&' . $_u; ?>" target="_blank" title="<?php echo $this->__('Share on Facebook') ?>" class="link-facebook">
                                    <?php echo $this->__('Share Facebook') ?>
                                </a>
                            </li>
                            <li>
                                <a href="<?php echo 'http://twitter.com/home?status=' . $_productName . '+' . $_productUrl; ?>" target="_blank" title="<?php echo $this->__('Share on Twitter') ?>" class="link-twitter"><?php echo $this->__('Share on Twitter') ?></a>
                            </li>
                            <li>    
                                <a href="<?php echo 'https://pinterest.com/pin/create/button/?url=' . $_productUrl . '&media=' . $_productImageUrl . '&description=' . $_productName; ?>" target="_blank" title="<?php echoif $this->__('Share on Pinterest') ?>" class="link-pinterest"><?php echo $this$product->__>isSaleable('Share on Pinterest') ?></a>
                            </li>
                            <li>
                                <a href="<?php echo 'https://plus.google.com/share?url=' . $_productUrl; ?>" target="_blank" title="<?php echo $this->__('Share on Google+') ?>" class="link-googleplus"><?php echo $this->__('Share on Google+'){ ?></a>
                            </li>>
                       <div </ul>class="item">

                    <?php $_imgSize = 278; ?>
                    <div class="product-image">
                        <div class="selection">Coup de cœur #</div>
                        <a href="<?php echo $product->getProductUrl() ?>" >
                            <img class="gondole" id="product-collection-image-<?php echo $product->getId(); ?>"
                                 src="<?php echo $this->helper('catalog/image')->init($product, 'small_image')->resize($_imgSize); ?>"
                                 alt="<?php echo $this->stripTags($this->getImageLabel($product, 'small_image'), null, true) ?>" width="<?php echo $_imgSize; ?>" />                        </a>
                        </a>
                    </div>
                    <div class="product-info">
                        <?php
                        echo $this->getChild('favorite_carousel_price')->getPriceHtml($product);
                        ?>
                        <div class="social"><span><span class="icon icon-sharing"></div>span></span>
                            <br />
                            <ul class="sharing-links">
                                <?php  $_productName = urlencode(trim($_helper->productAttribute($product, $product->getName(), 'name'))) ?>
                                <?php  $_productImageUrl = urlencode(trim($this->helper('catalog/image')->init($product, 'image'))) ?>
                                <?php $_productUrl = urlencode(trim($product->getProductUrl())) ?>
                                <li>
                                    <?php $_u = 'p[url]=' . $_productUrl . '&p[images][0]=' . $_productImageUrl . '&p[title]=' . $_productName . '&p[summary]=' . urlencode(trim($_helper->productAttribute($_product, nl2br($product->getShortDescription()), 'short_description'))); ?>
                                    <a href="<?php echo 'http://www.facebook.com/sharer.php?s=100&' . $_u; ?>" target="_blank" title="<?php echo $this->__('Share on Facebook') ?>" class="link-facebook">
                                        <?php echo $this->__('Share Facebook') ?>
                                    </a>
                                </li>
                                <li>
                                    <a href="<?php echo 'http://twitter.com/home?status=' . $_productName . '+' . $_productUrl; ?>" target="_blank" title="<?php echo $this->__('Share on Twitter') ?>" class="link-twitter"><?php echo $this->__('Share on Twitter') ?></a>
                                </li>
                                <li>    
                                    <a href="<?php echo 'https://pinterest.com/pin/create/button/?url=' . $_productUrl . '&media=' . $_productImageUrl . '&description=' . $_productName; ?>" target="_blank" title="<?php echo $this->__('Share on Pinterest') ?>" class="link-pinterest"><?php echo $this->__('Share on Pinterest') ?></a>
                                </li>
                                <li>
                                    <a href="<?php echo 'https://plus.google.com/share?url=' . $_productUrl; ?>" target="_blank" title="<?php echo $this->__('Share on Google+') ?>" class="link-googleplus"><?php echo $this->__('Share on Google+') ?></a>
                                </li>
                            </ul>

                        </div>
        <?php } ?>
    <?php endforeach; ?>
    </div>

                </div>
            <?php } ?>
        <?php endforeach; ?>
    </div>

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="<?php echo $this->getSkinUrl('owlcarousel/js/owl.carousel.min.js'); ?>"></script>
    <script type="text/javascript">
        var toto = jQuery.noConflict();
        toto(window).load(function () {
            toto('#carousel_favorite').owlCarousel({autoPlay: true, navigation: true, slideSpeed: 300, paginationSpeed: 400, singleItem: true});
        });
    </script>
    <?php
}

}

<?php

$_helper = $this->helper('catalog/output'); if (!is_null($this->getProductCollection())) { ?>

<div class="owl-carousel owl-theme" id="carousel_favorite">
    <?php
    $i = 0;
    foreach ($this->getProductCollection() as $product):
        ?>
        <?php if ($product->isSaleable()) { ?>
            <div class="item">

                <?php $_imgSize = 278; ?>
                <div class="product-image">
                    <div class="selection">Coup de cœur #</div>
                    <a href="<?php echo $product->getProductUrl() ?>" >
                        <img class="gondole" id="product-collection-image-<?php echo $product->getId(); ?>"
                             src="<?php echo $this->helper('catalog/image')->init($product, 'small_image')->resize($_imgSize); ?>"
                             alt="<?php echo $this->stripTags($this->getImageLabel($product, 'small_image'), null, true) ?>" width="<?php echo $_imgSize; ?>" />                        </a>
                    </a>
                </div>
                <div class="product-info">
                    <?php
                    echo $this->getChild('favorite_carousel_price')->getPriceHtml($product);
                    ?>
                    <div class="social"><span><span class="icon icon-sharing"></span></span>
                        <br />
                        <ul class="sharing-links">
                            <?php  $_productName = urlencode(trim($_helper->productAttribute($product, $product->getName(), 'name'))) ?>
                            <?php  $_productImageUrl = urlencode(trim($this->helper('catalog/image')->init($product, 'image'))) ?>
                            <?php $_productUrl = urlencode(trim($product->getProductUrl())) ?>
                            <li>
                                <?php $_u = 'p[url]=' . $_productUrl . '&p[images][0]=' . $_productImageUrl . '&p[title]=' . $_productName . '&p[summary]=' . urlencode(trim($_helper->productAttribute($_product, nl2br($product->getShortDescription()), 'short_description'))); ?>
                                <a href="<?php echo 'http://www.facebook.com/sharer.php?s=100&' . $_u; ?>" target="_blank" title="<?php echo $this->__('Share on Facebook') ?>" class="link-facebook">
                                    <?php echo $this->__('Share Facebook') ?>
                                </a>
                            </li>
                            <li>
                                <a href="<?php echo 'http://twitter.com/home?status=' . $_productName . '+' . $_productUrl; ?>" target="_blank" title="<?php echo $this->__('Share on Twitter') ?>" class="link-twitter"><?php echo $this->__('Share on Twitter') ?></a>
                            </li>
                            <li>    
                                <a href="<?php echo 'https://pinterest.com/pin/create/button/?url=' . $_productUrl . '&media=' . $_productImageUrl . '&description=' . $_productName; ?>" target="_blank" title="<?php echo $this->__('Share on Pinterest') ?>" class="link-pinterest"><?php echo $this->__('Share on Pinterest') ?></a>
                            </li>
                            <li>
                                <a href="<?php echo 'https://plus.google.com/share?url=' . $_productUrl; ?>" target="_blank" title="<?php echo $this->__('Share on Google+') ?>" class="link-googleplus"><?php echo $this->__('Share on Google+') ?></a>
                            </li>
                        </ul>

                    </div>
                </div>

            </div>
        <?php } ?>
    <?php endforeach; ?>
</div>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo $this->getSkinUrl('owlcarousel/js/owl.carousel.min.js'); ?>"></script>
<script type="text/javascript">
    var toto = jQuery.noConflict();
    toto(window).load(function () {
        toto('#carousel_favorite').owlCarousel({autoPlay: true, navigation: true, slideSpeed: 300, paginationSpeed: 400, singleItem: true});
    });
</script>
<?php

}

    <?php
$_helper = $this->helper('catalog/output');
if (!is_null($this->getProductCollection())) {
    ?>

    <div class="owl-carousel owl-theme" id="carousel_favorite">
        <?php
        $i = 0;
        foreach ($this->getProductCollection() as $product):
            ?>
            <?php if ($product->isSaleable()) { ?>
                <div class="item">

                    <?php $_imgSize = 278; ?>
                    <div class="product-image">
                        <div class="selection">Coup de cœur #</div>
                        <a href="<?php echo $product->getProductUrl() ?>" >
                            <img class="gondole" id="product-collection-image-<?php echo $product->getId(); ?>"
                                 src="<?php echo $this->helper('catalog/image')->init($product, 'small_image')->resize($_imgSize); ?>"
                                 alt="<?php echo $this->stripTags($this->getImageLabel($product, 'small_image'), null, true) ?>" width="<?php echo $_imgSize; ?>" />                        </a>
                        </a>
                    </div>
                    <div class="product-info">
                        <?php
                        echo $this->getChild('favorite_carousel_price')->getPriceHtml($product);
                        ?>
                        <div class="social"><span><span class="icon icon-sharing"></span></span>
                            <br />
                            <ul class="sharing-links">
                                <?php  $_productName = urlencode(trim($_helper->productAttribute($product, $product->getName(), 'name'))) ?>
                                <?php  $_productImageUrl = urlencode(trim($this->helper('catalog/image')->init($product, 'image'))) ?>
                                <?php $_productUrl = urlencode(trim($product->getProductUrl())) ?>
                                <li>
                                    <?php $_u = 'p[url]=' . $_productUrl . '&p[images][0]=' . $_productImageUrl . '&p[title]=' . $_productName . '&p[summary]=' . urlencode(trim($_helper->productAttribute($_product, nl2br($product->getShortDescription()), 'short_description'))); ?>
                                    <a href="<?php echo 'http://www.facebook.com/sharer.php?s=100&' . $_u; ?>" target="_blank" title="<?php echo $this->__('Share on Facebook') ?>" class="link-facebook">
                                        <?php echo $this->__('Share Facebook') ?>
                                    </a>
                                </li>
                                <li>
                                    <a href="<?php echo 'http://twitter.com/home?status=' . $_productName . '+' . $_productUrl; ?>" target="_blank" title="<?php echo $this->__('Share on Twitter') ?>" class="link-twitter"><?php echo $this->__('Share on Twitter') ?></a>
                                </li>
                                <li>    
                                    <a href="<?php echo 'https://pinterest.com/pin/create/button/?url=' . $_productUrl . '&media=' . $_productImageUrl . '&description=' . $_productName; ?>" target="_blank" title="<?php echo $this->__('Share on Pinterest') ?>" class="link-pinterest"><?php echo $this->__('Share on Pinterest') ?></a>
                                </li>
                                <li>
                                    <a href="<?php echo 'https://plus.google.com/share?url=' . $_productUrl; ?>" target="_blank" title="<?php echo $this->__('Share on Google+') ?>" class="link-googleplus"><?php echo $this->__('Share on Google+') ?></a>
                                </li>
                            </ul>

                        </div>
                    </div>

                </div>
            <?php } ?>
        <?php endforeach; ?>
    </div>

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="<?php echo $this->getSkinUrl('owlcarousel/js/owl.carousel.min.js'); ?>"></script>
    <script type="text/javascript">
        var toto = jQuery.noConflict();
        toto(window).load(function () {
            toto('#carousel_favorite').owlCarousel({autoPlay: true, navigation: true, slideSpeed: 300, paginationSpeed: 400, singleItem: true});
        });
    </script>
    <?php
}
Source Link

Get Image URL in a category for a carousel

I already work on a carousel in category for product push_ahead. On the carousel i want to display share button. But it's still not work and i doesn't want to use any module for that.

In a second way i wanted to know how can i short the link for example on twitter with bitly ? Without using any module ?

So here my code :

<?php

$_helper = $this->helper('catalog/output'); if (!is_null($this->getProductCollection())) { ?>

<div class="owl-carousel owl-theme" id="carousel_favorite">
    <?php
    $i = 0;
    foreach ($this->getProductCollection() as $product):
        ?>
        <?php if ($product->isSaleable()) { ?>
            <div class="item">

                <?php $_imgSize = 278; ?>
                <div class="product-image">
                    <div class="selection">Coup de cœur #</div>
                    <a href="<?php echo $product->getProductUrl() ?>" >
                        <img class="gondole" id="product-collection-image-<?php echo $product->getId(); ?>"
                             src="<?php echo $this->helper('catalog/image')->init($product, 'small_image')->resize($_imgSize); ?>"
                             alt="<?php echo $this->stripTags($this->getImageLabel($product, 'small_image'), null, true) ?>" width="<?php echo $_imgSize; ?>" />                        </a>
                    </a>
                </div>
                <div class="product-info">
                    <?php
                    echo $this->getChild('favorite_carousel_price')->getPriceHtml($product);
                    ?>
                    <div class="social"><span><span class="icon icon-sharing"></span></span>
                        <br />
                        <ul class="sharing-links">
                            <?php  $_productName = urlencode(trim($_helper->productAttribute($product, $product->getName(), 'name'))) ?>
                            <?php  $_productImageUrl = urlencode(trim($this->helper('catalog/image')->init($product, 'image'))) ?>
                            <?php $_productUrl = urlencode(trim($product->getProductUrl())) ?>
                            <li>
                                <?php $_u = 'p[url]=' . $_productUrl . '&p[images][0]=' . $_productImageUrl . '&p[title]=' . $_productName . '&p[summary]=' . urlencode(trim($_helper->productAttribute($_product, nl2br($product->getShortDescription()), 'short_description'))); ?>
                                <a href="<?php echo 'http://www.facebook.com/sharer.php?s=100&' . $_u; ?>" target="_blank" title="<?php echo $this->__('Share on Facebook') ?>" class="link-facebook">
                                    <?php echo $this->__('Share Facebook') ?>
                                </a>
                            </li>
                            <li>
                                <a href="<?php echo 'http://twitter.com/home?status=' . $_productName . '+' . $_productUrl; ?>" target="_blank" title="<?php echo $this->__('Share on Twitter') ?>" class="link-twitter"><?php echo $this->__('Share on Twitter') ?></a>
                            </li>
                            <li>    
                                <a href="<?php echo 'https://pinterest.com/pin/create/button/?url=' . $_productUrl . '&media=' . $_productImageUrl . '&description=' . $_productName; ?>" target="_blank" title="<?php echo $this->__('Share on Pinterest') ?>" class="link-pinterest"><?php echo $this->__('Share on Pinterest') ?></a>
                            </li>
                            <li>
                                <a href="<?php echo 'https://plus.google.com/share?url=' . $_productUrl; ?>" target="_blank" title="<?php echo $this->__('Share on Google+') ?>" class="link-googleplus"><?php echo $this->__('Share on Google+') ?></a>
                            </li>
                        </ul>

                    </div>
                </div>

            </div>
        <?php } ?>
    <?php endforeach; ?>
</div>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo $this->getSkinUrl('owlcarousel/js/owl.carousel.min.js'); ?>"></script>
<script type="text/javascript">
    var toto = jQuery.noConflict();
    toto(window).load(function () {
        toto('#carousel_favorite').owlCarousel({autoPlay: true, navigation: true, slideSpeed: 300, paginationSpeed: 400, singleItem: true});
    });
</script>
<?php

}