Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- public function getImageUrl($product)
- {
- $storeId = Mage::app()->getStore()->getId();
- $sku = Mage::getResourceModel('catalog/product')->getAttributeRawValue($product->geId(), 'sku', $storeId);
- $asin = substr($sku,0,10);
- if ($sku != null) {
- $asin = $product->getAsin();
- }
- return "http://productimages.bundles.com/images/$asin.jpg";
- }
- else
- {
- return echo error;
- }?>
- <?php
- /**
- * @var Bundle_LocalHelpers_Helper_Basic $localHelper
- */
- $localHelper = Mage::helper('localhelper/basic');
- ?>
- <div id="owl-demo" class="owl-carousel">
- <?php
- $categoryId = 2; // this is the category holding your products
- $products = Mage::getSingleton('catalog/category')->load($categoryId) // load the category
- ->getProductCollection() // and the products
- ->addAttributeToSelect('image'); // tell Magento which attributes to get
- foreach ($products as $product) { // iterate through the entire collection
- echo '<div class="item"><img src="'.$localHelper->getImageUrl($product);.'"></div>'; // print the image url inside of the required Owl markup
- }
- ?>
- </div>
- <script>
- jQuery.noConflict();
- jQuery(document).ready(function() {
- jQuery("#owl-demo").owlCarousel({
- items : 4,
- lazyLoad : true,
- navigation : true
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement