示例#1
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     global $section, $action;
     parent::__construct(__FILE__);
     // register backend
     if (class_exists('backend')) {
         $backend = backend::getInstance();
         $import_menu = $backend->getMenu('shop_import');
         if (!is_null($import_menu)) {
             $import_menu->addChild(null, new backend_MenuItem($this->getLanguageConstant('menu_import_items'), url_GetFromFilePath($this->path . 'images/import.svg'), window_Open('shop_import_items', 350, $this->getLanguageConstant('title_import_items'), true, true, backend_UrlMake($this->name, 'import')), 6));
             $import_menu->addChild(null, new backend_MenuItem($this->getLanguageConstant('menu_import_english'), url_GetFromFilePath($this->path . 'images/import.svg'), window_Open('shop_import_items', 350, $this->getLanguageConstant('title_import_items'), true, true, backend_UrlMake($this->name, 'import_english')), 6));
         }
     }
     // register delivery method and create menu items
     if (ModuleHandler::is_loaded('backend') && ModuleHandler::is_loaded('shop')) {
         require_once 'units/method.php';
         require_once 'units/pickup_method.php';
         Paid_DeliveryMethod::getInstance($this);
         Pickup_DeliveryMethod::getInstance($this);
     }
     if (ModuleHandler::is_loaded('head_tag') && $section == 'shop' && $action == 'checkout') {
         $head_tag = head_tag::getInstance();
         $head_tag->addTag('script', array('src' => url_GetFromFilePath($this->path . 'include/pikaday.js'), 'type' => 'text/javascript'));
         $head_tag->addTag('link', array('href' => url_GetFromFilePath($this->path . 'include/pikaday.css'), 'rel' => 'stylesheet', 'type' => 'text/css'));
         $head_tag->addTag('link', array('href' => url_GetFromFilePath($this->path . 'include/checkout.css'), 'rel' => 'stylesheet', 'type' => 'text/css'));
     }
     if (ModuleHandler::is_loaded('backend') && ModuleHandler::is_loaded('head_tag') && $section == 'backend') {
         $head_tag = head_tag::getInstance();
         $head_tag->addTag('script', array('src' => url_GetFromFilePath($this->path . 'include/backend.js'), 'type' => 'text/javascript'));
     }
     // connect transaction handling event
     Events::connect('shop', 'transaction-completed', 'on_transaction_completed', $this);
 }
示例#2
0
 /**
  * Public function that creates a single instance
  */
 public static function getInstance($parent)
 {
     if (!isset(self::$_instance)) {
         self::$_instance = new self($parent);
     }
     return self::$_instance;
 }