Skip to content

Commit

Permalink
git merge 'develop-option'
Browse files Browse the repository at this point in the history
  • Loading branch information
bjrambo committed Mar 10, 2016
1 parent 91697b7 commit 4e44472
Show file tree
Hide file tree
Showing 23 changed files with 89 additions and 27 deletions.
3 changes: 1 addition & 2 deletions modules/ncart/ncart.view.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ function dispNcartOrderItems()
return new Object(-1, $lang->msg_no_items);
}


/*
* stock check
*/
Expand All @@ -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);

Expand Down
9 changes: 7 additions & 2 deletions modules/ncart/tpl/skin.js/itemdetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('<tr id="option_'+option_srl+'" data-price="'+ (item_price + (price)) +'"><td>'+ title + str_price + '</td><td><input type="hidden" name="option_srls" value="' + option_srl + '" /><input type="text" name="quantities" class="quantity" value="1" />개</td><td><span onclick="jQuery(this).parent().parent().remove(); printTotalPrice();" class="deleteItem">X</span></td><td><span>' + number_format(item_price + (price)) + '</span></td></tr>');
if (!$('#option_' + option_srl).length) {
if (type == 'Y') {
$('#selected_options').append('<tr id="option_' + option_srl + '" data-price="' + (price) + '"><td>' + title + str_price + '</td><td><input type="hidden" name="option_srls" value="' + option_srl + '" /><input type="text" name="quantities" class="quantity" value="1" />' + xe.lang.each + '</td><td><span onclick="jQuery(this).parent().parent().remove(); printTotalPrice();" class="deleteItem">X</span></td><td><span>' + number_format(g_discounted_price + (price)) + '</span></td></tr>');
} else {
$('#selected_options').append('<tr id="option_' + option_srl + '" data-price="' + (g_discounted_price + (price)) + '"><td>' + title + str_price + '</td><td><input type="hidden" name="option_srls" value="' + option_srl + '" /><input type="text" name="quantities" class="quantity" value="1" />' + xe.lang.each + '</td><td><span onclick="jQuery(this).parent().parent().remove(); printTotalPrice();" class="deleteItem">X</span></td><td><span>' + number_format(g_discounted_price + (price)) + '</span></td></tr>');
}
}

printTotalPrice();
Expand Down
2 changes: 1 addition & 1 deletion modules/nproduct/m.skins/default/itemdetail.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ <h2 class="product_name">{$item_info->item_name}</h2>
<div class="text-right">
<select id="select_options">
<option value="">선택하세요</option>
<option loop="$options=>$key,$val" value="{$val->option_srl}" data-title="{$val->title}" data-price="{$val->price}">{$val->title} <span cond="$val->price > 0">+</span><span cond="$val->price != 0">{nproductItem::formatMoney($val->price)}</span></option>
<option loop="$options=>$key,$val" value="{$val->option_srl}" data-title="{$val->title}" data-price="{$val->price}" data-type="{$val->type}">{$val->title} <span cond="$val->price > 0">+</span><span cond="$val->price != 0">{nproductItem::formatMoney($val->price)}</span></option>
</select>

<div class="text-right">
Expand Down
2 changes: 1 addition & 1 deletion modules/nproduct/m.skins/elearning/itemdetail.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ <h2 class="product_name">{$item_info->item_name}</h2><a cond="$sample_content" h
<div class="text-right">
<select id="select_options">
<option value="">{$lang->cmd_select}</option>
<option loop="$options=>$key,$val" value="{$val->option_srl}" data-title="{$val->title}" data-price="{$val->price}">{$val->title} <span cond="$val->price > 0">+</span><span cond="$val->price != 0">{nproductItem::formatMoney($val->price)}</span></option>
<option loop="$options=>$key,$val" value="{$val->option_srl}" data-title="{$val->title}" data-price="{$val->price}" data-type="{$val->type}">{$val->title} <span cond="$val->price > 0">+</span><span cond="$val->price != 0">{nproductItem::formatMoney($val->price)}</span></option>
</select>

<div class="text-right">
Expand Down
2 changes: 1 addition & 1 deletion modules/nproduct/m.skins/shopping/itemdetail.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ <h2 class="product_name">{$item_info->item_name}</h2>
<div class="text-right">
<select id="select_options">
<option value="">{$lang->cmd_select}</option>
<option loop="$options=>$key,$val" value="{$val->option_srl}" data-title="{$val->title}" data-price="{$val->price}">{$val->title} <span cond="$val->price > 0">+</span><span cond="$val->price != 0">{nproductItem::formatMoney($val->price)}</span></option>
<option loop="$options=>$key,$val" value="{$val->option_srl}" data-title="{$val->title}" data-price="{$val->price}" data-type="{$val->type}">{$val->title} <span cond="$val->price > 0">+</span><span cond="$val->price != 0">{nproductItem::formatMoney($val->price)}</span></option>
</select>

<div class="text-right">
Expand Down
10 changes: 10 additions & 0 deletions modules/nproduct/nproduct.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ function checkUpdate()
return true;
}

if(!$oDB->isColumnExists('nproduct_options', 'type'))
{
return true;
}

return false;
}

Expand Down Expand Up @@ -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');
}

Expand Down
4 changes: 4 additions & 0 deletions modules/nproduct/nproduct.controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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())
{
Expand All @@ -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())
{
Expand All @@ -1206,6 +1209,7 @@ function procNproductInsertOptions()
}
}


if(count($existing_options))
{
$args = new stdClass();
Expand Down
1 change: 1 addition & 0 deletions modules/nproduct/nproduct.item.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
39 changes: 31 additions & 8 deletions modules/nproduct/nproduct.model.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1005,6 +1015,7 @@ function getMemberDiscount(&$item_info, $logged_info)
return new Object();
}

$args = new stdClass();
$args->member_srl = $logged_info->member_srl;

// check
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -1822,7 +1845,7 @@ function getProcModules()
$output = ModuleHandler::triggerCall('nproduct.getProcModules', 'before', $module_list);
if(!$output->toBool())
{
debugPrint($output);

}
return $module_list;
}
Expand Down
1 change: 1 addition & 0 deletions modules/nproduct/queries/insertOption.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<column name="title" var="title" notnull="notnull" />
<column name="price" var="price" notnull="notnull" />
<column name="list_order" var="list_order" />
<column name="type" var="type" />
<column name="regdate" var="regdate" default="curdate()" />
</columns>
</query>
1 change: 1 addition & 0 deletions modules/nproduct/queries/updateOption.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<columns>
<column name="title" var="title" />
<column name="price" var="price" />
<column name="type" var="type" />
</columns>
<conditions>
<condition operation="equal" column="option_srl" var="option_srl" notnull="notnull" />
Expand Down
1 change: 1 addition & 0 deletions modules/nproduct/schemas/nproduct_options.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<column name="item_srl" type="number" size="11" index="idx_item_srl" />
<column name="title" type="varchar" size="250" />
<column name="price" type="number" size="11" notnull="notnull" default="0" />
<column name="type" type="varchar" size="11" default="0" />
<column name="list_order" type="number" size="11" notnull="notnull" />
<column name="regdate" type="date" notnull="notnull" index="idx_regdate" />
</table>
2 changes: 1 addition & 1 deletion modules/nproduct/skins/book/itemdetail.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<div>
<select id="select_options">
<option value="">{$lang->cmd_select}</option>
<option loop="$options=>$key,$val" value="{$val->option_srl}" data-title="{$val->title}" data-price="{$val->price}">{$val->title} <span cond="$val->price > 0">+</span><span cond="$val->price != 0">{nproductItem::formatMoney($val->price)}</span></option>
<option loop="$options=>$key,$val" value="{$val->option_srl}" data-title="{$val->title}" data-price="{$val->price}" data-type="{$val->type}">{$val->title} <span cond="$val->price > 0">+</span><span cond="$val->price != 0">{nproductItem::formatMoney($val->price)}</span></option>
</select>

<div>
Expand Down
2 changes: 1 addition & 1 deletion modules/nproduct/skins/default/itemdetail.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<td>
<select id="select_options">
<option value="">{$lang->cmd_select}</option>
<option loop="$options=>$key,$val" value="{$val->option_srl}" data-title="{$val->title}" data-price="{$val->price}">{$val->title} <span cond="$val->price > 0">+</span><span cond="$val->price != 0">{nproductItem::formatMoney($val->price)}</span></option>
<option loop="$options=>$key,$val" value="{$val->option_srl}" data-title="{$val->title}" data-price="{$val->price}" data-type="{$val->type}">{$val->title} <span cond="$val->price > 0">+</span><span cond="$val->price != 0">{nproductItem::formatMoney($val->price)}</span></option>
</select>

<div>
Expand Down
2 changes: 1 addition & 1 deletion modules/nproduct/skins/doorae/itemdetail.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ <h2 class="product_name">{$item_info->item_name}</h2>
<td>
<select id="select_options">
<option value="">선택하세요</option>
<option loop="$options=>$key,$val" value="{$val->option_srl}" data-title="{$val->title}" data-price="{$val->price}">{$val->title} <span cond="$val->price > 0">+</span><span cond="$val->price != 0">{nstore_coreItem::formatMoney($val->price)}</span></option>
<option loop="$options=>$key,$val" value="{$val->option_srl}" data-title="{$val->title}" data-price="{$val->price}" data-type="{$val->type}">{$val->title} <span cond="$val->price > 0">+</span><span cond="$val->price != 0">{nstore_coreItem::formatMoney($val->price)}</span></option>
</select>

<div>
Expand Down
2 changes: 1 addition & 1 deletion modules/nproduct/skins/elearning/itemdetail.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ <h2 class="product_name">{$item_info->item_name}</h2>
<td>
<select id="select_options">
<option value="">선택하세요</option>
<option loop="$options=>$key,$val" value="{$val->option_srl}" data-title="{$val->title}" data-price="{$val->price}">{$val->title} <span cond="$val->price > 0">+</span><span cond="$val->price != 0">{nstore_coreItem::formatMoney($val->price)}</span></option>
<option loop="$options=>$key,$val" value="{$val->option_srl}" data-title="{$val->title}" data-price="{$val->price}" data-type="{$val->type}">{$val->title} <span cond="$val->price > 0">+</span><span cond="$val->price != 0">{nstore_coreItem::formatMoney($val->price)}</span></option>
</select>

<div>
Expand Down
2 changes: 1 addition & 1 deletion modules/nproduct/skins/en_eng/itemdetail.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ <h2 class="product_name">{$item_info->item_name}</h2><a cond="$sample_content" h
<td>
<select id="select_options">
<option value="">{$cmd_select}</option>
<option loop="$options=>$key,$val" value="{$val->option_srl}" data-title="{$val->title}" data-price="{$val->price}">{$val->title} <span cond="$val->price > 0">+</span><span cond="$val->price != 0">{nproductItem::formatMoney($val->price)}</span></option>
<option loop="$options=>$key,$val" value="{$val->option_srl}" data-title="{$val->title}" data-price="{$val->price}" data-type="{$val->type}">{$val->title} <span cond="$val->price > 0">+</span><span cond="$val->price != 0">{nproductItem::formatMoney($val->price)}</span></option>
</select>

<div>
Expand Down
2 changes: 1 addition & 1 deletion modules/nproduct/skins/eng_book/itemdetail.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<div>
<select id="select_options">
<option value="">{$lang->cmd_select}</option>
<option loop="$options=>$key,$val" value="{$val->option_srl}" data-title="{$val->title}" data-price="{$val->price}">{$val->title} <span cond="$val->price > 0">+</span><span cond="$val->price != 0">{nproductItem::formatMoney($val->price)}</span></option>
<option loop="$options=>$key,$val" value="{$val->option_srl}" data-title="{$val->title}" data-price="{$val->price}" data-type="{$val->type}">{$val->title} <span cond="$val->price > 0">+</span><span cond="$val->price != 0">{nproductItem::formatMoney($val->price)}</span></option>
</select>

<div>
Expand Down
2 changes: 1 addition & 1 deletion modules/nproduct/skins/merryj/itemdetail.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<div>
<select id="select_options">
<option value="">{$lang->cmd_select}</option>
<option loop="$options=>$key,$val" value="{$val->option_srl}" data-title="{$val->title}" data-price="{$val->price}">{$val->title} <span cond="$val->price > 0">+</span><span cond="$val->price != 0">{nproductItem::formatMoney($val->price)}</span></option>
<option loop="$options=>$key,$val" value="{$val->option_srl}" data-title="{$val->title}" data-price="{$val->price}" data-type="{$val->type}">{$val->title} <span cond="$val->price > 0">+</span><span cond="$val->price != 0">{nproductItem::formatMoney($val->price)}</span></option>
</select>

<div>
Expand Down
2 changes: 1 addition & 1 deletion modules/nproduct/skins/shopping/itemdetail.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<td>
<select id="select_options">
<option value="">{$lang->cmd_select}</option>
<option loop="$options=>$key,$val" value="{$val->option_srl}" data-title="{$val->title}" data-price="{$val->price}">{$val->title} <span cond="$val->price > 0">+</span><span cond="$val->price != 0">{nproductItem::formatMoney($val->price)}</span></option>
<option loop="$options=>$key,$val" value="{$val->option_srl}" data-title="{$val->title}" data-price="{$val->price}" data-type="{$val->type}">{$val->title} <span cond="$val->price > 0">+</span><span cond="$val->price != 0">{nproductItem::formatMoney($val->price)}</span></option>
</select>

<div>
Expand Down
2 changes: 1 addition & 1 deletion modules/nproduct/skins/ydcloud/itemdetail.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ <h2 class="product_name">{$item_info->item_name}</h2><a cond="$sample_content" h
<td>
<select id="select_options">
<option value="">{$cmd_select}</option>
<option loop="$options=>$key,$val" value="{$val->option_srl}" data-title="{$val->title}" data-price="{$val->price}">{$val->title} <span cond="$val->price > 0">+</span><span cond="$val->price != 0">{nproductItem::formatMoney($val->price)}</span></option>
<option loop="$options=>$key,$val" value="{$val->option_srl}" data-title="{$val->title}" data-price="{$val->price}" data-type="{$val->type}">{$val->title} <span cond="$val->price > 0">+</span><span cond="$val->price != 0">{nproductItem::formatMoney($val->price)}</span></option>
</select>

<div>
Expand Down

0 comments on commit 4e44472

Please sign in to comment.