Ejemplo n.º 1
0
 public function __construct($id = NULL, $id_lang = NULL)
 {
     parent::__construct($id, $id_lang);
     if ($this->name == '0') {
         $this->name = Configuration::get('PS_SHOP_NAME');
     }
 }
Ejemplo n.º 2
0
 function __construct($id = null)
 {
     if (version_compare(_PS_VERSION_, '1.5.0.2', '<')) {
         $definition = $this->getDefinitionProperty();
         // child class name
         $this->tables = array($definition['table']);
         $this->table = $definition['table'];
         $this->identifier = $definition['primary'];
     }
     if (version_compare(_PS_VERSION_, '1.5', '<')) {
         $definition = $this->getDefinitionProperty();
         // child class name
         $this->tables = array($definition['table']);
         $this->table = $definition['table'];
         $this->identifier = $definition['primary'];
         foreach ($definition['fields'] as $field_name => $field) {
             if (!in_array($field_name, array('id_shop', 'date_upd', 'date_add'))) {
                 $validateRule = isset($field['validate']) ? $field['validate'] : 'isAnything';
                 $this->fieldsValidate[$field_name] = $validateRule;
                 if (isset($field['required'])) {
                     array_push($this->fieldsRequired, $field_name);
                 }
                 if (isset($field['size'])) {
                     $this->fieldsSize[$field_name] = $field['size'];
                 }
             }
         }
     }
     return parent::__construct($id);
 }
Ejemplo n.º 3
0
    public function __construct(SplFileInfo $fileinfo = null)
    {
        parent::__construct();
        if ($fileinfo) {
            $this->file_hash = md5($fileinfo->getRealPath());
            $fileSize = $fileinfo->getSize();
            // Looking for existing path
            $result = Db::getInstance()->getRow('
				SELECT *
				FROM `' . _DB_PREFIX_ . bqSQL(self::$definition['table']) . '`
				WHERE `file_hash` = \'' . pSQL($this->file_hash) . '\'');
            if (!$result) {
                $this->file_size = $fileSize;
                $this->file_info = $fileinfo;
            } else {
                $this->id = $result['id'];
                foreach ($result as $key => $value) {
                    if (array_key_exists($key, $this)) {
                        $this->{$key} = $value;
                    }
                }
                // Check file size
                if ($this->file_size != $fileSize) {
                    $this->file_size = $fileSize;
                    $this->file_info = $fileinfo;
                }
            }
        }
        return $this;
    }
Ejemplo n.º 4
0
 public function __construct($id = NULL, $id_lang = NULL)
 {
     parent::__construct($id, $id_lang);
     /* Get the manufacturer's id_address */
     $this->id_address = $this->getManufacturerAddress();
     $this->link_rewrite = $this->getLink();
 }
Ejemplo n.º 5
0
 public function __construct($id = null, $id_lang = null, $id_shop = null)
 {
     parent::__construct($id, $id_lang, $id_shop);
     if ($this->id && !isset(Group::$group_price_display_method[$this->id])) {
         self::$group_price_display_method[$this->id] = $this->price_display_method;
     }
 }
Ejemplo n.º 6
0
 public function __construct($id = null)
 {
     if (version_compare(_PS_VERSION_, '1.5', '<')) {
         $caller_class_name = $this->getCallerClassName();
         // child class name
         if (property_exists($caller_class_name, 'definition')) {
             $class_variables = get_class_vars($caller_class_name);
             $this->table = $class_variables['definition']['table'];
             $this->identifier = $class_variables['definition']['primary'];
             foreach ($class_variables['definition']['fields'] as $field_name => $field) {
                 if (!in_array($field_name, array('id_shop', 'date_upd', 'date_add'))) {
                     $validate_rule = isset($field['validate']) ? $field['validate'] : 'isAnything';
                     $this->fieldsValidate[$field_name] = $validate_rule;
                     if (isset($field['required'])) {
                         array_push($this->fieldsRequired, $field_name);
                     }
                     if (isset($field['size'])) {
                         $this->fieldsSize[$field_name] = $field['size'];
                     }
                 }
             }
         }
     }
     return parent::__construct($id);
 }
Ejemplo n.º 7
0
 public function __construct($id = NULL, $identifier = 'id_shopgate_order')
 {
     $this->identifier = $identifier;
     parent::__construct($id);
     $this->id = $this->id_shopgate_order;
     $this->identifier = 'id_shopgate_order';
 }
    public function __construct($id = null, $alias = null, $search = null, $id_lang = null)
    {
        $this->def = Alias::getDefinition($this);
        $this->setDefinitionRetrocompatibility();
        if ($id) {
            parent::__construct($id);
        } elseif ($alias && Validate::isValidSearch($alias)) {
            if (!Alias::isFeatureActive()) {
                $this->alias = trim($alias);
                $this->search = trim($search);
            } else {
                $row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
				SELECT a.id_alias, a.search, a.alias
				FROM `' . _DB_PREFIX_ . 'alias` a
				WHERE `alias` LIKE \'' . pSQL($alias) . '\' AND `active` = 1');
                if ($row) {
                    $this->id = (int) $row['id_alias'];
                    $this->search = $search ? trim($search) : $row['search'];
                    $this->alias = $row['alias'];
                } else {
                    $this->alias = trim($alias);
                    $this->search = trim($search);
                }
            }
        }
    }
Ejemplo n.º 9
0
 public function __construct($id_simpleblog_post = null, $id_lang = null, $id_shop = null)
 {
     parent::__construct($id_simpleblog_post, $id_lang, $id_shop);
     $category = new SimpleBlogCategory($this->id_simpleblog_category, $id_lang);
     $this->category = $category->name;
     $this->category_rewrite = $category->link_rewrite;
     $this->url = self::getLink($this->link_rewrite, $this->category_rewrite, $id_lang);
     $this->category_url = SimpleBlogCategory::getLink($category->link_rewrite, $id_lang);
     if ($category->id_parent > 0) {
         $parent = new SimpleBlogCategory($category->id_parent, $id_lang);
         $this->parent_category = $parent;
     }
     if (file_exists(_PS_MODULE_DIR_ . 'ph_simpleblog/covers/' . $this->id_simpleblog_post . '.' . $this->cover)) {
         $this->banner = _MODULE_DIR_ . 'ph_simpleblog/covers/' . $this->id_simpleblog_post . '.' . $this->cover;
         $this->banner_thumb = _MODULE_DIR_ . 'ph_simpleblog/covers/' . $this->id_simpleblog_post . '-thumb.' . $this->cover;
         $this->banner_wide = _MODULE_DIR_ . 'ph_simpleblog/covers/' . $this->id_simpleblog_post . '-wide.' . $this->cover;
     }
     if (file_exists(_PS_MODULE_DIR_ . 'ph_simpleblog/featured/' . $this->id_simpleblog_post . '.' . $this->featured)) {
         $this->featured_image = _MODULE_DIR_ . 'ph_simpleblog/featured/' . $this->id_simpleblog_post . '.' . $this->featured;
     }
     if ($this->id) {
         $tags = SimpleBlogTag::getPostTags((int) $this->id);
         $this->tags = $tags;
         if (isset($tags) && isset($tags[$id_lang])) {
             $this->tags_list = $tags[$id_lang];
         }
         $this->comments = SimpleBlogComment::getCommentsCount((int) $this->id);
         $this->post_type = SimpleBlogPostType::getSlugById((int) $this->id_simpleblog_post_type);
         if ($this->post_type == 'gallery') {
             $this->gallery = SimpleBlogPostImage::getAllById((int) $this->id);
         }
     }
 }
Ejemplo n.º 10
0
 /**
  * On shop instance, get its theme and URL data too
  *
  * @param int $id
  * @param int $id_lang
  * @param int $id_shop
  */
 public function __construct($id = null, $id_lang = null, $id_shop = null)
 {
     parent::__construct($id, $id_lang, $id_shop);
     if ($this->id) {
         $this->setUrl();
     }
 }
Ejemplo n.º 11
0
 public function __construct($id = NULL, $id_lang = NULL)
 {
     parent::__construct($id, $id_lang);
     if ($this->id) {
         $this->default_img = $this->getDefaultImage();
     }
 }
Ejemplo n.º 12
0
 public function __construct($id = null, $id_lang = null, $id_shop = null)
 {
     parent::__construct($id, $id_lang, $id_shop);
     if ($this->id) {
         $this->associated_shops = $this->getAssociatedShops();
     }
 }
Ejemplo n.º 13
0
 public function __construct($id_seo = NULL, $id_lang = NULL, $id_shop = NULL)
 {
     if (version_compare(_PS_VERSION_, '1.5.0.0', '>=')) {
         parent::__construct($id_seo, $id_lang, $id_shop);
     } else {
         parent::__construct($id_seo, $id_lang);
     }
 }
Ejemplo n.º 14
0
 public function __construct($id = null, $id_lang = null, $id_shop = null)
 {
     parent::__construct($id, $id_lang, $id_shop);
     // prefix and suffix are convenient shortcut for displaying
     // price sign before or after the price number
     $this->prefix = $this->format % 2 != 0 ? $this->sign . ' ' : '';
     $this->suffix = $this->format % 2 == 0 ? ' ' . $this->sign : '';
 }
Ejemplo n.º 15
0
 public function __construct($id_address = NULL, $id_lang = NULL)
 {
     parent::__construct($id_address);
     // Check if all files needed are here, if not, disabled language
     if ($this->iso_code != 'en' and !$this->checkFiles()) {
         $this->active = false;
     }
 }
Ejemplo n.º 16
0
 public function __construct($id = null, $id_lang = null)
 {
     parent::__construct($id, $id_lang);
     /* Get the manufacturer's id_address */
     $this->id_address = $this->getManufacturerAddress();
     $this->link_rewrite = $this->getLink();
     $this->image_dir = _PS_MANU_IMG_DIR_;
 }
Ejemplo n.º 17
0
 /**
  * Build an address
  *
  * @param int $id_address Existing address id in order to load object (optional)
  */
 public function __construct($id_address = null, $id_lang = null)
 {
     parent::__construct($id_address);
     /* Get and cache address country name */
     if ($this->id) {
         $this->country = Country::getNameById($id_lang ? $id_lang : Configuration::get('PS_LANG_DEFAULT'), $this->id_country);
     }
 }
Ejemplo n.º 18
0
 public function __construct($id = null, $id_lang = null, $id_shop = null)
 {
     parent::__construct($id, $id_lang, $id_shop);
     if ((int) $id > 0) {
         $this->response = LGRespuesta::getResponseByQuestion($id);
     } else {
         $this->response = new LGRespuesta();
     }
 }
Ejemplo n.º 19
0
 public function __construct($id = NULL, $id_lang = NULL)
 {
     if (isset($id) && !is_null($id)) {
         $this->wanted_cart_id = (int) $id;
     }
     parent::__construct($id, $id_lang);
     if (isset($this->id) && $this->id == $this->wanted_cart_id) {
         unset($this->wanted_cart_id);
     }
 }
Ejemplo n.º 20
0
 public function __construct($id = NULL, $id_lang = NULL)
 {
     parent::__construct($id, $id_lang);
     if ($this->id_customer) {
         $customer = new Customer(intval($this->id_customer));
         $this->_taxCalculationMethod = Group::getPriceDisplayMethod(intval($customer->id_default_group));
     } else {
         $this->_taxCalculationMethod = Group::getDefaultPriceDisplayMethod();
     }
 }
Ejemplo n.º 21
0
 public function __construct($id = NULL, $id_lang = NULL, $liteResult = true, $hideScenePosition = false)
 {
     parent::__construct(intval($id), intval($id_lang));
     if (!$liteResult) {
         $this->products = $this->getProducts(true, intval($id_lang), false);
     }
     if ($hideScenePosition) {
         $this->name = Scene::hideScenePosition($this->name);
     }
 }
Ejemplo n.º 22
0
 public function __construct($id = null, $id_lang = null)
 {
     parent::__construct($id, $id_lang);
     $this->link_rewrite = $this->getLink();
     $this->image_dir = _PS_SUPP_IMG_DIR_;
     //  Association stuffs
     $association_results = $this->getSupplierForAssociationInformation();
     $this->association_discount = $association_results[0]['discount'];
     $this->association_gain = $association_results[0]['gain'];
 }
Ejemplo n.º 23
0
 public function __construct($id = null, $id_lang = null, $id_shop = null)
 {
     parent::__construct($id, $id_lang, $id_shop);
     if ($this->id) {
         $this->content = json_decode($this->content, true);
     }
     if (is_null($this->content)) {
         $this->content = array('cms' => array(), 'product' => array(), 'static' => array());
     }
 }
Ejemplo n.º 24
0
 public function __construct($id = null, $id_lang = null, $id_shop = null)
 {
     parent::__construct($id, null, $id_shop);
     if (!is_null($id_lang)) {
         $this->id_lang = (int) (Language::getLanguage($id_lang) !== false) ? $id_lang : Configuration::get('PS_LANG_DEFAULT');
     }
     if ($this->id) {
         $this->associated_shops = $this->getAssociatedShops();
     }
     $this->image_dir = _PS_EMPLOYEE_IMG_DIR_;
 }
Ejemplo n.º 25
0
 public function __construct($id = null, $id_lang = null, $lite_result = true, $hide_scene_position = false)
 {
     parent::__construct($id, $id_lang);
     if (!$lite_result) {
         $this->products = $this->getProducts(true, (int) $id_lang, false);
     }
     if ($hide_scene_position) {
         $this->name = Scene::hideScenePosition($this->name);
     }
     $this->image_dir = _PS_SCENE_IMG_DIR_;
 }
Ejemplo n.º 26
0
 public function __construct($id = null, $id_lang = null, $id_shop = null)
 {
     if (version_compare(_PS_VERSION_, '1.5', '>')) {
         self::$definition = array('table' => 'ebay_log', 'primary' => 'id_ebay_log', 'fields' => array('text' => array('type' => self::TYPE_STRING, 'validate' => 'isString'), 'type' => array('type' => self::TYPE_STRING, 'validate' => 'isString')));
     } else {
         $tables = array('ebay_log');
         $fieldsRequired = array('text', 'type', 'date_add');
         $fieldsValidate = array();
     }
     return parent::__construct($id, $id_lang, $id_shop);
 }
Ejemplo n.º 27
0
 public function __construct($id = null, $id_lang = null, $id_shop = null)
 {
     if (version_compare(_PS_VERSION_, '1.5', '>')) {
         self::$definition = array('table' => 'ebay_store_category', 'primary' => 'id_ebay_store_category', 'fields' => array('id_ebay_profile' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), 'ebay_category_id' => array('type' => self::TYPE_STRING, 'validate' => 'isString'), 'name' => array('type' => self::TYPE_STRING, 'validate' => 'isString'), 'order' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), 'ebay_parent_category_id' => array('type' => self::TYPE_STRING, 'validate' => 'isString')));
     } else {
         $tables = array('ebay_store_category');
         $fieldsRequired = array('id_ebay_profile', 'ebay_category_id', 'name', 'order');
         $fieldsValidate = array();
     }
     return parent::__construct($id, $id_lang, $id_shop);
 }
 public function __construct($id_wrap = NULL, $id_lang = NULL)
 {
     if (version_compare(_PS_VERSION_, '1.3.0.0', '<')) {
         $this->fieldsValidateLang['value_over'] = 'isCleanHTML';
         $this->fieldsValidateLang['value_under'] = 'isCleanHTML';
     } else {
         $this->fieldsValidateLang['value_over'] = 'isString';
         $this->fieldsValidateLang['value_under'] = 'isString';
     }
     parent::__construct($id_wrap, $id_lang);
 }
Ejemplo n.º 29
0
    /**
     * Build an address
     *
     * @param integer $id_address Existing address id in order to load object (optional)
     */
    public function __construct($id_address = NULL, $id_lang = NULL)
    {
        parent::__construct($id_address);
        /* Get and cache address country name */
        if ($this->id) {
            $result = Db::getInstance()->getRow('SELECT `name` FROM `' . _DB_PREFIX_ . 'country_lang`
												WHERE `id_country` = ' . intval($this->id_country) . '
												AND `id_lang` = ' . ($id_lang ? intval($id_lang) : Configuration::get('PS_LANG_DEFAULT')));
            $this->country = $result['name'];
        }
    }
Ejemplo n.º 30
0
 public function __construct($id = null, $id_lang = null, $id_shop = null)
 {
     if (version_compare(_PS_VERSION_, '1.5', '>')) {
         self::$definition = array('table' => 'ebay_product_modified', 'primary' => 'id_ebay_product_modified', 'fields' => array('id_product' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), 'id_ebay_profile' => array('type' => self::TYPE_INT, 'validate' => 'isInt')));
     } else {
         $tables = array('ebay_product_modified');
         $fieldsRequired = array('id_ebay_profile', 'id_product');
         $fieldsValidate = array('id_ebay_profile' => 'isUnsignedInt', 'id_product' => 'isUnsignedInt');
     }
     return parent::__construct($id, $id_lang, $id_shop);
 }