Advertisement
Guest User

Untitled

a guest
Nov 15th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.55 KB | None | 0 0
  1. if (isset($_POST['add_to_cart'])) {
  2. if (isset($_POST['select_size']) && isset($_POST['select_color']) && isset($_POST['select_quantity'])) {
  3. $size = $_POST['select_size'];
  4. $color = $_POST['select_color'];
  5. $quantity = $_POST['select_quantity'];
  6.  
  7.  
  8. if (isset($_GET['lang'])) {
  9. $the_lang = mysqli_real_escape_string($connection, $_GET['lang']);
  10.  
  11. if ($the_lang == 'ro') {
  12. $product_name = $product_name_ro;
  13. } else if ($the_lang == 'en') {
  14. $product_name = $product_name_en;
  15. } else if ($the_lang == 'fr') {
  16. $product_name = $product_name_fr;
  17. }
  18. } else {
  19. $product_name = $product_name_ro;
  20. }
  21.  
  22. if (isset($_GET['coin'])) {
  23. $the_coin = mysqli_real_escape_string($connection, $_GET['coin']);
  24.  
  25. if ($the_coin == 'ron') {
  26. $price = $product_price_ron;
  27. $the_coin = 'RON';
  28. } else if ($the_coin == 'dollar') {
  29. $price = $product_price_dollar;
  30. $the_coin = '$';
  31. } else if ($the_coin == 'euro') {
  32. $price = $product_price_euro;
  33. $the_coin = '€';
  34. }
  35. } else {
  36. $price = $product_price_ron;
  37. $the_coin = 'RON';
  38. }
  39. }
  40.  
  41. $total_price = $price * $quantity;
  42.  
  43.  
  44. $_SESSION['cart'][$product_id] = array('product_name' => $product_name, 'coin' => $the_coin, 'price' => $price, 'total_price' => $total_price, 'size' => $size, 'color' => $color, 'quantity' => $quantity);
  45.  
  46. $temp = $_SESSION['cart'];
  47. array_push($_SESSION['cart'][$product_id], $temp);
  48. //setcookie($product_id, $product_name.",".$the_coin.",".$price.",".$total_price.",".$size.",".$color.",".$quantity, time() + (86400 * 30), "/");
  49.  
  50. /*
  51. if (isset($_GET['lang'])) {
  52. $the_lang = mysqli_real_escape_string($connection, $_GET['lang']);
  53.  
  54. if ($the_lang == 'ro') {
  55. setcookie($product_name_ro, $product_id, time() + (86400 * 30), "/");
  56. } else if ($the_lang == 'en') {
  57. setcookie($product_name_en, $product_id, time() + (86400 * 30), "/");
  58. } else if ($the_lang == 'fr') {
  59. setcookie($product_name_fr, $product_id, time() + (86400 * 30), "/");
  60. }
  61. } else {
  62.  
  63. }
  64. */
  65.  
  66. header("Location: ".$_SERVER['HTTP_REFERER']);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement