public function build($params = null) { $products = parent::getCall('getAPI', 'magebridge_product.list', modMageBridgeProductsHelper::getArguments($params)); if (!empty($products)) { foreach ($products as $index => $product) { // Use the URL-key to build a URL if (!empty($product['url_store'])) { $product['url'] = MageBridgeUrlHelper::route($product['url_store']); } elseif (!empty($product['url_path'])) { $product['url'] = MageBridgeUrlHelper::route($product['url_path']); } elseif (empty($product['url'])) { $product['url'] = MageBridgeUrlHelper::route($product['url_key']); } $product['addtocart_url'] = MageBridgeUrlHelper::route('checkout/cart/add/product/' . $product['product_id'] . '/'); // Create labels $product['addtocart_label'] = JText::sprintf($params->get('addtocart', 'MOD_MAGEBRIDGE_PRODUCTS_ADDTOCART'), $product['label']); $product['addtocart_text'] = JText::sprintf($params->get('addtocart', 'MOD_MAGEBRIDGE_PRODUCTS_ADDTOCART'), $product['name']); $product['readmore_label'] = JText::sprintf($params->get('readmore', 'MOD_MAGEBRIDGE_PRODUCTS_READMORE'), $product['label']); $product['readmore_text'] = JText::sprintf($params->get('readmore', 'MOD_MAGEBRIDGE_PRODUCTS_READMORE'), $product['name']); // Remove the current product from the list if (JURI::getInstance()->toString(array('path')) == $product['url']) { unset($products[$index]); continue; } $products[$index] = $product; } } return $products; }
/** * Joomla! module MageBridge: Products block * * @author Yireo (info@yireo.com) * @package MageBridge * @copyright Copyright 2012 * @license GNU Public License * @link http://www.yireo.com */ // No direct access defined('_JEXEC') or die('Restricted access'); // Read the parameters $layout = $params->get('layout', 'default'); // Call the helper require_once dirname(__FILE__) . '/helper.php'; $products = modMageBridgeProductsHelper::build($params); // Add CSS and JavaScript $templateHelper = new MageBridgeTemplateHelper(); if ($layout == 'slideshow') { if ($params->get('load_slideshow_jquery', 1) == 1) { $templateHelper->load('jquery'); } if ($params->get('load_slideshow_jquery_easing', 1) == 1) { $templateHelper->load('jquery-easing'); } if ($params->get('load_slideshow_jquery_cycle', 1) == 1) { $templateHelper->load('js', 'jquery/jquery.cycle.all.min.js'); } if ($params->get('load_slideshow_css', 1) == 1) { $templateHelper->load('css', 'mod-products-slideshow.css'); }