当前位置: 首页>>代码示例>>PHP>>正文


PHP mslib_fe::getNameOptions方法代码示例

本文整理汇总了PHP中mslib_fe::getNameOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP mslib_fe::getNameOptions方法的具体用法?PHP mslib_fe::getNameOptions怎么用?PHP mslib_fe::getNameOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mslib_fe的用法示例。


在下文中一共展示了mslib_fe::getNameOptions方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: insertOrdersProductPreProc

 function insertOrdersProductPreProc(&$params, &$reference)
 {
     error_log("insertOrdersProductPreProc - begin");
     $order_id = $params['insertArray']['orders_id'];
     $cart_product_item = $params['value'];
     $product_id = $cart_product_item['products_id'];
     $variant_id = $cart_product_item['variant_id'];
     // Get variant's details from the db
     $qry_res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('v.variant_price, v.variant_sku', 'tx_msvariants_domain_model_variants v', 'v.variant_id=' . $variant_id . ' and v.product_id=' . $product_id);
     if ($GLOBALS['TYPO3_DB']->sql_num_rows($qry_res) != 1) {
         // TODO this should never happen - raise exception?
         return;
     }
     $variant_data = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry_res);
     // Insert variant details about the order into the db
     $insert_array = array('order_id' => $order_id, 'product_id' => $product_id, 'variant_id' => $variant_id, 'price' => $variant_data['variant_price'], 'quantity' => $cart_product_item['qty'], 'sku' => $variant_data['variant_sku']);
     $res = $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_msvariants_domain_model_variantsorders', $insert_array);
     // Insert variant attributes details about the order into the db
     $qry_res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('va.attribute_id, va.option_id, va.option_value_id', 'tx_msvariants_domain_model_variantsattributes va', 'va.variant_id=' . $variant_id . ' and va.product_id=' . $product_id);
     if ($GLOBALS['TYPO3_DB']->sql_num_rows($qry_res) <= 0) {
         // TODO this should never happen - raise exception?
         return;
     }
     while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry_res)) != false) {
         $row['option_name'] = mslib_fe::getRealNameOptions($row['option_id']);
         $row['option_value_name'] = mslib_fe::getNameOptions($row['option_value_id']);
         $insert_array = array('order_id' => $order_id, 'product_id' => $product_id, 'variant_id' => $variant_id, 'attribute_id' => $row['attribute_id'], 'option_id' => $row['option_id'], 'option_value_id' => $row['option_value_id'], 'option_name' => $row['option_name'], 'option_value_name' => $row['option_value_name']);
         $res = $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_msvariants_domain_model_variantsattributesorders', $insert_array);
     }
     // while
     error_log("insertOrdersProductPreProc - end");
 }
开发者ID:piramidex,项目名称:msvariants,代码行数:32,代码来源:class.tx_msvariants_insertordersproductpreproc.php

示例2: array

            $js_select2_cache_options = array();
            $js_select2_cache_values = array();
            $js_select2_cache = '
			<script type="text/javascript">
				var attributesSearchOptions=[];
				var attributesSearchValues=[];
				var attributesOptions=[];
				var attributesValues=[];' . "\n";
            if ($product['products_id']) {
                if ($GLOBALS['TYPO3_DB']->sql_num_rows($qry_pa) > 0) {
                    $ctr = 1;
                    $options_data = array();
                    $attributes_data = array();
                    $attribute_values_class_id = array();
                    while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry_pa)) != false) {
                        $row['options_values_name'] = mslib_fe::getNameOptions($row['options_values_id']);
                        $options_data[$row['products_options_id']] = $row['products_options_name'];
                        $attributes_data[$row['products_options_id']][] = $row;
                        // js cache
                        $js_select2_cache_options[$row['products_options_id']] = 'attributesOptions[' . $row['products_options_id'] . ']={id:"' . $row['products_options_id'] . '", text:"' . htmlentities($row['products_options_name'], ENT_QUOTES) . '"}';
                        $js_select2_cache_values[$row['options_values_id']] = 'attributesValues[' . $row['options_values_id'] . ']={id:"' . $row['options_values_id'] . '", text:"' . htmlentities($row['options_values_name'], ENT_QUOTES) . '"}';
                    }
                    if (count($options_data)) {
                        $attributes_tab_block .= '<thead><tr id="product_attributes_content_row">';
                        $attributes_tab_block .= '<td colspan="5" id="products_attributes_items">';
                        foreach ($options_data as $option_id => $option_name) {
                            if (!isset($group_row_type) || $group_row_type == 'even_group_row') {
                                $group_row_type = 'odd_group_row';
                            } else {
                                $group_row_type = 'even_group_row';
                            }
开发者ID:bvbmedia,项目名称:multishop,代码行数:31,代码来源:admin_edit_product.php

示例3: str_replace

 } else {
     $price_prefix = '+';
     $this->post['edit_manual_price'][$x] = str_replace('+', '', $this->post['edit_manual_price'][$x]);
 }
 if (!empty($this->post['edit_manual_option'][$x]) && !empty($this->post['edit_manual_values'][$x])) {
     $optname = $this->post['edit_manual_option'][$x];
     $optid = 0;
     $optvalname = $this->post['edit_manual_values'][$x];
     $optvalid = 0;
     if (!$this->post['is_manual_option'][$x]) {
         $optid = $this->post['edit_manual_option'][$x];
         $optname = mslib_fe::getRealNameOptions($optid);
     }
     if (!$this->post['is_manual_value'][$x]) {
         $optvalid = $this->post['edit_manual_values'][$x];
         $optvalname = mslib_fe::getNameOptions($optvalid);
     }
     $insertArray = array();
     $insertArray['orders_id'] = (int) $this->get['orders_id'];
     $insertArray['orders_products_id'] = $orders_products_id;
     $insertArray['products_options'] = $optname;
     $insertArray['products_options_values'] = $optvalname;
     $insertArray['options_values_price'] = $this->post['edit_manual_price'][$x];
     $insertArray['price_prefix'] = $price_prefix;
     $insertArray['products_options_id'] = $optid;
     $insertArray['products_options_values_id'] = $optvalid;
     $query = $GLOBALS['TYPO3_DB']->INSERTquery('tx_multishop_orders_products_attributes', $insertArray);
     $res = $GLOBALS['TYPO3_DB']->sql_query($query);
     //$sql="insert into tx_multishop_orders_products_attributes (orders_id, orders_products_id, products_options, products_options_values, options_values_price, price_prefix, attributes_values, products_options_id, products_options_values_id) values ('".$this->get['orders_id']."', '".$orders_products_id."', '".$optname."', '".$optvalname."', '".$this->post['edit_manual_price'][$x]."', '".$price_prefix."', NULL, '".$optid."', '".$optvalid."')";
     //$GLOBALS['TYPO3_DB']->sql_query($sql);
 }
开发者ID:bvbmedia,项目名称:multishop,代码行数:31,代码来源:zzzz_admin_edit_order.php

示例4: insertProductPostHook

 function insertProductPostHook(&$params, &$reference)
 {
     // First time product is created so variants must be generated
     // and updated with the form inputs.....
     // TODO update with the form inputs
     error_log("insertProductPostHook - begin!");
     $products_id = $params['products_id'];
     error_log("products_id: " . $params['products_id']);
     error_log("products_id: " . $products_id);
     // product Attribute
     //if (!$reference->ms['MODULES']['DISABLE_PRODUCT_VARIANTS_TAB_IN_EDITOR'])
     // Get attributes (option and options values) for product from db
     // and create variants based on attributes and insert them into db
     $output = '';
     $sql_pa = $GLOBALS['TYPO3_DB']->SELECTquery('popt.required,popt.products_options_id, popt.products_options_name, popt.listtype, patrib.*', 'tx_multishop_products_options popt, tx_multishop_products_attributes patrib', "patrib.products_id='" . $products_id . "' and popt.language_id = '0' and patrib.options_id = popt.products_options_id", '', 'patrib.sort_order_option_name, patrib.sort_order_option_value', '');
     $qry_pa = $GLOBALS['TYPO3_DB']->sql_query($sql_pa);
     if ($products_id) {
         if ($GLOBALS['TYPO3_DB']->sql_num_rows($qry_pa) > 0) {
             $ctr = 1;
             $options_data = array();
             $attributes_data = array();
             while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry_pa)) != false) {
                 $row['options_values_name'] = mslib_fe::getNameOptions($row['options_values_id']);
                 $options_data[$row['products_options_id']] = $row['products_options_name'];
                 $attributes_data[$row['products_options_id']][] = $row;
             }
             if (count($options_data)) {
                 $num_options = count($options_data);
                 $options_ids = array_keys($options_data);
                 $counters = array_fill(0, $num_options, 0);
                 $limits = array();
                 $k = 0;
                 foreach ($options_ids as $option_id) {
                     $limits[$k] = count($attributes_data[$option_id]) - 1;
                     $k++;
                 }
                 $content_variants = '';
                 $k = 0;
                 while ($k < $num_options) {
                     if ($k == 0) {
                         $variant_name = 'Variant: ';
                         $content_options = '';
                         $markerArray = array();
                         // insert (variant_id, product_id, price, stock, sku) into db
                         $variant_row = array('variant_id' => 0, 'product_id' => $products_id, 'variant_price' => 0.0, 'variant_stock' => 0, 'variant_sku' => '');
                         $res = $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_msvariants_domain_model_variants', $variant_row);
                         error_log('variant row inserted res; ' . $res);
                         // TODO there must be a better way to set the variant_id or rename uid
                         $variant_id = $GLOBALS['TYPO3_DB']->sql_insert_id();
                         $update_array = array('variant_id' => $variant_id);
                         $res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_msvariants_domain_model_variants', 'uid=' . $variant_id, $update_array);
                         // insert list of options, values for the variant into db
                         for ($i = $num_options - 1; $i >= 0; $i--) {
                             $attribute_id = $attributes_data[$options_ids[$i]][$counters[$i]]['products_attributes_id'];
                             $option_id = $attributes_data[$options_ids[$i]][$counters[$i]]['options_id'];
                             $option_value_id = $attributes_data[$options_ids[$i]][$counters[$i]]['options_values_id'];
                             $option_name = $attributes_data[$options_ids[$i]][$counters[$i]]['products_options_name'];
                             $option_value = $attributes_data[$options_ids[$i]][$counters[$i]]['options_values_name'];
                             $variant_name .= $attributes_data[$options_ids[$i]][$counters[$i]]['options_values_name'] . " - ";
                             // insert (variant_id, ..., option, value) into db
                             $variant_option_row = array('variant_id' => $variant_id, 'product_id' => $products_id, 'attribute_id' => $attribute_id, 'option_id' => $option_id, 'option_value_id' => $option_value_id);
                             $res = $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_msvariants_domain_model_variantsattributes', $variant_option_row);
                             error_log('variantattribute row inserted res; ' . $res);
                         }
                     }
                     $counters[$k]++;
                     if ($counters[$k] > $limits[$k]) {
                         $counters[$k] = 0;
                         $k++;
                     } elseif ($k > 0) {
                         $k = 0;
                     }
                 }
             }
         }
     }
     error_log("insertProductPostHook - end");
 }
开发者ID:piramidex,项目名称:msvariants,代码行数:78,代码来源:class.tx_msvariants_insertproductposthook.php

示例5: list

         }
         $return_data['products_used'] = $total_product;
     }
     $json_data = mslib_befe::array2json($return_data);
     echo $json_data;
     exit;
     break;
 case 'delete_options_values':
     $option_id = 0;
     $option_value_id = 0;
     list($option_id, $option_value_id) = explode(':', $this->post['data_id']);
     $return_data = array();
     $return_data['option_id'] = $option_id;
     $return_data['option_value_id'] = $option_value_id;
     $return_data['option_name'] = mslib_fe::getRealNameOptions($option_id);
     $return_data['option_value_name'] = mslib_fe::getNameOptions($option_value_id);
     $return_data['data_id'] = $this->post['data_id'];
     $return_data['delete_status'] = 'notok';
     $have_entries_in_pa_table = false;
     if ($option_value_id > 0) {
         $str = "select products_id from tx_multishop_products_attributes where options_id='" . $option_id . "' and options_values_id=" . $option_value_id;
         $qry = $GLOBALS['TYPO3_DB']->sql_query($str);
         $total_product = $GLOBALS['TYPO3_DB']->sql_num_rows($qry);
         if ($total_product > 0) {
             $ctr = 0;
             $return_data['products'] = array();
             while ($rs = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry)) {
                 $product = mslib_fe::getProduct($rs['products_id'], '', '', 1);
                 if (!empty($product['products_name'])) {
                     $return_data['products'][$ctr]['name'] = $product['products_name'];
                     $return_data['products'][$ctr]['link'] = mslib_fe::typolink($this->shop_pid . ',2003', 'tx_multishop_pi1[page_section]=edit_product&pid=' . $rs['products_id'] . '&cid=' . $product['categories_id'] . '&action=edit_product');
开发者ID:bvbmedia,项目名称:multishop,代码行数:31,代码来源:admin_ajax_attributes_options_values.php

示例6: adminEditProductPreProc

 function adminEditProductPreProc(&$params, &$reference)
 {
     //----------------------------------------
     // VARIANTS TAB
     //----------------------------------------
     // product Attribute
     //if (!$reference->ms['MODULES']['DISABLE_PRODUCT_VARIANTS_TAB_IN_EDITOR']) {
     $product = $params['product'];
     // Get HTML template file
     if ($reference->conf['edit_variants_tmpl_path']) {
         $template = $reference->cObj->fileResource($reference->conf['edit_variants_tmpl_path']);
     } else {
         $template = $reference->cObj->fileResource(t3lib_extMgm::siteRelPath('msvariants') . 'Templates/edit_variants.tmpl');
     }
     // Extract the subparts from the template
     $subparts = array();
     $subparts['template'] = $reference->cObj->getSubpart($template, '###TEMPLATE###');
     $subparts['item_variant'] = $reference->cObj->getSubpart($subparts['template'], '###ITEM_VARIANT###');
     $subparts['item_option'] = $reference->cObj->getSubpart($subparts['template'], '###ITEM_OPTION###');
     // Get variants from db
     $sql_pa = $GLOBALS['TYPO3_DB']->SELECTquery('vars.variant_id, vars.product_id, vars.variant_price, vars.variant_stock, vars.variant_sku, vattrs.attribute_id, vattrs.option_id, vattrs.option_value_id', 'tx_msvariants_domain_model_variants vars, tx_msvariants_domain_model_variantsattributes vattrs', "vars.product_id='" . $product['products_id'] . "' and vars.variant_id=vattrs.variant_id", '', '', '');
     $qry_pa = $GLOBALS['TYPO3_DB']->sql_query($sql_pa);
     // Generate HTML for variants tab block if there are variants
     if ($product['products_id']) {
         if ($GLOBALS['TYPO3_DB']->sql_num_rows($qry_pa) > 0) {
             $variants_data = array();
             $variants_attributes_data = array();
             while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry_pa)) != false) {
                 if (!$variants_data[$row['variant_id']]) {
                     $variants_data[$row['variant_id']] = array('variant_id' => $row['variant_id'], 'product_id' => $row['product_id'], 'variant_price' => $row['variant_price'], 'variant_stock' => $row['variant_stock'], 'variant_sku' => $row['variant_sku']);
                 }
                 $row['option_name'] = mslib_fe::getRealNameOptions($row['option_id']);
                 $row['option_value_name'] = mslib_fe::getNameOptions($row['option_value_id']);
                 $variants_attributes_data[$row['variant_id']][] = $row;
             }
             // Generate HTML for variants
             foreach ($variants_data as $variant) {
                 $variant_name = 'Variant: ';
                 // generate HTML for variant's attributes
                 $content_options = '';
                 $markerArray = array();
                 foreach ($variants_attributes_data[$variant['variant_id']] as $variant_attribute) {
                     $markerArray['OPTION_NAME'] = $variant_attribute['option_name'];
                     $markerArray['OPTION_VALUE'] = $variant_attribute['option_value_name'];
                     $content_options .= $reference->cObj->substituteMarkerArray($subparts['item_option'], $markerArray, '###|###');
                     $variant_name .= $variant_attribute['option_value_name'] . " - ";
                 }
                 // generate HTML for variant details
                 $markerArray = array();
                 $markerArray['LABEL_VARIANT_NAME'] = $variant_name;
                 $markerArray['LABEL_PRICE'] = 'Price';
                 $markerArray['LABEL_STOCK'] = 'Stock';
                 $markerArray['LABEL_SKU'] = 'SKU';
                 $markerArray['VARIANT_ID'] = $variant['variant_id'];
                 $markerArray['PRICE'] = $variant['variant_price'];
                 $markerArray['STOCK'] = $variant['variant_stock'];
                 $markerArray['SKU'] = $variant['variant_sku'];
                 $content_item_variant = $reference->cObj->substituteMarkerArray($subparts['item_variant'], $markerArray, '###|###');
                 $content_item_variant = $reference->cObj->substituteSubpart($content_item_variant, 'ITEM_OPTION', $content_options);
                 $content_variants .= $content_item_variant;
             }
             // Generate HTML for variants tab block
             $markerArray = array();
             $markerArray['LABEL_HEADING_TAB_VARIANTS'] = 'VARIANTS';
             $content = $reference->cObj->substituteMarkerArray($subparts['template'], $markerArray, '###|###');
             $content = $reference->cObj->substituteSubpart($content, 'ITEM_VARIANT', $content_variants);
         }
     }
     $params['plugins_extra_tab']['tabs_header'][] = '<li><a href="#product_variants">VARIANTS</a></li>';
     //$params['plugins_extra_tab']['tabs_content'][] =
     //  '<div style="display:none;" id="product_variants" class="tab_content">'.$res.'</div';
     $params['plugins_extra_tab']['tabs_content'][] = $content;
     //----------------------------------------
     // VARIANTS IMAGES TAB
     //----------------------------------------
     // product Attribute
     //if (!$reference->ms['MODULES']['DISABLE_PRODUCT_VARIANTS_TAB_IN_EDITOR']) {
     // Get HTML template file
     if ($reference->conf['edit_variants_images_tmpl_path']) {
         $template = $reference->cObj->fileResource($reference->conf['edit_variants_images_tmpl_path']);
     } else {
         $template = $reference->cObj->fileResource(t3lib_extMgm::siteRelPath('msvariants') . 'Templates/edit_variants_images.tmpl');
     }
     // Extract the subparts from the template
     $subparts = array();
     $subparts['template'] = $reference->cObj->getSubpart($template, '###TEMPLATE###');
     $subparts['item_variant_images'] = $reference->cObj->getSubpart($subparts['template'], '###ITEM_VARIANT_IMAGES###');
     $subparts['item_option'] = $reference->cObj->getSubpart($subparts['template'], '###ITEM_OPTION###');
     // Get variants from db
     $sql_pa = $GLOBALS['TYPO3_DB']->SELECTquery('vars.variant_id, vars.product_id, vars.variant_price, vars.variant_stock, vars.variant_sku, vattrs.attribute_id, vattrs.option_id, vattrs.option_value_id', 'tx_msvariants_domain_model_variants vars, tx_msvariants_domain_model_variantsattributes vattrs', "vars.product_id='" . $product['products_id'] . "' and vars.variant_id=vattrs.variant_id", '', '', '');
     $qry_pa = $GLOBALS['TYPO3_DB']->sql_query($sql_pa);
     // Generate HTML for variants tab block if there are variants
     if ($product['products_id']) {
         if ($GLOBALS['TYPO3_DB']->sql_num_rows($qry_pa) > 0) {
             $variants_data = array();
             $variants_attributes_data = array();
             while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry_pa)) != false) {
                 if (!$variants_data[$row['variant_id']]) {
                     $variants_data[$row['variant_id']] = array('variant_id' => $row['variant_id'], 'product_id' => $row['product_id'], 'variant_price' => $row['variant_price'], 'variant_stock' => $row['variant_stock'], 'variant_sku' => $row['variant_sku']);
                 }
//.........这里部分代码省略.........
开发者ID:piramidex,项目名称:msvariants,代码行数:101,代码来源:class.tx_msvariants_admineditproductpreproc.php


注:本文中的mslib_fe::getNameOptions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。