Prev | Current Page 666 | Next

Emilian Balanescu and Cristian Darie

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


Exercise: Updating the Presentation Tier
1. Modify presentation/templates/checkout_info.tpl as highlighted:
Shipping region: {$obj->mShippingRegion}


{/if}
CHAPTER 17 ?–  STORING CUSTOMER ORDERS 564
{if $obj->mNoCreditCard!= 'yes' && $obj->mNoShippingAddress != 'yes'}


Shipping type:


{/if}
{$obj->mOrderButtonVisible} /> |
Edit Shopping Cart |
2. Add a new member to the CheckoutInfo class in presentation/checkout_info.php as follows:
public $mLinkToCart;
public $mLinkToContinueShopping;
public $mShippingInfo;
3. Modify the init() method in the CheckoutInfo class in presentation/checkout_info.php:
// If the Place Order button was clicked, save the order to database ...
if(isset ($_POST['place_order']))
{
$this->mCustomerData = Customer::Get();
$tax_id = '';
switch ($this->mCustomerData['shipping_region_id'])
{
case 2:
$tax_id = 1;
break;
default:
$tax_id = 2;
}
// Create the order and get the order ID
$order_id = ShoppingCart::CreateOrder(
$this->mCustomerData['customer_id'],
(int)$_POST['shipping'], $tax_id);
// This will contain the PayPal link
$redirect =
PAYPAL_URL .


Pages:
654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678
tanie hotele w polsce skarpetki narciarskie męskie dobry katalog Życie klamki