コード例 #1
0
 /**
  * Initialize the data container
  * @param object
  * @return string
  */
 public function initDCA($dc)
 {
     $arrCategories = array();
     $objCategories = \Database::getInstance()->prepare("SELECT * FROM " . \Isotope\Model\RelatedCategory::getTable() . " WHERE id NOT IN (SELECT category FROM " . $dc->table . " WHERE pid=" . (strlen(\Input::get('act')) ? "(SELECT pid FROM " . $dc->table . " WHERE id=?) AND id!=?" : '?') . ")")->execute($dc->id, $dc->id);
     while ($objCategories->next()) {
         $arrCategories[$objCategories->id] = $objCategories->name;
     }
     if (empty($arrCategories)) {
         $GLOBALS['TL_DCA']['tl_iso_related_product']['config']['closed'] = true;
     }
     if (\Input::get('act') == 'edit') {
         unset($GLOBALS['TL_DCA']['tl_iso_related_product']['fields']['category']['foreignKey']);
         $GLOBALS['TL_DCA']['tl_iso_related_product']['fields']['category']['options'] = $arrCategories;
         $GLOBALS['TL_DCA']['tl_iso_related_product']['fields']['products']['eval']['allowedIds'] = \Database::getInstance()->prepare("SELECT id FROM tl_iso_product WHERE pid=0 AND id!=(SELECT pid FROM tl_iso_related_product WHERE id=?)")->execute($dc->id)->fetchEach('id');
     }
 }
コード例 #2
0
ファイル: config.php プロジェクト: Aziz-JH/core
$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';
$GLOBALS['TL_MODELS'][\Isotope\Model\RequestCache::getTable()] = 'Isotope\\Model\\RequestCache';
$GLOBALS['TL_MODELS'][\Isotope\Model\Shipping::getTable()] = 'Isotope\\Model\\Shipping';
$GLOBALS['TL_MODELS'][\Isotope\Model\TaxClass::getTable()] = 'Isotope\\Model\\TaxClass';
$GLOBALS['TL_MODELS'][\Isotope\Model\TaxRate::getTable()] = 'Isotope\\Model\\TaxRate';
/**
 * Checkout steps
 */
$GLOBALS['ISO_CHECKOUTSTEP'] = array('address' => array('\\Isotope\\CheckoutStep\\BillingAddress', '\\Isotope\\CheckoutStep\\ShippingAddress'), 'shipping' => array('\\Isotope\\CheckoutStep\\ShippingMethod'), 'payment' => array('\\Isotope\\CheckoutStep\\PaymentMethod'), 'review' => array('\\Isotope\\CheckoutStep\\OrderConditionsOnTop', '\\Isotope\\CheckoutStep\\OrderInfo', '\\Isotope\\CheckoutStep\\OrderConditionsBeforeProducts', '\\Isotope\\CheckoutStep\\OrderProducts', '\\Isotope\\CheckoutStep\\OrderConditionsAfterProducts'));
/**
 * Permissions are access settings for user and groups (fields in tl_user and tl_user_group)
 */
$GLOBALS['TL_PERMISSIONS'][] = 'iso_modules';
$GLOBALS['TL_PERMISSIONS'][] = 'iso_product_types';
$GLOBALS['TL_PERMISSIONS'][] = 'iso_product_typep';
コード例 #3
0
 /**
  * Disable features that are not used in the current installation
  */
 protected function checkFeatures()
 {
     $blnDownloads = false;
     $blnVariants = false;
     $blnAdvancedPrices = false;
     $blnShowSku = false;
     $blnShowPrice = false;
     $arrAttributes = array();
     /** @var \Isotope\Model\ProductType[] $objProductTypes */
     if (($objProductTypes = ProductType::findAllUsed()) !== null) {
         foreach ($objProductTypes as $objType) {
             if ($objType->hasDownloads()) {
                 $blnDownloads = true;
             }
             if ($objType->hasVariants()) {
                 $blnVariants = true;
             }
             if ($objType->hasAdvancedPrices()) {
                 $blnAdvancedPrices = true;
             }
             if (in_array('sku', $objType->getAttributes())) {
                 $blnShowSku = true;
             }
             if (in_array('price', $objType->getAttributes())) {
                 $blnShowPrice = true;
             }
             $arrAttributes = array_merge($arrAttributes, $objType->getAttributes());
         }
     }
     // If no downloads are enabled in any product type, we do not need the option
     if (!$blnDownloads) {
         unset($GLOBALS['TL_DCA'][Product::getTable()]['list']['operations']['downloads']);
     }
     // Disable all variant related operations
     if (!$blnVariants) {
         unset($GLOBALS['TL_DCA'][Product::getTable()]['list']['global_operations']['toggleVariants']);
         unset($GLOBALS['TL_DCA'][Product::getTable()]['list']['operations']['generate']);
     }
     // Disable prices button if not enabled in any product type
     if (!$blnAdvancedPrices) {
         unset($GLOBALS['TL_DCA'][Product::getTable()]['list']['operations']['prices']);
     }
     // Hide SKU column if not enabled in any product type
     if (!$blnShowSku) {
         unset($GLOBALS['TL_DCA'][Product::getTable()]['list']['label']['fields'][2]);
     }
     // Hide price column if not enabled in any product type
     if (!$blnShowPrice) {
         unset($GLOBALS['TL_DCA'][Product::getTable()]['list']['label']['fields'][3]);
     }
     // Disable sort-into-group if no groups are defined
     if (Group::countAll() == 0) {
         unset($GLOBALS['TL_DCA'][Product::getTable()]['list']['operations']['group']);
     }
     // Disable related categories if none are defined
     if (RelatedCategory::countAll() == 0) {
         unset($GLOBALS['TL_DCA'][Product::getTable()]['list']['operations']['related']);
     }
     foreach (array_diff(array_keys($GLOBALS['TL_DCA'][Product::getTable()]['fields']), array_unique($arrAttributes)) as $field) {
         $GLOBALS['TL_DCA'][Product::getTable()]['fields'][$field]['filter'] = false;
         $GLOBALS['TL_DCA'][Product::getTable()]['fields'][$field]['sorting'] = false;
         $GLOBALS['TL_DCA'][Product::getTable()]['fields'][$field]['search'] = false;
     }
 }
コード例 #4
0
ファイル: tl_module.php プロジェクト: Aziz-JH/core
$GLOBALS['TL_DCA']['tl_module']['fields']['iso_emptyMessage'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_emptyMessage'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('submitOnChange' => true, 'tl_class' => 'clr w50'), 'sql' => "char(1) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_module']['fields']['iso_noProducts'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_noProducts'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('maxlength' => 255, 'tl_class' => 'clr long'), 'sql' => "varchar(255) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_module']['fields']['iso_emptyFilter'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_emptyFilter'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('submitOnChange' => true, 'tl_class' => 'clr'), 'sql' => "char(1) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_module']['fields']['iso_noFilter'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_noFilter'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('maxlength' => 255, 'tl_class' => 'clr long'), 'sql' => "varchar(255) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_module']['fields']['iso_category_scope'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_category_scope'], 'exclude' => true, 'inputType' => 'radio', 'default' => 'current_category', 'options' => array('current_category', 'current_and_first_child', 'current_and_all_children', 'parent', 'product', 'article', 'global'), 'reference' => &$GLOBALS['TL_LANG']['tl_module']['iso_category_scope_ref'], 'eval' => array('tl_class' => 'clr w50 w50h', 'helpwizard' => true), 'sql' => "varchar(64) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_module']['fields']['iso_list_where'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_list_where'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('preserveTags' => true, 'maxlength' => 255, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_module']['fields']['iso_filterModules'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_filterModules'], 'exclude' => true, 'inputType' => 'checkboxWizard', 'foreignKey' => 'tl_module.name', 'options_callback' => array('Isotope\\Backend\\Module\\Callback', 'getFilterModules'), 'eval' => array('multiple' => true, 'tl_class' => 'clr w50 w50h'), 'sql' => "blob NULL", 'relation' => array('type' => 'hasMany', 'load' => 'lazy'));
$GLOBALS['TL_DCA']['tl_module']['fields']['iso_filterFields'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_filterFields'], 'exclude' => true, 'inputType' => 'checkboxWizard', 'options_callback' => array('Isotope\\Backend\\Module\\Callback', 'getFilterFields'), 'eval' => array('multiple' => true, 'tl_class' => 'clr w50 w50h'), 'sql' => "blob NULL");
$GLOBALS['TL_DCA']['tl_module']['fields']['iso_newFilter'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_newFilter'], 'exclude' => true, 'inputType' => 'select', 'default' => 'show_all', 'options' => array('show_all', 'show_new', 'show_old'), 'reference' => &$GLOBALS['TL_LANG']['tl_module']['iso_newFilter'], 'eval' => array('tl_class' => 'w50'), 'sql' => "varchar(8) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_module']['fields']['iso_filterHideSingle'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_filterHideSingle'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50 m12'), 'sql' => "char(1) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_module']['fields']['iso_searchFields'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_searchFields'], 'exclude' => true, 'inputType' => 'checkboxWizard', 'options_callback' => array('Isotope\\Backend\\Module\\Callback', 'getSearchFields'), 'eval' => array('multiple' => true, 'tl_class' => 'clr w50 w50h'), 'sql' => "blob NULL");
$GLOBALS['TL_DCA']['tl_module']['fields']['iso_searchAutocomplete'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_searchAutocomplete'], 'exclude' => true, 'inputType' => 'select', 'options_callback' => array('Isotope\\Backend\\Module\\Callback', 'getAutocompleteFields'), 'eval' => array('tl_class' => 'w50', 'includeBlankOption' => true), 'sql' => "varchar(255) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_module']['fields']['iso_sortingFields'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_sortingFields'], 'exclude' => true, 'inputType' => 'checkboxWizard', 'options_callback' => array('Isotope\\Backend\\Module\\Callback', 'getSortingFields'), 'eval' => array('multiple' => true, 'tl_class' => 'clr w50 w50h'), 'sql' => "blob NULL");
$GLOBALS['TL_DCA']['tl_module']['fields']['iso_enableLimit'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_enableLimit'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('submitOnChange' => true, 'tl_class' => 'clr w50 m12'), 'sql' => "char(1) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_module']['fields']['iso_perPage'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_perPage'], 'exclude' => true, 'default' => '8,12,32,64', 'inputType' => 'text', 'eval' => array('mandatory' => true, 'maxlength' => 64, 'rgxp' => 'extnd', 'tl_class' => 'w50'), 'sql' => "varchar(64) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_module']['fields']['iso_cart_jumpTo'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['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_module']['fields']['iso_checkout_jumpTo'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_checkout_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_module']['fields']['iso_listingSortField'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['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 ''", 'save_callback' => array(array('Isotope\\Backend', 'truncateProductCache')));
$GLOBALS['TL_DCA']['tl_module']['fields']['iso_listingSortDirection'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_listingSortDirection'], 'exclude' => true, 'default' => 'DESC', 'inputType' => 'select', 'options' => array('DESC', 'ASC'), 'reference' => &$GLOBALS['TL_LANG']['tl_module']['sortingDirection'], 'eval' => array('tl_class' => 'w50'), 'sql' => "varchar(8) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_module']['fields']['iso_buttons'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['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_module']['fields']['iso_related_categories'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_related_categories'], 'exclude' => true, 'inputType' => 'checkboxWizard', 'foreignKey' => \Isotope\Model\RelatedCategory::getTable() . '.name', 'eval' => array('mandatory' => true, 'multiple' => true, 'tl_class' => 'clr'), 'sql' => "blob NULL", 'relation' => array('type' => 'hasMany', 'load' => 'lazy'));
$GLOBALS['TL_DCA']['tl_module']['fields']['iso_includeMessages'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_includeMessages'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('doNotCopy' => true, 'tl_class' => 'w50'), 'sql' => "char(1) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_module']['fields']['iso_continueShopping'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_continueShopping'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50'), 'sql' => "char(1) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_module']['fields']['iso_productcache'] = array('sql' => "blob NULL");
/**
 * Limit notification choices
 */
$GLOBALS['TL_DCA']['tl_module']['fields']['nc_notification']['eval']['ncNotificationChoices']['iso_checkout'] = array('iso_order_status_change');
$GLOBALS['TL_DCA']['tl_module']['fields']['nc_notification']['eval']['ncNotificationChoices']['iso_checkoutmember'] = array('iso_order_status_change');
$GLOBALS['TL_DCA']['tl_module']['fields']['nc_notification']['eval']['ncNotificationChoices']['iso_checkoutguest'] = array('iso_order_status_change');
$GLOBALS['TL_DCA']['tl_module']['fields']['nc_notification']['eval']['ncNotificationChoices']['iso_checkoutboth'] = array('iso_order_status_change');
コード例 #5
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_related_product
 */
$GLOBALS['TL_DCA']['tl_iso_related_product'] = array('config' => array('dataContainer' => 'Table', 'enableVersioning' => true, 'ptable' => 'tl_iso_product', 'onload_callback' => array(array('Isotope\\Backend\\RelatedProduct\\Callback', 'initDCA')), 'sql' => array('keys' => array('id' => 'primary', 'pid' => 'index'))), 'list' => array('sorting' => array('mode' => 4, 'fields' => array('category'), 'flag' => 1, 'panelLayout' => 'filter,limit', 'headerFields' => array('type', 'name', 'alias', 'sku'), 'disableGrouping' => true, 'child_record_callback' => array('Isotope\\Backend\\RelatedProduct\\Callback', 'listRows')), 'global_operations' => array('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_related_product']['edit'], 'href' => 'act=edit', 'icon' => 'edit.gif'), 'copy' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_related_product']['copy'], 'href' => 'act=copy', 'icon' => 'copy.gif'), 'delete' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_related_product']['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_related_product']['show'], 'href' => 'act=show', 'icon' => 'show.gif'))), 'palettes' => array('default' => '{category_legend},category;{products_legend},products'), 'fields' => array('id' => array('sql' => "int(10) unsigned NOT NULL auto_increment"), 'pid' => array('foreignKey' => 'tl_iso_product.name', 'sql' => "int(10) unsigned NOT NULL default '0'", 'relation' => array('type' => 'belongsTo', 'load' => 'lazy')), 'tstamp' => array('sql' => "int(10) unsigned NOT NULL default '0'"), 'sorting' => array('sql' => "int(10) unsigned NOT NULL default '0'"), 'category' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_related_product']['category'], 'exclude' => true, 'filter' => true, 'inputType' => 'select', 'foreignKey' => \Isotope\Model\RelatedCategory::getTable() . '.name', 'eval' => array('mandatory' => true, 'includeBlankOption' => true, 'chosen' => true), 'sql' => "int(10) unsigned NOT NULL default '0'", 'relation' => array('type' => 'hasOne', 'load' => 'lazy')), 'products' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_related_product']['products'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('mandatory' => true, 'tl_class' => 'long'), 'sql' => "blob NULL")));