Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.23 KB | None | 0 0
  1. <?php
  2.  
  3. require_once(dirname(__FILE__).'/config/config.inc.php');
  4. require_once(dirname(__FILE__).'/init.php');
  5.  
  6. //will be initialized bellow...
  7. if(intval(Configuration::get('PS_REWRITING_SETTINGS')) === 1)
  8. $rewrited_url = null;
  9.  
  10. /* CSS ans JS files calls */
  11. $css_files = array(__PS_BASE_URI__.'css/jquery.cluetip.css' => 'all', _THEME_CSS_DIR_.'scenes.css' => 'all');
  12.  
  13. require_once(dirname(__FILE__).'/header.php');
  14.  
  15.  
  16.  
  17.  
  18. $errors = array();
  19. if (!isset($_GET['id_category']) OR !Validate::isUnsignedId($_GET['id_category']))
  20. $errors[] = Tools::displayError('category ID is missing');
  21. else
  22. {
  23. $category = new Category(intval(Tools::getValue('id_category')), intval($cookie->id_lang));
  24. if (!Validate::isLoadedObject($category))
  25. $errors[] = Tools::displayError('category does not exist');
  26. elseif (!$category->checkAccess(intval($cookie->id_customer)))
  27. $errors[] = Tools::displayError('you do not have access to this category');
  28. else
  29. {
  30. /* rewrited url set */
  31. $rewrited_url = $link->getCategoryLink($category->id, $category->link_rewrite);
  32.  
  33. /* Scenes (could be externalised to another controler if you need them */
  34. $smarty->assign('scenes', Scene::getScenes(intval($category->id), intval($cookie->id_lang), true, false));
  35.  
  36. /* Scenes images formats */
  37. if ($sceneImageTypes = ImageType::getImagesTypes('scenes'))
  38. {
  39. foreach ($sceneImageTypes AS $sceneImageType)
  40. {
  41. if ($sceneImageType['name'] == 'thumb_scene')
  42. $thumbSceneImageType = $sceneImageType;
  43. elseif ($sceneImageType['name'] == 'large_scene')
  44. $largeSceneImageType = $sceneImageType;
  45. }
  46. $smarty->assign('thumbSceneImageType', isset($thumbSceneImageType) ? $thumbSceneImageType : NULL);
  47. $smarty->assign('largeSceneImageType', isset($largeSceneImageType) ? $largeSceneImageType : NULL);
  48. }
  49.  
  50. $category->name = Category::hideCategoryPosition($category->name);
  51. $category->description = nl2br2($category->description);
  52. $subCategories = $category->getSubCategories(intval($cookie->id_lang));
  53. $smarty->assign('category', $category);
  54. if (Db::getInstance()->numRows())
  55. $smarty->assign('subcategories', $subCategories);
  56. if ($category->id != 1)
  57. {
  58. $nbProducts = $category->getProducts(NULL, NULL, NULL, 'date_add', 'DESC', true);
  59. include(dirname(__FILE__).'/pagination.php');
  60. $smarty->assign('nb_products', $nbProducts);
  61. $cat_products = $category->getProducts(intval($cookie->id_lang), intval($p), intval($n), 'date_add', 'DESC');
  62. }
  63. $smarty->assign(array(
  64. 'products' => (isset($cat_products) AND $cat_products) ? $cat_products : NULL,
  65. 'id_category' => intval($category->id),
  66. 'id_category_parent' => intval($category->id_parent),
  67. 'return_category_name' => Tools::safeOutput(Category::hideCategoryPosition($category->name)),
  68. 'path' => Tools::getPath(intval($category->id), $category->name),
  69. 'homeSize' => Image::getSize('home')
  70. ));
  71. }
  72. }
  73.  
  74. $smarty->assign(array(
  75. 'allow_oosp' => intval(Configuration::get('PS_ORDER_OUT_OF_STOCK')),
  76. 'suppliers' => Supplier::getSuppliers(),
  77. 'errors' => $errors));
  78.  
  79. if (isset($subCategories))
  80. $smarty->assign(array(
  81. 'subcategories_nb_total' => sizeof($subCategories),
  82. 'subcategories_nb_half' => ceil(sizeof($subCategories) / 2)));
  83.  
  84.  
  85.  
  86.  
  87.  
  88. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement