Exemple #1
0
 /**
  * Override template if available in record
  *
  * @param array $arrData The data record
  *
  * @return $this The model object
  */
 public function setRow(array $arrData)
 {
     if ($arrData['customTpl'] != '' && TL_MODE == 'FE') {
         $this->strTemplate = $arrData['customTpl'];
     }
     return parent::setRow($arrData);
 }
 public function showJsLibraryHint()
 {
     if ('edit' === \Input::get('act')) {
         $gallery = Gallery::findByPk(\Input::get('id'));
         if (null !== $gallery && 'elevatezoom' === $gallery->type) {
             \Message::addInfo($GLOBALS['TL_LANG']['tl_iso_gallery']['includeJQuery']);
         }
     }
 }
 public function run($blnInstalled)
 {
     if ($blnInstalled && \Database::getInstance()->tableExists('tl_iso_gallery')) {
         $this->createDatabaseField('lightbox_template', 'tl_iso_gallery');
         $t = \Isotope\Model\Gallery::getTable();
         $this->objGaleries = \Isotope\Model\Gallery::findBy(array("{$t}.type='standard'", "{$t}.anchor='lightbox'", "lightbox_template IS NULL"), null);
         if (null !== $this->objGaleries) {
             $this->generate();
         }
     }
 }
Exemple #4
0
 public function run($blnInstalled)
 {
     if ($blnInstalled && \Database::getInstance()->tableExists('tl_iso_gallery')) {
         if (!\Database::getInstance()->fieldExists('lightbox_template', 'tl_iso_gallery')) {
             \Database::getInstance()->query("\n                    ALTER TABLE tl_iso_gallery\n                    ADD COLUMN `lightbox_template` blob NULL\n                ");
         }
         $t = \Isotope\Model\Gallery::getTable();
         $this->objGaleries = \Isotope\Model\Gallery::findBy(array("{$t}.type='standard'", "{$t}.anchor='lightbox'", "lightbox_template IS NULL"), null);
         if (null !== $this->objGaleries) {
             $this->generate();
         }
     }
 }
Exemple #5
0
$GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['email_text'] = array('uniqid', 'order_status', 'order_status_old', 'order_status_id', 'order_status_id_old', 'recipient_email', 'order_id', 'order_items', 'order_products', 'order_subtotal', 'order_total', 'document_number', 'cart_html', 'cart_text', 'document', 'billing_address', 'billing_address_*', 'shipping_address', 'shipping_address_*', 'form_*', 'payment_id', 'payment_label', 'payment_note', 'shipping_id', 'shipping_label', 'shipping_note', 'config_*', 'member_*');
$GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['email_subject'] =& $GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['email_text'];
$GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['email_html'] =& $GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['email_text'];
$GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['email_replyTo'] =& $GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['recipients'];
$GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['email_recipient_cc'] =& $GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['recipients'];
$GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['email_recipient_bcc'] =& $GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['recipients'];
/**
 * Models
 */
$GLOBALS['TL_MODELS'][\Isotope\Model\Address::getTable()] = 'Isotope\\Model\\Address';
$GLOBALS['TL_MODELS'][\Isotope\Model\Attribute::getTable()] = 'Isotope\\Model\\Attribute';
$GLOBALS['TL_MODELS'][\Isotope\Model\BasePrice::getTable()] = 'Isotope\\Model\\BasePrice';
$GLOBALS['TL_MODELS'][\Isotope\Model\Config::getTable()] = 'Isotope\\Model\\Config';
$GLOBALS['TL_MODELS'][\Isotope\Model\Document::getTable()] = 'Isotope\\Model\\Document';
$GLOBALS['TL_MODELS'][\Isotope\Model\Download::getTable()] = 'Isotope\\Model\\Download';
$GLOBALS['TL_MODELS'][\Isotope\Model\Gallery::getTable()] = 'Isotope\\Model\\Gallery';
$GLOBALS['TL_MODELS'][\Isotope\Model\Group::getTable()] = 'Isotope\\Model\\Group';
$GLOBALS['TL_MODELS'][\Isotope\Model\Label::getTable()] = 'Isotope\\Model\\Label';
$GLOBALS['TL_MODELS'][\Isotope\Model\OrderStatus::getTable()] = 'Isotope\\Model\\OrderStatus';
$GLOBALS['TL_MODELS'][\Isotope\Model\Payment::getTable()] = 'Isotope\\Model\\Payment';
$GLOBALS['TL_MODELS'][\Isotope\Model\Product::getTable()] = 'Isotope\\Model\\Product';
$GLOBALS['TL_MODELS'][\Isotope\Model\ProductCategory::getTable()] = 'Isotope\\Model\\ProductCategory';
$GLOBALS['TL_MODELS'][\Isotope\Model\ProductCollection::getTable()] = 'Isotope\\Model\\ProductCollection';
$GLOBALS['TL_MODELS'][\Isotope\Model\ProductCollectionDownload::getTable()] = 'Isotope\\Model\\ProductCollectionDownload';
$GLOBALS['TL_MODELS'][\Isotope\Model\ProductCollectionItem::getTable()] = 'Isotope\\Model\\ProductCollectionItem';
$GLOBALS['TL_MODELS'][\Isotope\Model\ProductCollectionSurcharge::getTable()] = 'Isotope\\Model\\ProductCollectionSurcharge';
$GLOBALS['TL_MODELS'][\Isotope\Model\ProductPrice::getTable()] = 'Isotope\\Model\\ProductPrice';
$GLOBALS['TL_MODELS'][\Isotope\Model\ProductCache::getTable()] = 'Isotope\\Model\\ProductCache';
$GLOBALS['TL_MODELS'][\Isotope\Model\ProductType::getTable()] = 'Isotope\\Model\\ProductType';
$GLOBALS['TL_MODELS'][\Isotope\Model\RelatedCategory::getTable()] = 'Isotope\\Model\\RelatedCategory';
$GLOBALS['TL_MODELS'][\Isotope\Model\RelatedProduct::getTable()] = 'Isotope\\Model\\RelatedProduct';
/**
 * Quick Product Content Element for Isotope eCommerce and Contao Open Source CMS
 *
 * Copyright (C) 2015 Rhyme.Digital
 *
 * @package    Isotope_Quickproducts
 * @link       http://rhyme.digital
 * @license    http://opensource.org/licenses/lgpl-3.0.html
 */
\Controller::loadDataContainer('tl_module');
\Controller::loadLanguageFile('tl_module');
/**
 * Palettes
 */
$GLOBALS['TL_DCA']['tl_content']['palettes']['isotope_quick'] = '{type_legend},type,headline;{include_legend},iso_products;{config_legend},iso_listingSortField,iso_listingSortDirection,iso_cols,iso_use_quantity,iso_buttons,iso_addProductJumpTo;{template_settings},iso_gallery,iso_list_layout;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space;{invisible_legend:hide},invisible,start,stop';
/**
 * Fields
 */
$GLOBALS['TL_DCA']['tl_content']['fields']['iso_products'] = array('label' => &$GLOBALS['TL_LANG']['tl_content']['iso_products'], 'exclude' => true, 'inputType' => 'tableLookup', 'sql' => "blob NULL", 'eval' => array('mandatory' => true, 'doNotSaveEmpty' => true, 'tl_class' => 'clr', 'foreignTable' => 'tl_iso_product', 'fieldType' => 'checkbox', 'listFields' => array('type' => "type", 'name', 'sku'), 'searchFields' => array('name', 'alias', 'sku', 'description'), 'sqlWhere' => 'pid=0', 'searchLabel' => 'Search products'));
$GLOBALS['TL_DCA']['tl_content']['fields']['iso_gallery'] = array('label' => &$GLOBALS['TL_LANG']['tl_content']['iso_gallery'], 'exclude' => true, 'inputType' => 'select', 'foreignKey' => \Isotope\Model\Gallery::getTable() . '.name', 'eval' => array('includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50'), 'sql' => "int(10) unsigned NOT NULL default '0'");
$GLOBALS['TL_DCA']['tl_content']['fields']['iso_list_layout'] = array('label' => &$GLOBALS['TL_LANG']['tl_content']['iso_list_layout'], 'exclude' => true, 'inputType' => 'select', 'options_callback' => function (\DataContainer $dc) {
    return \Isotope\Backend::getTemplates('iso_list_');
}, 'eval' => array('includeBlankOption' => true, 'tl_class' => 'w50', 'chosen' => true), 'sql' => "varchar(64) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_content']['fields']['iso_use_quantity'] = array('label' => &$GLOBALS['TL_LANG']['tl_content']['iso_use_quantity'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50'), 'sql' => "char(1) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_content']['fields']['iso_cols'] = array('label' => &$GLOBALS['TL_LANG']['tl_content']['iso_cols'], 'exclude' => true, 'default' => 1, 'inputType' => 'text', 'eval' => array('maxlength' => 1, 'rgxp' => 'digit', 'tl_class' => 'w50'), 'sql' => "int(1) unsigned NOT NULL default '1'");
$GLOBALS['TL_DCA']['tl_content']['fields']['iso_buttons'] = array('label' => &$GLOBALS['TL_LANG']['tl_content']['iso_buttons'], 'exclude' => true, 'inputType' => 'checkboxWizard', 'default' => array('add_to_cart'), 'options_callback' => array('Isotope\\Backend\\Module\\Callback', 'getButtons'), 'eval' => array('multiple' => true, 'tl_class' => 'clr'), 'sql' => "blob NULL");
$GLOBALS['TL_DCA']['tl_content']['fields']['iso_listingSortField'] = array('label' => &$GLOBALS['TL_LANG']['tl_content']['iso_listingSortField'], 'exclude' => true, 'inputType' => 'select', 'options_callback' => array('Isotope\\Backend\\Module\\Callback', 'getSortingFields'), 'eval' => array('includeBlankOption' => true, 'tl_class' => 'clr w50'), 'sql' => "varchar(255) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_content']['fields']['iso_listingSortDirection'] = array('label' => &$GLOBALS['TL_LANG']['tl_content']['iso_listingSortDirection'], 'exclude' => true, 'default' => 'DESC', 'inputType' => 'select', 'options' => array('DESC', 'ASC'), 'reference' => &$GLOBALS['TL_LANG']['tl_content']['sortingDirection'], 'eval' => array('tl_class' => 'w50'), 'sql' => "varchar(8) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_content']['fields']['iso_cart_jumpTo'] = array('label' => &$GLOBALS['TL_LANG']['tl_content']['iso_cart_jumpTo'], 'exclude' => true, 'inputType' => 'pageTree', 'foreignKey' => 'tl_page.title', 'eval' => array('fieldType' => 'radio', 'tl_class' => 'clr'), 'explanation' => 'jumpTo', 'sql' => "int(10) unsigned NOT NULL default '0'", 'relation' => array('type' => 'hasOne', 'load' => 'lazy'));
$GLOBALS['TL_DCA']['tl_content']['fields']['iso_addProductJumpTo'] = $GLOBALS['TL_DCA']['tl_module']['fields']['iso_addProductJumpTo'];
Exemple #7
0
<?php

/**
 * Isotope eCommerce for Contao Open Source CMS
 *
 * Copyright (C) 2009-2014 terminal42 gmbh & Isotope eCommerce Workgroup
 *
 * @package    Isotope
 * @link       http://isotopeecommerce.org
 * @license    http://opensource.org/licenses/lgpl-3.0.html
 */
/**
 * Table tl_iso_gallery
 */
$GLOBALS['TL_DCA']['tl_iso_gallery'] = array('config' => array('dataContainer' => 'Table', 'enableVersioning' => true, 'closed' => true, 'onload_callback' => array(array('Isotope\\Backend', 'initializeSetupModule')), 'sql' => array('keys' => array('id' => 'primary'))), 'list' => array('sorting' => array('mode' => 1, 'flag' => 1, 'fields' => array('name'), 'panelLayout' => 'filter;search,limit'), 'label' => array('fields' => array('name', 'type'), 'format' => '%s <span style="color:#b3b3b3; padding-left:3px;">[%s]</span>'), 'global_operations' => array('back' => array('label' => &$GLOBALS['TL_LANG']['MSC']['backBT'], 'href' => 'mod=&table=', 'class' => 'header_back', 'attributes' => 'onclick="Backend.getScrollOffset();"'), 'new' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_gallery']['new'], 'href' => 'act=create', 'class' => 'header_new', 'attributes' => 'onclick="Backend.getScrollOffset();"'), 'all' => array('label' => &$GLOBALS['TL_LANG']['MSC']['all'], 'href' => 'act=select', 'class' => 'header_edit_all', 'attributes' => 'onclick="Backend.getScrollOffset();" accesskey="e"')), 'operations' => array('edit' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_gallery']['edit'], 'href' => 'act=edit', 'icon' => 'edit.gif'), 'copy' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_gallery']['copy'], 'href' => 'act=copy', 'icon' => 'copy.gif'), 'delete' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_gallery']['delete'], 'href' => 'act=delete', 'icon' => 'delete.gif', 'attributes' => 'onclick="if (!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\')) return false; Backend.getScrollOffset();"'), 'show' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_gallery']['show'], 'href' => 'act=show', 'icon' => 'show.gif'))), 'palettes' => array('__selector__' => array('type', 'anchor'), 'default' => '{name_legend},name,type', 'standard' => '{name_legend},name,type,anchor,placeholder;{size_legend},main_size,gallery_size;{watermark_legend:hide},main_watermark_image,main_watermark_position,gallery_watermark_image,gallery_watermark_position;{template_legend:hide},customTpl', 'standardlightbox' => '{name_legend},name,type,anchor,placeholder;{size_legend},main_size,gallery_size;{lightbox_legend},lightbox_template,lightbox_size;{watermark_legend:hide},main_watermark_image,main_watermark_position,gallery_watermark_image,gallery_watermark_position,lightbox_watermark_image,lightbox_watermark_position;{template_legend:hide},customTpl', 'inline' => '{name_legend},name,type,placeholder;{size_legend},main_size,gallery_size;{watermark_legend:hide},main_watermark_image,main_watermark_position,gallery_watermark_image,gallery_watermark_position;{template_legend:hide},customTpl'), 'fields' => array('id' => array('sql' => "int(10) unsigned NOT NULL auto_increment"), 'tstamp' => array('sql' => "int(10) unsigned NOT NULL default '0'"), 'name' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_gallery']['name'], 'exclude' => true, 'search' => true, 'inputType' => 'text', 'eval' => array('mandatory' => true, 'maxlength' => 255, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'type' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_gallery']['type'], 'exclude' => true, 'filter' => true, 'default' => 'standard', 'inputType' => 'select', 'options_callback' => function () {
    return \Isotope\Model\Gallery::getModelTypeOptions();
}, 'eval' => array('helpwizard' => true, 'submitOnChange' => true, 'chosen' => true, 'tl_class' => 'w50'), 'sql' => "varchar(64) NOT NULL default ''"), 'anchor' => array('label' => $GLOBALS['TL_LANG']['tl_iso_gallery']['anchor'], 'exclude' => true, 'inputType' => 'radio', 'options' => array('none', 'reader', 'lightbox'), 'reference' => &$GLOBALS['TL_LANG']['tl_iso_gallery'], 'eval' => array('mandatory' => true, 'submitOnChange' => true, 'tl_class' => 'clr w50 w50h'), 'sql' => "varchar(8) NOT NULL default ''"), 'placeholder' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_gallery']['placeholder'], 'exclude' => true, 'inputType' => 'fileTree', 'eval' => array('fieldType' => 'radio', 'files' => true, 'filesOnly' => true, 'extensions' => $GLOBALS['TL_CONFIG']['validImageTypes'], 'tl_class' => 'w50 w50h'), 'sql' => "binary(16) NULL"), 'main_size' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_gallery']['main_size'], 'exclude' => true, 'inputType' => 'imageSize', 'options' => $GLOBALS['TL_CROP'], 'reference' => &$GLOBALS['TL_LANG']['MSC'], 'eval' => array('rgxp' => 'digit', 'nospace' => true, 'helpwizard' => true, 'tl_class' => 'w50'), 'sql' => "varchar(64) NOT NULL default ''"), 'gallery_size' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_gallery']['gallery_size'], 'exclude' => true, 'inputType' => 'imageSize', 'options' => $GLOBALS['TL_CROP'], 'reference' => &$GLOBALS['TL_LANG']['MSC'], 'eval' => array('rgxp' => 'digit', 'nospace' => true, 'helpwizard' => true, 'tl_class' => 'w50'), 'sql' => "varchar(64) NOT NULL default ''"), 'lightbox_template' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_gallery']['lightbox_template'], 'exclude' => true, 'inputType' => 'checkboxWizard', 'options_callback' => function () {
    // Do not use \Isotope\Backend::getTemplates() here, as they cannot be selected in a page layout!
    return array_merge(\Controller::getTemplateGroup('moo_'), \Controller::getTemplateGroup('j_'));
}, 'eval' => array('mandatory' => true, 'multiple' => true, 'tl_class' => 'w50 w50h'), 'sql' => "blob NULL"), 'lightbox_size' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_gallery']['lightbox_size'], 'exclude' => true, 'inputType' => 'imageSize', 'options' => $GLOBALS['TL_CROP'], 'reference' => &$GLOBALS['TL_LANG']['MSC'], 'eval' => array('rgxp' => 'digit', 'nospace' => true, 'helpwizard' => true, 'tl_class' => 'w50'), 'sql' => "varchar(64) NOT NULL default ''"), 'main_watermark_image' => array('label' => $GLOBALS['TL_LANG']['tl_iso_gallery']['main_watermark_image'], 'exclude' => true, 'inputType' => 'fileTree', 'eval' => array('fieldType' => 'radio', 'files' => true, 'filesOnly' => true, 'extensions' => $GLOBALS['TL_CONFIG']['validImageTypes'], 'tl_class' => 'clr w50 w50h'), 'sql' => "binary(16) NULL"), 'main_watermark_position' => array('label' => $GLOBALS['TL_LANG']['tl_iso_gallery']['main_watermark_position'], 'exclude' => true, 'inputType' => 'select', 'options' => array('left_top', 'center_top', 'right_top', 'left_center', 'center_center', 'right_center', 'left_bottom', 'center_bottom', 'right_bottom'), 'reference' => $GLOBALS['TL_LANG']['MSC'], 'eval' => array('tl_class' => 'w50'), 'sql' => "varchar(16) NOT NULL default ''"), 'gallery_watermark_image' => array('label' => $GLOBALS['TL_LANG']['tl_iso_gallery']['gallery_watermark_image'], 'exclude' => true, 'inputType' => 'fileTree', 'eval' => array('fieldType' => 'radio', 'files' => true, 'filesOnly' => true, 'extensions' => $GLOBALS['TL_CONFIG']['validImageTypes'], 'tl_class' => 'clr w50 w50h'), 'sql' => "binary(16) NULL"), 'gallery_watermark_position' => array('label' => $GLOBALS['TL_LANG']['tl_iso_gallery']['gallery_watermark_position'], 'exclude' => true, 'inputType' => 'select', 'options' => array('left_top', 'center_top', 'right_top', 'left_center', 'center_center', 'right_center', 'left_bottom', 'center_bottom', 'right_bottom'), 'reference' => $GLOBALS['TL_LANG']['MSC'], 'eval' => array('tl_class' => 'w50'), 'sql' => "varchar(16) NOT NULL default ''"), 'lightbox_watermark_image' => array('label' => $GLOBALS['TL_LANG']['tl_iso_gallery']['lightbox_watermark_image'], 'exclude' => true, 'inputType' => 'fileTree', 'eval' => array('fieldType' => 'radio', 'files' => true, 'filesOnly' => true, 'extensions' => $GLOBALS['TL_CONFIG']['validImageTypes'], 'tl_class' => 'clr w50 w50h'), 'sql' => "binary(16) NULL"), 'lightbox_watermark_position' => array('label' => $GLOBALS['TL_LANG']['tl_iso_gallery']['lightbox_watermark_position'], 'exclude' => true, 'inputType' => 'select', 'options' => array('left_top', 'center_top', 'right_top', 'left_center', 'center_center', 'right_center', 'left_bottom', 'center_bottom', 'right_bottom'), 'reference' => $GLOBALS['TL_LANG']['MSC'], 'eval' => array('tl_class' => 'w50'), 'sql' => "varchar(16) NOT NULL default ''"), 'customTpl' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_gallery']['customTpl'], 'exclude' => true, 'inputType' => 'select', 'options_callback' => function () {
    return \Isotope\Backend::getTemplates('iso_gallery_');
}, 'eval' => array('includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50'), 'sql' => "varchar(64) NOT NULL default ''")));
Exemple #8
0
 /**
  * Add the collection to a template
  * @param   object
  * @param   array
  */
 public function addToTemplate(\Isotope\Template $objTemplate, array $arrConfig = array())
 {
     $arrGalleries = array();
     $arrItems = $this->addItemsToTemplate($objTemplate, $arrConfig['sorting']);
     $objTemplate->collection = $this;
     $objTemplate->config = $this->getRelated('config_id') || Isotope::getConfig();
     $objTemplate->surcharges = \Isotope\Frontend::formatSurcharges($this->getSurcharges());
     $objTemplate->subtotal = Isotope::formatPriceWithCurrency($this->getSubtotal());
     $objTemplate->total = Isotope::formatPriceWithCurrency($this->getTotal());
     $objTemplate->generateAttribute = function ($strAttribute, ProductCollectionItem $objItem) {
         if (!$objItem->hasProduct()) {
             return '';
         }
         $objAttribute = $GLOBALS['TL_DCA']['tl_iso_product']['attributes'][$strAttribute];
         if (!$objAttribute instanceof IsotopeAttribute) {
             throw new \InvalidArgumentException($strAttribute . ' is not a valid attribute');
         }
         return $objAttribute->generate($objItem->getProduct());
     };
     $objTemplate->getGallery = function ($strAttribute, ProductCollectionItem $objItem) use($arrConfig, &$arrGalleries) {
         if (!$objItem->hasProduct()) {
             return new \Isotope\Model\Gallery\Standard();
         }
         $strCacheKey = 'product' . $objItem->product_id . '_' . $strAttribute;
         $arrConfig['jumpTo'] = $objItem->getRelated('jumpTo');
         if (!isset($arrGalleries[$strCacheKey])) {
             $arrGalleries[$strCacheKey] = Gallery::createForProductAttribute($objItem->getProduct(), $strAttribute, $arrConfig);
         }
         return $arrGalleries[$strCacheKey];
     };
     // !HOOK: allow overriding of the template
     if (isset($GLOBALS['ISO_HOOKS']['addCollectionToTemplate']) && is_array($GLOBALS['ISO_HOOKS']['addCollectionToTemplate'])) {
         foreach ($GLOBALS['ISO_HOOKS']['addCollectionToTemplate'] as $callback) {
             $objCallback = \System::importStatic($callback[0]);
             $objCallback->{$callback}[1]($objTemplate, $arrItems, $this);
         }
     }
 }
Exemple #9
0
 /**
  * Generate a product template
  *
  * @param array $arrConfig
  *
  * @return string
  */
 public function generate(array $arrConfig)
 {
     $this->strFormId = ($arrConfig['module'] instanceof \ContentElement ? 'cte' : 'fmd') . $arrConfig['module']->id . '_product_' . $this->getProductId();
     $objProduct = $this->validateVariant();
     // A variant has been loaded, generate the variant
     if ($objProduct->id != $this->id) {
         return $objProduct->generate($arrConfig);
     }
     $arrGalleries = array();
     /** @type Template|object $objTemplate */
     $objTemplate = new Template($arrConfig['template']);
     $objTemplate->setData($this->arrData);
     $objTemplate->product = $this;
     $objTemplate->config = $arrConfig;
     $objTemplate->generateAttribute = function ($strAttribute, array $arrOptions = array()) use($objProduct) {
         $objAttribute = $GLOBALS['TL_DCA']['tl_iso_product']['attributes'][$strAttribute];
         if (!$objAttribute instanceof IsotopeAttribute) {
             throw new \InvalidArgumentException($strAttribute . ' is not a valid attribute');
         }
         return $objAttribute->generate($objProduct, $arrOptions);
     };
     $objTemplate->generatePrice = function () use($objProduct) {
         $objPrice = $objProduct->getPrice();
         /** @type ProductType $objType */
         $objType = $objProduct->getRelated('type');
         if (null === $objPrice) {
             return '';
         }
         return $objPrice->generate($objType->showPriceTiers(), 1, $objProduct->getOptions());
     };
     $objTemplate->getGallery = function ($strAttribute) use($objProduct, $arrConfig, &$arrGalleries) {
         if (!isset($arrGalleries[$strAttribute])) {
             $arrGalleries[$strAttribute] = Gallery::createForProductAttribute($objProduct, $strAttribute, $arrConfig);
         }
         return $arrGalleries[$strAttribute];
     };
     $arrVariantOptions = array();
     $arrProductOptions = array();
     $arrAjaxOptions = array();
     foreach (array_unique(array_merge($this->getAttributes(), $this->getVariantAttributes())) as $attribute) {
         $arrData = $GLOBALS['TL_DCA']['tl_iso_product']['fields'][$attribute];
         if ($arrData['attributes']['customer_defined'] || $arrData['attributes']['variant_option']) {
             $strWidget = $this->generateProductOptionWidget($attribute, $arrVariantOptions, $arrAjaxOptions);
             if ($strWidget != '') {
                 $arrProductOptions[$attribute] = array_merge($arrData, array('name' => $attribute, 'html' => $strWidget));
             }
         }
     }
     $arrButtons = array();
     // !HOOK: retrieve buttons
     if (isset($GLOBALS['ISO_HOOKS']['buttons']) && is_array($GLOBALS['ISO_HOOKS']['buttons'])) {
         foreach ($GLOBALS['ISO_HOOKS']['buttons'] as $callback) {
             $objCallback = \System::importStatic($callback[0]);
             $arrButtons = $objCallback->{$callback}[1]($arrButtons);
         }
         $arrButtons = array_intersect_key($arrButtons, array_flip($arrConfig['buttons']));
     }
     if (\Input::post('FORM_SUBMIT') == $this->getFormId() && !$this->doNotSubmit) {
         foreach ($arrButtons as $button => $data) {
             if (isset($_POST[$button])) {
                 if (isset($data['callback'])) {
                     $objCallback = \System::importStatic($data['callback'][0]);
                     $objCallback->{$data['callback'][1]}($this, $arrConfig);
                 }
                 break;
             }
         }
     }
     RowClass::withKey('rowClass')->addCustom('product_option')->addFirstLast()->addEvenOdd()->applyTo($arrProductOptions);
     $objTemplate->buttons = $arrButtons;
     $objTemplate->useQuantity = $arrConfig['useQuantity'];
     $objTemplate->minimum_quantity = $this->getMinimumQuantity();
     $objTemplate->raw = $this->arrData;
     $objTemplate->raw_options = $this->getConfiguration();
     $objTemplate->configuration = $this->getConfiguration();
     $objTemplate->href = $this->generateUrl($arrConfig['jumpTo']);
     $objTemplate->label_detail = $GLOBALS['TL_LANG']['MSC']['detailLabel'];
     $objTemplate->options = $arrProductOptions;
     $objTemplate->hasOptions = !empty($arrProductOptions);
     $objTemplate->enctype = $this->hasUpload ? 'multipart/form-data' : 'application/x-www-form-urlencoded';
     $objTemplate->formId = $this->getFormId();
     $objTemplate->action = ampersand(\Environment::get('request'), true);
     $objTemplate->formSubmit = $this->getFormId();
     $objTemplate->product_id = $this->getProductId();
     $objTemplate->module_id = $arrConfig['module']->id;
     $GLOBALS['AJAX_PRODUCTS'][] = array('formId' => $this->getFormId(), 'attributes' => $arrAjaxOptions);
     // !HOOK: alter product data before output
     if (isset($GLOBALS['ISO_HOOKS']['generateProduct']) && is_array($GLOBALS['ISO_HOOKS']['generateProduct'])) {
         foreach ($GLOBALS['ISO_HOOKS']['generateProduct'] as $callback) {
             $objCallback = \System::importStatic($callback[0]);
             $objCallback->{$callback}[1]($objTemplate, $this);
         }
     }
     return $objTemplate->parse();
 }
<?php

/**
 * Isotope eCommerce for Contao Open Source CMS
 *
 * Copyright (C) 2009-2014 terminal42 gmbh & Isotope eCommerce Workgroup
 *
 * @package    Isotope
 * @link       http://isotopeecommerce.org
 * @license    http://opensource.org/licenses/lgpl-3.0.html
 */
/**
 * Table tl_iso_producttype
 */
$GLOBALS['TL_DCA']['tl_iso_producttype'] = array('config' => array('dataContainer' => 'Table', 'enableVersioning' => true, 'closed' => true, 'onload_callback' => array(array('Isotope\\Backend', 'initializeSetupModule'), array('Isotope\\Backend\\ProductType\\Callback', 'checkPermission'), array('Isotope\\Backend\\ProductType\\Permission', 'check')), 'sql' => array('keys' => array('id' => 'primary', 'variants' => 'index'))), 'list' => array('sorting' => array('mode' => 1, 'fields' => array('name'), 'flag' => 1, 'panelLayout' => 'filter;search,limit'), 'label' => array('fields' => array('name', 'variants', 'downloads', 'shipping_exempt'), 'showColumns' => true, 'label_callback' => array('\\Isotope\\Backend\\ProductType\\Label', 'generate')), 'global_operations' => array('back' => array('label' => &$GLOBALS['TL_LANG']['MSC']['backBT'], 'href' => 'mod=&table=', 'class' => 'header_back', 'attributes' => 'onclick="Backend.getScrollOffset();"'), 'new' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_producttype']['new'], 'href' => 'act=create', 'class' => 'header_new', 'attributes' => 'onclick="Backend.getScrollOffset();"'), 'all' => array('label' => &$GLOBALS['TL_LANG']['MSC']['all'], 'href' => 'act=select', 'class' => 'header_edit_all', 'attributes' => 'onclick="Backend.getScrollOffset();"')), 'operations' => array('edit' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_producttype']['edit'], 'href' => 'act=edit', 'icon' => 'edit.gif'), 'copy' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_producttype']['copy'], 'href' => 'act=copy', 'icon' => 'copy.gif', 'button_callback' => array('Isotope\\Backend\\ProductType\\Callback', 'copyProductType')), 'delete' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_producttype']['delete'], 'href' => 'act=delete', 'icon' => 'delete.gif', 'attributes' => 'onclick="if (!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\')) return false; Backend.getScrollOffset();"', 'button_callback' => array('Isotope\\Backend\\ProductType\\Callback', 'deleteProductType')), 'show' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_producttype']['show'], 'href' => 'act=show', 'icon' => 'show.gif'))), 'palettes' => array('__selector__' => array('class', 'prices', 'variants'), 'default' => '{name_legend},name,class', 'standard' => '{name_legend},name,class,fallback;{description_legend:hide},description;{prices_legend:hide},prices;{template_legend},list_template,reader_template,list_gallery,reader_gallery;{attributes_legend},attributes;{variants_legend:hide},variants;{expert_legend:hide},shipping_exempt,downloads'), 'subpalettes' => array('prices' => 'show_price_tiers', 'variants' => 'variant_attributes,force_variant_options'), 'fields' => array('id' => array('sql' => "int(10) unsigned NOT NULL auto_increment"), 'tstamp' => array('sql' => "int(10) unsigned NOT NULL default '0'"), 'name' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_producttype']['name'], 'exclude' => true, 'search' => true, 'inputType' => 'text', 'eval' => array('mandatory' => true, 'maxlength' => 255, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'class' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_producttype']['class'], 'exclude' => true, 'filter' => true, 'inputType' => 'select', 'default' => 'standard', 'options_callback' => function () {
    return \Isotope\Model\Product::getModelTypeOptions();
}, 'eval' => array('mandatory' => true, 'submitOnChange' => true, 'helpwizard' => true, 'tl_class' => 'w50'), 'sql' => "varchar(64) NOT NULL default ''"), 'fallback' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_producttype']['fallback'], 'exclude' => true, 'filter' => true, 'inputType' => 'checkbox', 'eval' => array('fallback' => true, 'tl_class' => 'w50'), 'sql' => "char(1) NOT NULL default ''"), 'description' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_producttype']['description'], 'exclude' => true, 'inputType' => 'textarea', 'eval' => array('style' => 'height:80px', 'tl_class' => 'clr'), 'sql' => "text NULL"), 'prices' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_producttype']['prices'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('submitOnChange' => true, 'tl_class' => 'clr'), 'sql' => "char(1) NOT NULL default ''"), 'show_price_tiers' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_producttype']['show_price_tiers'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50'), 'sql' => "char(1) NOT NULL default ''"), 'list_template' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_producttype']['list_template'], 'exclude' => true, 'inputType' => 'select', 'default' => 'iso_list_default', 'options_callback' => function (\DataContainer $dc) {
    return \Isotope\Backend::getTemplates('iso_list_');
}, 'eval' => array('mandatory' => true, 'tl_class' => 'w50', 'chosen' => true), 'sql' => "varchar(255) NOT NULL default ''"), 'reader_template' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_producttype']['reader_template'], 'exclude' => true, 'inputType' => 'select', 'default' => 'iso_reader_default', 'options_callback' => function (\DataContainer $dc) {
    return \Isotope\Backend::getTemplates('iso_reader_');
}, 'eval' => array('mandatory' => true, 'tl_class' => 'w50', 'chosen' => true), 'sql' => "varchar(255) NOT NULL default ''"), 'list_gallery' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_producttype']['list_gallery'], 'exclude' => true, 'inputType' => 'select', 'foreignKey' => \Isotope\Model\Gallery::getTable() . '.name', 'eval' => array('mandatory' => true, 'includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50'), 'sql' => "int(10) unsigned NOT NULL default '0'"), 'reader_gallery' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_producttype']['reader_gallery'], 'exclude' => true, 'inputType' => 'select', 'foreignKey' => \Isotope\Model\Gallery::getTable() . '.name', 'eval' => array('mandatory' => true, 'includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50'), 'sql' => "int(10) unsigned NOT NULL default '0'"), 'attributes' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_producttype']['attributes'], 'exclude' => true, 'default' => array(array('name' => 'type', 'enabled' => 1), array('name' => 'pages', 'enabled' => 1), array('name' => 'alias', 'enabled' => 1), array('name' => 'sku', 'enabled' => 1), array('name' => 'name', 'enabled' => 1), array('name' => 'teaser', 'enabled' => 1), array('name' => 'description', 'enabled' => 1), array('name' => 'price', 'enabled' => 1), array('name' => 'images', 'enabled' => 1), array('name' => 'published', 'enabled' => 1), array('name' => 'start', 'enabled' => 1), array('name' => 'stop', 'enabled' => 1)), 'inputType' => 'multiColumnWizard', 'eval' => array('tl_class' => 'clr', 'columnsCallback' => array('Isotope\\Backend\\ProductType\\AttributeWizard', 'getColumns'), 'buttons' => array('copy' => false, 'delete' => false)), 'sql' => 'blob NULL', 'load_callback' => array(array('Isotope\\Backend\\ProductType\\AttributeWizard', 'load')), 'save_callback' => array(array('Isotope\\Backend\\ProductType\\AttributeWizard', 'save'))), 'variants' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_producttype']['variants'], 'exclude' => true, 'filter' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'clr', 'submitOnChange' => true), 'sql' => "char(1) NOT NULL default ''"), 'variant_attributes' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_producttype']['variant_attributes'], 'exclude' => true, 'inputType' => 'multiColumnWizard', 'eval' => array('tl_class' => 'clr', 'columnsCallback' => array('Isotope\\Backend\\ProductType\\AttributeWizard', 'getColumns'), 'buttons' => array('copy' => false, 'delete' => false)), 'sql' => 'blob NULL', 'load_callback' => array(array('Isotope\\Backend\\ProductType\\AttributeWizard', 'load')), 'save_callback' => array(array('Isotope\\Backend\\ProductType\\Callback', 'validateVariantAttributes'), array('Isotope\\Backend\\ProductType\\AttributeWizard', 'save'))), 'force_variant_options' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_producttype']['force_variant_options'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'clr'), 'sql' => "char(1) NOT NULL default ''"), 'shipping_exempt' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_producttype']['shipping_exempt'], 'exclude' => true, 'filter' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50'), 'sql' => "char(1) NOT NULL default ''"), 'downloads' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_producttype']['downloads'], 'exclude' => true, 'filter' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50'), 'sql' => "char(1) NOT NULL default ''")));
Exemple #11
0
   /**
    * Generate the widget and return it as string
    * @return string
    */
   public function generate()
   {
       $arrFallback = $this->getFallbackData();
       // Adapt the temporary files
       if (is_array($this->varValue['files']) && !empty($this->varValue['files'])) {
           foreach ($this->varValue['files'] as $v) {
               if (!is_file(TL_ROOT . '/' . $this->getFilePath($v))) {
                   continue;
               }
               $this->varValue[] = array('src' => $v, 'alt' => '', 'desc' => '', 'link' => '', 'translate' => '');
           }
           unset($this->varValue['files']);
       }
       // Merge parent record data
       if ($arrFallback !== false) {
           $blnLanguage = true;
           $this->varValue = Gallery::mergeMediaData($this->varValue, $arrFallback);
       }
       $arrButtons = array('up', 'down', 'delete', 'drag');
       $strCommand = 'cmd_' . $this->strField;
       // Change the order
       if (\Input::get($strCommand) && is_numeric(\Input::get('cid')) && \Input::get('id') == $this->currentRecord) {
           switch (\Input::get($strCommand)) {
               case 'up':
                   $this->varValue = array_move_up($this->varValue, \Input::get('cid'));
                   break;
               case 'down':
                   $this->varValue = array_move_down($this->varValue, \Input::get('cid'));
                   break;
               case 'delete':
                   $this->varValue = array_delete($this->varValue, \Input::get('cid'));
                   break;
           }
           \Database::getInstance()->prepare("UPDATE " . $this->strTable . " SET " . $this->strField . "=? WHERE id=?")->execute(serialize($this->varValue), $this->currentRecord);
           \Controller::redirect(preg_replace('/&(amp;)?cid=[^&]*/i', '', preg_replace('/&(amp;)?' . preg_quote($strCommand, '/') . '=[^&]*/i', '', \Environment::get('request'))));
       }
       $blnIsAjax = \Environment::get('isAjaxRequest');
       $return = '';
       $upload = '';
       if (!$blnIsAjax) {
           $return .= '<div id="ctrl_' . $this->strId . '" class="tl_mediamanager">';
           $extensions = trimsplit(',', $GLOBALS['TL_CONFIG']['validImageTypes']);
           $upload .= '<div id="fineuploader_' . $this->strId . '" class="upload_container"></div>
 <script>
   window.addEvent("domready", function() {
     Isotope.MediaManager.init($("fineuploader_' . $this->strId . '"), "' . $this->strId . '", ' . json_encode($extensions) . ');
   });
 </script>
 <script type="text/template" id="qq-template">
   <div class="qq-uploader-selector qq-uploader">
       <div class="qq-upload-drop-area-selector qq-upload-drop-area" qq-hide-dropzone>
           <span>' . $GLOBALS['TL_LANG']['MSC']['mmDrop'] . '</span>
       </div>
       <div class="qq-upload-button-selector qq-upload-button">
           <div class="tl_submit">' . $GLOBALS['TL_LANG']['MSC']['mmUpload'] . '</div>
       </div>
       <span class="qq-drop-processing-selector qq-drop-processing">
           <span>' . $GLOBALS['TL_LANG']['MSC']['mmProcessing'] . '</span>
           <span class="qq-drop-processing-spinner-selector qq-drop-processing-spinner"></span>
       </span>
       <ul class="qq-upload-list-selector qq-upload-list">
           <li>
               <div class="qq-progress-bar-container-selector">
                   <div class="qq-progress-bar-selector qq-progress-bar"></div>
               </div>
               <span class="qq-upload-spinner-selector qq-upload-spinner"></span>
               <span class="qq-edit-filename-icon-selector qq-edit-filename-icon"></span>
               <span class="qq-upload-file-selector qq-upload-file"></span>
               <input class="qq-edit-filename-selector qq-edit-filename" tabindex="0" type="text">
               <span class="qq-upload-size-selector qq-upload-size"></span>
               <span class="qq-upload-status-text-selector qq-upload-status-text"></span>
           </li>
       </ul>
   </div>
 </script>';
       }
       $return .= '<div>';
       if (!is_array($this->varValue) || empty($this->varValue)) {
           return $return . $GLOBALS['TL_LANG']['MSC']['mmNoUploads'] . '</div>' . $upload . (!$blnIsAjax ? '</div>' : '');
       }
       // Add label and return wizard
       $return .= '<table>
 <thead>
 <tr>
   <td class="col_0 col_first">' . $GLOBALS['TL_LANG'][$this->strTable]['mmSrc'] . '</td>
   <td class="col_1">' . $GLOBALS['TL_LANG'][$this->strTable]['mmAlt'] . ' / ' . $GLOBALS['TL_LANG'][$this->strTable]['mmLink'] . '</td>
   <td class="col_2">' . $GLOBALS['TL_LANG'][$this->strTable]['mmDesc'] . '</td>
   <td class="col_3">' . $GLOBALS['TL_LANG'][$this->strTable]['mmTranslate'] . '</td>
   <td class="col_4 col_last">&nbsp;</td>
 </tr>
 </thead>
 <tbody class="sortable">';
       // Add input fields
       for ($i = 0, $count = count($this->varValue); $i < $count; $i++) {
           $strFile = $this->getFilePath($this->varValue[$i]['src']);
           if (!is_file(TL_ROOT . '/' . $strFile)) {
               continue;
           }
           $objFile = new \File($strFile);
           if ($objFile->isGdImage) {
               $strPreview = \Image::get($strFile, 50, 50, 'box');
           } else {
               $strPreview = 'system/themes/' . $this->getTheme() . '/images/' . $objFile->icon;
           }
           $strTranslateText = $blnLanguage && $this->varValue[$i]['translate'] != 'all' ? ' disabled="disabled"' : '';
           $strTranslateNone = $blnLanguage && $this->varValue[$i]['translate'] == 'none' ? ' disabled="disabled"' : '';
           $return .= '
 <tr>
   <td class="col_0 col_first"><input type="hidden" name="' . $this->strName . '[' . $i . '][src]" value="' . specialchars($this->varValue[$i]['src']) . '"><a href="' . $strFile . '" onclick="Backend.openModalImage({\'width\':' . $objFile->width . ',\'title\':\'' . str_replace("'", "\\'", $GLOBALS['TL_LANG'][$this->strTable]['mmSrc']) . '\',\'url\':\'' . $strFile . '\'});return false"><img src="' . $strPreview . '" alt="' . specialchars($this->varValue[$i]['src']) . '"></a></td>
   <td class="col_1"><input type="text" class="tl_text_2" name="' . $this->strName . '[' . $i . '][alt]" value="' . specialchars($this->varValue[$i]['alt'], true) . '"' . $strTranslateNone . '><br><input type="text" class="tl_text_2" name="' . $this->strName . '[' . $i . '][link]" value="' . specialchars($this->varValue[$i]['link'], true) . '"' . $strTranslateText . '></td>
   <td class="col_2"><textarea name="' . $this->strName . '[' . $i . '][desc]" cols="40" rows="3" class="tl_textarea"' . $strTranslateNone . ' >' . specialchars($this->varValue[$i]['desc']) . '</textarea></td>
   <td class="col_3">
       ' . ($blnLanguage ? '<input type="hidden" name="' . $this->strName . '[' . $i . '][translate]" value="' . $this->varValue[$i]['translate'] . '">' : '') . '
       <fieldset class="radio_container">
           <span>
               <input id="' . $this->strName . '_' . $i . '_translate_none" name="' . $this->strName . '[' . $i . '][translate]" type="radio" class="tl_radio" value="none"' . $this->optionChecked('none', $this->varValue[$i]['translate']) . ($blnLanguage ? ' disabled="disabled"' : '') . '>
               <label for="' . $this->strName . '_' . $i . '_translate_none" title="' . $GLOBALS['TL_LANG'][$this->strTable]['mmTranslateNone'][1] . '">' . $GLOBALS['TL_LANG'][$this->strTable]['mmTranslateNone'][0] . '</label></span>
           <span>
               <input id="' . $this->strName . '_' . $i . '_translate_text" name="' . $this->strName . '[' . $i . '][translate]" type="radio" class="tl_radio" value="text"' . $this->optionChecked('text', $this->varValue[$i]['translate']) . ($blnLanguage ? ' disabled="disabled"' : '') . '>
               <label for="' . $this->strName . '_' . $i . '_translate_text" title="' . $GLOBALS['TL_LANG'][$this->strTable]['mmTranslateText'][1] . '">' . $GLOBALS['TL_LANG'][$this->strTable]['mmTranslateText'][0] . '</label></span>
           <span>
               <input id="' . $this->strName . '_' . $i . '_translate_all" name="' . $this->strName . '[' . $i . '][translate]" type="radio" class="tl_radio" value="all"' . $this->optionChecked('all', $this->varValue[$i]['translate']) . ($blnLanguage ? ' disabled="disabled"' : '') . '>
               <label for="' . $this->strName . '_' . $i . '_translate_all" title="' . $GLOBALS['TL_LANG'][$this->strTable]['mmTranslateAll'][1] . '">' . $GLOBALS['TL_LANG'][$this->strTable]['mmTranslateAll'][0] . '</label></span>
       </fieldset>
   </td>
   <td class="col_4 col_last">';
           // Add buttons
           foreach ($arrButtons as $button) {
               if ($button == 'delete' && $blnLanguage && $this->varValue[$i]['translate'] != 'all') {
                   continue;
               }
               $class = $button == 'up' || $button == 'down' ? ' class="button-move"' : '';
               if ($button == 'drag') {
                   $return .= \Image::getHtml('drag.gif', '', 'class="drag-handle" title="' . sprintf($GLOBALS['TL_LANG']['MSC']['move']) . '"');
               } else {
                   $return .= '<a href="' . $this->addToUrl('&amp;' . $strCommand . '=' . $button . '&amp;cid=' . $i . '&amp;id=' . $this->currentRecord) . '"' . $class . ' title="' . specialchars($GLOBALS['TL_LANG'][$this->strTable]['wz_' . $button]) . '" onclick="Isotope.MediaManager.act(this, \'' . $button . '\',  \'ctrl_' . $this->strId . '\'); return false;">' . \Image::getHtml($button . '.gif', $GLOBALS['TL_LANG'][$this->strTable]['wz_' . $button], 'class="tl_listwizard_img"') . '</a> ';
               }
           }
           $return .= '</td>
 </tr>';
       }
       return $return . '
 </tbody>
 </table>
 </div>' . $upload . (!$blnIsAjax ? '</div>' : '');
   }
 public function addToTemplate($intProductType, Order $objOrder, \Template $objTemplate, array $arrConfig = array())
 {
     $arrGalleries = array();
     // FIX - call to custom function since addItemsToTemplate isn't static
     $arrItems = static::addItemsToTemplate($intProductType, $objOrder, $objTemplate, $arrConfig['sorting']);
     $objTemplate->id = $objOrder->id;
     $objTemplate->collection = $objOrder;
     $objTemplate->config = $objOrder->getRelated('config_id') || Isotope::getConfig();
     $objTemplate->surcharges = Frontend::formatSurcharges($objOrder->getSurcharges());
     $objTemplate->subtotal = Isotope::formatPriceWithCurrency($objOrder->getSubtotal());
     $objTemplate->total = Isotope::formatPriceWithCurrency($objOrder->getTotal());
     $objTemplate->tax_free_subtotal = Isotope::formatPriceWithCurrency($objOrder->getTaxFreeSubtotal());
     $objTemplate->tax_free_total = Isotope::formatPriceWithCurrency($objOrder->getTaxFreeTotal());
     $objTemplate->hasAttribute = function ($strAttribute, ProductCollectionItem $objItem) {
         if (!$objItem->hasProduct()) {
             return false;
         }
         $objProduct = $objItem->getProduct();
         return in_array($strAttribute, $objProduct->getAttributes()) || in_array($strAttribute, $objProduct->getVariantAttributes());
     };
     $objTemplate->generateAttribute = function ($strAttribute, ProductCollectionItem $objItem, array $arrOptions = array()) {
         if (!$objItem->hasProduct()) {
             return '';
         }
         $objAttribute = $GLOBALS['TL_DCA']['tl_iso_product']['attributes'][$strAttribute];
         if (!$objAttribute instanceof IsotopeAttribute) {
             throw new \InvalidArgumentException($strAttribute . ' is not a valid attribute');
         }
         return $objAttribute->generate($objItem->getProduct(), $arrOptions);
     };
     $objTemplate->getGallery = function ($strAttribute, ProductCollectionItem $objItem) use($arrConfig, &$arrGalleries) {
         if (!$objItem->hasProduct()) {
             return new Standard();
         }
         $strCacheKey = 'product' . $objItem->product_id . '_' . $strAttribute;
         $arrConfig['jumpTo'] = $objItem->getRelated('jumpTo');
         if (!isset($arrGalleries[$strCacheKey])) {
             $arrGalleries[$strCacheKey] = Gallery::createForProductAttribute($objItem->getProduct(), $strAttribute, $arrConfig);
         }
         return $arrGalleries[$strCacheKey];
     };
     // !HOOK: allow overriding of the template
     if (isset($GLOBALS['ISO_HOOKS']['addCollectionToTemplate']) && is_array($GLOBALS['ISO_HOOKS']['addCollectionToTemplate'])) {
         foreach ($GLOBALS['ISO_HOOKS']['addCollectionToTemplate'] as $callback) {
             $objCallback = \System::importStatic($callback[0]);
             $objCallback->{$callback}[1]($objTemplate, $arrItems, $objOrder);
         }
     }
 }
<?php

/**
 * Isotope eCommerce for Contao Open Source CMS
 *
 * Copyright (C) 2009-2014 terminal42 gmbh & Isotope eCommerce Workgroup
 *
 * @package    Isotope
 * @link       http://isotopeecommerce.org
 * @license    http://opensource.org/licenses/lgpl-3.0.html
 */
/**
 * Table tl_iso_document
 */
$GLOBALS['TL_DCA']['tl_iso_document'] = array('config' => array('dataContainer' => 'Table', 'enableVersioning' => true, 'closed' => true, 'onload_callback' => array(array('Isotope\\Backend', 'initializeSetupModule')), 'sql' => array('keys' => array('id' => 'primary'))), 'list' => array('sorting' => array('mode' => 1, 'fields' => array('name'), 'flag' => 1, 'panelLayout' => 'filter;search,limit'), 'label' => array('fields' => array('name'), 'format' => '%s'), 'global_operations' => array('back' => array('label' => &$GLOBALS['TL_LANG']['MSC']['backBT'], 'href' => 'mod=&table=', 'class' => 'header_back', 'attributes' => 'onclick="Backend.getScrollOffset();"'), 'new' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_document']['new'], 'href' => 'act=create', 'class' => 'header_new', 'attributes' => 'onclick="Backend.getScrollOffset();"'), 'all' => array('label' => &$GLOBALS['TL_LANG']['MSC']['all'], 'href' => 'act=select', 'class' => 'header_edit_all', 'attributes' => 'onclick="Backend.getScrollOffset();"')), 'operations' => array('edit' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_document']['edit'], 'href' => 'act=edit', 'icon' => 'edit.gif'), 'copy' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_document']['copy'], 'href' => 'act=copy', 'icon' => 'copy.gif'), 'delete' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_document']['delete'], 'href' => 'act=delete', 'icon' => 'delete.gif', 'attributes' => 'onclick="if (!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\')) return false; Backend.getScrollOffset();"'), 'show' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_document']['show'], 'href' => 'act=show', 'icon' => 'show.gif'))), 'palettes' => array('__selector__' => array('type'), 'default' => '{type_legend},name,type', 'standard' => '{type_legend},name,type;{config_legend},documentTitle,fileTitle;{template_legend},documentTpl,gallery,collectionTpl,orderCollectionBy'), 'fields' => array('id' => array('sql' => "int(10) unsigned NOT NULL auto_increment"), 'tstamp' => array('sql' => "int(10) unsigned NOT NULL default '0'"), 'name' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_document']['name'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('mandatory' => true, 'maxlength' => 255, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'type' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_document']['type'], 'exclude' => true, 'filter' => true, 'inputType' => 'select', 'default' => 'Standard', 'options_callback' => function () {
    return \Isotope\Model\Document::getModelTypeOptions();
}, 'eval' => array('submitOnChange' => true, 'tl_class' => 'w50', 'includeBlankOption' => true), 'sql' => "varchar(255) NOT NULL default ''"), 'documentTitle' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_document']['documentTitle'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('mandatory' => true, 'decodeEntities' => true, 'maxlength' => 255, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'fileTitle' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_document']['fileTitle'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('mandatory' => true, 'decodeEntities' => true, 'maxlength' => 255, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'documentTpl' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_document']['documentTpl'], 'exclude' => true, 'inputType' => 'select', 'options_callback' => function (\DataContainer $dc) {
    return \Isotope\Backend::getTemplates('iso_document_');
}, 'eval' => array('includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50', 'mandatory' => true), 'sql' => "varchar(64) NOT NULL default ''"), 'collectionTpl' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_document']['collectionTpl'], 'exclude' => true, 'default' => 'iso_collection_invoice', 'inputType' => 'select', 'options_callback' => function (\DataContainer $dc) {
    return \Isotope\Backend::getTemplates('iso_collection_');
}, 'eval' => array('includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50', 'mandatory' => true), 'sql' => "varchar(64) NOT NULL default ''"), 'orderCollectionBy' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_document']['orderCollectionBy'], 'exclude' => true, 'default' => 'asc_id', 'inputType' => 'select', 'options' => $GLOBALS['TL_LANG']['MSC']['iso_orderCollectionBy'], 'eval' => array('mandatory' => true, 'tl_class' => 'w50'), 'sql' => "varchar(16) NOT NULL default ''"), 'gallery' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_document']['gallery'], 'exclude' => true, 'inputType' => 'select', 'foreignKey' => \Isotope\Model\Gallery::getTable() . '.name', 'eval' => array('includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50'), 'sql' => "int(10) unsigned NOT NULL default '0'")));
 /**
  * Alter the options and set an image as label
  *
  * @param IsotopeProduct|Product\Standard $objProduct
  *
  * @return array|mixed
  *
  * @throws \InvalidArgumentException when optionsSource=product but product is null
  * @throws \UnexpectedValueException for unknown optionsSource
  */
 public function getOptionsForWidget(IsotopeProduct $objProduct = null)
 {
     // Skip in the back end or without a given product
     if (TL_MODE == 'BE' || null === $objProduct) {
         return parent::getOptionsForWidget($objProduct);
     }
     // Fetch all product's variants and make the accessible via the attribute value in an array
     $objVariants = Product::findAvailableByIds($objProduct->getVariantIds());
     if (null === $objVariants) {
         return parent::getOptionsForWidget($objProduct);
     }
     /** @var IsotopeProduct[] $arrVariants */
     $arrVariants = array_combine($objVariants->fetchEach($this->field_name), $objVariants->getModels());
     // Alter the options
     return array_map(function ($arrOption) use($arrVariants) {
         // Skip if option has no associated product variant
         if (!array_key_exists($arrOption['value'], $arrVariants)) {
             return $arrOption;
         }
         /** @var Gallery|Gallery\Standard $objGallery */
         $objGallery = Gallery::createForProductAttribute($arrVariants[$arrOption['value']], 'images', array('gallery' => $this->radioImageGallery));
         // Wrap label in span with css class
         $arrOption['label'] = sprintf('<span class="attribute-label">%s</span>', $arrOption['label']);
         // Add image to label
         $arrOption['label'] .= PHP_EOL . $objGallery->generateMainImage();
         return $arrOption;
     }, parent::getOptionsForWidget($objProduct));
 }
<?php

/**
 * RadioImage extension for Isotope eCommerce provides an attribute that generates the variant's gallery image as label.
 *
 * Copyright (c) 2016 Richard Henkenjohann
 *
 * @package RadioImage
 * @author  Richard Henkenjohann <*****@*****.**>
 */
/**
 * Palettes
 */
$GLOBALS['TL_DCA']['tl_iso_attribute']['palettes']['radioImage'] = str_replace(',includeBlankOption', ',includeBlankOption,radioImageGallery', $GLOBALS['TL_DCA']['tl_iso_attribute']['palettes']['radio']);
$GLOBALS['TL_DCA']['tl_iso_attribute']['palettes']['radioImageoption_variant'] = str_replace(',includeBlankOption', ',includeBlankOption,radioImageGallery', $GLOBALS['TL_DCA']['tl_iso_attribute']['palettes']['radiooption_vairant']);
$GLOBALS['TL_DCA']['tl_iso_attribute']['palettes']['radioImageproduct'] = str_replace(',includeBlankOption', ',includeBlankOption,radioImageGallery', $GLOBALS['TL_DCA']['tl_iso_attribute']['palettes']['radioproduct']);
/**
 * Fields
 */
$GLOBALS['TL_DCA']['tl_iso_attribute']['fields']['radioImageGallery'] = array('label' => &$GLOBALS['TL_LANG']['tl_iso_attribute']['radioImageGallery'], 'exclude' => true, 'inputType' => 'select', 'options_callback' => function () {
    /** @noinspection PhpUndefinedMethodInspection */
    $objGalleries = \Isotope\Model\Gallery::findAll();
    /** @noinspection PhpUndefinedMethodInspection */
    return null === $objGalleries ? array() : $objGalleries->fetchEach('name');
}, 'eval' => array('mandatory' => true, 'tl_class' => 'w50 m12', 'chosen' => true), 'sql' => "int(10) NOT NULL default '0'");