コード例 #1
0
ファイル: ShopManager.class.php プロジェクト: Niggu/cloudrexx
 /**
  * Attributes and options edit view
  * @access    private
  */
 function view_attributes_edit()
 {
     global $_ARRAYLANG, $_CONFIG;
     self::$pageTitle = $_ARRAYLANG['TXT_PRODUCT_CHARACTERISTICS'];
     self::$objTemplate->addBlockfile('SHOP_PRODUCTS_FILE', 'shop_products_block', 'module_shop_product_attributes.html');
     //DBG::log("Shopmanager::view_attributes_edit(): Post: ".var_export($_POST, true));
     // delete Attribute
     if (!empty($_GET['delete_attribute_id'])) {
         // TODO: Set messages in there
         $this->_deleteAttribute($_GET['delete_attribute_id']);
     } elseif (!empty($_POST['multi_action']) && $_POST['multi_action'] == 'delete' && !empty($_POST['selected_attribute_id'])) {
         $this->_deleteAttribute($_POST['selected_attribute_id']);
     }
     // store new option
     if (!empty($_POST['addAttributeOption'])) {
         $this->_storeNewAttributeOption();
     }
     // update attribute options
     if (!empty($_POST['updateAttributeOptions'])) {
         // TODO: Set messages in there
         $this->_updateAttributeOptions();
     }
     // Clear the Product Attribute data present in Attributes.
     // This may have been changed above and would thus be out of date.
     Attributes::reset();
     $count = 0;
     $limit = $_CONFIG['corePagingLimit'];
     $order = "`id` ASC";
     $filter = isset($_REQUEST['filter']) ? contrexx_input2raw($_REQUEST['filter']) : null;
     $arrAttributes = Attributes::getArray($count, \Paging::getPosition(), $limit, $order, $filter);
     //DBG::log("ShopManager::_showAttributeOptions(): count ".count($arrAttributes)." of $count, limit $limit, order $order, filter $filter");
     $rowClass = 1;
     foreach ($arrAttributes as $attribute_id => $objAttribute) {
         self::$objTemplate->setCurrentBlock('attributeList');
         self::$objTemplate->setVariable(array('SHOP_PRODUCT_ATTRIBUTE_ROW_CLASS' => 'row' . (++$rowClass % 2 + 1), 'SHOP_PRODUCT_ATTRIBUTE_ID' => $attribute_id, 'SHOP_PRODUCT_ATTRIBUTE_NAME' => $objAttribute->getName(), 'SHOP_PRODUCT_ATTRIBUTE_VALUE_MENU' => Attributes::getOptionMenu($attribute_id, 'option_id', '', 'setSelectedValue(' . $attribute_id . ')', 'width: 290px;'), 'SHOP_PRODUCT_ATTRIBUTE_VALUE_INPUTBOXES' => Attributes::getInputs($attribute_id, 'option_name', 'value', 255, 'width: 200px;'), 'SHOP_PRODUCT_ATTRIBUTE_PRICE_INPUTBOXES' => Attributes::getInputs($attribute_id, 'option_price', 'price', 9, 'width: 200px; text-align: right;'), 'SHOP_PRODUCT_ATTRIBUTE_DISPLAY_TYPE' => Attributes::getDisplayTypeMenu($attribute_id, $objAttribute->getType(), 'updateOptionList(' . $attribute_id . ')')));
         self::$objTemplate->parseCurrentBlock();
     }
     // The same for a new Attribute
     $uri_param = '&cmd=Shop&act=products&tpl=attributes';
     self::$objTemplate->setVariable(array('SHOP_PRODUCT_ATTRIBUTE_TYPE_MENU' => Attributes::getDisplayTypeMenu(0, 0, 'updateOptionList(0)'), 'SHOP_PRODUCT_ATTRIBUTE_JS_VARS' => Attributes::getAttributeJSVars(), 'SHOP_PRODUCT_ATTRIBUTE_CURRENCY' => Currency::getDefaultCurrencySymbol(), 'SHOP_PAGING' => \Paging::get($uri_param, $_ARRAYLANG['TXT_PRODUCT_CHARACTERISTICS'], $count, $limit)));
 }