本文整理汇总了PHP中mslib_fe::getRealNameOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP mslib_fe::getRealNameOptions方法的具体用法?PHP mslib_fe::getRealNameOptions怎么用?PHP mslib_fe::getRealNameOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mslib_fe
的用法示例。
在下文中一共展示了mslib_fe::getRealNameOptions方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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");
}
示例2: str_replace
for ($x = 0; $x < $count_manual_attributes; $x++) {
if (strpos($this->post['edit_manual_price'][$x], '-') !== false) {
$price_prefix = '-';
$this->post['edit_manual_price'][$x] = str_replace('-', '', $this->post['edit_manual_price'][$x]);
} 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);
示例3: list
$return_data['delete_id'] = '#options_' . $option_id;
}
$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'];
示例4: 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']);
}
//.........这里部分代码省略.........