16 : دراسة حالة لتطبيق يستند إلى بروتوكول الوصول اللاسكلي WAP
الصنفان Shopping_cart و Shopping_cart_item
699
The Shopping_cart and Shopping_cart_Item
يحتوي البرنامج النصي Shopping Cart.php على تعريف كل من الصنفين Shopping_Cart
و Shopping_Cart_Item :
1n11de (musicItem.php
يخزن المتحول shoppingCarltem$ مصفوفة من كائنات Shopping_Cart_Item:
يتولى المشيد تبدلة متحول العضو shopping CartItems$ :
var shoppingcartitems;
function S
$thid>shoppingcaretone array ( )
يقوم التابع ()additem بإضافة العدد quantity من العناصر (item$) في سلة التسوق:
function addItem(Item, Squantity
ويتم الحصول على عنصر سلة التسوق الموافق للمتحول sitem:
ingCartItem = $this->getShoppingCartItem(SitemNo) ingCartItem)
إذا لم يكن هناك عنصر في سلة التسوق يوافق item$ ، تتم إضافة عنصر سلة تسوق يوافق sitem:
$this->hoppingCart_tema
كما يضاف quantity$ إلى عنصر سلة التسوق السابق:
Ebad30uantity (Squanti
ص٦٩٩