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

What do you understand by the term open source, (a) Briefly outline the co...

(a) Briefly outline the concept of the Three-tier architecture. (b) What do you understand by the term Open Source? How does Open Source Software differ from Proprietary Sof

Draw layer from common toolbar, Step 1:  Select Layer from Common toolbar &...

Step 1:  Select Layer from Common toolbar & draw a layer. Step 2:  Write the text within the Layer. Step 3:  Click on Modify button (when the layer is selected) Step 4:  C

We are in need of website development, We are need of Website Development ...

We are need of Website Development I want a website developed that can do the following: 1. Google map that can search locations in a certain area. They must be able to searc

Need to make responsive website, Need to make RESPONSIVE WEBSITE NEEDED- Ad...

Need to make RESPONSIVE WEBSITE NEEDED- Adjustments to existing site I presently have a website template with a company called Bludomain. I need to host with another company as

Prestashop custom url rewrite, Prestashop Custom URL rewrite- repost I w...

Prestashop Custom URL rewrite- repost I would like somewhat to automatically create custom URLs in my shop for guest wishlists using the wishlist owner's names I presently am us

Phpbb modifications for course type forum, PHPBB modifications (course type...

PHPBB modifications (course type forum) I want to create a different view/organization of the viewForum.php for my phpBB site. To support this change several changes needs to

Network layer of osi model, This layer is responsible for routing a packet ...

This layer is responsible for routing a packet in the subnet i.e., from source to destination nodes across multiple nodes in the similar network or across multiple networks. This l

Dreamweaver, A Web site is a set of linked documents along shared attribute...

A Web site is a set of linked documents along shared attributes, such as associated topics, a similar design, or a shared reason. Macromedia Dreamweaver is site creation & manageme

A bot for uploading purpose, A bot for uploading purpose Project Descrip...

A bot for uploading purpose Project Description: i'm seeking a good coder to code me a bot for uploading purpose must work on windows Skills required are C Programming, PH

Wordpress plugin configuration as well as customizations, Wordpress Plugin ...

Wordpress Plugin Configuration as well as Customizations I want help configuring a plugin correctly (Social Review Engine Plugin) in my Wordpress site. The plugin is previously

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