Prev | Current Page 361 | Next

Emilian Balanescu and Cristian Darie

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


Exercise: Integrating the PayPal Shopping Cart and Custom Checkout
1. Open config.php from the include folder, and add the following constants declarations:
// PayPal configuration
define('PAYPAL_URL', 'https://www.paypal.com/cgi-bin/webscr');
define('PAYPAL_EMAIL', 'youremail@example.com');
define('PAYPAL_CURRENCY_CODE', 'USD');
define('PAYPAL_RETURN_URL', 'http://www.example.com');
define('PAYPAL_CANCEL_RETURN_URL', 'http://www.example.com');
?– Caution Make sure you replace youremail@example.com with the e-mail address you submitted when
you created your PayPal account! You need to use the correct e-mail address if you want the money to get
into your account! Also, replace both instances of www.example.com with the address of your e-commerce store.
CHAPTER 9 ?–  RECEIVING PAYMENTS USING PAYPAL 256
2. Open presentation/products_list.php, and add the highlighted code to the end of init() method
as shown:
// Build links for product details pages
for ($i = 0; $i < count($this->mProducts); $i++)
{
$this->mProducts[$i]['link_to_product'] =
Link::ToProduct($this->mProducts[$i]['product_id']);
if ($this->mProducts[$i]['thumbnail'])
$this->mProducts[$i]['thumbnail'] =
Link::Build('product_images/' . $this->mProducts[$i]['thumbnail']);
// Create the Add to Cart link
$this->mProducts[$i]['link_to_add_product'] =
Link::ToAddProduct($this->mProducts[$i]['product_id']);
$this->mProducts[$i]['attributes'] =
Catalog::GetProductAttributes($this->mProducts[$i]['product_id']);
}
}
3.


Pages:
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373
wycieczki do Skandynawii Mix przecie Ciekawe miejsca SPA Łeba domki noclegi jastrzebia gora