%PDF-1.7 GIF89;
Server IP : 5.161.254.237 / Your IP : 216.73.216.52 Web Server : Apache System : Linux diamond.sialwebvps.com 4.18.0-553.8.1.el8_10.x86_64 #1 SMP Tue Jul 2 07:26:33 EDT 2024 x86_64 User : stellasp ( 1131) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/stellasp/www/application/views/admin/ |
Upload File : |
<?php defined('BASEPATH') OR exit('No direct script access allowed');?> <?php $this->load->view('backend/Common/Head'); ?> <?php $this->load->view('backend/Common/Header'); ?> <?php $this->load->view('backend/Common/Sidebar'); ?> <?php $this->load->view('backend/Common/Menu'); ?> <div class="right_col" role="main"> <?php //lets have the flashdata overright "$message" if it exists if($this->session->flashdata('message')) { $message = $this->session->flashdata('message'); } if($this->session->flashdata('error')) { $error = $this->session->flashdata('error'); } if(function_exists('validation_errors') && validation_errors() != '') { $error = validation_errors(); } ?> <?php if (!empty($message)): ?> <div class="alert alert-success alert-dismissible fade in" > <p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span> <strong><?php echo lang('common_note') ?>:</strong> <?php echo $message; ?></p> </div> <?php endif; ?> <?php if (!empty($error)): ?> <div class="alert alert-danger alert-dismissible fade in" > <p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span> <strong><?php echo lang('common_alert') ?>:</strong> <?php echo $error; ?></p> </div> <?php endif; ?> <div id="js_error_container" class="alert alert-warning alert-dismissible fade in" style="display:none; padding:10px; margin-bottom:10px;"> <p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span> <strong><?php echo lang('common_alert') ?>:</strong> <span id="js_error"></span> </p> </div> <div class=""> <div class="page-title"> <div class="title_left"> <h3><?php echo $page_title; ?></h3> </div> <div class="title_right"> <div class="col-md-5 col-sm-5 col-xs-12 form-group pull-right top_search"> </div> </div> </div> <div class="clearfix"></div> <div class="row"> <div class="col-md-12 col-sm-12 col-xs-12"> <div class="x_panel"> <div class="x_title"> <h2><?php echo $page_title; ?> <small> </small></h2> <ul class="nav navbar-right panel_toolbox"> </ul> <div class="clearfix"></div> </div> <div class="x_content"> <?php echo form_open($this->config->item('admin_folder').'/products/form/'.$id, 'enctype="multipart/form-data" id="product_form" class="form-horizontal form-label-left" novalidate'); ?> <div class="" role="tabpanel" data-example-id="togglable-tabs"> <ul id="myTab" class="nav nav-tabs bar_tabs" role="tablist"> <li role="presentation" class="active" ><a href="#gc_product_info" role="tab" data-toggle="tab" aria-expanded="true"><?php echo lang('description');?></a></li> <li role="presentation" class="" ><a href="#gc_product_attributes" role="tab" id="profile-tab" data-toggle="tab" aria-expanded="false" ><?php echo lang('attributes');?></a></li> <li role="presentation" class="" ><a href="#gc_product_categories" role="tab" id="profile-tab" data-toggle="tab" aria-expanded="false" ><?php echo lang('categories');?></a></li> <li role="presentation" class="" ><a href="#gc_product_downloads" role="tab" id="profile-tab" data-toggle="tab" aria-expanded="false"><?php echo lang('digital_content');?></a></li><!-- --> <!-- <li role="presentation" class="" ><a href="#gc_product_pdf" role="tab" id="profile-tab" data-toggle="tab" aria-expanded="false">Product PDF</a></li> --> <li role="presentation" class=""><a href="#gc_product_seo" role="tab" id="profile-tab" data-toggle="tab" aria-expanded="false"><?php echo lang('seo');?></a></li> <li role="presentation" class=""><a href="#gc_product_options" role="tab" id="profile-tab" data-toggle="tab" aria-expanded="false" ><?php echo lang('options');?></a></li> <li role="presentation" class=" "><a href="#gc_product_related" role="tab" id="profile-tab" data-toggle="tab" aria-expanded="false"><?php echo lang('related_products');?></a></li> <li role="presentation" class=""><a href="#gc_product_photos" role="tab" id="profile-tab" data-toggle="tab" aria-expanded="false"><?php echo lang('images');?></a></li> <!-- <li role="presentation" class=""><a href="#gc_product_icons" role="tab" id="profile-tab" data-toggle="tab" aria-expanded="false">Icons</a></li> <li role="presentation" class=""><a href="#gc_product_data_sheet" role="tab" id="profile-tab" data-toggle="tab" aria-expanded="false">Sheet</a></li> --> </ul> <div id="myTabContent" class="tab-content"> <div id="gc_product_info" class="tab-pane fade active in" id="tab_content1" aria-labelledby="home-tab"> <div class="item form-group"> <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name"> <?php echo lang('name');?> <span class="required">*</span> </label> <div class="col-md-6 col-sm-6 col-xs-12"> <?php $data = array('id'=>'name', 'name'=>'name', 'value'=>set_value('name', $name), 'class'=>'form-control col-md-7 col-xs-12'); echo form_input($data); ?> </div> </div> <div class="item form-group"> <label for="weight"><?php echo 'Products Details';?> </label> <div class="gc_field gc_tinymce"> <?php $data = array('id'=>'description', 'name'=>'description', 'class'=>'tinyMCE form-control col-md-7 col-xs-12' , 'value'=>set_value('description', $description)); echo form_textarea($data); ?> </div> <div class="button_set "> <input type="button" onclick="toggleEditor('description'); return false;" value="Toggle WYSIWYG" /> </div> </div> <div class="item form-group" style="display: none;"> <label for="size_chart"><?php echo 'Size Chart';?> </label> <div class="gc_field gc_tinymce"> <?php $data = array('id'=>'size_chart', 'name'=>'size_chart', 'class'=>'tinyMCE form-control col-md-7 col-xs-12' , 'value'=>set_value('size_chart', $size_chart)); echo form_textarea($data); ?> </div> <div class="button_set "> <input type="button" onclick="toggleEditor('size_chart'); return false;" value="Toggle WYSIWYG" /> </div> </div> <div class="item form-group" style="display: none;"> <label for="returnstext"><?php echo 'Privacy Policy';?> </label> <div class="gc_field gc_tinymce"> <?php $data = array('id'=>'returnstext', 'name'=>'returnstext', 'class'=>'tinyMCE form-control col-md-7 col-xs-12' , 'value'=>set_value('returnstext', $returnstext)); echo form_textarea($data); ?> </div> <div class="button_set "> <input type="button" onclick="toggleEditor('returnstext'); return false;" value="Toggle WYSIWYG" /> </div> </div> <div class=" hdide"> <label for="weight"><?php echo 'Products Features';?> </label> <br /> <div class="gc_field gc_tinymce"> <?php $data = array('id'=>'features', 'name'=>'features', 'class'=>'tinyMCE', 'value'=>set_value('features', $features)); echo form_textarea($data); ?> </div> <div class="button_set"> <input type="button" onclick="toggleEditor('features'); return false;" value="Toggle WYSIWYG" /> </div> </div> <!-- <div class=" hide"> <label for="weight"><?php echo 'Delivery & Returns';?> </label> <br /> <div class="gc_field gc_tinymce"> <?php $data = array('id'=>'returnstext', 'name'=>'returnstext', 'class'=>'tinyMCE', 'value'=>set_value('returnstext', $returnstext)); echo form_textarea($data); ?> </div> <div class="button_set"> <input type="button" onclick="toggleEditor('returnstext'); return false;" value="Toggle WYSIWYG" /> </div> </div> --> </div> <div id="gc_product_attributes" class="tab-pane fade" id="tab_content2" aria-labelledby="profile-tab"> <div class="item form-group"> <label class="control-label col-md-3 col-sm-3 col-xs-12" for="sku"><?php echo lang('sku');?> </label> <div class="col-md-6 col-sm-6 col-xs-12"> <?php $data = array('id'=>'sku', 'name'=>'sku', 'value'=>set_value('sku', $sku), 'class'=>'form-control col-md-7 col-xs-12'); echo form_input($data); ?> </div> </div> <div class="item form-group"> <label class="control-label col-md-3 col-sm-3 col-xs-12" for="sku">Sort Order </label> <div class="col-md-6 col-sm-6 col-xs-12"> <?php $data = array('id'=>'sort_order', 'name'=>'sort_order', 'value'=>set_value('sort_order', $sort_order), 'class'=>'form-control col-md-7 col-xs-12'); echo form_input($data); ?> </div> </div> <div class="item form-group hide"> <label class="control-label col-md-3 col-sm-3 col-xs-12" for="price"><?php echo lang('price');?> </label> <div class="col-md-6 col-sm-6 col-xs-12"> <?php $data = array('id'=>'price', 'name'=>'price', 'value'=>set_value('price', $price), 'class'=>'form-control col-md-7 col-xs-12'); echo form_input($data); ?> </div> </div> <div class="item form-group hide"> <label class="control-label col-md-3 col-sm-3 col-xs-12" for="price"><?php echo lang('saleprice');?> </label> <div class="col-md-6 col-sm-6 col-xs-12"> <?php $data = array('id'=>'saleprice', 'name'=>'saleprice', 'value'=>set_value('saleprice', $saleprice), 'class'=>'form-control col-md-7 col-xs-12'); echo form_input($data); ?> </div> </div> <div class="item form-group hide"> <label class="control-label col-md-3 col-sm-3 col-xs-12" for="weight"><?php echo 'Rating';?> </label> <div class="col-md-6 col-sm-6 col-xs-12"> <?php $data = array('id'=>'rating', 'name'=>'rating', 'value'=>set_value('rating', $rating), 'class'=>'form-control col-md-7 col-xs-12'); echo form_input($data); ?> </div> </div> <div class="item form-group hide"> <label class="control-label col-md-3 col-sm-3 col-xs-12" for="weight"><?php echo 'reviews';?> </label> <div class="col-md-6 col-sm-6 col-xs-12"> <?php $data = array('id'=>'reviews', 'name'=>'reviews', 'value'=>set_value('reviews', $reviews), 'class'=>'form-control col-md-7 col-xs-12'); echo form_input($data); ?> </div> </div> <div class="item form-group hide"> <label class="control-label col-md-3 col-sm-3 col-xs-12" for="weight"><?php echo lang('weight');?> </label> <div class="col-md-6 col-sm-6 col-xs-12"> <?php $data = array('id'=>'weight', 'name'=>'weight', 'value'=>set_value('weight', $weight), 'class'=>'form-control col-md-7 col-xs-12'); echo form_input($data); ?> </div> </div> <div class="item form-group"> <label class="control-label col-md-3 col-sm-3 col-xs-12" class="control-label col-md-3 col-sm-3 col-xs-12" for="slug"><?php echo lang('slug');?> </label> <div class="col-md-6 col-sm-6 col-xs-12"> <?php $data = array('id'=>'slug', 'name'=>'slug', 'value'=>set_value('slug', $slug), 'class'=>'form-control col-md-7 col-xs-12'); echo form_input($data); ?> </div> </div> <div class="item form-group"> <label class="control-label col-md-3 col-sm-3 col-xs-12" for="slug"><?php echo lang('track_stock');?> </label> <div class="col-md-6 col-sm-6 col-xs-12"> <?php $options = array( '1' => lang('track_stock') ,'0' => lang('do_not_track_stock') ); echo form_dropdown('track_stock', $options, set_value('track_stock',$track_stock), 'id="track_stock"'); ?> </div> </div> <div class="item form-group hide"> <label class="control-label col-md-3 col-sm-3 col-xs-12" for="quantity"><?php echo lang('quantity');?> </label> <div class="col-md-6 col-sm-6 col-xs-12"> <?php $data = array('id'=>'quantity', 'name'=>'quantity', 'value'=>set_value('quantity', $quantity), 'class'=>'form-control col-md-7 col-xs-12'); echo form_input($data); ?><small><?php echo lang('quantity_in_stock_note');?></small> </div></div> <div class="item form-group hide"> <label class="control-label col-md-3 col-sm-3 col-xs-12" for="costpersqft"><?php echo lang('costpersqft');?> </label> <div class="col-md-6 col-sm-6 col-xs-12"> <?php $options = array( '1' => lang('yes') ,'0' => lang('no') ); echo form_dropdown('costpersqft', $options, set_value('costpersqft',$costpersqft)); ?> </div> </div> <div class="item form-group hide"> <label class="control-label col-md-3 col-sm-3 col-xs-12" for="slug"><?php echo lang('shippable');?> </label> <div class="col-md-6 col-sm-6 col-xs-12"> <?php $options = array( '1' => lang('yes') ,'0' => lang('no') ); echo form_dropdown('shippable', $options, set_value('shippable',$shippable)); ?> </div></div> <div class="item form-group hide"> <label class="control-label col-md-3 col-sm-3 col-xs-12" for="slug"><?php echo lang('fixed_quantity');?> </label> <div class="col-md-6 col-sm-6 col-xs-12"> <?php $options = array( '1' => lang('yes') ,'0' => lang('no') ); echo form_dropdown('fixed_quantity', $options, set_value('fixed_quantity',$fixed_quantity)); ?> <small><?php echo lang('fixed_quantity_note');?></small> </div></div> <div class="item form-group hide"> <label class="control-label col-md-3 col-sm-3 col-xs-12" for="slug"><?php echo lang('taxable');?> </label> <div class="col-md-6 col-sm-6 col-xs-12"> <?php $options = array( '1' => lang('yes') ,'0' => lang('no') ); echo form_dropdown('taxable', $options, set_value('taxable',$taxable)); ?> </div></div> <div class="item form-group hide"> <label class="control-label col-md-3 col-sm-3 col-xs-12" for="slug"><?php echo lang('enabled');?> </label> <div class="col-md-6 col-sm-6 col-xs-12"> <?php $options = array( '1' => lang('yes') ,'0' => lang('no') ); echo form_dropdown('enabled', $options, set_value('enabled',$enabled)); ?> </div></div> <div class="item form-group"> <label class="control-label col-md-3 col-sm-3 col-xs-12" for="slug"><?php echo 'Favourite';?> </label> <div class="col-md-6 col-sm-6 col-xs-12"> <?php $options = array( '1' => lang('yes') ,'0' => lang('no') ); echo form_dropdown('favourite', $options, set_value('favourite',$favourite)); ?> </div></div> <div class="item form-group"> <label class="control-label col-md-3 col-sm-3 col-xs-12" for="slug"><?php echo 'New Arrival';?> </label> <div class="col-md-6 col-sm-6 col-xs-12"> <?php $options = array( '1' => lang('yes') ,'0' => lang('no') ); echo form_dropdown('arrival', $options, set_value('arrival',$arrival)); ?> </div></div> <div class="item form-group"> <label class="control-label col-md-3 col-sm-3 col-xs-12" for="slug"><?php echo 'By Category (Home Page)';?> </label> <div class="col-md-6 col-sm-6 col-xs-12"> <?php $options = array( '1' => lang('yes') ,'0' => lang('no') ); echo form_dropdown('category_arrival', $options, set_value('category_arrival',$category_arrival)); ?> </div></div> <div class="item form-group"> <label class="control-label col-md-3 col-sm-3 col-xs-12"><?php echo lang('excerpt');?></label> <div class="col-md-6 col-sm-6 col-xs-12"> <?php $data = array('id'=>'excerpt', 'name'=>'excerpt', 'value'=>set_value('excerpt', $excerpt), 'class'=>'form-control col-md-7 col-xs-12'); echo form_textarea($data); ?> </div></div> </div> <div id="gc_product_categories" class="tab-pane fade" aria-labelledby="profile-tab"> <table class="table table-striped projects" cellspacing="0" cellpadding="0" > <thead> <tr> <th class="gc_cell_left" style="text-align:left"><?php echo lang('name');?></th> <th class="gc_cell_right"></th> </tr> </thead> <tbody> <?php define('ADMIN_FOLDER', $this->config->item('admin_folder')); function list_categories($cats, $product_categories_list, $sub='') { foreach ($cats as $cat):?> <tr class="gc_row"> <td><?php echo $sub.$cat['category']->name; ?></td> <td style="text-align:right"> <input type="checkbox" name="categories[]" value="<?php echo $cat['category']->id;?>" <?php echo (in_array($cat['category']->id, $product_categories_list))?'checked="checked"':'';?>/> </td> </tr> <?php if (sizeof($cat['children']) > 0) { $sub2 = str_replace('→ ', ' ', $sub); $sub2 .= ' → '; list_categories($cat['children'], $product_categories_list, $sub2); } endforeach; } list_categories($categories, $product_categories); ?> </tbody> </table> </div> <div id="gc_product_downloads" class="tab-pane fade" aria-labelledby="profile-tab"> <?php echo lang('digital_products_desc') ?> <table class="table table-striped projects" cellspacing="0" cellpadding="0"> <thead> <tr> <th class="gc_cell_left"><?php echo lang('filename');?></th> <th><?php echo lang('title');?></th> <th style="width:70px;"><?php echo lang('size');?></th> <th class="gc_cell_right"></th> </tr> </thead> <tbody> <?php echo (count($file_list) < 1)?'<tr><td style="text-align:center;" colspan="6">'.lang('no_files').'</td></tr>':''?> <?php foreach ($file_list as $file):?> <?php if($file->catalogue_type == 'product'){ ?> <tr> <td class="gc_cell_left"><?php echo $file->filename ?></td> <td><?php echo $file->title ?></td> <td><?php echo $file->size ?></td> <td><?php echo form_checkbox('downloads[]', $file->id, in_array($file->id, $product_files)); ?></td> </tr> <?php } ?> <?php endforeach; ?> </tbody> </table> </div> <div id="gc_product_pdf" class="tab-pane fade" aria-labelledby="profile-tab"> <?php echo lang('digital_products_desc') ?> <div id="selected_options_pdf" class="option_form"> <span id="add_buttons" style="float:right;"> <input class="form-control col-md-7 col-xs-12" id="option_name_pdf" style="width:200px;" type="text" name="option_name_pdf" placeholder="Enter PDF Section Name" autocomplete="off" /> <button type="button" class="add_option_pdf" rel="list">ADD SECTION</button> </span> <br style="clear:both;"/> <div id="options_accordion_pdf"> <?php $count = 1; if(!empty($product_pdf_options)): //print_r($product_options); foreach($product_pdf_options as $pdf_option): //print_r($option); $pdf_option = (object)$pdf_option; if(empty($pdf_option->required)) { $pdf_option->required = false; } ?> <div id="option-pdf-<?php echo $count;?>"> <h3><a href="#"><?php echo $pdf_option->type.' > '.$pdf_option->name; ?></a></h3> <div style="text-align: left"> Option Name <span style="float:right"> <a href="javascript:void(0)" onclick="remove_pdf_option(<?php echo $count;?>, 1, <?php echo $pdf_option->id ?>)" class="ui-state-default ui-corner-all" style="float:right;"><span class="ui-icon ui-icon-circle-minus"></span> Delete</a> </span> <input class="input gc_tf1" type="text" name="option_pdf[<?php echo $count;?>][name]" value="<?php echo $pdf_option->name; ?>"> <input type="hidden" name="option_pdf[<?php echo $count;?>][type]" value="list"> <button id="add_item_pdf_<?php echo $count;?>" type="button" rel="list" onclick="add_item_pdf($(this).attr('rel'), <?php echo $count;?>);">Add Item</button> <div class="option_item_form_pdf"> <ul class="sortable sortable_pdf ui-sortable" id="option_items_pdf_<?php echo $count;?>"> <?php if(!empty($pdf_option->values)){ ?> <?php $valcount = 1; foreach($pdf_option->values as $pdfvalue) : $pdfvalue = (object)$pdfvalue; ?> <li id="rpdf<?php echo $pdfvalue->id; ?>"> <p>Attach PDF File: <a href="javascript:void()" onclick="remove_pdf(<?php echo $pdfvalue->id; ?>, 1, <?php echo $pdfvalue->id ?>)" style="padding:10px 0 0 500px;">Delete</a> </p> <a href="" style="font-size: 18px; font-weight: bold;"><?php echo $valcount; ?>. <?php echo $pdfvalue->name ?></a> <!-- <input type="file" name="option_pdf[<?php echo $valcount; ?>][]" value=""> </li> --> <?php $valcount++; endforeach; ?> <?php } ?> </ul> </div> </div> </div> <?php $count++; endforeach; endif; ?> </div> </div> </div> <div id="gc_product_seo" class="tab-pane fade" aria-labelledby="profile-tab"> <div class="item form-group"> <label class="control-label col-md-3 col-sm-3 col-xs-12" for="seo_title"><?php echo lang('seo_title');?> </label> <div class="col-md-6 col-sm-6 col-xs-12"> <?php $data = array('id'=>'seo_title', 'name'=>'seo_title', 'value'=>set_value('seo_title', $seo_title), 'class'=>'form-control col-md-7 col-xs-12'); echo form_input($data); ?> </div> </div> <div class="item form-group"> <label class="control-label col-md-3 col-sm-3 col-xs-12"><?php echo lang('meta');?></label> <small><?php echo lang('meta_example');?></small> <div class="col-md-6 col-sm-6 col-xs-12"> <?php $data = array('id'=>'meta', 'name'=>'meta', 'value'=>set_value('meta', html_entity_decode($meta)), 'class'=>'form-control col-md-7 col-xs-12'); echo form_textarea($data); ?> </div> </div> </div> <div id="gc_product_options" class="tab-pane fade" aria-labelledby="profile-tab"> <div id="selected_options" class="option_form"> <span id="add_buttons" style="float:right;"> <input class="form-control col-md-7 col-xs-12" id="option_name" style="width:200px;" type="text" name="option_name" /> <button type="button" class="add_option" rel="checklist"><?php echo lang('checklist');?></button> <button type="button" class="add_option" rel="radiolist"><?php echo lang('radiolist');?></button> <button type="button" class="add_option" rel="droplist"><?php echo lang('droplist');?></button> <button type="button" class="add_option" rel="textfield"><?php echo lang('textfield');?></button> <button type="button" class="add_option" rel="textarea"><?php echo lang('textarea');?></button> </span> <br style="clear:both;"/> <div id="options_accordion"> <?php $count = 0; if(!empty($product_options)): //print_r($product_options); foreach($product_options as $option): //print_r($option); $option = (object)$option; if(empty($option->required)) { $option->required = false; } ?> <div id="option-<?php echo $count;?>"> <h3><a href="#"><?php echo $option->type.' > '.$option->name; ?> </a></h3> <div style="text-align: left"> <?php echo lang('option_name');?> <a style="float:right" onclick="remove_option(<?php echo $count ?>)" class="ui-state-default ui-corner-all" ><span class="ui-icon ui-icon-circle-minus">Delete</span></a> <input class="input gc_tf2" type="text" name="option[<?php echo $count;?>][name]" value="<?php echo $option->name;?>"/> <input type="hidden" name="option[<?php echo $count;?>][type]" value="<?php echo $option->type;?>" /> <input class="checkbox" type="checkbox" name="option[<?php echo $count;?>][required]" value="1" <?php echo ($option->required)?'checked="checked"':'';?>/> <?php echo lang('required');?> <?php if($option->type!='textarea' && $option->type!='textfield') { ?> <button id="add_item_<?php echo $count;?>" type="button" rel="<?php echo $option->type;?>"onclick="add_item($(this).attr('rel'), <?php echo $count;?>);"><?php echo lang('add_item');?></button> <?php } ?> <div class="option_item_form"> <?php if($option->type!='textarea' && $option->type!='textfield') { ?><ul class="sortable" id="option_items_<?php echo $count;?>"><?php } ?> <?php if(!empty($option->values)) $valcount = 0; foreach($option->values as $value) : $value = (object)$value;?> <?php if($option->type!='textarea' && $option->type!='textfield') { ?><li id="value-<?php echo $count;?>-<?php echo $valcount;?>"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span><?php } ?> <div style="margin:2px"><span><?php echo lang('name');?> </span><input class="req gc_tf2" type="text" name="option[<?php echo $count;?>][values][<?php echo $valcount ?>][name]" value="<?php echo $value->name ?>" /> <span><?php echo lang('value');?> </span><input class="req gc_tf2" type="text" name="option[<?php echo $count;?>][values][<?php echo $valcount ?>][value]" value="<?php echo $value->value ?>" /> <span><?php echo lang('weight');?> </span><input class="req gc_tf2" type="text" name="option[<?php echo $count;?>][values][<?php echo $valcount ?>][weight]" value="<?php echo $value->weight ?>" /> <span><?php echo lang('price');?> </span><input class="req gc_tf2" type="text" name="option[<?php echo $count;?>][values][<?php echo $valcount ?>][price]" value="<?php echo $value->price ?>" /> <?php if($option->type == 'textfield'):?> <span><?php echo lang('limit');?> </span><input class="req gc_tf2" type="text" name="option[<?php echo $count;?>][values][<?php echo $valcount ?>][limit]" value="<?php echo $value->limit ?>" /> <?php endif;?> <?php if($option->type!='textarea' && $option->type!='textfield') { ?> <a onclick="if(confirm('<?php echo lang('confirm_remove_value');?>')) $('#value-<?php echo $count;?>-<?php echo $valcount;?>').remove()" class="ui-state-default ui-corner-all" style="float:right;"> Delete<span class="ui-icon ui-icon-circle-minus"></span></a> <?php } ?> </div> <?php if($option->type!='textarea' && $option->type!='textfield') { ?> </li> <?php } ?> <?php $valcount++; endforeach; ?> <?php if($option->type!='textarea' && $option->type!='textfield') { ?></ul><?php } ?> </div> </div> </div> <?php $count++; endforeach; endif; ?> </div> </div> </div> <div id="gc_product_related" class="tab-pane fade" id="tab_content3" aria-labelledby="profile-tab"> <div class="gc_field"> <label><?php echo lang('select_a_product')?>: </label> <select id="product_list"> <?php foreach($product_list as $p): if(!empty($p) && $id != $p->id):?> <option id="product_item_<?php echo $p->id;?>" value="<?php echo $p->id; ?>"><?php echo $p->name;?></option> <?php endif; endforeach;?> </select> <a href="#" onclick="add_related_product();return false;" class="button" title="Add Related Product"><?php echo lang('add_related_product');?></a> </div> <?php $products = array(); foreach($product_list as $p) { $products[$p->id] = $p->name; } ?> <table class="table table-striped projects" cellspacing="0" cellpadding="0"> <thead> <tr> <th class="gc_cell_left"><?php echo lang('product_name');?></th> <th class="gc_cell_right"></th> </tr> </thead> <tbody id="product_items_container"> <?php if(!empty($related_products)):foreach($related_products as $rel): if(!empty($rel)) :?> <?php if(array_key_exists($rel, $products)) { echo related_items($rel, $products[$rel]); } ?> <?php endif; endforeach; endif;?> </tbody> </table> </div> <div id="gc_product_photos" class="tab-pane fade" id="tab_content3" aria-labelledby="profile-tab"> <div class="gc_segment_content"> <iframe src="<?php echo site_url($this->config->item('admin_folder').'/products/product_image_form');?>" style="height:75px; border:0px;"> </iframe> <div id="gc_photos"> <?php foreach($images as $photo_id=>$photo_obj) { if(!empty($photo_obj)) { $photo = (array)$photo_obj; add_image($photo_id, $photo['filename'], $photo['alt'], $photo['caption'], isset($photo['primary'])); } } ?> </div> </div> </div> <div id="gc_product_icons" class="tab-pane fade" id="tab_content3" aria-labelledby="profile-tab"> <div class="gc_segment_content"> <?php //echo site_url($this->config->item('admin_folder').'/products/product_icon_image_form');?> <iframe src="<?php echo site_url($this->config->item('admin_folder').'/products/product_icon_image_form');?>" style="height:75px; border:0px;"> </iframe> <div id="gc_icon_photos"> <?php foreach($icons as $photo_id=>$photo_obj) { if(!empty($photo_obj)) { $photo = (array)$photo_obj; add_icon_image($photo_id, $photo['filename'], $photo['alt'], $photo['caption'], isset($photo['primary'])); } } ?> </div> </div> </div> <div id="gc_product_data_sheet" class="tab-pane fade" id="tab_content3" aria-labelledby="profile-tab"> <div class="gc_segment_content"> <?php //echo site_url($this->config->item('admin_folder').'/products/product_icon_image_form');?> <iframe src="<?php echo site_url($this->config->item('admin_folder').'/products/product_data_sheet_form');?>" style="height:75px; border:0px;"> </iframe> <div id="gc_data_sheets"> <?php foreach($sheets as $photo_id=>$photo_obj) { if(!empty($photo_obj)) { $photo = (array)$photo_obj; add_data_sheet($photo_id, $photo['filename'], $photo['name'], $photo['description'], isset($photo['primary'])); } } ?> </div> </div> </div> </div> <div class="ln_solid"></div> <div class="form-group"> <div class="col-md-6 col-md-offset-3"> <input type="submit" class="btn btn-success" value="<?php echo lang('form_save');?>" /> </div> </div> </form> </div> </div> </div> </div> </div> </div> <!-- /page content --> <?php function add_image($photo_id, $filename, $alt, $caption, $primary=false) { ob_start(); ?> <div class="gc_photo" id="gc_photo_<?php echo $photo_id;?>"> <table cellspacing="0" cellpadding="0"> <tr> <td style="width:81px;padding-right:10px;" rowspan="2"> <input type="hidden" name="images[<?php echo $photo_id;?>][filename]" value="<?php echo $filename;?>"/> <img class="gc_thumbnail" src="<?php echo base_url('uploads/images/thumbnails/'.$filename);?>"/> </td> <td> <input type="radio" name="primary_image" value="<?php echo $photo_id;?>" <?php if($primary) echo 'checked="checked"';?>/> <?php echo lang('primary');?> <a onclick="return remove_image($(this));" rel="<?php echo $photo_id;?>" class="button" style="float:right; font-size:9px;"><?php echo lang('remove');?></a> </td> </tr> <tr> <td> <table> <tr> <td><?php echo lang('alt_tag');?></td> <td><input name="images[<?php echo $photo_id;?>][alt]" value="<?php echo $alt;?>" class="gc_tf2"/></td> </tr> <tr> <td><?php echo lang('caption');?></td> <td><textarea name="images[<?php echo $photo_id;?>][caption]"><?php echo $caption;?></textarea></td> </tr> </table> </td> </tr> </table> </div> <?php $stuff = ob_get_contents(); ob_end_clean(); echo replace_newline($stuff); } function add_icon_image($photo_id, $filename, $alt, $caption, $primary=false) { ob_start(); ?> <div class="gc_icon_photo" id="gc_icon_photo_<?php echo $photo_id;?>"> <table cellspacing="0" cellpadding="0"> <tr> <td style="width:81px;padding-right:10px;" rowspan="2"> <input type="hidden" name="icons[<?php echo $photo_id;?>][filename]" value="<?php echo $filename;?>"/> <img class="gc_thumbnail" src="<?php echo base_url('uploads/images/thumbnails/'.$filename);?>"/> </td> <td> <input style="display: none" type="radio" name="primary_image" value="<?php echo $photo_id;?>" <?php if($primary) echo 'checked="checked"';?>/> <?php echo lang('primary');?> <a onclick="return remove_icon_image($(this));" rel="<?php echo $photo_id;?>" class="button" style="float:right; font-size:9px;"><?php echo lang('remove');?></a> </td> </tr> <tr> <td> <table> <tr> <td><?php echo lang('alt_tag');?></td> <td><input name="icons[<?php echo $photo_id;?>][alt]" value="<?php echo $alt;?>" class="gc_tf2"/></td> </tr> <tr> <td><?php echo lang('caption');?></td> <td><textarea name="icons[<?php echo $photo_id;?>][caption]"><?php echo $caption;?></textarea></td> </tr> </table> </td> </tr> </table> </div> <?php $stuff = ob_get_contents(); ob_end_clean(); echo replace_newline($stuff); } function add_data_sheet($photo_id, $filename, $alt, $caption, $primary=false) { ob_start(); ?> <div class="gc_icon_photo" id="gc_data_sheet_<?php echo $photo_id;?>"> <table cellspacing="0" cellpadding="0"> <tr> <td style="width:81px;padding-right:10px;" rowspan="2"> <input type="hidden" name="sheets[<?php echo $photo_id;?>][filename]" value="<?php echo $filename;?>"/> <h2><?php echo $filename;?></h2> </td> <td> <input style="display: none" type="radio" name="sheet_primary" value="<?php echo $photo_id;?>" <?php if($primary) echo 'checked="checked"';?>/> <?php //echo lang('primary');?> <a onclick="return remove_data_sheet($(this));" rel="<?php echo $photo_id;?>" class="button" style="float:right; font-size:9px;"><?php echo lang('remove');?></a> </td> </tr> <tr> <td> <table> <tr> <td>Name</td> <td><input name="sheets[<?php echo $photo_id;?>][name]" value="<?php echo $alt;?>" class="gc_tf2"/></td> </tr> <tr> <td>Description</td> <td><textarea name="sheets[<?php echo $photo_id;?>][description]"><?php echo $caption;?></textarea></td> </tr> </table> </td> </tr> </table> </div> <?php $stuff = ob_get_contents(); ob_end_clean(); echo replace_newline($stuff); } function add_option($name, $option_id, $type,$required='false') { ob_start(); ?> <div id="option-<?php echo $option_id;?>"> <h3><a href="#"><?php echo $type.' > '.$name; ?></a></h3> <div style="text-align: left"> <?php echo lang('option_name');?> <span style="float:right"> <a onclick="remove_option(<?php echo $option_id ?>)" class="ui-state-default ui-corner-all" style="float:right;"><span class="ui-icon ui-icon-circle-minus"></span></a></span> <input class="input gc_tf1" type="text" name="option[<?php echo $option_id;?>][name]" value="<?php echo $name;?>"/> <input type="hidden" name="option[<?php echo $option_id;?>][type]" value="<?php echo $type;?>" /> <input class="checkbox" type="checkbox" name="option[<?php echo $option_id;?>][required]" value="1" <?php if('true' == $required) echo 'checked="checked"'; ?>/> <?php echo lang('required');?> <button id="add_item_<?php echo $option_id;?>" type="button" rel="<?php echo $type;?>"onclick="add_item($(this).attr(\'rel\'), <?php echo $option_id;?>);"><?php echo lang('add_item');?></button> <div class="option_item_form" > <ul class="sortable" id="option_items_<?php echo $option_id;?>"> </ul> </div> </div> </div> <?php $stuff = ob_get_contents(); ob_end_clean(); echo replace_newline($stuff); } function add_option_pdf($name, $option_id, $type,$required='false') { ob_start(); ?> <div id="option-pdf-<?php echo $option_id;?>"> <h3><a href="#"><?php echo $type.' > '.$name; ?></a></h3> <div style="text-align: left"> <?php echo lang('option_name');?> <span style="float:right"><a onclick="remove_pdf_option(<?php echo $option_id ?>, 0, 0)" class="ui-state-default ui-corner-all" style="float:right;"><span class="ui-icon ui-icon-circle-minus"></span>Delete</a></span> <input class="input gc_tf1" type="text" name="option_pdf[<?php echo $option_id;?>][name]" value="<?php echo $name;?>"/> <input type="hidden" name="option_pdf[<?php echo $option_id;?>][type]" value="<?php echo $type;?>" /> <button id="add_item_pdf_<?php echo $option_id;?>" type="button" rel="<?php echo $type;?>"onclick="add_item_pdf($(this).attr(\'rel\'), <?php echo $option_id;?>);"><?php echo lang('add_item');?></button> <div class="option_item_form_pdf" > <ul class="sortable sortable_pdf" id="option_items_pdf_<?php echo $option_id;?>"> </ul> </div> </div> </div> <?php $stuff = ob_get_contents(); ob_end_clean(); echo replace_newline($stuff); } //this makes it easy to use the same code for initial generation of the form as well as javascript additions function replace_newline($string) { return (string)str_replace(array("\r", "\r\n", "\n", "\t"), ' ', $string); } ?> <script type="text/javascript"> //<![CDATA[ var option_count = $('#options_accordion h3').length; var option_pdf_count = $('#options_accordion_pdf h3').length; //alert(option_count); var count = <?php echo $count;?>; function add_related_product() { //if the related product is not already a related product, add it if($('#related_product_'+$('#product_list').val()).length == 0 && $('#product_list').val() != null) { <?php $new_item = str_replace(array("\n", "\t", "\r"),'',related_items("'+$('#product_list').val()+'", "'+$('#product_item_'+$('#product_list').val()).html()+'"));?> var related_product = '<?php echo $new_item;?>'; $('#product_items_container').append(related_product); $('.list_buttons').buttonset(); } else { if($('#product_list').val() == null) { alert('<?php echo lang('alert_select_product');?>'); } else { alert('<?php echo lang('alert_product_related');?>'); } } } function remove_related_product(id) { if(confirm('<?php echo lang('confirm_remove_related');?>?')) { $('#related_product_'+id).remove(); } } function photos_sortable() { $('#gc_photos').sortable({ handle : '.gc_thumbnail', items: '.gc_photo', axis: 'y', scroll: true }); } function photos_icon_sortable() { $('#gc_icon_photos').sortable({ handle : '.gc_thumbnail', items: '.gc_icon_photo', axis: 'y', scroll: true }); } function data_sheets_sortable() { $('#gc_data_sheets').sortable({ handle : '.gc_thumbnail', items: '.gc_icon_photo', axis: 'y', scroll: true }); } //]]> </script> <?php function related_items($id, $name) { return ' <tr id="related_product_'.$id.'" class="gc_row"> <td class="gc_cell_left" > <input type="hidden" name="related_products[]" value="'.$id.'"/> '.$name.'</td> <td class="gc_cell_right list_buttons"> <a href="#" onclick="remove_related_product('.$id.'); return false;">'.lang('remove').'</a> </td> </tr> '; } ?> <!-- /page content --> <?php $this->load->view('backend/Common/Footer'); ?> </div> </div> <?php $this->load->view('backend/Common/Script'); ?> <style type="text/css"> .sortable { list-style-type: none; margin: 0; padding: 0; width: 100%; } .sortable li { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em; height: 18px; } .sortable li>span { position: absolute; margin-left: -1.3em; margin-top:.4em; } .option_item_form li{ padding:10px; margin: 23px 0; } .sortable_pdf { list-style-type: none; margin: 0; padding: 0; width: 100%; } .sortable_pdf li { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em; height: 60px; } .sortable_pdf li>span { position: absolute; margin-left: -1.3em; margin-top:.4em; } .option_item_form_pdf li{ padding:0px; margin: 0px 20px; } </style> <script type="text/javascript"> //<![CDATA[ $(document).ready(function() { $(".sortable").sortable(); $(".sortable > span").disableSelection(); //if the image already exists (phpcheck) enable the selector <?php if($id) : ?> //options related var ct = $('#option_list').children().size(); //create_sortable(); //set_accordion(); // set initial count option_count = <?php echo count($product_options); ?>; option_pdf_count = <?php echo count($product_pdf_options); ?>; <?php endif; ?> //button() $( "#add_buttons" ).buttonset(); photos_sortable(); }); $( document ).on('click','.add_option',function(){ add_option($(this).attr('rel')); }); $( document ).on('click','.add_option_pdf',function(){ add_option_pdf($(this).attr('rel')); }); function add_option_pdf(type) { //alert(type); if(jQuery.trim($('#option_name_pdf').val()) != '') { //increase option_count by 1 option_pdf_count++; //alert(option_count); $('#options_accordion_pdf').append('<?php add_option_pdf("'+$('#option_name_pdf').val()+'", "'+option_pdf_count+'", "'+type+'");?>'); //eliminate the add button if this is a text based option if(type == 'textarea' || type == 'textfield') { $('#add_item_'+option_count).remove(); } add_item_pdf(type, option_pdf_count); //reset the option_name field $('#option_name_pdf').val(''); //reset_accordion(); } else { alert('<?php echo lang('alert_must_name_option');?>'); } } CostperSqftOption=<?php echo $costpersqft?> ; function add_product_image(data) { p = data.split('.'); var photo = '<?php add_image("'+p[0]+'", "'+p[0]+'.'+p[1]+'", '', '');?>'; $('#gc_photos').append(photo); $('#gc_photos').sortable('destroy'); photos_sortable(); $('.button').button(); } function add_icon_product_image(data) { p = data.split('.'); var photo = '<?php add_icon_image("'+p[0]+'", "'+p[0]+'.'+p[1]+'", '', '');?>'; $('#gc_icon_photos').append(photo); $('#gc_icon_photos').sortable('destroy'); photos_icon_sortable(); $('.button').button(); } function add_data_sheet_product(data) { p = data.split('.'); var photo = '<?php add_data_sheet("'+p[0]+'", "'+p[0]+'.'+p[1]+'", '', '');?>'; $('#gc_data_sheets').append(photo); $('#gc_data_sheets').sortable('destroy'); data_sheets_sortable(); $('.button').button(); } function remove_image(img) { if(confirm('<?php echo lang('confirm_remove_image');?>')) { var id = img.attr('rel') $('#gc_photo_'+id).remove(); } } function remove_icon_image(img) { if(confirm('<?php echo lang('confirm_remove_image');?>')) { var id = img.attr('rel') $('#gc_icon_photo_'+id).remove(); } } function remove_data_sheet(img) { if(confirm('<?php echo lang('confirm_remove_image');?>')) { var id = img.attr('rel') $('#gc_data_sheet_'+id).remove(); } } function photos_sortable() { $('#gc_photos').sortable({ handle : '.gc_thumbnail', items: '.gc_photo', axis: 'y', scroll: true }); } function add_option(type) { if(jQuery.trim($('#option_name').val()) != '') { //increase option_count by 1 option_count++; //alert(option_count); $('#options_accordion').append('<?php add_option("'+$('#option_name').val()+'", "'+option_count+'", "'+type+'");?>'); //eliminate the add button if this is a text based option if(type == 'textarea' || type == 'textfield') { $('#add_item_'+option_count).remove(); } add_item(type, option_count); //reset the option_name field $('#option_name').val(''); //reset_accordion(); } else { alert('<?php echo lang('alert_must_name_option');?>'); } } function add_csqftoption() { // Add Width //increase option_count by 1 option_count++; $('#options_accordion').append('<?php add_option('Width(in Inches)', "'+option_count+'", "textfield",'true');?>'); //eliminate the add button if this is a text based option $('#add_item_'+option_count).remove(); add_csqftitem("Width","5" ,option_count); // Add Height //increase option_count by 1 option_count++; $('#options_accordion').append('<?php add_option('Height(in Inches)', "'+option_count+'", "textfield",'true');?>'); //eliminate the add button if this is a text based option $('#add_item_'+option_count).remove(); add_csqftitem("Height","6" ,option_count); //reset the option_name field $('#option_name').val(''); //reset_accordion(); } function add_csqftitem(name,val, id) { var count = $('#option_items_'+id+'>li').size()+1; append_html = ''; append_html += '<div style="margin:2px"><span><?php echo lang('name');?>: </span> <input class="req gc_tf2" type="text" name="option['+id+'][values]['+count+'][name]" value="'+name+'" /> '+ '<span><?php echo lang('value');?>: </span> <input class="req gc_tf2" type="text" name="option['+id+'][values]['+count+'][value]" value="'+val+'" /> '+ '<span><?php echo lang('weight');?>: </span> <input class="req gc_tf2" type="text" name="option['+id+'][values]['+count+'][weight]" value="" /> '+ '<span><?php echo lang('price');?>: </span> <input class="req gc_tf2" type="text" name="option['+id+'][values]['+count+'][price]" value="" />'; append_html += ' <span><?php echo lang('limit');?>: </span> <input class="req gc_tf2" type="text" name="option['+id+'][values]['+count+'][limit]" value="" />'; append_html += '</div> '; $('#option_items_'+id).append(append_html); $(".sortable").sortable(); $(".sortable > span").disableSelection(); } function add_item(type, id) { var count = $('#option_items_'+id+'>li').size()+1; append_html = ''; if(type!='textfield' && type != 'textarea') { append_html = append_html + '<li id="value-'+id+'-'+count+'"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span><a onclick="if(confirm(\'<?php echo lang('confirm_remove_value');?>\')) $(\'#value-'+id+'-'+count+'\').remove()" class="ui-state-default ui-corner-all" style="float:right;"><span class="ui-icon ui-icon-circle-minus"></span></a>'; } append_html += '<div style="margin:2px"><span><?php echo lang('name');?>: </span> <input class="req gc_tf2" type="text" name="option['+id+'][values]['+count+'][name]" value="" /> '+ '<span><?php echo lang('value');?>: </span> <input class="req gc_tf2" type="text" name="option['+id+'][values]['+count+'][value]" value="" /> '+ '<span><?php echo lang('weight');?>: </span> <input class="req gc_tf2" type="text" name="option['+id+'][values]['+count+'][weight]" value="" /> '+ '<span><?php echo lang('price');?>: </span> <input class="req gc_tf2" type="text" name="option['+id+'][values]['+count+'][price]" value="" />'; if(type == 'textfield') { append_html += ' <span><?php echo lang('limit');?>: </span> <input class="req gc_tf2" type="text" name="option['+id+'][values]['+count+'][limit]" value="" />'; } append_html += '</div> '; if(type!='textfield' && type != 'textarea') { append_html += '</li>'; } $('#option_items_'+id).append(append_html); $(".sortable").sortable(); $(".sortable > span").disableSelection(); } function remove_pdf(el, dynamic, id) { if(confirm('<?php echo lang('confirm_remove_option');?>')) { if(dynamic == 1){ $.ajax({ url: '<?php echo site_url($this->config->item('admin_folder').'/products/remove_pdf_options');?>', type: 'POST', dataType: 'json', data: {action: 'pdfOption', 'id': id}, success: function(r){ $('#rpdf'+el).remove(); ///option_pdf_count --; } }) .done(function() { console.log("success"); }) .fail(function() { console.log("error"); }) .always(function() { console.log("complete"); }); return false; } } $('#rpdf'+el).remove(); //element.remove(); } function add_item_pdf(type, id) { var count = $('#option_items_pdf_'+id+'>li').size()+1; append_html = ''; append_html += '<li id="rpdf'+id+'">'; if(type == 'list') { append_html += ' <p>Attach PDF File: <a href="javascript:void()" onclick="remove_pdf('+id+', 0, 0)" style="padding:10px 0 0 500px">Delete</a> </p> <input type="file" name="option_pdf['+id+'][]" value="" /> '; } append_html += '</li> '; append_html += '</div> '; $('#option_items_pdf_'+id).append(append_html); $(".sortable").sortable(); $(".sortable > span").disableSelection(); } function remove_option(id) { if(confirm('<?php echo lang('confirm_remove_option');?>')) { $('#option-'+id).remove(); option_count --; //reset_accordion(); } } function remove_pdf_option(id, dynamic, section_id) { if(confirm('<?php echo lang('confirm_remove_option');?>')) { if(dynamic == 1){ // alert('its dynamic'); // alert(section_id); $.ajax({ url: '<?php echo site_url($this->config->item('admin_folder').'/products/remove_pdf_section_with_options');?>', type: 'POST', dataType: 'json', data: {action: 'pdfSection', 'section_id': section_id}, success: function(r){ $('#option-pdf-'+id).remove(); option_pdf_count --; } }) .done(function() { console.log("success"); }) .fail(function() { console.log("error"); }) .always(function() { console.log("complete"); }); return false; } $('#option-pdf-'+id).remove(); option_pdf_count --; //reset_accordion(); } } function reset_accordion() { $( "#options_accordion" ).accordion('destroy'); $('.option_item_form').sortable('destroy'); $('.option_item_form_pdf').sortable('destroy'); //set_accordion(); } function set_accordion(){ var stop = false; $( "#options_accordion h3" ).click(function( event ) { if ( stop ) { event.stopImmediatePropagation(); event.preventDefault(); stop = false; } }); $( "#options_accordion" ).accordion({ autoHeight: false, active: option_count-1, header: "> div > h3" }).sortable({ axis: "y", handle: "h3", stop: function() { stop = true; } }); $('.option_item_form').sortable({ axis: 'y', handle: 'span', stop: function() { stop = true; } }); $('.option_item_form_pdf').sortable({ axis: 'y', handle: 'span', stop: function() { stop = true; } }); } function delete_product_option(id) { //remove the option if it exists. this function is also called by the lightbox when an option is deleted $('#options-'+id).remove(); } //]]> </script> <!-- page content --> </body> </html>