I am making a matchmaking system. I have a button submit that already inserts entries of players to my matching table, but the thing is whenever I'm inserting it, it goes like this (Please see pic 1), My target is to make a matching where players who have the same level gets to match.
For example Handler1 = level 1 and Handler3 = level 1, they'll be matched because they have the same level.
How can I make this work? Thank you in advance.
Views:
<form autocomplete="off" action="<?php echo base_url('controller/create'); ?>" enctype="multipart/form-data" method="post">
<div class="card-body table-responsive py-3 px-3">
<table id="table_list" class="table table-bordered" cellspacing="0" style="width: 100%;">
<thead>
<tr>
<th>HandlerID </th>
<th>Handler </th>
<th>Level </th>
</tr>
</thead>
<tbody>
<?php foreach ($j->result() as $row) { ?>
<tr>
<td><input type="text" name="handlerID[]" value="<?php echo $row->handlerID; ?>"> </td>
<td><input type="text" name="handler[]" value="<?php echo $row->handler; ?>"> </td>
<td><input type="text" name="level[]" value="<?php echo $row->level; ?>"> </td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<button type="submit" class="btn btn-primary">Save</button>
</div>
</div>
</form>
</div>
Controller:
public function create()
{
$handlerID = $this->input->post('handlerID');
$handler = $this->input->post('handler');
$level = $this->input->post('level');
$data = [];
for($i=0;$i<count($handlerID);$i++) { $data[$i]=array ('handlerID'=> $handlerID[$i], 'handler' => $handler[$i], 'level' => $level[$i]);
}
$this->model->createSomething($data);
Model:
public function createSomething($data)
{
$q = $this->db->insert_batch('matching',$data);
if ($q)
{
return TRUE;
}
else return FALSE;
}
I have data table with search filed. I am trying to filter table using data range and order status. I want to filter table also using range and status and also want to export into excel sheet. Code is working for only search and simple export (Not filtered data).
Thanks
This is my file (View, Controller and Model)
View:-
<a class="pull-right btn btn-primary btn-xs" href="<?php echo base_url()?>order/createXLS"><i class="fa fa-file-excel-o"></i> Export Data</a>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title" >Custom Filter : </h3>
</div>
<div class="panel-body">
<form id="form-filter" method="POST" action="order/ajax_list" class="form-horizontal">
<div class="form-group">
<label for="FirstName" class="col-sm-2 control-label">From</label>
<div class="col-sm-4">
<input type="date" class="form-control" id="from">
</div>
</div>
<div class="form-group">
<label for="LastName" class="col-sm-2 control-label">To</label>
<div class="col-sm-4">
<input type="date" class="form-control" id="to">
</div>
</div>
<div class="form-group">
<label for="LastName" class="col-sm-2 control-label">Status</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="status">
</div>
</div>
<div class="form-group">
<label for="LastName" class="col-sm-2 control-label"></label>
<div class="col-sm-4">
<button type="button" id="btn-filter" class="btn btn-primary">Filter</button>
<button type="button" id="btn-reset" class="btn btn-default">Reset</button>
</div>
</div>
</form>
</div>
</div>
<table class="table table-bordered table-striped" id="mytable">
<thead>
<tr>
<th width="80px">No</th>
<th>Order Number</th>
<th>Service Date</th>
<th>Service Location</th>
<th>Customer Name</th>
<th>Contact Number</th>
<th>Order Status</th>
<th>Payment Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$start = 0;
foreach ($job_positions_data as $job_positions)
{
?>
<tr>
<td>
<?php echo ++$start ?>
</td>
<td>
<?php echo $job_positions->order_number ?>
</td>
<td>
<?php echo $job_positions->service_date ?>
</td>
<td>
<?php if($job_positions->service_location == 1)
{
echo 'vkool_branch';
}
else
{
echo 'customer_location' ;
}
?>
</td>
<td>
<?php echo $job_positions->firstname ?>
</td>
<td>
<?php echo $job_positions->contact_number ?>
</td>
<td>
<?php if($job_positions->order_status == 0)
{
echo 'Action Pending';
}
elseif($job_positions->order_status == 1)
{
echo 'Under Process' ;
}
elseif($job_positions->order_status == 2)
{
echo 'Cancelled' ;
}
elseif($job_positions->order_status == 3)
{
echo 'Completed' ;
}
elseif($job_positions->order_status == 4)
{
echo 'Refund' ;
}
?>
</td>
<td>
<?php if( $job_positions->payment_status == 1)
{
echo 'Pending (Pay at Store)';
}
elseif($job_positions->payment_status == 0)
{
echo 'Pending (Pay Online)';
}
elseif($job_positions->payment_status == 14)
{
echo 'Paid';
}?>
</td>
<td style="text-align:center" width="200px">
<i class="fa fa-search-plus"></i>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<script type="text/javascript">
$(document).ready(function() {
$("#mytable").dataTable();
});
</script>
Controller : -
public function createXLS() {
$fileName = 'data-'.time().'.xlsx';
require_once APPPATH . "/third_party/PHPExcel/Classes/PHPExcel.php";
$orderInfo = $this->Order_model->get_For_Export();
$ordervalue = json_encode($orderInfo, true);
/*echo '<pre>';
print_r($orderInfo);
echo '</pre>';
exit;*/
$objPHPExcel = new PHPExcel();
$objPHPExcel->setActiveSheetIndex(0);
// set Header
$objPHPExcel->getActiveSheet()->SetCellValue('A1', 'S.No');
$objPHPExcel->getActiveSheet()->SetCellValue('B1', 'Order Number');
$objPHPExcel->getActiveSheet()->SetCellValue('C1', 'Service Location');
$objPHPExcel->getActiveSheet()->SetCellValue('D1', 'First Name');
$objPHPExcel->getActiveSheet()->SetCellValue('E1', 'Last Name');
$objPHPExcel->getActiveSheet()->SetCellValue('F1', 'Contact_No');
$objPHPExcel->getActiveSheet()->SetCellValue('G1', 'Order Status');
$objPHPExcel->getActiveSheet()->SetCellValue('H1', 'Payment Status');
// Style
$style = array(
'alignment' => array(
'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
),
'font' => array(
'bold' => true,
'color' => array('rgb' => '2F4F4F'),
'size' => 20,
),
);
$styleHeading = array(
'alignment' => array(
'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
),
'font' => array(
'bold' => true,
'size' => 15,
),
);
// set Row
$rowCount = 2;
foreach ($orderInfo as $element) {
$objPHPExcel->getActiveSheet()->SetCellValue('A' . $rowCount, $element['id']);
$objPHPExcel->getActiveSheet()->SetCellValue('B' . $rowCount, $element['order_number']);
$objPHPExcel->getActiveSheet()->SetCellValue('C' . $rowCount, $element['service_location']);
$objPHPExcel->getActiveSheet()->SetCellValue('D' . $rowCount, $element['firstname']);
$objPHPExcel->getActiveSheet()->SetCellValue('E' . $rowCount, $element['lastname']);
$objPHPExcel->getActiveSheet()->SetCellValue('F' . $rowCount, $element['contact_number']);
$objPHPExcel->getActiveSheet()->SetCellValue('G' . $rowCount, $element['order_status']);
$objPHPExcel->getActiveSheet()->SetCellValue('H' . $rowCount, $element['payment_status']);
$rowCount++;
}
// download file
$filename = "jobSummery". date("Y-m-d-H-i-s").".xls";
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="'.$filename.'"');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
}
public function list_view()
{
$job_positions = $this->Order_model->get_all();
$data = array(
'job_positions_data' => $job_positions
);
$this->load->view('order/index', $data);
}
Model :-
public function get_all()
{
$this->db->order_by('id', 'DESC');
$this->db->from('tbl_order');
$query = $this->db->get();
$result = $query->result();
return $result;
}
public function get_For_Export()
{
$this->db->order_by('id', 'DESC');
$this->db->from('tbl_order');
$query = $this->db->get();
$result = $query->result_array();
return $result;
}
I have one view candidate details form in my application.
In that I gave one button called scheduled interview.
So when I click on the button it redirect the page to candidate process page with the candidate_id and user_id in the url.
And in the candidate_process page I have one form with some details and under the form I display all the records from database in data table.
I want to display the records only for the particular candidate.I don't want to display all the records.
Here is my view:
<form method="post" action="" id="form">
<b>Date </b>:<input type="text" name="date" id="date"><br><br>
<input type="hidden" name="candidate_id" value="<?php echo $getCandidate['candidate_id']; ?>">
<input type="hidden" name="user_id" value="<?php echo $getCandidate['user_id']; ?>">
<div class="form-group">
<label><b>Select Interview Type:</b></label>
<select class="form-control" id="interview_type_id" name="interview_type_id" >
<option value="" disabled selected>Interview Type</option>
<?php foreach($interviewtype as $rows) { ?>
<option value="<?php echo $rows->interview_type_id?>"><?php echo ucfirst($rows->interview_type_name)?></option>
<?php } ?>
</select>
</div><br>
<div class="form-group">
<label><b>Select Status:</b></label>
<select class="form-control" id="status_type_id" name="status_type_id" >
<option value="" disabled selected>Status Type</option>
<?php foreach($statustype as $rows) { ?>
<option value="<?php echo $rows->status_type_id?>"><?php echo ucfirst($rows->status)?></option>
<?php } ?>
</select>
</div><br>
<button type="submit" name="submit" value="submit" class="btn btn-primary" value="submit">Submit</button>
<button type="submit" id="submit" name="submit" class="btn btn-primary" value="schedule" onclick="ScheduleNextRound();">Schedule Next Round</button><br></br>
</form>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h3>Reports</h3>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-body">
<table id="example1" class="table table-bordered table-hover">
<thead>
<tr>
<th>Interview Date</th>
<th>Candidate</th>
<th>interview</th>
<th>status</th>
<th>Vendor</th>
</tr>
</thead>
<?php foreach ($view_candidates as $idata){ ?>
<tbody>
<tr id="domain<?php echo $idata->candidate_seletion_id;?>">
<td><?php echo $idata->date;?></td>
<td><?php echo $idata->f_name;?></td>
<td><?php echo $idata->interview_type_name;?></td>
<td><?php echo $idata->status;?></td>
<td><?php echo $idata->first_name;?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
</div>
</section>
</div>
Controller:
function candidate_process($candidateid,$userid){
$data["msg"]="";
$this->load->model('CandidateModel');
$data['statustype']=$this->CandidateModel->getstatustypes();
$data['interviewtype']=$this->CandidateModel->getinterviewtypes();
$data['candidate']=$this->CandidateModel->getcandidates();
$data['usertype']=$this->CandidateModel->getvendors();
$data['getCandidate'] = $this->CandidateModel->get_candidate_detail($candidateid);
$data['view_candidates'] = $this->CandidateModel->getcandidateselection();//this is my table view
if($this->input->post('submit')=="submit"){
$this->CandidateModel->add_candidate_selection($this->input->post());
redirect(base_url('Candidate/view_candidate_selection'));
}
$this->load->view('Candidates/candidate_process',$data);
}
Model1:
public function add_candidate_selection($data){
$data=array(
'candidate_id'=>$this->input->post('candidate_id'),
'user_id'=>$this->input->post('user_id'),
'status_type_id'=>$this->input->post('status_type_id'),
'interview_type_id'=>$this->input->post('interview_type_id'),
'date'=>$this->input->post('date')
);
$this->db->insert('candidate_selection', $data);
//print_r($data);
}
MOdel2:
public function getcandidateselection(){
$this->db->select('*');
$this->db->from('candidate_selection');
$this->db- >join('candidates_details','candidates_details.candidate_id=candidate_selection.candidate_id');
$this->db->join('interview_types','interview_types.interview_type_id=candidate_selection.interview_type_id');
$this->db->join('status_types','status_types.status_type_id=candidate_selection.status_type_id');
$this->db->join('users','users.user_id=candidate_selection.user_id');
$query = $this->db->get();
//echo $this->db->last_query();
return $query->result();
}
Can anyone help me how to do this..
Thanks in advance.
Replace the Following code in your model function
function getcandidateselection($candidateid)
{
$this->db->join('candidate_selection as cs','cs.candidate_id = cd.candidate_id');
$this->db->join('status_types as st','st.status_type_id = cs.status_type_id');
$this->db->where('cd.candidate_id',$candidateid);
$q = $this->db->get('candidates_details as cd');
return $q->result();
}
Hope it will solve your problem
My site offers products that have multiple options. Some with as many as 5-8 options. So, the "details box" ends up way beneath all of the options. Also, the details are to long to place into the "short description" box at the top. So, I moved the details box above the options box. When doing this it causes the "add to cart" button to no longer work. I have tried moving code all over the page & no matter which portion of code I move the "add to cart button" won't work. (I have tried moving the options code & the details box code) I am using a custom theme called BuyShop. Here is a link to one of the products so you can see what I am talking about & trying to do: http://www.dvineinspiration.com/featured-products/mime-basic-plus.html. I have also included the code from the product/view.phtml file below.
<!--PRODUCT BOX-->
<?php
$widthSmall=62;
$heightSmall=62;
$widthMedium=460;
$heightMedium=440;
$_video = $this->getProduct()->getVideobox();
$_customtab = $this->getProduct()->getCustomtab();
$_customtabtitle = $this->getProduct()->getCustomtabtitle();
$image_size=Mage::getStoreConfig('buyshoplayout/product_info/product_info_image_size');
$main_image_popup='';
$popup_video='';
if(Mage::helper('lightboxes')->isActive())
{
/*popups*/
$helper = Mage::helper('lightboxes');
$rel = $helper->getLightboxRel($helper->getConfig('lightbox_type'));
$class = $helper->getLightboxClass($helper->getConfig('lightbox_type'));
$main_image_popup='class="'.$class.'" rel="'.$rel.'"';
$popup_video='class="video '.$class.'" rel="'.$rel.'"';
}
switch($image_size)
{
case 'small':
if(Mage::helper('buyshopconfig')->getMediaCount($_product) or !empty($_video))
{
$span0=4;
$span1=1;
$span2=3;
$span3=8;
}
else
{
$span0=3;
$span1=1;
$span2=3;
$span3=9;
}
$height_thumbs=206;
break;
case 'medium':
if(Mage::helper('buyshopconfig')->getMediaCount($_product) or !empty($_video))
{
$span0=5;
$span1=1;
$span2=4;
$span3=7;
}
else
{
$span0=4;
$span1=1;
$span2=4;
$span3=8;
}
$height_thumbs=350;
break;
case 'big':
if(Mage::helper('buyshopconfig')->getMediaCount($_product) or !empty($_video))
{
$span0=6;
$span1=1;
$span2=5;
$span3=6;
}else
{
$span0=5;
$span1=1;
$span2=5;
$span3=7;
}
$height_thumbs=422;
break;
}
?>
<form action="<?php echo $this->getSubmitUrl($_product) ?>" method="post" id="product_addtocart_form"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
<div class="product-box">
<div class="no-display">
<input type="hidden" name="product" value="<?php echo $_product->getId() ?>" />
<input type="hidden" name="related_product" id="related-products-field" value="" />
</div>
<div class="row">
<div class="span<?php echo $span0?>">
<div class="product-img-box">
<div class="row">
<?php if(Mage::helper('buyshopconfig')->getMediaCount($_product) or !empty($_video)):?>
<div class="span<?php echo $span1?>">
<div class="more-views flexslider">
<ul class="slides">
<?php echo $this->getChildHtml('media') ?>
<?php if(!empty($_video)):?>
<li><a class="video" href="<?php echo Mage::helper('catalog/output')->productAttribute($this->getProduct(), $_video, 'video') ?>"><i class=" icon-link"></i></a></li>
<?php endif;?>
</ul>
</div>
</div>
<?php endif;?>
<div class="span<?php echo $span2?>">
<div class="product-image">
<a <?php echo $main_image_popup;?> title="<?php echo $this->htmlEscape($_product->getImageLabel())?>" <?php if(!Mage::helper('lightboxes')->isActive()):?>class="cloud-zoom"<?php endif;?> href="<?php echo Mage::helper('catalog/image')->init($_product, 'image', $_product->getFile())?>" <?php if(!Mage::helper('lightboxes')->isActive()):?>id='zoom1' data-rel="position: 'right', adjustX: 10, adjustY: 0"<?php endif;?>>
<img class="product-retina" data-image2x="<?php echo Mage::helper('catalog/image')->init($_product, 'image', $_product->getFile())->resize($widthMedium*2, $heightMedium*2)?>" src="<?php echo Mage::helper('catalog/image')->init($_product, 'image', $_product->getFile())->resize($widthMedium, $heightMedium)?>" alt="" />
</a>
</div>
<div class="pull-right hidden"><i class="icon-zoom-in"></i></div>
</div>
</div>
</div>
</div>
<div class="span<?php echo $span3?>">
<div class="product-shop">
<?php echo $this->getChildHtml('custom_related_block') ?>
<div class="product_info_left">
<div class="product-name">
<h1><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h1>
</div>
<?php if(Mage::getStoreConfig('buyshoplayout/product_info/sku')):?>
<p><?php echo $this->__('SKU') ?>: <b><?php echo nl2br($_product->getSku()) ?></b></p>
<?php endif; ?>
<?php if(!Mage::getStoreConfig('buyshopconfig/options/catalog_mode')):?>
<div class="product_type_data_price"><?php echo $this->getChildHtml('product_type_data') ?></div>
<?php endif; ?>
<div class="share-buttons share-buttons-panel" data-style="medium" data-counter="true" data-oauth="true" data-hover="true" data-promo-callout="left" data-buttons="twitter,facebook,pinterest"></div></p>
<div class="add-to-links">
<ul>
<?php echo Mage::helper('buyshopconfig')->addWishCompLink($_product,$this,true); ?>
<?php if ($this->canEmailToFriend()): ?>
<li><i class="icon-at"></i><?php echo $this->__('Email to a friend') ?></li>
<?php endif; ?>
</ul>
</div>
<?php echo $this->getReviewsSummaryHtml($_product, false, true)?>
<?php if(!Mage::getStoreConfig('buyshopconfig/options/catalog_mode')):?>
<?php echo $this->getPriceHtml($_product) ?>
<?php endif; ?>
<div class="socialsplugins_wrapper">
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('buyshop_social_like_buttons')->toHtml() ?>
</div>
<?php if ($_product->getShortDescription()):?>
<div class="short-description"><?php echo $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description') ?></div>
<?php endif;?>
<?php echo Mage::helper('buyshopconfig')->countdownSpecialPrice($_product,'defaultCountdown',$this);?>
<?php if(!Mage::getStoreConfig('buyshopconfig/options/catalog_mode')):?>
<?php echo $this->getChildHtml('alert_urls') ?>
<?php echo $this->getTierPriceHtml() ?>
<?php echo $this->getChildHtml('extrahint') ?>
<?php if (!$this->hasOptions()):?>
<?php if($_product->isSaleable()): ?>
<?php echo $this->getChildHtml('addtocart') ?>
<?php endif; ?>
<?php echo $this->getChildHtml('extra_buttons') ?>
<?php endif; ?>
<?php endif; ?>
<?php echo $this->getChildHtml('other');?>
<?php if(Mage::getStoreConfig('buyshoplayout/product_info/qr')):?>
<div class="clearfix hidden-phone" style="margin: 20px 0 0 0">
<img src="http://api.qrserver.com/v1/create-qr-code/?size=100x100&data=<?php echo Mage::helper("core/url")->getCurrentUrl() ?>" alt="QR: <?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?>"/>
</div>
<?php endif;?>
</div>
</div>
</div>
<?php $modules_enable=Mage::getStoreConfig('advanced/modules_disable_output');?>
<div class="row">
<div class="span12">
<ul class="nav-tabs" id="myTab">
<li class="active"><?php echo $this->__('Description') ?></li>
<?php if(!$modules_enable['Mage_Review']):?><li><?php echo $this->__('Reviews') ?></li><?php endif;?>
<?php if(!$modules_enable['Mage_Tag']):?><li><?php echo $this->__('Tags') ?></li><?php endif;?>
<?php if ($_customtab && Mage::getStoreConfig('buyshoplayout/product_info/custom_tab')): ?>
<li><?php if(!empty($_customtabtitle)) echo html_entity_decode($this->helper('catalog/output')->productAttribute($this->getProduct(), $_customtabtitle, 'customtabtitle'));else echo 'Custom tab title' ?></li>
<?php endif;?>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab1">
<?php foreach ($this->getChildGroup('detailed_info', 'getChildHtml') as $alias => $html):?>
<div class="box-collateral <?php echo "box-{$alias}"?>">
<?php if ($title = $this->getChildData($alias, 'title')):?>
<h2><?php echo $this->escapeHtml($title); ?></h2>
<?php endif;?>
<?php echo $html; ?>
</div>
<?php endforeach;?>
</div>
<div class="tab-pane" id="tab2">
<?php echo $this->getChildHtml('reviews') ?>
</div>
<div class="tab-pane" id="tab3">
<?php echo $this->getChildHtml('product_additional_data') ?>
</div>
<?php if ($_customtab): ?>
<div class="tab-pane" id="tab4">
<?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), $_customtab, 'customtab') ?>
</div>
<?php endif; ?>
</div></div></div>
<?php if ($_product->isSaleable() && $this->hasOptions()):?>
<?php echo $this->getChildChildHtml('container1', '', true, true) ?>
<?php endif;?>
<?php if ($_product->isSaleable() && $this->hasOptions()):?>
<?php echo $this->getChildChildHtml('container2', '', true, true) ?>
<?php endif;?>
</div>
</div>
<!--PRODUCT BOX EOF-->
</form>
</div>
</div>
</div>
<?php echo $this->getChildHtml('upsell_products') ?>
<script type="text/javascript">
<?php
?>
jQuery(function(){
var PreviewSliderHeight = function() {
var big_image_height= <?php echo $height_thumbs?>;
var preview_image_height= jQuery('div.more-views ul.slides li:first-child').height();
var slider_height = Math.round (big_image_height/preview_image_height) * preview_image_height - 10;
jQuery(".flexslider.more-views .flex-viewport").css({
"min-height": slider_height + "px"
});
if((slider_height-(jQuery('div.more-views ul.slides li:first-child').height()*jQuery('div.more-views ul.slides li').length))>=-10)
{
jQuery('.more-views .flex-next').remove()
jQuery('.more-views .flex-prev').remove()
}
};
jQuery('.flexslider.more-views').flexslider({
animation: "slide",
autoplay: false,
minItems: 3,
animationLoop: false,
direction: "vertical",
controlNav: false,
slideshow: false,
prevText: "<i class='icon-down'></i>",
nextText: "<i class='icon-up'></i>",
start: PreviewSliderHeight
});
})
</script>
<script type="text/javascript">
//<![CDATA[
var productAddToCartForm = new VarienForm('product_addtocart_form');
<?php if(Mage::getStoreConfig('buyshopconfig/options/ajax_add_to_cart')){?>
productAddToCartForm.submit = function(button, url) {
if (this.validator.validate()) {
var form = this.form;
var oldUrl = form.action;
if (url) {
form.action = url;
}
var e = null;
// Start of our new ajax code
if (!url) {
url = jQuery('#product_addtocart_form').attr('action');
}
url = url.replace("checkout/cart","ajax/index"); // New Code
var data = jQuery('#product_addtocart_form').serialize();
data += '&isAjax=1';
jQuery('#preloader .loader').fadeIn(300);
try {
jQuery.ajax( {
url : url,
dataType : 'json',
type : 'post',
data : data,
success : function(data) {
jQuery('#ajax_loader').hide();
if(data.status == 'ERROR'){
jQuery('#preloader .loader').hide();
jQuery('#preloader .inside').html(data.message);
jQuery('#preloader .message').fadeIn(300);
setTimeout(function(){
jQuery('#preloader .message').fadeOut();
},1500);
}else{
jQuery('#preloader .loader').hide();
if(jQuery('.ul_wrapper.toplinks')){
jQuery('.shoppingcart').replaceWith(data.sidebar);
}
jQuery(".shoppingcart .fadelink").bind({
mouseenter: function(e) {
jQuery(this).find(".shopping_cart_mini").stop(true, true).fadeIn(300, "linear");
},
mouseleave: function(e) {
jQuery(this).find(".shopping_cart_mini").stop(true, true).fadeOut(300, "linear");
}
});
if(jQuery('#topline .links')){
jQuery('#topline .links').replaceWith(data.toplink);
}
jQuery('#preloader .inside').html(data.message);
jQuery('#preloader .message').fadeIn(300);
setTimeout(function(){
jQuery('#preloader .message').fadeOut();
},1500)
}
}
});
} catch (e) {
}
// End of our new ajax code
this.form.action = oldUrl;
if (e) {
throw e;
}
}
}.bind(productAddToCartForm);
<?php }else { ?>
productAddToCartForm.submit = function(button, url) {
if (this.validator.validate()) {
var form = this.form;
var oldUrl = form.action;
if (url) {
form.action = url;
}
var e = null;
try {
this.form.submit();
} catch (e) {
}
this.form.action = oldUrl;
if (e) {
throw e;
}
if (button && button != 'undefined') {
button.disabled = true;
}
}
}.bind(productAddToCartForm);
<?php } ?>
productAddToCartForm.submitLight = function(button, url){
if(this.validator) {
var nv = Validation.methods;
delete Validation.methods['required-entry'];
delete Validation.methods['validate-one-required'];
delete Validation.methods['validate-one-required-by-name'];
// Remove custom datetime validators
for (var methodName in Validation.methods) {
if (methodName.match(/^validate-datetime-.*/i)) {
delete Validation.methods[methodName];
}
}
if (this.validator.validate()) {
if (url) {
this.form.action = url;
}
this.form.submit();
}
Object.extend(Validation.methods, nv);
}
}.bind(productAddToCartForm);
<?php if(!Mage::helper('lightboxes')->isActive()):?>
jQuery("a.video").click(function() {
jQuery.fancybox({
'padding' : 0,
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'title' : this.title,
'width' : 680,
'height' : 495,
'href' : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
'type' : 'swf',
'swf' : {
'wmode' : 'transparent',
'allowfullscreen' : 'true'
}
});
return false;
});
<?php endif;?>
//]]>
When you have products with multiple options the details box ends up way beneath them so that the customer many not even see them. So, just in case anyone else has this issue & wants/needs assistance doing this. In order to move the "Details/Description" box above the add to cart button & keep the add to cart button functioning......
1. Details/Description Box - move the following code to above the last two </div> right before <!--PRODUCT BOX EOF-->:
<?php $modules_enable=Mage::getStoreConfig('advanced/modules_disable_output');?>
<div class="row">
<div class="span12">
<ul class="nav-tabs" id="myTab">
<li class="active"><?php echo $this->__('Description') ?></li>
<?php if(!$modules_enable['Mage_Review']):?><li><?php echo $this->__('Reviews') ?></li><?php endif;?>
<?php if(!$modules_enable['Mage_Tag']):?><li><?php echo $this->__('Tags') ?></li><?php endif;?>
<?php if ($_customtab && Mage::getStoreConfig('buyshoplayout/product_info/custom_tab')): ?>
<li><?php if(!empty($_cu`enter code here`stomtabtitle)) echo html_entity_decode($this->helper('catalog/output')->productAttribute($this->getProduct(), $_customtabtitle, 'customtabtitle'));else echo 'Custom tab title' ?></li>
<?php endif;?>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab1">
<?php foreach ($this->getChildGroup('detailed_info', 'getChildHtml') as $alias => $html):?>
<div class="box-collateral <?php echo "box-{$alias}"?>">
<?php if ($title = $this->getChildData($alias, 'title')):?>
<h2><?php echo $this->escapeHtml($title); ?></h2>
<?php endif;?>
<?php echo $html; ?>
</div>
<?php endforeach;?>
</div>
<div class="tab-pane" id="tab2">
<?php echo $this->getChildHtml('reviews') ?>
</div>
<div class="tab-pane" id="tab3">
<?php echo $this->getChildHtml('product_additional_data') ?>
</div>
<?php if ($_customtab): ?>
<div class="tab-pane" id="tab4">
<?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), $_customtab, 'customtab') ?>
</div>
<?php endif; ?>
2. Add to cart button - move the following code beneath <!--PRODUCT BOX EOF--> (Each piece of code is located in a separate part of the product box so just look for them & put them together)
<form action="<?php echo $this->getSubmitUrl($_product) ?>" method="post" id="product_addtocart_form"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
And
<?php if ($_product->isSaleable() && $this->hasOptions()):?>
<?php echo $this->getChildChildHtml('container1', '', true, true) ?>
<?php endif;?>
<?php if ($_product->isSaleable() && $this->hasOptions()):?>
<?php echo $this->getChildChildHtml('container2', '', true, true) ?>
<?php endif;?>
And
</form>
I have two forms on my page, I wrapped the first with a new class just to restrict it to span5, and from that the forms now appear next to each other horizontally but the first is not allowing you to click into or on the elements at all.
<div class="row">
<div class="greybg-container">
<div class="span5">
<div id="login-container">
<div class="inner-content">
<h4>Login</h4>
<div class="basket-login"><div class="basket-login-text"><?php $seintro = new Page($db,'SiteElements','Login'); echo $seintro->row['pageCopy']; ?></div>
<form method="post" action="<?php echo HTTP_HOST; ?>Site/MyAccount/Login/?basketId=<?php echo $_REQUEST['basketId'] ? $_REQUEST['basketId'] : $basket->row['orderId']; ?>&wishlist=<?php echo $_GET['wishlist']; ?>&categoryId=<?php echo $_GET['categoryId']; ?>&addToBasketSize=<?php echo $_GET['addToBasketSize']; ?>">
<?php if ($errorLogin){ ?>
<span class="error"><?php echo $errorLogin; ?></span>
<?php } ?>
<table class="basket">
<?php foreach($form_login as $each){ ?>
<tr><td class="title"><?php $each->writeLabel(); ?></td>
<td><?php $each->write(); ?></td></tr>
<?php } ?>
<tr>
<td class="title">
<label for="login_userSubmit"></label>
</td>
<td class="form_button">
<input id="login_userSubmit" type="submit" size="" value="Send" onclick="" name="login_userSubmit">
<br>
<a class="grey-link" href="<?php echo HTTP_HOST; ?>Site/MyAccount/ForgotPassword">Forgot Password ?</a>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
</div>
<div id="left">
<div class="inner-content">
<h4>Register</h4>
<div class="basket-login"><div class="basket-login-text"><?php $seintro = new Page($db,'SiteElements','Register'); echo $seintro->row['pageCopy']; ?><?php echo $page->row['pageCopy']; ?></div></div>
<form method="post" enctype="multipart/form-data">
<?php if (is_array($error)){ ?>
<strong>Please Note :</strong> The following errors have occurred
<ul>
<?php foreach($error as $id=>$each){ ?>
<li class="error"><?php $form_signup[$id]->writeLabel($each); ?></li>
<?php } ?>
</ul>
<?php } ?>
<table class="basket">
<?php if($form_signup){ foreach($form_signup as $each){ ?>
<tr>
<td class="title"><?php $each->writeLabel(); ?></td>
<td><?php $each->write(); ?></td>
<?php } } ?>
<tr>
<td class="title">
<label for="signup_submit"></label>
</td>
<td class="form_button">
<input style="width:auto;" id="signup_submit" type="submit" size="" value="Continue Registration" onclick="document.getElementById('action_submit').value='1';document.submit();" name="signup_submit">
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
the second form starts where there is div id="left". ignore the fact it says left, that's the form on the right as you'll see.
http://bit.ly/19fegdi
Span5 is overlapped by the form which on the right side. Add the following css style will fix it.
#left{
float: left;
}