change quantity button cannot be functioned, PHP Web Programming

Assignment Help:
error_reporting(0);
session_start();
header(''Content-type: text/html; charset=utf-8'');
include_once(''../../xajax_core/xajax.inc.php''); // ?? xajax
$xajax = new xajax(); // ?? xajax ??

// ??????
$chaObj=$xajax->registerFunction(''change_quantity'');
$chaObj->useSingleQuote();
$chaObj->addParameter(XAJAX_FORM_VALUES,''form1'');
$xajax->processRequest(); // ????

$xajax->printJavascript();


//---------------------- ????? ---------------------
// ?????????????

function change_quantity($form) {

$objResponse = new xajaxResponse(); // ??????
// ???? Checkbox ??? p_id, ????, ??????
// ?????????? ''p_id'' ??, ??????????
// ????????

if(isset($form[''p_id''])) {
// ?????????????
foreach($form[''p_id''] as $p_id) {
// ???????????????
if($form[''qua''][$p_id]==''0'') {
// ???????? 0, ????????????
unset($_SESSION[''cart''][$p_id]);

if(count($_SESSION[''cart''])==0) { // ????????
$objResponse-> // ?????
script(''alert("cart has no items");window.close();'');
unset($_SESSION[''cart'']);
}
else { // ???????????
// ?????????????
$objResponse->remove($p_id);

// ???????????
$objResponse->assign(''total'',''innerHTML'',gettotal());
}
}
else if ($form[''qua''][$p_id]>0) {
// ????? 0 ??, ?????????????
$_SESSION[''cart''][$p_id][''quantity''] = $form[''qua''][$p_id];

// ??????, ?????????????????
$objResponse->assign(''sub['' . $p_id . '']'', ''innerHTML'',
$_SESSION[''cart''][$p_id][''quantity''] *
$_SESSION[''cart''][$p_id][''price'']);
$objResponse->assign(''total'',''innerHTML'',gettotal());
}
else {
// ??????, ?????????
$objResponse->assign(''qua['' . $pid . '']'', ''innerHTML'',
$_SESSION[$pid][''quantity'']);
}
}
}
return $objResponse; // ??????
} // ???? change_quantity() ??

// ????????
function getTotal() {
$total = 0;
foreach($_SESSION[''cart''] as $p_id => $item)
$total += ($item[''quantity''] * $item[''price'']);

return $total;
}


//---------------------- ??? HTML ---------------------
// ?????????, ?????????????????
if( !isset($_SESSION[''cart'']) ) { // ???????
echo "";
exit();
}
?>
?????




printJavaScript(''/''); ?>





cellspacing="0" cellpadding="2"
style="text-align:center;border:1px solid silver">













// ?????????
$total = 0;
foreach($_SESSION[''cart''] as $p_id => $item) {
// ???? id ???? $p_id, ???????
echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "";
echo "\n";
echo "\n";
}
?>




cart
all

onClick="select_all(''form1'',''p_id[]'',this.name);">
product name unit price quantity subtotal
" .
" $p_id . "''>
" . $item[''name''] . "" . $item[''price''] . "×" .
" value=''" . $item[''quantity''] . "'' size=''3''>
=" .""."
total:













onClick="settozero(''form1'',''p_id[]'')">

onClick="xajax_change_quantity(xajax.getFormValues(''form1''))">

onClick="window.close();">

onClick="location.href=''checkout.php'';">



Related Discussions:- change quantity button cannot be functioned

Prepare a custom website in php only, Prepare a Custom Website in PHP only....

Prepare a Custom Website in PHP only. Do Not propose any CMS for this software. I am also PHP developer. So please note that read cautiously then bid on this project. This is

We need help in channel unity magento site setup for amazon, We need help i...

We need help in Channel Unity Magento site setup for amazon/ebay I am in search of someone with detailed knowledge of Channel Unity software who can set up my Amazon and Ebay ac

Need an expert to clone a website, Need an expert to Clone a website I w...

Need an expert to Clone a website I would like to repeat a website with other words to have a similar website with the same application for demo trading and trial accounts. O

How to Install PHP Xampp, How to Install PHp Xampp please can someone guide...

How to Install PHp Xampp please can someone guide me.

I am in search of wufoo api expert, I am in search of Wufoo API Expert I...

I am in search of Wufoo API Expert I am seeking someone who is skilled with Wufoo's form API. The task needs submitting wufoo form xml to another site. Please offer relevant exp

We need help in financial application support, We need help in Financial Ap...

We need help in Financial Application Support Enhance our account aggregation process using Yodlee API. We want to fix several bugs in our existing process as well as change fro

I want an experienced html and css developer, HTML / CSS Developer for Joom...

HTML / CSS Developer for Joomla Based Site I want an experienced HTML/CSS developer to develop HTML/CSS from PSD designs for a Joomla based site for a mobile focused company.

I need help for booking travel site, I need help for Booking Travel Site ...

I need help for Booking Travel Site before you offer, we merely award projects to contractors with a strong rating, history, and the same experience. Make 100% confident that

Magento expert wanted for a quick help, Magento Expert wanted for a quick j...

Magento Expert wanted for a quick job at ALRUG.com We are working on a new website founded on Magento for ALRUG.com, which is now located at ALRUG.com/beta running on Magento Co

We need help to code fix on our web site, We need help to Code Fix on Our W...

We need help to Code Fix on Our Web site Our web site is a WordPress based site. Freshly we updated the plug-ins on our web site. All plug-ins updated appropriately except our M

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd