Prev | Current Page 518 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"


??? addProductToCart() is called from the HTML page to add a product to the cart.
??? handleAddProductToCart() is the callback function for the Add to Cart server calls.
??? postAddProductToCartProcess() reads the Add to Cart server response and updates the
cart summary box.
You??™ll also update your project in various places to utilize or support the new features. Let??™s
go through the exercise that follows, and we??™ll discuss the process in more detail afterward.
CHAPTER 13 ?–  IMPLEMENTING AJAX FEATURES 413
Exercise: Adding Products Quicker
1. Open presentation\templates\product.tpl, add the highlighted code, and modify the name of the
input element to add_to_cart:
{* The Add to Cart form *}
action="{$obj->mProduct.link_to_add_product}"
onsubmit="return addProductToCart(this);">
{* Generate the list of attribute values *}


{* Parse the list of attributes and attribute values *}
{section name=k loop=$obj->mProduct.attributes}
...
{/section}


{* Add the submit button and close the form *}





2. Open presentation\templates\products_list.tpl, and modify it as shown here:
{* The Add to Cart form *}
action="{$obj->mProducts[k].


Pages:
506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530
gdyz imprezy integracyjne dla firm judo łódź znaki drogowe tanie rozmowy