Prev | Current Page 576 | Next

Emilian Balanescu and Cristian Darie

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


When obtaining shopping cart recommendations, we basically use the same technique as
for single product recommendations, except that we add the shopping cart ingredient to the
mix. Instead of obtaining the products that were ordered together with another product, we
obtain the products that were ordered together with any of the products of the shopping cart.
This is a more complex calculation indeed, but the return on your time investment is worth it
for the potential extra sales!
The last thing to note before writing the code is that our proposed implementation is one
of the many possible ones. Generally in programming, and particularly in the world of SQL,
a result can be achieved in many ways. The query that returns product recommendations can
be rewritten in a number of ways, the most obvious being that of using subqueries instead of
table joins.
We implement the data tier logic we??™ve just explained in the two stored procedures:
catalog_get_recommendations and shopping_cart_get_recommendations. In addition to the
queries shown earlier, the stored procedures will also retrieve the product names and descriptions,
which need to be displayed to the visitor.
Exercise: Adding the Product Recommendation Stored Procedures
1. Use phpMyAdmin to create the stored procedure described in the following steps. Don??™t forget to set the $$
delimiter before executing the code at each step.


Pages:
564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588
wycieczki do Skandynawii traktorki ogrodowe skarpetki narciarskie męskie perfumy fm Szkoły policealne fryzjer w warszawie