diff --git a/modules/ncart/ncart.view.php b/modules/ncart/ncart.view.php index c3886bb..c084fd6 100644 --- a/modules/ncart/ncart.view.php +++ b/modules/ncart/ncart.view.php @@ -223,7 +223,6 @@ function dispNcartOrderItems() return new Object(-1, $lang->msg_no_items); } - /* * stock check */ @@ -232,7 +231,7 @@ function dispNcartOrderItems() //quantity $stock = array(); - foreach ($cart->item_list as $key=>$val) + foreach ($cart->item_list as $key=>$val) { $item_info = $oNproductModel->getItemInfo($val->item_srl); diff --git a/modules/ncart/tpl/skin.js/itemdetail.js b/modules/ncart/tpl/skin.js/itemdetail.js index 45700ed..d664337 100644 --- a/modules/ncart/tpl/skin.js/itemdetail.js +++ b/modules/ncart/tpl/skin.js/itemdetail.js @@ -25,13 +25,18 @@ jQuery(function($) { if (!option_srl) return; var $opt = $('option:selected',this); var title = $opt.attr('data-title'); + var type = $opt.attr('data-type'); var price = parseFloat($opt.attr('data-price')); var str_price=''; if (price > 0) str_price = '(' + '+' + number_format(price) + ')'; if (price < 0) str_price = '(' + number_format(price) + ')'; - if (!$('#option_'+option_srl).length) { - $('#selected_options').append(''+ title + str_price + 'X' + number_format(item_price + (price)) + ''); + if (!$('#option_' + option_srl).length) { + if (type == 'Y') { + $('#selected_options').append('' + title + str_price + '' + xe.lang.each + 'X' + number_format(g_discounted_price + (price)) + ''); + } else { + $('#selected_options').append('' + title + str_price + '' + xe.lang.each + 'X' + number_format(g_discounted_price + (price)) + ''); + } } printTotalPrice(); diff --git a/modules/nproduct/m.skins/default/itemdetail.html b/modules/nproduct/m.skins/default/itemdetail.html index faba671..58230cb 100644 --- a/modules/nproduct/m.skins/default/itemdetail.html +++ b/modules/nproduct/m.skins/default/itemdetail.html @@ -94,7 +94,7 @@

{$item_info->item_name}

diff --git a/modules/nproduct/m.skins/elearning/itemdetail.html b/modules/nproduct/m.skins/elearning/itemdetail.html index b4fc193..c5feba1 100644 --- a/modules/nproduct/m.skins/elearning/itemdetail.html +++ b/modules/nproduct/m.skins/elearning/itemdetail.html @@ -86,7 +86,7 @@

{$item_info->item_name}

diff --git a/modules/nproduct/m.skins/shopping/itemdetail.html b/modules/nproduct/m.skins/shopping/itemdetail.html index 9f01f0a..4f1cf2d 100644 --- a/modules/nproduct/m.skins/shopping/itemdetail.html +++ b/modules/nproduct/m.skins/shopping/itemdetail.html @@ -75,7 +75,7 @@

{$item_info->item_name}

diff --git a/modules/nproduct/nproduct.class.php b/modules/nproduct/nproduct.class.php index 2e834e9..774fcfe 100644 --- a/modules/nproduct/nproduct.class.php +++ b/modules/nproduct/nproduct.class.php @@ -101,6 +101,11 @@ function checkUpdate() return true; } + if(!$oDB->isColumnExists('nproduct_options', 'type')) + { + return true; + } + return false; } @@ -253,6 +258,11 @@ function moduleUpdate() $oDB->addColumn('nproduct_items', 'minimum_order_quantity', 'number', '11', '0', TRUE); } + if(!$oDB->isColumnExists('nproduct_options', 'type')) + { + $oDB->addColumn('nproduct_options', 'type', 'varchar', '11'); + } + return new Object(0, 'success_updated'); } diff --git a/modules/nproduct/nproduct.controller.php b/modules/nproduct/nproduct.controller.php index 5ffefd6..858b16e 100644 --- a/modules/nproduct/nproduct.controller.php +++ b/modules/nproduct/nproduct.controller.php @@ -1167,6 +1167,7 @@ function procNproductInsertOptions() $option_srls = Context::get('option_srls'); $options_title = Context::get('options_title'); $options_price = Context::get('options_price'); + $options_type = Context::get('type'); $existing_options = $oNproductModel->getOptions($item_srl); @@ -1185,6 +1186,7 @@ function procNproductInsertOptions() $args->list_order = $args->option_srl * -1; $args->title = $val; $args->price = $options_price[$key]; + $args->type = $options_type[$key]; $output = executeQuery('nproduct.insertOption', $args); if(!$output->toBool()) { @@ -1197,6 +1199,7 @@ function procNproductInsertOptions() $args->list_order = $args->option_srl * -1; $args->title = $val; $args->price = $options_price[$key]; + $args->type = $options_type[$key]; $output = executeQuery('nproduct.updateOption', $args); if(!$output->toBool()) { @@ -1206,6 +1209,7 @@ function procNproductInsertOptions() } } + if(count($existing_options)) { $args = new stdClass(); diff --git a/modules/nproduct/nproduct.item.php b/modules/nproduct/nproduct.item.php index e889205..7311ea1 100644 --- a/modules/nproduct/nproduct.item.php +++ b/modules/nproduct/nproduct.item.php @@ -58,6 +58,7 @@ function nproductItem($info, $currency="KRW", $as_sign="N", $decimals=0) if(is_object($extra_vars) || is_array($extra_vars)) { + $this->extra_var_objs = new stdClass(); foreach ($extra_vars as $key => $val) { $this->extra_var_objs->{$val->column_name} = $val; diff --git a/modules/nproduct/nproduct.model.php b/modules/nproduct/nproduct.model.php index f1d81e2..9f749c6 100644 --- a/modules/nproduct/nproduct.model.php +++ b/modules/nproduct/nproduct.model.php @@ -32,6 +32,10 @@ function getModuleConfig() { $oModuleModel = getModel('module'); $config = $oModuleModel->getModuleConfig('nproduct'); + if(!$config) + { + $config = new stdClass(); + } if(!$config->cart_thumbnail_width) { $config->cart_thumbnail_width = 100; @@ -119,7 +123,7 @@ function getItemExtraFormList($module_srl, $filter_response = false) $join_form_list = array($join_form_list); } $join_form_count = count($join_form_list); - + $lang->extend_vars = array(); for($i = 0; $i < $join_form_count; $i++) { $join_form_list[$i]->column_name = strtolower($join_form_list[$i]->column_name); @@ -361,6 +365,7 @@ function getCombineItemExtras(&$item_info) */ function getCategoryInfo($node_id) { + $args = new stdClass(); $args->node_id = $node_id; $output = executeQuery('nproduct.getCategoryInfo', $args); if(!$output->toBool()) @@ -417,6 +422,7 @@ function getAllCategories() function getItemInfo($item_srl) { $config = $this->getModuleConfig(); + $args = new stdClass(); $args->item_srl = $item_srl; $output = executeQuery('nproduct.getItemInfo', $args); if(!$output->toBool()) @@ -470,6 +476,7 @@ function getItemNames(&$itemList) function getItemList($item_srl, $list_count = 20, $sort_index = 'list_order') { $config = $this->getModuleConfig(); + $args = new stdClass(); $args->item_srl = $item_srl; $args->list_count = $list_count; $args->sort_index = $sort_index; @@ -835,6 +842,7 @@ function getDiscount(&$item_info) */ function getGroupDiscount(&$item_info, $group_list) { + $args = new stdClass(); $args->item_srl = $item_info->item_srl; $output = executeQueryArray('nproduct.getGroupDiscount', $args); if(!$output->toBool()) @@ -887,6 +895,7 @@ function getGroupDiscount(&$item_info, $group_list) */ function getGlobalGroupDiscount($module_srl, &$item_info, $group_list) { + $args = new stdClass(); $args->module_srl = $module_srl; $output = executeQueryArray('nproduct.getGlobalGroupDiscount', $args); if(!$output->toBool()) @@ -952,6 +961,7 @@ function getQuantityDiscount(&$item_info, $logged_info) $purchase_count = $oNcartModel->getPurchaseCount($logged_info->member_srl, $item_info->item_srl); } + $args = new stdClass(); $args->item_srl = $item_info->item_srl; // check @@ -1005,6 +1015,7 @@ function getMemberDiscount(&$item_info, $logged_info) return new Object(); } + $args = new stdClass(); $args->member_srl = $logged_info->member_srl; // check @@ -1118,6 +1129,7 @@ function discountItems(&$item_list, $group_list = array(), $width = 50, $height $config = $oNcartModel->getModuleConfig(); + $ret_obj = new stdClass(); $ret_obj->total_price = 0; $ret_obj->sum_price = 0; $ret_obj->delivery_fee = 0; @@ -1166,12 +1178,18 @@ function discountItems(&$item_list, $group_list = array(), $width = 50, $height } if($option) { - // 단가 - $item_list[$key]->price = $val->price + ($option->price); - // 할인가 합계 - $item_list[$key]->sum_discounted_price += ($option->price * $val->quantity); - // 판매가(원가격) - $item_list[$key]->sum_price += ($option->price * $val->quantity); + if($option->type == 'Y') + { + $item_list[$key]->price = $option->price; + $item_list[$key]->sum_discounted_price = ($option->price * $val->quantity); + $item_list[$key]->sum_price = ($option->price * $val->quantity); + } + else + { + $item_list[$key]->price = $val->price + ($option->price); + $item_list[$key]->sum_discounted_price += ($option->price * $val->quantity); + $item_list[$key]->sum_price += ($option->price * $val->quantity); + } } $ret_obj->total_discounted_price += $item_list[$key]->sum_discounted_price; @@ -1237,6 +1255,7 @@ function getFrontDisplayItems($module_srl, $category_srl = null, $num_columns = $oFileModel = getModel('file'); // display categories + $args = new stdClass(); $args->module_srl = $module_srl; if($category_srl) { @@ -1328,6 +1347,7 @@ function getDisplayItems($module_srls, $category_srl, $maxsize) for($i = $nr_length - 1; $i >= 0; $i--) { + $args = new stdClass(); $args->module_srl = $module_srls; $args->node_route = $this->getNodeRoute($node_route, $i); $args->list_count = $maxsize; @@ -1423,6 +1443,7 @@ function getReviews(&$item_info) */ function getOptions($item_srl) { + $args = new stdClass(); $args->item_srl = $item_srl; $output = executeQueryArray('nproduct.getOptions', $args); $options = array(); @@ -1581,6 +1602,7 @@ function getNproductExtraVars($module_name = null, $item_srl = null) if($item_srl) { + $args = new stdClass(); $args->item_srl = $item_srl; $output = executeQueryArray("nproduct.getNproductExtraVars", $args); if(!$output->toBool()) @@ -1743,6 +1765,7 @@ function getNproductInputExtraVars($extra_info) */ function getItemExtraVarList($item_srl) { + $args = new stdClass(); $args->item_srl = $item_srl; $output = executeQueryArray("nproduct.getNproductExtraVars", $args); if(!$output->toBool()) @@ -1822,7 +1845,7 @@ function getProcModules() $output = ModuleHandler::triggerCall('nproduct.getProcModules', 'before', $module_list); if(!$output->toBool()) { - debugPrint($output); + } return $module_list; } diff --git a/modules/nproduct/queries/insertOption.xml b/modules/nproduct/queries/insertOption.xml index 115edc2..99be07c 100644 --- a/modules/nproduct/queries/insertOption.xml +++ b/modules/nproduct/queries/insertOption.xml @@ -8,6 +8,7 @@ + diff --git a/modules/nproduct/queries/updateOption.xml b/modules/nproduct/queries/updateOption.xml index 5203b89..96a715e 100644 --- a/modules/nproduct/queries/updateOption.xml +++ b/modules/nproduct/queries/updateOption.xml @@ -5,6 +5,7 @@ + diff --git a/modules/nproduct/schemas/nproduct_options.xml b/modules/nproduct/schemas/nproduct_options.xml index d9b7e64..f0edf98 100644 --- a/modules/nproduct/schemas/nproduct_options.xml +++ b/modules/nproduct/schemas/nproduct_options.xml @@ -3,6 +3,7 @@ + diff --git a/modules/nproduct/skins/book/itemdetail.html b/modules/nproduct/skins/book/itemdetail.html index 1077b0b..386e3ad 100644 --- a/modules/nproduct/skins/book/itemdetail.html +++ b/modules/nproduct/skins/book/itemdetail.html @@ -80,7 +80,7 @@
diff --git a/modules/nproduct/skins/default/itemdetail.html b/modules/nproduct/skins/default/itemdetail.html index 77f5c2d..53c88aa 100644 --- a/modules/nproduct/skins/default/itemdetail.html +++ b/modules/nproduct/skins/default/itemdetail.html @@ -84,7 +84,7 @@
diff --git a/modules/nproduct/skins/doorae/itemdetail.html b/modules/nproduct/skins/doorae/itemdetail.html index 190f4f1..817d027 100644 --- a/modules/nproduct/skins/doorae/itemdetail.html +++ b/modules/nproduct/skins/doorae/itemdetail.html @@ -99,7 +99,7 @@

{$item_info->item_name}

diff --git a/modules/nproduct/skins/elearning/itemdetail.html b/modules/nproduct/skins/elearning/itemdetail.html index 2c0c4ea..c07fc8e 100644 --- a/modules/nproduct/skins/elearning/itemdetail.html +++ b/modules/nproduct/skins/elearning/itemdetail.html @@ -96,7 +96,7 @@

{$item_info->item_name}

diff --git a/modules/nproduct/skins/en_eng/itemdetail.html b/modules/nproduct/skins/en_eng/itemdetail.html index f2101a7..83dec67 100644 --- a/modules/nproduct/skins/en_eng/itemdetail.html +++ b/modules/nproduct/skins/en_eng/itemdetail.html @@ -93,7 +93,7 @@

{$item_info->item_name}

diff --git a/modules/nproduct/skins/eng_book/itemdetail.html b/modules/nproduct/skins/eng_book/itemdetail.html index 9462f44..c1277c8 100644 --- a/modules/nproduct/skins/eng_book/itemdetail.html +++ b/modules/nproduct/skins/eng_book/itemdetail.html @@ -84,7 +84,7 @@
diff --git a/modules/nproduct/skins/merryj/itemdetail.html b/modules/nproduct/skins/merryj/itemdetail.html index 7720ecb..bcb2c0e 100644 --- a/modules/nproduct/skins/merryj/itemdetail.html +++ b/modules/nproduct/skins/merryj/itemdetail.html @@ -80,7 +80,7 @@
diff --git a/modules/nproduct/skins/shopping/itemdetail.html b/modules/nproduct/skins/shopping/itemdetail.html index 31a1e2b..68c2df4 100644 --- a/modules/nproduct/skins/shopping/itemdetail.html +++ b/modules/nproduct/skins/shopping/itemdetail.html @@ -78,7 +78,7 @@
diff --git a/modules/nproduct/skins/ydcloud/itemdetail.html b/modules/nproduct/skins/ydcloud/itemdetail.html index 4dbec53..505ed0a 100644 --- a/modules/nproduct/skins/ydcloud/itemdetail.html +++ b/modules/nproduct/skins/ydcloud/itemdetail.html @@ -92,7 +92,7 @@

{$item_info->item_name}

diff --git a/modules/nproduct/tpl/form_insert_options.html b/modules/nproduct/tpl/form_insert_options.html index 6ac845d..37bae54 100644 --- a/modules/nproduct/tpl/form_insert_options.html +++ b/modules/nproduct/tpl/form_insert_options.html @@ -6,7 +6,7 @@

{$lang->title_option}

- + @@ -14,11 +14,23 @@

{$lang->title_option}

+ {@$count++} +
{$lang->option_title}{$lang->extra_price}{$lang->option_title}{$lang->extra_price}type
+ +
+ +
diff --git a/modules/nproduct/tpl/skin.js/itemdetail.js b/modules/nproduct/tpl/skin.js/itemdetail.js index f9feb4b..184fca1 100644 --- a/modules/nproduct/tpl/skin.js/itemdetail.js +++ b/modules/nproduct/tpl/skin.js/itemdetail.js @@ -40,13 +40,18 @@ jQuery(function($) { if (!option_srl) return; var $opt = $('option:selected',this); var title = $opt.attr('data-title'); + var type = $opt.attr('data-type'); var price = parseFloat($opt.attr('data-price')); var str_price=''; if (price > 0) str_price = '(' + '+' + number_format(price) + ')'; if (price < 0) str_price = '(' + number_format(price) + ')'; - if (!$('#option_'+option_srl).length) { - $('#selected_options').append(''+ title + str_price + '' + xe.lang.each + 'X' + number_format(g_discounted_price + (price)) + ''); + if (!$('#option_' + option_srl).length) { + if (type == 'Y') { + $('#selected_options').append('' + title + str_price + '' + xe.lang.each + 'X' + number_format(g_discounted_price + (price)) + ''); + } else { + $('#selected_options').append('' + title + str_price + '' + xe.lang.each + 'X' + number_format(g_discounted_price + (price)) + ''); + } } printTotalPrice();