I have Datepicker that is purely working in test_datepicker.html. Here is my code:
<!DOCTYPE html>
<html>
<head>
<title>Date Picker</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" >
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script type="text/javascript">
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
</head>
<body>
this is working, but when i sync this on my ci with php the code is not working.
http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" ?>' >
http://code.jquery.com/jquery-1.10.2.js" ?>' >
http://code.jquery.com/ui/1.11.4/jquery-ui.js" ?>' >
<script type="text/javascript">
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
<table class="table">
<tr>
<th class="author">Employee</th>
<th>Branch</th>
<th>Designation</th>
<th>Date hired</th>
</tr>
<?php
$e = $this->db->distinct("lastname,firstname")->from("tb_employee")->get();
foreach($e->result() as $emp ):
?>
<tr>
<td><?php echo $emp->lastname . ' ' . $emp->firstname; ?></td>
<td>
<select name = "tbarnch">
<?php $b = $this->db->select("*")->from("tb_branch")->get();
foreach($b->result() as $br ):
?>
<option value =<?php echo $br->branch_id;?>>
<?php echo $br->branch_name; ?>
</option>
<?php endforeach;?>
</select>
</td>
<td>
<select name = "tdesignation">
<?php $d = $this->db->select("*")->from("tb_designation")->get();
foreach($d->result() as $des ):
?>
<option>
<?php echo $des->designation_name; ?>
</option>
<?php endforeach;?>
</select>
</td>
<td>
<select>
<?php
$date = '';
$date = date("Y");
for ($i=$date; $i > 1900;$i--) {
echo "<option value = ".$i.">" .$i. "</option>";
}
?>
</select>
</td>
<td><input type="text" placeholder="Pickup Date" id="datepicker" name="datepicker"></td>
</tr>
<?php endforeach;?>
</table>
i am using table tag on this.
Try to paste the following code before the body tag.
<script type="text/javascript">
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
I just solved it... :) cheers
<script type="text/javascript">
$( "#datepicker" ).datepicker();
</script>
When i check it on my Dev tools in my google Chrome, it does not recognize as a function..
Related
Below code we are using to display quantity text field and update quantity.
I want to know what all code is there in behind to update this quantity.
Means what script, ajax, contoller codes are responsible for saving this quantity.
<li class="fields">
<div class="customer-name">
<div class="field">
<label class="required" for="qty"><em>*</em><?php echo $helper->__('Quantity')?></label>
<div class="input-box">
<input type="text" name="qty" id="qty" value="<?php echo intval($mpAssignProductModel->getQty()) ?>" class="required-entry validate-zero-or-greater input-text"/>
</div>
</div>
</div>
</li>
because when i used above code in another file. It didt worked for me.
another page was displaying like this before :
After i replaced above code in another phtml file, its displaying like this :
This is complete code of file where updating quantity is not working :
phtml code :
<?php
$helper=Mage::helper('mpassignproduct');
$isPartner= Mage::getModel('marketplace/userprofile')->isPartner();
if($isPartner==1){ ?>
<script type="text/javascript">
if (typeof jQuery == 'undefined'){
document.write(unescape("%3Cscript src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>
<script src="//code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<div>
<div class="page-title">
<h1><?php echo $helper->__('My Assign Product List') ?></h1>
</div>
<div class="wk_mp_design">
<div class="block block-account">
<div class="block-title">
<strong><span><h4><?php echo $helper->__('My Assign Product List'); ?></h4></span></strong>
</div>
</div>
<div class="fieldset wk_mp_fieldset">
<div class="grid">
<div class="hor-scroll">
<?php
if(count($this->getCollection())==0): ?>
<div class="fieldset wk_mp_fieldset">
<div class="wk_emptymsg">
<?php echo $helper->__('No Product Available') ?>
</div>
</div>
<?php else: ?>
<form action="<?php echo Mage::helper('core/url')->getCurrentUrl();?>" method="post">
<table cellspacing="0" class="border wk_mp_list_table">
<thead>
<tr id="wk_mp_tr_heading">
<th><span><?php echo $helper->__('Product Name') ?></span></th>
<th><span><?php echo $helper->__('Date') ?></span></th>
<th><span><?php echo $helper->__('Product Status') ?></span></th>
<th><span> </span></th>
</tr>
</thead>
<tbody class="wk_mp_body">
<tr>
<td>
<input type="text" class="input-text" name="s" placeholder='<?php echo $helper->__('Search by product name') ?>' value="<?php echo $this->getRequest()->getParam('s')?>"/>
</td>
<td>
<span class="wk_mp_td_span">
<?php echo $helper->__('From: ') ?>
<input name="from_date" id="special_from_date" class="input-text" value="<?php echo $this->getRequest()->getParam('from_date')?>" />
</span>
<span class="wk_mp_td_span">
<?php echo $helper->__('To: ') ?>
<input name="to_date" id="special_to_date" class="input-text" value="<?php echo $this->getRequest()->getParam('to_date')?>" />
</span>
</td>
<td>
<select name="prostatus" class="input-text">
<option value=""><?php echo $helper->__('All') ?></option>
<option value="1" <?php if($this->getRequest()->getParam('prostatus') == 1) echo 'selected="selected"'?>>
<?php echo $helper->__('Approved') ?>
</option>
<option value="2" <?php if($this->getRequest()->getParam('prostatus') == 2) echo 'selected="selected"'?>>
<?php echo $helper->__('Unapproved') ?>
</option>
</select>
</td>
<td>
<button class="button" title="Save" type="submit">
<span><span><span><?php echo $helper->__('Submit') ?></span></span></span>
</button>
</td>
</tr>
</tbody>
</table>
</form>
<form name="formmassdelete" id="form-customer-product-delete" method="post" action="<?php echo $this->getUrl('mpassignproduct/index/massdeletepro') ?>">
<input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" />
<button id="mass_delete_butn" style="float: left;padding: 5px 5px 5px 0;" type="submit" title="Delete Sellers" class="button">
<span><span>Delete Products</span></span>
</button>
<table cellspacing="0" class="border wk_mp_list_table wk_mp_list_container_table">
<thead>
<tr class="wk_content">
<th class="wk_check_first_td">
<span><input type="checkbox" id="mpselecctall" value="all" name="mpselecctall"></span>
</th>
<th class="wk_first_td">
<span class="label "><?php echo $helper->__('Product Name')?></span>
</th>
<th>
<span class="label name"><?php echo $helper->__('Price')?></span>
</th>
<th>
<span class="label name"><?php echo $helper->__('SKU')?></span>
</th>
<th>
<span class="label name"><?php echo $helper->__('Delivery Time')?></span>
</th>
<th>
<span class="label name"><?php echo $helper->__('Replacement Guarantee')?></span>
</th>
<th>
<span class="label qty"><?php echo $helper->__('Status')?></span>
</th>
<th>
<span class="label qty"><?php echo $helper->__('Qty.')?></span>
</th>
<th>
<span class="label qty"><?php echo $helper->__('Condition')?></span>
</th>
<th>
<span class="label"><?php echo $helper->__('Action')?></span>
</th>
</tr>
</thead>
<tbody>
<?php foreach($this->getCollection() as $assinproducts): ?>
<?php $products=Mage::getModel('catalog/product')->load($assinproducts->getProductId()); ?>
<tr class="wk_row_view ">
<td class="wk_check_first_td">
<span>
<input type="checkbox" value="<?php echo $assinproducts->getMpassignproductId(); ?>" class="mpcheckbox" name="product_mass_delete[]">
</span>
</td>
<td class="wk_first_td">
<span class="label name" title="<?php echo $products->getName(); ?>">
<?php
$productname=strlen($products->getName())>7?substr($products->getName(),0,7)."..":$products->getName();
echo $products->getName();
?>
</span>
</td>
<td>
<span class="label price">
<?php echo Mage::helper('core')->currency($assinproducts->getPrice(), true, false);?>
</span>
</td>
<td>
<span class="label sku">
<?php echo $assinproducts->getsku() ?>
</span>
</td>
<td>
<span class="label replacement">
<?php echo $assinproducts->getdeliverytime() ?>
</span>
</td>
<td>
<span class="label delivery">
<?php echo $assinproducts->getreplacement() ?>
</span>
</td>
<td>
<span class="label pro_status">
<?php if($assinproducts['flag']==1): ?>
<?php echo Mage::helper('mpassignproduct')->__('Approved')?>
<?php else: ?>
<?php echo Mage::helper('mpassignproduct')->__('Un-Approved')?>
<?php endif; ?>
</span>
</td>
<td>
<li class="fields">
<div class="customer-name">
<div class="field">
<label class="required" for="qty"><em>*</em><?php echo $helper->__('Quantity')?></label>
<div class="input-box">
<input type="text" name="qty" id="qty" value="<?php echo intval($mpAssignProductModel->getQty()) ?>" class="required-entry validate-zero-or-greater input-text"/>
</div>
</div>
</div>
</li>
</td>
<td>
<span class="label">
<?php
if($assinproducts['product_condition']=='new')
echo Mage::helper('mpassignproduct')->__('New');
else
echo Mage::helper('mpassignproduct')->__('Used');
?>
</span>
</td>
<td>
<span class="label wk_action">
<img src="<?php echo $this->getSkinUrl('marketplace/images/icon-edit.png'); ?>" data-type="<?php echo $assinproducts->getMpassignproductId(); ?>" alt="<?php echo $helper->__('Edit')?>" title="<?php echo $helper->__('Edit')?>" class="mp_edit"/>
<img data-type="<?php echo $assinproducts->getMpassignproductId(); ?>" src="<?php echo $this->getSkinUrl('marketplace/images/icon-trash.png'); ?>" alt="<?php echo $helper->__('Delete')?>" title="<?php echo $helper->__('Delete')?>" class="mp_delete"/>
</span>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</form>
<?php endif; ?>
</div>
</div>
<?php echo $this->getPagerHtml(); ?>
</div>
</div>
<div class="buttons-set">
<p class="back-link">
« <?php echo Mage::helper('marketplace')->__('Back') ?>
</p>
</div>
</div>
<?php }else{
echo "<h2 class='wk_new_msg'>".$helper->__("To BECOME SELLER PLEASE CONTACT TO ADMIN.")."</h2>";
}?>
<script>
function validateNumbers(e)
{
if (jQuery.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 ||
// Allow: Ctrl+A, Command+A
(e.keyCode == 65 && ( e.ctrlKey === true || e.metaKey === true ) ) ||
// Allow: home, end, left, right, down, up
(e.keyCode >= 35 && e.keyCode <= 40)) {
// let it happen, don't do anything
return;
}
// Ensure that it is a number and stop the keypress
if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
e.preventDefault();
}
}
var $wk_jq = jQuery.noConflict();
(function($wk_jq){
$wk_jq( "#special_from_date" ).datepicker({dateFormat: "yy-mm-dd"});
$wk_jq( "#special_to_date" ).datepicker({dateFormat: "yy-mm-dd"});
$wk_jq('#mpselecctall').click(function(event) {
if(this.checked) {
$wk_jq('.mpcheckbox').each(function() {
this.checked = true;
});
}else{
$wk_jq('.mpcheckbox').each(function() {
this.checked = false;
});
}
});
$wk_jq('body').delegate('.mp_edit','click',function(){
var id=$wk_jq(this).attr("data-type");
var dicision=confirm('<?php echo $helper->__(" Are you sure you want to edit this product ? ")?>');
if(dicision==true){
var $type_id=$wk_jq(this).attr('data-type');
window.location = "<?php echo $this->getUrl('mpassignproduct/index/edit/') ?>".concat("id/",id);
}
});
$wk_jq('.mp_delete').click(function(){
var id=$wk_jq(this).attr("data-type");
var dicisionapp=confirm('<?php echo $helper->__(" Are you sure you want to delete this product ? ")?>');
if(dicisionapp==true)
window.location = "<?php echo $this->getUrl('mpassignproduct/index/delete/') ?>".concat("id/",id);
});
$wk_jq('#mass_delete_butn').click(function(e){
var flag =0;
$wk_jq('.mpcheckbox').each(function(){
if (this.checked == true){
flag =1;
}
});
if (flag == 0){
alert("<?php echo $helper->__(' No Checkbox is checked') ?>");
return false;
}
else{
var dicisionapp=confirm('<?php echo $helper->__(" Are you sure you want to delete these product ? ")?>');
if(dicisionapp==true){
$wk_jq('#form-customer-product-delete').submit();
}else{
return false;
}
}
});
})($wk_jq);
function hideReset(product_id)
{
var qtyId='#qty_'+ product_id;
var editLink="#edit_link_"+ product_id;
var updateButton="#update_button_"+ product_id;
var resetButton="#reset_button_"+ product_id;
$wk_jq(qtyId).hide();
$wk_jq(editLink).show();
$wk_jq(updateButton).hide();
$wk_jq(resetButton).hide();
}
function showField(product_id)
{
var qtyId = '#qty_'+ product_id;
var editLink = "#edit_link_"+ product_id;
var updateButton = "#update_button_"+ product_id;
var resetButton = "#reset_button_"+ product_id;
$wk_jq(qtyId).show();
$wk_jq(editLink).hide();
$wk_jq(updateButton).show();
$wk_jq(updateButton).prop('disabled', false);//just in case
$wk_jq(resetButton).show();
return false;
}
function updateField(product_id,assignqty)
{
// alert("Hello! I am an alert box!!");
var qtyId = '#qty_'+ product_id;
var valueId = '#valueqty_'+ product_id;
var updatedqty = '#updatedqty_'+ product_id;
var editLink = "#edit_link_"+ product_id;
var updateButton = "#update_button_"+ product_id;
var resetButton = "#reset_button"+ product_id;
var url = '<?php echo Mage::getUrl('marketplace/marketplaceaccount/updateField/')?>';
$wk_jq(qtyId).toggle();
$wk_jq(editLink).hide();
$wk_jq(updateButton).show();
$wk_jq(resetButton).show();
$qty = $wk_jq(qtyId).val();
jQuery(valueId).html($qty);
hideReset(product_id);
var tmpQty = assignqty+parseInt($qty) ;
new Ajax.Request(url, {
method: 'post',
parameters: {id: product_id, qty: tmpQty},
onComplete: function (transport) {
// alert(tmpQty);
jQuery(priceId).val($price);
jQuery(updatedqty).show().delay(2000).fadeOut();
$updateButton.prop('disabled', false);
}
});
}
</script>
Quantity is working in this file = http://pastebin.com/mByVn3ax
I have the following form and controller where it has a image upload, but everything goes smooth except the file not being uploaded to the particular folder.
View
<?php
$this->load->helper('url');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>diluks eCommerce cms - home page</title>
<link href="<?php
echo base_url();
?>Public/scripts/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form action="<?php echo base_url();?>index.php/addproduct_controller" method="post">
<?php
include 'header-adminpanel.php';
?>
<div class="container">
<div class="body-content">
<div class="side-left"><?php
include 'adminproduct_sidebar.php';
?></div>
<div class="side-right">
<br />
<table>
<tr>
<td class="captions">Product Code</td>
<td><input name="txt_pcode" type="text"/></td>
</tr>
<tr>
<td class="captions">Product Name</td>
<td><input name="txt_pname" type="text" size="40" /></td>
</tr>
<tr>
<td class="captions">Product Price</td>
<td><input name="txt_pprice" type="text" /></td>
</tr>
<tr>
<td class="captions">Product Description</td>
<td><textarea name="txt_pdesc" style="width:300px;height:100px;"></textarea></td>
</tr>
<tr>
<td class="captions">Product Image</td>
<td><input type="file" name="userfile" size="20" /></td>
</tr>
<tr>
<td class="captions">Product Options</td>
<td><input name="txt_poptions" size="40" type="text" /><a class="hint"> (Separate by a "," comma)</a></td>
</tr>
<tr><td><input name="btn_add" class="button" type="submit" value="Add" /></td></tr>
</table>
<br />
</div>
</div>
</div>
<div style="clear:both"></div>
<?php
include 'footer.php';
?>
</form>
</body>
</html>
Controller
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Addproduct_controller extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->helper(array('form', 'url'));
}
public function index()
{
if (isset($_POST["btn_logout"])) {
$this->session->sess_destroy();
$this->load->view('welcome_view');
} else if (isset($_POST["btn_home"])) {
$this->load->view('welcome_view');
} else if (isset($_POST["btn_account"])) {
} else if (isset($_POST["btn_add"])) {
$prod_img = 'no image';
$config['upload_path'] = 'Public/uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '1024';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$config['encrypt_name'] = TRUE;
$this->load->library('upload', $config);
if (!$this->upload->do_upload()) {
// $error = array('error' => $this->upload->display_errors());
//$this->load->view('upload_form', $error);
//return 'error';
} else {
global $prod_img;
$data = array(
'upload_data' => $this->upload->data()
);
$prod_img = $data->file_name;
// $this->load->view('upload_success', $data);
}
$prod_name = $_POST["txt_pname"];
$prod_code = $_POST["txt_pcode"];
$prod_price = $_POST["txt_pprice"];
$prod_desc = $_POST["txt_pdesc"];
$prod_options = $_POST["txt_poptions"];
$this->load->model('product_model');
$addproduct_result = $this->product_model->addProduct($prod_code, $prod_name, $prod_price, $prod_desc, $prod_img);
if ($addproduct_result == true) {
echo "Added Successfully";
} else {
echo "Failed";
}
}
}
}
Then I tried by adding following instead of normal tags.
<?php
$this->load->helper('form');
?>
<?php
echo form_open_multipart(base_url().'index.php/addproduct_controller');
?>
where it gaves me an error
A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: controllers/addproduct_controller.php
Line Number: 53
Please help me with this or show me where I have done the mistake.
enctype attribute missing in your from tag.
Add enctype="multipart/form-data" in your form tag
OR
In CI, Use form_open_multipart function to generate form tag
As per discussion in comment, update your code as below.
$data = array(
'upload_data' => $this->upload->data()
);
$prod_img = $data["upload_data"]->file_name;
You have missed out to include form attribute to upload the file
Add enctype="multipart/form-data" in your form tag
You have make the html form but not added file upload tag in your form creation.
add: enctype="multipart/form-data" in your form tag.
<form action="<?php echo base_url();?>index.php/addproduct_controller" method="post" enctype="multipart/form-data" >
I copied estimatePostAction and made estimateAjaxPostAction (overriding core - I did not hack the core). The controller action works as well (class Mage_Checkout_CartController).
Now I want to get/create a block for replacing shipping block after estimate shipping with ajax. I tried this:
public function estimateAjaxPostAction()
{
$country = (string) $this->getRequest()->getParam('country_id');
$postcode = (string) $this->getRequest()->getParam('estimate_postcode');
$city = (string) $this->getRequest()->getParam('estimate_city');
$regionId = (string) $this->getRequest()->getParam('region_id');
$region = (string) $this->getRequest()->getParam('region');
$this->_getQuote()->getShippingAddress()
->setCountryId($country)
->setCity($city)
->setPostcode($postcode)
->setRegionId($regionId)
->setRegion($region)
->setCollectShippingRates(true);
$this->_getQuote()->save();
//$this->_goBack();
$this->loadLayout();
$block = $this->getLayout()->createBlock('Mage_Checkout_Block_Cart_Shipping','checkout.cart.shipping.ajax',array('template' => 'checkout/cart/shipping.phtml'));
if($block) {
$response = array();
$response['shipping'] = $block->toHtml();
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
}
}
The block checkout.cart.shipping.ajax was created. But toHtml() returns nothing.
My JSON returns:
{"shipping":""}
Why toHtml method doesn't work?
Edit: My block code (checkout/cart/shipping.phtml)
<?php /** #var $this Mage_Checkout_Block_Cart_Shipping */ ?>
<div class="row contem-shipping">
<div class="col-xs-10 shipping">
<div class="text-ship">
<h2><?php echo $this->__('Calcular o frete:') ?></h2>
<p><?php echo $this->__('Insira o CEP do endereço<br />no campo ao lado.') ?></p>
</div>
<div class="shipping-form">
<form action="<?php echo $this->getUrl('checkout/cart/estimatePost') ?>" method="post" id="shipping-zip-form">
<ul class="form-list">
<li class="no-display">
<div class="input-box">
<?php echo Mage::getBlockSingleton('directory/data')->getCountryHtmlSelect($this->getEstimateCountryId()) ?>
</div>
</li>
<?php if($this->getStateActive()): ?>
<li>
<label for="region_id"<?php if ($this->isStateProvinceRequired()) echo ' class="required"' ?>><?php if ($this->isStateProvinceRequired()) echo '<em>*</em>' ?><?php echo $this->__('State/Province') ?></label>
<div class="input-box">
<select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" style="display:none;"<?php echo ($this->isStateProvinceRequired() ? ' class="validate-select"' : '') ?>>
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
</select>
<script type="text/javascript">
//<![CDATA[
$('region_id').setAttribute('defaultValue', "<?php echo $this->getEstimateRegionId() ?>");
//]]>
</script>
<input type="text" id="region" name="region" value="<?php echo $this->escapeHtml($this->getEstimateRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none;" />
</div>
</li>
<?php endif; ?>
<?php if($this->getCityActive()): ?>
<li>
<label for="city"<?php if ($this->isCityRequired()) echo ' class="required"' ?>><?php if ($this->isCityRequired()) echo '<em>*</em>' ?><?php echo $this->__('City') ?></label>
<div class="input-box">
<input class="input-text<?php if ($this->isCityRequired()):?> required-entry<?php endif;?>" id="city" type="text" name="estimate_city" value="<?php echo $this->escapeHtml($this->getEstimateCity()) ?>" />
</div>
</li>
<?php endif; ?>
<li>
<div class="input-box">
<input class="input-text validate-postcode<?php if ($this->isZipCodeRequired()):?> required-entry<?php endif;?>" type="text" id="postcode" name="estimate_postcode" value="<?php echo $this->escapeHtml($this->getEstimatePostcode()) ?>" />
</div>
</li>
</ul>
<div class="buttons-set">
<button id="button-cep" style="width: 100px;" type="button" title="<?php echo $this->__('Get a Quote') ?>" onclick="calculaFreteAjax(jQuery('#postcode').val()); return false;" class="btn btn-2 btn-2a"><?php echo $this->__('Get a Quote') ?></button>
</div>
</form>
<script type="text/javascript">
//<![CDATA[
new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>);
//]]>
</script>
<?php $_shippingRateGroups = $this->getEstimateRates(); ?>
<?php if ($_shippingRateGroups): ?>
<form id="co-shipping-method-form" action="<?php echo $this->getUrl('checkout/cart/estimateUpdatePost') ?>">
<dl class="sp-methods">
<?php foreach ($_shippingRateGroups as $code => $_rates): ?>
<dt><?php echo $this->escapeHtml($this->getCarrierName($code)) ?></dt>
<dd>
<ul>
<?php foreach ($_rates as $_rate): ?>
<li<?php if ($_rate->getErrorMessage()) echo ' class="error-msg"';?>>
<?php if ($_rate->getErrorMessage()): ?>
<?php echo $this->escapeHtml($_rate->getErrorMessage()) ?>
<?php else: ?>
<input name="estimate_method" type="radio" value="<?php echo $this->escapeHtml($_rate->getCode()) ?>" id="s_method_<?php echo $_rate->getCode() ?>"<?php if($_rate->getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> class="radio" />
<label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $this->escapeHtml($_rate->getMethodTitle()) ?>
<?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
<?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
<?php echo $_excl; ?>
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
(<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
<?php endif; ?>
</label>
<?php endif ?>
</li>
<?php endforeach; ?>
</ul>
</dd>
<?php endforeach; ?>
</dl>
</form>
<?php endif; ?>
<script type="text/javascript">
//<![CDATA[
var coShippingMethodForm = new VarienForm('shipping-zip-form');
var countriesWithOptionalZip = <?php echo $this->helper('directory')->getCountriesWithOptionalZip(true) ?>;
coShippingMethodForm.submit = function () {
var country = $F('country');
var optionalZip = false;
for (i=0; i < countriesWithOptionalZip.length; i++) {
if (countriesWithOptionalZip[i] == country) {
optionalZip = true;
}
}
if (optionalZip) {
$('postcode').removeClassName('required-entry');
}
else {
$('postcode').addClassName('required-entry');
}
return VarienForm.prototype.submit.bind(coShippingMethodForm)();
}
//]]>
</script>
</div>
</div>
<div class="col-xs-6">
<?php
$totalItemsInCart = Mage::helper('checkout/cart')->getItemsCount(); //total items in cart
$totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals(); //Total object
$subtotal = $totals["subtotal"]->getValue(); //Subtotal value
$grandtotal = $totals["grand_total"]->getValue(); //Grandtotal value
if(isset($totals['discount']) && $totals['discount']->getValue()) {
$discount = $totals['discount']->getValue(); //Discount value if applied
} else {
$discount = '';
}
$shipping = Mage::helper('checkout')->getQuote()->getShippingAddress()->getData();
$tax = $shipping["shipping_amount"];
/*if( $totals["tax"]->getValue()) {
$tax = $totals["tax"]->getValue(); //Tax value if present
} else {
$tax = '';
}*/
?>
<table class="totals-cart">
<tr>
<td class="total-tile">
Subtotal do pedido:
</td>
<td class="total-price">
<?php echo Mage::helper('core')->currency($subtotal, true, false); ?>
</td>
</tr>
<tr>
<td class="total-tile">
Frete:
</td>
<td class="total-price">
<?php echo Mage::helper('core')->currency($tax, true, false); ?>
</td>
</tr>
<?php if ($discount):?>
<tr>
<td class="total-tile">
Desconto:
</td>
<td class="total-price">
<?php echo Mage::helper('core')->currency($discount, true, false); ?>
</td>
</tr>
<?php endif;?>
</table>
</div>
</div>
<div class="row">
<div class="col-xs-16">
<div class="grand-total">
<p class="text">Total:</p>
<p class="price"><?php echo Mage::helper('core')->currency($grandtotal, true, false);?></p>
</div>
</div>
</div>
<script type="text/javascript">
function calculaFreteAjax(cep) {
jQuery('.contem-shipping .shipping').html('<span class="remove-frete" style="display: block; margin: 0 auto; width: 20px;" id="login-please-wait"><img src="http://sites.xpd.com.br/cpaps/skin/frontend/xpd/default/images/opc-ajax-loader.gif" class="v-middle" alt=""/></span>');
var param = {'country_id': 'BR','estimate_postcode': cep};
console.log(param);
jQuery.ajax({
type: "GET",
url: '<?php echo Mage::getBaseUrl().'checkout/cart/estimateAjaxPost/'; ?>', //My Custom Controller
data: param,
success: function(response) {
response = jQuery.parseJSON(response);
if(response.shipping) {
jQuery('.contem-shipping').parent().html(response.shipping);
}
else {
alert('Falha ao calcular o frete. Tente novamente.');
}
}
});
jQuery('#co-shipping-method-form dd input.radio').click(function(){
//I will submit the shipping method selected
});
}
</script>
Denis... I have modify code please check
public function estimateAjaxPostAction()
{
$country = (string) $this->getRequest()->getParam('country_id');
$postcode = (string) $this->getRequest()->getParam('estimate_postcode');
$city = (string) $this->getRequest()->getParam('estimate_city');
$regionId = (string) $this->getRequest()->getParam('region_id');
$region = (string) $this->getRequest()->getParam('region');
$this->_getQuote()->getShippingAddress()
->setCountryId($country)
->setCity($city)
->setPostcode($postcode)
->setRegionId($regionId)
->setRegion($region)
->setCollectShippingRates(true);
$this->_getQuote()->save();
$response = array();
$response['shipping']=$this->eastmatesajax();
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
}
protected function eastmatesajax()
{
$layout=$this->getLayout();
$layout->getMessagesBlock()->setMessages(Mage::getSingleton('checkout/session')->getMessages(true),Mage::getSingleton('catalog/session')->getMessages(true));
$block = $this->getLayout()->createBlock('checkout/cart_shipping')->setTemplate( 'checkout/cart/shipping.phtml');
return $block->toHtml();
}
Updated block issue solved using $this->_getQuote()->collectTotals(); before $this->_getQuote()->save();
I have a mystery question: in my magento shop there is a specific page (part of /customer/account but from an extension) where inline translation is not working at all.
To be more specific: If inline translation is enabled for the entire shop, then it does usually work fine. Menus, Sub-Menus, Titles, everything can be translated.
But as soon I navigate to said page, I can't translate anything on the whole site. Not even the Menus and Sub-Menus, that do not even belong to the requested page.
As soon as I navigate to another page, translation works fine again.
I'm really lost and I hope that you guys can point me to places where this might be configurated?
for full disclousure: the extension mentioned is Webkul_Marketplacepartner and the page mentioned is marketplacepartner/partnerproducts/mydashboard/
the source code of the phtml looks like this:
<?php
$customerid=Mage::getSingleton('customer/session')->getCustomerId();
$isPartner= Mage::getModel('marketplaceprofile/marketplaceprofile')->isPartner($customerid);
$partner=Mage::getModel('marketplaceprofile/marketplaceprofile')->getPartnerProfileById($customerid);
if($isPartner==1){?>
<link href="<?php echo $this->getSkinUrl('Customerpartner/css/global.css'); ?>" rel="stylesheet" type="text/css" />
<link href="<?php echo $this->getSkinUrl('Customerpartner/css/jquery.jqplot.min.css'); ?>" rel="stylesheet" type="text/css" />
<link href="<?php echo $this->getSkinUrl('Customerpartner/css/webkul-image-slider.css'); ?>" rel="stylesheet" type="text/css" />
<link href="<?php echo $this->getSkinUrl('Customerpartner/css/shCoreDefault.min.css'); ?>" rel="stylesheet" type="text/css" />
<link href="<?php echo $this->getSkinUrl('Customerpartner/css/shThemejqPlot.min.css'); ?>" rel="stylesheet" type="text/css" />
<script src="<?php echo $this->getSkinUrl('Customerpartner/js/jquery.min.js'); ?>" type="text/javascript"></script>
<script src="<?php echo $this->getSkinUrl('Customerpartner/js/jquery.jqplot.min.js'); ?>" type="text/javascript"></script>
<script src="<?php echo $this->getSkinUrl('Customerpartner/js/shCore.min.js'); ?>" type="text/javascript"></script>
<script src="<?php echo $this->getSkinUrl('Customerpartner/js/shBrushJScript.min.js'); ?>" type="text/javascript"></script>
<script src="<?php echo $this->getSkinUrl('Customerpartner/js/shBrushXml.min.js'); ?>" type="text/javascript"></script>
<script src="<?php echo $this->getSkinUrl('Customerpartner/js/jqplot.logAxisRenderer.min.js'); ?>" type="text/javascript"></script>
<script src="<?php echo $this->getSkinUrl('Customerpartner/js/jqplot.canvasTextRenderer.min.js'); ?>" type="text/javascript"></script>
<script src="<?php echo $this->getSkinUrl('Customerpartner/js/jqplot.canvasAxisLabelRenderer.min.js'); ?>" type="text/javascript"></script>
<script src="<?php echo $this->getSkinUrl('Customerpartner/js/jqplot.canvasAxisTickRenderer.min.js'); ?>" type="text/javascript"></script>
<script src="<?php echo $this->getSkinUrl('Customerpartner/js/jqplot.dateAxisRenderer.min.js'); ?>" type="text/javascript"></script>
<script src="<?php echo $this->getSkinUrl('Customerpartner/js/jqplot.categoryAxisRenderer.min.js'); ?>" type="text/javascript"></script>
<script src="<?php echo $this->getSkinUrl('Customerpartner/js/jqplot.barRenderer.min.js'); ?>" type="text/javascript"></script>
<script src="<?php echo $this->getSkinUrl('Customerpartner/js/jqplot.canvasTextRenderer.min.js'); ?>" type="text/javascript"></script>
<script src="<?php echo $this->getSkinUrl('Customerpartner/js/jqplot.canvasAxisLabelRenderer.min.js'); ?>" type="text/javascript"></script>
<style>
div.example-plot { height: 400px;width: 650px;}
</style>
<?php
$mysqlprefix = Mage::getConfig()->getTablePrefix();
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
$k="";
$i=0;
$Optioncreated=0;
// prefix checking and execute code
$j=0;$op=0;
$weeklytotal=0;
$todaytotal=0.0;
$yeartotal=0.0;
$sk=array();
$allskulist=array();
$allmageprolist=array();
$$allorderids=array();
$s1=0;
$s2=0;
$s5=0;
$today=date("Y-m-d");
$sqlQuery = "select * from ".$mysqlprefix."marketplacepartner_entity_saleslist where mageproownerid =".$customerid." order by autoid desc";
$querydata=$write->query($sqlQuery);
$grandTotal = array();
$dataArr= array();
$currentCurrencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();
$baseCurrencyCode = Mage::app()->getBaseCurrencyCode();
foreach($write->fetchAll($sqlQuery) as $row){
$l=explode('-',$row['cleared_at']);
$day=substr($row['cleared_at'],0,10);
$row['actualparterprocost'] = round(Mage::helper('directory')->currencyConvert($row['actualparterprocost'], $baseCurrencyCode, $currentCurrencyCode),2);
$order = Mage::getModel('sales/order')->loadByIncrementId($row['magerealorderid']);
if($order->getStatus()!='pending'){
if($day==$today){
$todaytotal+=$row['actualparterprocost'];
}
$week_number = date('W');
$year = date('Y');
for($days=1; $days<=7; $days++)
{
$m=date('Y-m-d', strtotime($year."W".$week_number.$days));
if($day==trim($m))
{
$row['magerealorderid'].$weeklytotal=$row['actualparterprocost']+$weeklytotal;
}
}
$grandTotal[$l[1]]=$row['actualparterprocost']+$grandTotal[$l[1]];
$dataArr[]= $row;
}
}
?>
<div class="prdouctbackground">
<div class="maindash">
<h4 class="textcolor"><span><?php echo $this->__('My Vendor Dashboard') ?></span></h4>
<div class="salesmonth">
<div class="todaydash"><?php echo Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol(); if($todaytotal<=0) {echo 0;} else {echo $todaytotal;}?> <span class="textcolordash"> <?php echo $this->__('Today') ?></span>
</div>
<div class="weekdash"><?php echo Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol(); if($weeklytotal<=0){ echo 0;} else {echo $weeklytotal;}?> <span class="textcolordash"> <?php echo $this->__('Week') ?></span>
</div>
<div class="monthdash"><?php echo Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();
$d=date('m');
echo $grandTotal[$d];
?>
<span class="textcolordash"><?php echo $this->__('Month') ?></span>
</div>
</div>
<div class="salesemail"></div>
<div class="orderdproduct">
<table class="tablepostioneditdash">
<thead><tr>
<th class="headingbg"><span><?php echo $this->__('Latest Order') ; ?> </span></th>
</tr></thead>
<tbody id="tbodyingeditdash">
<?php
$m=0;
foreach($dataArr as $key=>$val){
$order = Mage::getModel('sales/order')->loadByIncrementId($val['magerealorderid']);
if($order->getStatus()!= 'pending'){ ?>
<tr>
<th class="tdpadfirsteditheadingdash">
<label for="name" class="rightgapeditheadedit">
<?php if($order->getStatus()=='pending') {?>
<div class="status" style="background-color:orange"><?php echo $this->__(strtoupper($order->getStatus())); ?> </div>
<?php }?>
<?php if($order->getStatus()=='canceled') {?>
<div class="status" style="background-color:red"><?php echo $this->__(strtoupper($order->getStatus())); ?> </div>
<?php }?>
<?php if($order->getStatus()=='complete') {?>
<div class="status" style="background-color:green"><?php echo $this->__(strtoupper($order->getStatus())); ?> </div>
<?php }?>
<?php if($order->getStatus()=='delivered') {?>
<div class="status" style="background-color:green"><?php echo $this->__(strtoupper($order->getStatus())); ?> </div>
<?php }?>
<?php if($order->getStatus()=='processing') {?>
<div class="status" style="background-color:blue"><?php echo $this->__(strtoupper($order->getStatus())); ?> </div>
<?php }?>
<p style="margin: 0 0 10px 6px;"><?php echo "<br>".$val['cleared_at']; ?></p> </label>
</th>
<th class="tdpadfirsteditheadingdash">
<label for="name" class="rightgapeditheadedit">
<div class="textcolordashdiv"><?php echo $this->__('Order'); ?> #<?php echo $val['magerealorderid']; ?></div>
<?php $shipping_address = $order->getShippingAddress();
if ( $shipping_address != null) {
?>
<div class="dd">
<?php echo "By: " . $shipping_address->getCustomerId(); ?>
<br>
<?php
$orddataing="SELECT * FROM ".$mysqlprefix."sales_flat_order_item where order_id='".$val['mageorderid']."' ORDER BY order_id DESC";
//$sqlProductQuery = "select * from ".$mysqlprefix."marketplacepartner_entity_saleslist where mageproownerid =".$customerid." AND magerealorderid='".$val['magerealorderid']."'";
$ordconnectioning = Mage::getSingleton('core/resource')->getConnection('core_read');
//$order = Mage::getModel('sales/order')->load($orderidenitity[$x]);
//$priceTwo = Mage::helper('directory')->currencyConvert($aa, $baseCurrencyCode, $currentCurrencyCode);
$shipammount=(int)$order->getShippingAmount();
$count=0;
$product;
foreach($ordconnectioning->fetchAll($orddataing) as $ordername){
$product=Mage::getModel('catalog/product')->load($ordername['product_id']);
if($ordername['product_id'] == $val['mageproid']){
if($count==0){
echo "<p style='color:silver;float:left;'>" . (int)$ordername['qty_ordered']." x ".$ordername['name']." (" . $product->getSku() .")</p>"; $proid[$m]=$ordername['product_id'];
}else{
echo "<p style='color:silver;float:left;'>, ". (int)$ordername['qty_ordered']." x ".$ordername['name']." (" . $product->getSku() .")</p>"; $proid[$m]=$ordername['product_id'];
}
$count++;
$m++;
}
}?>
</div>
<?php } ?>
</label>
</th>
<th class="tdpadfirsteditheadingdash">
<?php
/* (2014-01-07 AM) disabled till further notice */
?>
<label for="name" class="rightgapeditheadprice"><?php echo $this->__('Net margin') . ': '; echo Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol(); echo " ".$val['actualparterprocost']?> </label>
<?php
/**/
?>
</th>
<th>
<?php if($order->getStatus()=='processing') {?> <label for="name" class="rightgapeditheadedit">
<div class="status" style="background-color:blue"><?php echo $this->__('Ready To Shipped'); ?></div>
<p style='color:silver;text-align:center;'><?php echo $this->__('Click To Ship Item'); ?></p>
<p style='color:silver;text-align:center;'><?php
if ($order->hasInvoices()) {
$invoice = $order->prepareInvoice();
$invoice->register();
//$invoice->setEmailSent(true);
$invoice->save();
//$invoice->sendEmail();
$invoiceID = $invoice->getId(); ?>
<?php
/*
(2014-01-07 AM) disable till further notice
<?php echo $this->__('Print Invoice'); ?>
*/
?>
<?php } ?></p>
</label>
<?php }?>
<?php $updatedDate = $order->getUpdatedAt();
$terminationDays = $partner['terminationperiod'];
$TotalTime = strtotime($updatedDate) + $terminationDays * 86400;
$currentTime = time();
?>
<?php if($order->getStatus()=='delivered') {?>
<label for="name" class="rightgapeditheadedit">
<div class="status" style="background-color:green"><?php echo $this->__('Item Delivered'); ?></div></label>
<p style='color:silver;text-align:center;'><?php
if ($order->hasInvoices()) {
$invoice = $order->prepareInvoice();
$invoice->register();
//$invoice->setEmailSent(true);
$invoice->save();
//$invoice->sendEmail();
$invoiceID = $invoice->getId(); ?>
<?php
/*
(2014-01-07 AM) disable till further notice
Print Invoice
*/
?>
<?php
if($currentTime <= $TotalTime){
?>
<p style='color:silver;text-align:center;'><?php echo $this->__('Click After Item Received'); ?></p>
<?php } ?>
</p>
<?php } ?>
<?php } ?>
<?php if($order->getStatus()=='complete') {?>
<label for="name" class="rightgapeditheadedit">
<div class="status" style="background-color:green"><?php echo $this->__('Item Delivered'); ?></div></label>
<p style='color:silver;text-align:center;'><?php
if ($order->hasInvoices()) {
$invoice = $order->prepareInvoice();
$invoice->register();
//$invoice->setEmailSent(true);
$invoice->save();
//$invoice->sendEmail();
$invoiceID = $invoice->getId();
?>
<?php
/*
(2014-01-07 AM) disable till further notice
Print Invoice
*/
?>
<?php if($currentTime <= $TotalTime){
?>
<p style='color:silver;text-align:center;'><?php echo $this->__('Click After Item Received'); ?></p>
<?php } ?>
<?php } ?></p>
<?php } ?>
</p>
<?php //} ?>
</th>
</tr>
<?php
}else { }
}
?>
</tbody>
</table>
</div>
<div class="review">
<h4 colspan="2" class="headingbg"><?php echo $this->__('Latest Comments & Reviews'); ?></h4>
<table class="reviewtable">
<?php
$c=0;$cc=0;$r=0;
// prefix checking and execute code
$productget="select entity_pk_value from ".$mysqlprefix."review ORDER BY created_at DESC";
$ownerread = Mage::getSingleton('core/resource')->getConnection('core_read');
$q5=0;
foreach($ownerread->fetchAll($productget) as $value){
$storepro[$q5]=$value['entity_pk_value'];
$q5++;
}
$listingpro = array_unique($storepro);
foreach($listingpro as $q2){
$allpro=Mage::getModel('catalog/product')->load($q2);
$owner=Mage::getSingleton('customer/session')->getCustomer()->getEntityid();
$ownerconnection = Mage::getSingleton('core/resource')->getConnection('core_read');
// prefix checking and execute code
$cusresult=$ownerconnection->query("SELECT * FROM ".$mysqlprefix."marketplacepartner_entity_data where userid='".Mage::getSingleton('customer/session')->getCustomer()->getEntityid()."' and sku='".$allpro['sku']."'");
$ownerkey=$cusresult->fetch();
if($allpro['sku']==$ownerkey['sku']){
$ownerread = Mage::getSingleton('core/resource')->getConnection('core_read');
// mysql prefix checking and execute code
$ownerreadresulting=$ownerread->query("select * from ".$mysqlprefix."review where entity_pk_value ='".$allpro['entity_id']."' ORDER BY created_at DESC");
$ownerget=$ownerreadresulting->fetch();
// prefix checking and execute code
$ownerreviewresulting=$ownerread->query("select * from ".$mysqlprefix."review_detail where review_id ='".$ownerget['review_id']."' ORDER BY review_id DESC");
$ownerreviewget=$ownerreviewresulting->fetch();
// here i code for mysql prefix checking and execute code
$ratdatasql="select rating_summary from ".$mysqlprefix."review_entity_summary where entity_pk_value='".$allpro['entity_id']."' ORDER BY primary_id DESC";
$ownerrateresult=$ownerread->query($ratdatasql);
$ownerrateresulting=$ownerrateresult->fetch();
if((gettype($ownerreviewget)=='array')&& (gettype($ownerrateresulting)=='array')){
if(($c==0)||($c==1)){?>
<tr class="ex2">
<th class="reviewtablethleft">
<?php
$detail=$ownerreviewget['title'];
$nickname=$ownerreviewget['nickname'];
$status_id=$ownerget['status_id'];
$created_at=$ownerget['created_at'];
$rating_summary=$ownerrateresulting['rating_summary'];
?>
<div class="ratingslider-box"><div class="rating" style="width:<?php echo ceil($rating_summary);?>%;"></div></div>
<?php $productcity=Mage::getModel('catalog/product')->load($allpro['entity_id']); ?>
<p class="rightgapeditheadedit" style="margin: 5px 0 10px 6px;float: left;"><?php echo $this->__('Product') ?> : </p>
<p class="textcolorproalter"><?php echo $productcity['name']; ?></p>
<p class="rightgapeditheadedit" style="margin: 0 0 10px 6px;float: left;"><?php echo $this->__('Comment By') ?>: </p>
<p class="textcolorproalter"><?php echo $nickname; ?></p>
<p class="rightgapeditheadedit" style="margin: 0 0 10px 6px;float: left;"> </p>
<p class="textcolorproalter1"><?php echo $detail; ?></p>
</th>
<th class="reviewtablethright">
<br><br>
<?php if($status_id==1){?>
<p class="statusapp"><?php echo $this->__('Approved'); ?></p>
<?php } else{ ?>
<p class="statussunapp"><?php echo $this->__('Unapproved'); ?></p>
<?php }?>
<br>
<p class="rightgapeditheadedit" style="margin:0 0 10px 37%;float: left;"><?php echo $this->__('Review On') ?> : </p>
<p class="textcolorpro"> <?php echo trim($created_at); ?></p>
<?php $c++;?>
</th>
</tr>
<?php }
}
$r++;
}
}?>
</table>
</div>
<br>
<?php
/*(2014-01-07 AM) disabled till further notice
<div class="example-plot" id="chart2"></div>
*/
?>
</div>
<div class="button-set buttonarea">
<p class="headingbackindex">
« <?php echo $this->__('Back') ?>
</p>
</div>
</div>
<?php
/*(2014-01-07 AM) disabled till further notice
<script class="code" type="text/javascript" language="javascript">
jQuery.noConflict();
jQuery(document).ready(function(){
var line2 = [['1/1/<?php echo date('Y');?>', <?php if($aa<=0){ echo 0; } else { echo $aa; }?>], ['2/1/<?php echo date('Y');?>', <?php if($bb<=0){ echo 0; } else { echo $bb; }?>], ['3/1/<?php echo date('Y');?>',<?php if($cc<=0){ echo 0; } else { echo $cc; }?>], ['4/1/<?php echo date('Y');?>',<?php if($dd<=0){ echo 0; } else { echo $dd; }?>], ['5/1/<?php echo date('Y');?>',<?php if($ee<=0){ echo 0; } else { echo $ee; }?>], ['6/1/<?php echo date('Y');?>', <?php if($ff<=0){ echo 0; } else { echo $ff; }?>], ['7/1/<?php echo date('Y');?>', <?php if($gg<=0){ echo 0; } else { echo $gg; }?>], ['8/1/<?php echo date('Y');?>', <?php if($hh<=0){ echo 0; } else { echo $hh; }?>], ['9/1/<?php echo date('Y');?>', <?php if($ii<=0){ echo 0; } else { echo $ii; }?>], ['10/1/<?php echo date('Y');?>', <?php if($jj<=0){ echo 0; } else { echo $jj; }?>], ['11/1/<?php echo date('Y');?>', <?php if($kk<=0){ echo 0; } else { echo $kk; }?>], ['12/1/<?php echo date('Y');?>', <?php if($ll<=0){ echo 0; } else { echo $ll; }?>]];
var plot2 = jQuery.jqplot('chart2', [line2], {
axes: {
xaxis: {
renderer: jQuery.jqplot.DateAxisRenderer,
label: '<?php echo $this->__("Month"); ?>',
labelRenderer: jQuery.jqplot.CanvasAxisLabelRenderer,
tickRenderer: jQuery.jqplot.CanvasAxisTickRenderer,
tickOptions: {angle: 30}
},
yaxis: {
label: '<?php echo $this->__("Money") ?>',
labelRenderer: jQuery.jqplot.CanvasAxisLabelRenderer
}
}
});
});
</script>
*/
?>
<?php }else{
echo "<h2 style='color:#ff0000;font-weight:600'>".$this->__('FOR BECOME SELLER CONTACT TO ADMIN..')."</h2>";
}?>
please note that this code is not mine. I just have to deal with it.. -.-
The question has been answered by the support team of the modules developers. the reason for the not working inline translation was an error in a java script.
the fix looks like this:
<script class="code" type="text/javascript" language="javascript">
$wk_jq=jQuery.noConflict();
(function($wk_jq){
jQuery(document).ready(function(){
var line2 = [['1/1/<?php echo date('Y');?>', <?php if($aa<=0){ echo 0; } else { echo $aa; }?>], ['2/1/<?php echo date('Y');?>', <?php if($bb<=0){ echo 0; } else { echo $bb; }?>], ['3/1/<?php echo date('Y');?>',<?php if($cc<=0){ echo 0; } else { echo $cc; }?>], ['4/1/<?php echo date('Y');?>',<?php if($dd<=0){ echo 0; } else { echo $dd; }?>], ['5/1/<?php echo date('Y');?>',<?php if($ee<=0){ echo 0; } else { echo $ee; }?>], ['6/1/<?php echo date('Y');?>', <?php if($ff<=0){ echo 0; } else { echo $ff; }?>], ['7/1/<?php echo date('Y');?>', <?php if($gg<=0){ echo 0; } else { echo $gg; }?>], ['8/1/<?php echo date('Y');?>', <?php if($hh<=0){ echo 0; } else { echo $hh; }?>], ['9/1/<?php echo date('Y');?>', <?php if($ii<=0){ echo 0; } else { echo $ii; }?>], ['10/1/<?php echo date('Y');?>', <?php if($jj<=0){ echo 0; } else { echo $jj; }?>], ['11/1/<?php echo date('Y');?>', <?php if($kk<=0){ echo 0; } else { echo $kk; }?>], ['12/1/<?php echo date('Y');?>', <?php if($ll<=0){ echo 0; } else { echo $ll; }?>]];
var plot2 = jQuery.jqplot('chart2', [line2], {
axes: {
xaxis: {
renderer: jQuery.jqplot.DateAxisRenderer,
label: '<?php echo $this->__("Month"); ?>',
labelRenderer: jQuery.jqplot.CanvasAxisLabelRenderer,
tickRenderer: jQuery.jqplot.CanvasAxisTickRenderer,
tickOptions: {angle: 30}
},
yaxis: {
label: '<?php echo $this->__("Money") ?>',
labelRenderer: jQuery.jqplot.CanvasAxisLabelRenderer
}
}
});
});
})($wk_jq);
</script>
i want to do is every dropdown list have submit example.
every list have formopen.
this is my sample code
<?php $delete = form_open('maintenance/delete',array('name'=>'deleteCheckForm'));
$active = form_open('maintenance/active',array('name'=>'deleteCheckForm'));
$disable = form_open('maintenance/disable',array('name'=>'deleteCheckForm'));
?>
<table>
<tr>
<?php foreach($sample as $list) { ?>
<td><input type="checkbox" name="type"></td>
<td>name :<?php echo $list->name; ?></td>
<?php } ?>
</tr>
</table>
<select onchange="this.form.submit()">
<option value="<?php echo $delete; ?>">delete</option>
<option value="<?php echo $active; ?>">active</option>
<option value="<?php echo $disable; ?>">disable</option>
</select>
<?php echo form_close(); ?>
<html>
<body>
<?php echo form_open('', array('name'=>'deleteCheckForm'))?>
<table>
<?php foreach($sample as $list) { ?>
<tr>
<td><input type="checkbox" name="type"></td>
<td>name :<?php echo $list->name; ?></td>
</tr>
<?php } ?>
</table>
<select onchange="this.form.action='<?php echo site_url('maintenance')?>/'+this.value;this.form.submit()">
<option value="delete">delete</option>
<option value="active">active</option>
<option value="disable">disable</option>
</select>
<?php echo form_close(); ?>
</body>
</html>
you can try this one
first make your form outside of php tag
<form action="your_action" id="delete_frm" method="post"></form>
<form action="your_action" id="active_frm" method="post"></form>
<form action="your_action" id="diable_frm" method="post"></form>
then your select option will be like
<select id="select_form_post">
<option value="delete">delete</option>
<option value="active">active</option>
<option value="disable">disable</option>
</select>
then your script will be like
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/ 1.7.1/ jquery.min.js"></script>
<script type="text/javascript">
$("#select_form_post").change(function(){
var form_to_post=$(this).val();
if(form_to_post=="delete")
{
$("#delete_frm").submit();
}
if(form_to_post=="active")
{
$("#active_frm").submit();
}
if(form_to_post=="disable")
{
$("#disable_frm").submit();
}
});
</script>
please let me know if you need anything more.