|
@@ -87,6 +87,50 @@
|
|
|
?>
|
|
|
<?= Yii::$service->page->widget->render($optionsView,$optionsParam); ?>
|
|
|
</div>
|
|
|
+
|
|
|
+ <!-- 自定义界面Star -->
|
|
|
+ <div class="product_custom_options">
|
|
|
+ <?php
|
|
|
+ $groupAttrArr = [
|
|
|
+ 'Bust'=>'80',
|
|
|
+ 'Waist'=>'60',
|
|
|
+ 'Hips'=>'70',
|
|
|
+ 'Hollow to floor'=>'60',
|
|
|
+ ];
|
|
|
+ ?>
|
|
|
+ <div id="user_custom">
|
|
|
+ <?php if(is_array($groupAttrArr)): ?>
|
|
|
+ <?php echo "<table style='line-height: 1rem;' ><tr><td width='40%'><div>"; ?>
|
|
|
+ <?php foreach($groupAttrArr as $k => $v): ?>
|
|
|
+ <?= "".$k."</br>"; ?>
|
|
|
+ <?php endforeach; ?>
|
|
|
+ <?php echo "</div></td><td><div id='my_size_box'>" ?>
|
|
|
+ <?php foreach($groupAttrArr as $k => $v): ?>
|
|
|
+ <?= "".$v."cm</br>"; ?>
|
|
|
+ <?php endforeach; ?>
|
|
|
+ <?php echo "</div></td></tr></table>" ?>
|
|
|
+ <?php endif; ?>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ <div id="user_custom_content" style="display: none;">
|
|
|
+
|
|
|
+ <?php if(is_array($groupAttrArr)): ?>
|
|
|
+ <?php echo "<table style='line-height: 1rem;'><tr><td width='40%'><div>"; ?>
|
|
|
+ <?php foreach($groupAttrArr as $k => $v): ?>
|
|
|
+ <?= "".$k."</br>"; ?>
|
|
|
+ <?php endforeach; ?>
|
|
|
+ <?php echo "</div></td><td><div>" ?>
|
|
|
+ <?php foreach($groupAttrArr as $k => $v): ?>
|
|
|
+ <input class="custom_op" type="number" min="1" max="500" attr="<?=$k?>" style="width: 50px;">cm</br>
|
|
|
+ <?php endforeach; ?>
|
|
|
+ <?php echo "</div></td></tr></table>" ?>
|
|
|
+ <?php endif; ?>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 自定义界面End -->
|
|
|
+
|
|
|
<div class="product_qty pg">
|
|
|
<div class="label"><?= Yii::$service->page->translate->__('Qty:'); ?></div>
|
|
|
<div class="rg">
|
|
@@ -253,6 +297,32 @@
|
|
|
error:function (XMLHttpRequest, textStatus, errorThrown){}
|
|
|
});
|
|
|
|
|
|
+
|
|
|
+ //自定义JS
|
|
|
+ $(".my_sizebj").click(function(){
|
|
|
+ var my_size = $(this).text();
|
|
|
+ var my_size_attr = new Array();
|
|
|
+ my_size_attr['s'] = new Array('80','60','70','90');
|
|
|
+ my_size_attr['m'] = new Array('90','70','80','100');
|
|
|
+ my_size_attr['xl'] = new Array('100','80','90','110');
|
|
|
+
|
|
|
+ if(my_size == 'CustomSize'){
|
|
|
+ $("#user_custom").css('display','none');
|
|
|
+ $("#user_custom_content").css('display','block');
|
|
|
+ }else{
|
|
|
+ $("#user_custom").css('display','block');
|
|
|
+ $("#user_custom_content").css('display','none');
|
|
|
+ var my_size_for = my_size_attr[my_size];
|
|
|
+ var my_size_html = '';
|
|
|
+ var x;
|
|
|
+ for(x in my_size_for){
|
|
|
+ my_size_html += my_size_for[x] + "cm<br/>";
|
|
|
+ }
|
|
|
+ $("#my_size_box").html(my_size_html);
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
$(".addProductToCart").click(function(){
|
|
|
i = 1;
|
|
|
$(".product_custom_options .pg .rg ul.required").each(function(){
|
|
@@ -274,6 +344,29 @@
|
|
|
custom_option[attr] = value;
|
|
|
});
|
|
|
custom_option_json = JSON.stringify(custom_option);
|
|
|
+
|
|
|
+
|
|
|
+ var a = $(".current.my_sizebj").text();
|
|
|
+ if(a == 'CustomSize'){
|
|
|
+ customsize = new Object();
|
|
|
+ $("input.custom_op").each(function(){
|
|
|
+ attr = $(this).attr("attr");
|
|
|
+ value = $(this).val();
|
|
|
+ customsize[attr] = value;
|
|
|
+
|
|
|
+ if(value == ''){
|
|
|
+ alert("Please fill in "+ attr);
|
|
|
+ throw SyntaxError();
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+ customsize = JSON.stringify(customsize);
|
|
|
+ }else{
|
|
|
+
|
|
|
+ customsize = '';
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//alert(custom_option_json);
|
|
|
sku = $(".sku").val();
|
|
|
qty = $(".qty").val();
|
|
@@ -290,6 +383,7 @@
|
|
|
$data['custom_option'] = custom_option_json;
|
|
|
$data['product_id'] = "<?= $_id ?>";
|
|
|
$data['qty'] = qty;
|
|
|
+ $data['customsize'] = customsize;
|
|
|
if (csrfName && csrfVal) {
|
|
|
$data[csrfName] = csrfVal;
|
|
|
}
|