Example #1
0
 /**
  * Modify DCA
  */
 public function checkPermission()
 {
     // Attribute options for products can always have a price
     if (\Input::get('do') != 'iso_products') {
         /** @type Attribute $objAttribute */
         $objAttribute = null;
         switch (\Input::get('act')) {
             case 'edit':
             case 'delete':
             case 'paste':
                 if (($objOption = AttributeOption::findByPk(\Input::get('id'))) !== null) {
                     $objAttribute = Attribute::findByPk($objOption->pid);
                 }
                 break;
             case '':
             case 'select':
             case 'editAll':
             case 'overwriteAll':
                 $objAttribute = Attribute::findByPk(\Input::get('id'));
                 break;
         }
         if (null === $objAttribute || $objAttribute->isVariantOption()) {
             unset($GLOBALS['TL_DCA'][AttributeOption::getTable()]['fields']['price']);
         }
     }
 }
 /**
  * Return list of MultiColumnWizard columns
  * @param   MultiColumnWizard
  * @return  array
  */
 public function getColumns($objWidget)
 {
     $arrColumns = array('value' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_attribute']['options']['value'], 'inputType' => 'text', 'eval' => array('class' => 'tl_text_2')), 'label' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_attribute']['options']['label'], 'inputType' => 'text', 'eval' => array('class' => 'tl_text_2')), 'default' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_attribute']['options']['default'], 'inputType' => 'checkbox', 'eval' => array('columnPos' => 2)), 'group' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_attribute']['options']['group'], 'inputType' => 'checkbox', 'eval' => array('columnPos' => 3)));
     if (($objAttribute = Attribute::findByPk($objWidget->activeRecord->id)) !== null && $objAttribute instanceof IsotopeAttributeWithOptions) {
         $arrColumns = $objAttribute->prepareOptionsWizard($objWidget, $arrColumns);
     }
     return $arrColumns;
 }
Example #3
0
 /**
  * Show price column in dcaWizard if attribute is not a variant option
  *
  * @param \Widget|object $objWidget
  *
  * @return string
  */
 public function initializeTableOptions(\Widget $objWidget)
 {
     /** @type Attribute $objAttribute */
     if (\Input::get('do') == 'iso_products') {
         $objAttribute = Attribute::findByFieldName($objWidget->name);
     } else {
         $objAttribute = Attribute::findByPk(\Input::get('id'));
     }
     if (null !== $objAttribute && !$objAttribute->isVariantOption()) {
         $objWidget->fields = array_merge($objWidget->fields, array('price'));
     }
     return AttributeOption::getTable();
 }
 /**
  * Get formatted label for the attribute option
  *
  * @param IsotopeProduct $objProduct
  *
  * @return string
  */
 public function getLabel(IsotopeProduct $objProduct = null)
 {
     $strLabel = $this->label;
     /** @type Attribute $objAttribute */
     $objAttribute = null;
     switch ($this->ptable) {
         case 'tl_iso_product':
             $objAttribute = Attribute::findByFieldName($this->field_name);
             break;
         case 'tl_iso_attribute':
             $objAttribute = Attribute::findByPk($this->pid);
             break;
     }
     if (null !== $objAttribute && !$objAttribute->isVariantOption() && $this->price != '') {
         $strLabel .= ' (';
         if (!$this->isPercentage() || null !== $objProduct) {
             $strPrice = Isotope::formatPriceWithCurrency($this->getPrice($objProduct), false);
         } else {
             $strPrice = $this->price;
         }
         $strLabel .= $this->isFromPrice($objProduct) ? sprintf($GLOBALS['TL_LANG']['MSC']['priceRangeLabel'], $strPrice) : $strPrice;
         $strLabel .= ')';
     }
     return $strLabel;
 }