PageRenderTime 63ms CodeModel.GetById 33ms RepoModel.GetById 0ms app.codeStats 0ms

/framework/models/addProductToBasket.php

https://bitbucket.org/designbyheart/original
PHP | 37 lines | 21 code | 4 blank | 12 comment | 8 complexity | f473dc9709714eea29e4e3c619516748 MD5 | raw file
Possible License(s): GPL-3.0
  1. <?php
  2. /**
  3. * Created by JetBrains PhpStorm.
  4. * User: predragjevtic
  5. * Date: 9/15/12
  6. * Time: 2:11 AM
  7. * To change this template use File | Settings | File Templates.
  8. */
  9. if (file_exists('../lib/setup.php')) {
  10. require_once('../lib/setup.php');
  11. }
  12. $selectedProducts = 0;
  13. if (!isset($_GET['productID']) && isset($_SESSION['clientID'])) {
  14. $selectedProducts = count(array_filter(explode(',', Log::usersProducts($_SESSION['clientID']))));
  15. }
  16. if (isset($_GET['cancelOrder'])) {
  17. $productsLog = Log::removeAllProducts($_SESSION['clientID']);
  18. $selectedProducts = 0;
  19. }
  20. ///1. save log for current user
  21. if (isset($_GET['productID']) && isset($_SESSION['clientID'])) {
  22. $productsLog = Log::addProductToBasket($_GET['productID'], $_SESSION['clientID']);
  23. //4. show selected products
  24. $selectedProducts = count($productsLog) - 1;
  25. // $products = Log::usersProducts($_SESSION['clientID']);
  26. }
  27. //if ($selectedProducts > 0) {
  28. echo trans('Moja korpa', 'My Basket') . ' (' . $selectedProducts . ')';
  29. //}
  30. if (isset($_GET['removeItem']) && isset($_GET['id'])) {
  31. $productsLog = Log::removeItemFromCart($_GET['id'], $_SESSION['clientID']);
  32. }
  33. ;