public function initFormVirtualProduct($product) { $data = $this->createTemplate($this->tpl_form); $currency = $this->context->currency; /* * Form for adding a virtual product like software, mp3, etc... */ $product_download = new ProductDownload(); if ($id_product_download = $product_download->getIdFromIdProduct($this->getFieldValue($product, 'id'))) { $product_download = new ProductDownload($id_product_download); } $product->{'productDownload'} = $product_download; if ($product->productDownload->id && empty($product->productDownload->display_filename)) { $this->errors[] = Tools::displayError('A file name is required in order to associate a file'); $this->tab_display = 'VirtualProduct'; } // @todo handle is_virtual with the value of the product $exists_file = realpath(_PS_DOWNLOAD_DIR_) . '/' . $product->productDownload->filename; $data->assign('product_downloaded', $product->productDownload->id); if (!file_exists($exists_file) && !empty($product->productDownload->display_filename) && empty($product->cache_default_attribute)) { $msg = sprintf(Tools::displayError('File "%s" is missing'), $product->productDownload->display_filename); } else { $msg = ''; } $virtual_product_file_uploader = new HelperUploader('virtual_product_file_uploader'); $virtual_product_file_uploader->setMultiple(false)->setUrl(Context::getContext()->link->getAdminLink('AdminProducts') . '&ajax=1&id_product=' . (int) $product->id . '&action=AddVirtualProductFile')->setPostMaxSize(Tools::getOctets(ini_get('upload_max_filesize')))->setTemplate('virtual_product.tpl'); $data->assign(array('download_product_file_missing' => $msg, 'download_dir_writable' => ProductDownload::checkWritableDir(), 'up_filename' => strval(Tools::getValue('virtual_product_filename')))); $product->productDownload->nb_downloadable = $product->productDownload->id > 0 ? $product->productDownload->nb_downloadable : htmlentities(Tools::getValue('virtual_product_nb_downloable'), ENT_COMPAT, 'UTF-8'); $product->productDownload->date_expiration = $product->productDownload->id > 0 ? !empty($product->productDownload->date_expiration) && $product->productDownload->date_expiration != '0000-00-00 00:00:00' ? date('Y-m-d', strtotime($product->productDownload->date_expiration)) : '' : htmlentities(Tools::getValue('virtual_product_expiration_date'), ENT_COMPAT, 'UTF-8'); $product->productDownload->nb_days_accessible = $product->productDownload->id > 0 ? $product->productDownload->nb_days_accessible : htmlentities(Tools::getValue('virtual_product_nb_days'), ENT_COMPAT, 'UTF-8'); $product->productDownload->is_shareable = $product->productDownload->id > 0 && $product->productDownload->is_shareable; $iso_tiny_mce = $this->context->language->iso_code; $iso_tiny_mce = file_exists(_PS_JS_DIR_ . 'tiny_mce/langs/' . $iso_tiny_mce . '.js') ? $iso_tiny_mce : 'en'; $data->assign(array('ad' => __PS_BASE_URI__ . basename(_PS_ADMIN_DIR_), 'iso_tiny_mce' => $iso_tiny_mce, 'product' => $product, 'token' => $this->token, 'currency' => $currency, 'link' => $this->context->link, 'is_file' => $product->productDownload->checkFile(), 'virtual_product_file_uploader' => $virtual_product_file_uploader->render())); $data->assign($this->tpl_form_vars); $this->tpl_form_vars['product'] = $product; $this->tpl_form_vars['custom_form'] = $data->fetch(); }
/** * getMemoryLimit allow to get the memory limit in octet * * @since 1.4.5.0 * @return int the memory limit value in octet */ public static function getMemoryLimit() { $memory_limit = @ini_get('memory_limit'); return Tools::getOctets($memory_limit); }
/** * @see InstallAbstractModel::display() */ public function display() { // The installer SHOULD take less than 32M, but may take up to 35/36M sometimes. So 42M is a good value :) $low_memory = Tools::getMemoryLimit() < Tools::getOctets('42M'); // We fill the process step used for Ajax queries $this->process_steps[] = array('key' => 'generateSettingsFile', 'lang' => $this->l('Create settings.inc file')); $this->process_steps[] = array('key' => 'installDatabase', 'lang' => $this->l('Create database tables')); $this->process_steps[] = array('key' => 'installDefaultData', 'lang' => $this->l('Create default shop and languages')); // If low memory, create subtasks for populateDatabase step (entity per entity) $populate_step = array('key' => 'populateDatabase', 'lang' => $this->l('Populate database tables')); if ($low_memory) { $populate_step['subtasks'] = array(); $xml_loader = new InstallXmlLoader(); foreach ($xml_loader->getSortedEntities() as $entity) { $populate_step['subtasks'][] = array('entity' => $entity); } } $this->process_steps[] = $populate_step; $this->process_steps[] = array('key' => 'configureShop', 'lang' => $this->l('Configure shop information')); if ($this->session->install_type == 'full') { // If low memory, create subtasks for installFixtures step (entity per entity) $fixtures_step = array('key' => 'installFixtures', 'lang' => $this->l('Install demonstration data')); if ($low_memory) { $fixtures_step['subtasks'] = array(); $xml_loader = new InstallXmlLoader(); $xml_loader->setFixturesPath(); foreach ($xml_loader->getSortedEntities() as $entity) { $fixtures_step['subtasks'][] = array('entity' => $entity); } } $this->process_steps[] = $fixtures_step; } $install_modules = array('key' => 'installModules', 'lang' => $this->l('Install modules')); if ($low_memory) { foreach ($this->model_install->getModulesList() as $module) { $install_modules['subtasks'][] = array('module' => $module); } } $this->process_steps[] = $install_modules; $install_modules = array('key' => 'installModulesAddons', 'lang' => $this->l('Install Addons modules')); $params = array('iso_lang' => $this->language->getLanguageIso(), 'iso_country' => $this->session->shop_country, 'email' => $this->session->admin_email, 'shop_url' => Tools::getHttpHost(), 'version' => _PS_INSTALL_VERSION_); if ($low_memory) { foreach ($this->model_install->getAddonsModulesList($params) as $module) { $install_modules['subtasks'][] = array('module' => (string) $module['name'], 'id_module' => (string) $module['id_module']); } } $this->process_steps[] = $install_modules; $this->process_steps[] = array('key' => 'installTheme', 'lang' => $this->l('Install theme')); $this->displayTemplate('process'); }
/** * renderForm contains all necessary initialization needed for all tabs * * @return void */ public function renderForm() { // This nice code (irony) is here to store the product name, because the row after will erase product name in multishop context $this->product_name = $this->object->name[$this->context->language->id]; if (!method_exists($this, 'initForm' . $this->tab_display)) { return; } $product = $this->object; // Product for multishop $this->context->smarty->assign('bullet_common_field', ''); if (Shop::isFeatureActive() && $this->display == 'edit') { if (Shop::getContext() != Shop::CONTEXT_SHOP) { $this->context->smarty->assign(array('display_multishop_checkboxes' => true, 'multishop_check' => Tools::getValue('multishop_check'))); } if (Shop::getContext() != Shop::CONTEXT_ALL) { $this->context->smarty->assign('bullet_common_field', '<img src="themes/' . $this->context->employee->bo_theme . '/img/bullet_orange.png" style="vertical-align: bottom" />'); $this->context->smarty->assign('display_common_field', true); } } $this->tpl_form_vars['tabs_preloaded'] = $this->available_tabs; $this->tpl_form_vars['product_type'] = (int) Tools::getValue('type_product', $product->getType()); $this->getLanguages(); $this->tpl_form_vars['id_lang_default'] = Configuration::get('PS_LANG_DEFAULT'); $this->tpl_form_vars['currentIndex'] = self::$currentIndex; $this->tpl_form_vars['display_multishop_checkboxes'] = Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_SHOP && $this->display == 'edit'; $this->fields_form = array(''); $this->tpl_form_vars['token'] = $this->token; $this->tpl_form_vars['combinationImagesJs'] = $this->getCombinationImagesJs(); $this->tpl_form_vars['PS_ALLOW_ACCENTED_CHARS_URL'] = (int) Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL'); $this->tpl_form_vars['post_data'] = Tools::jsonEncode($_POST); $this->tpl_form_vars['save_error'] = !empty($this->errors); // autoload rich text editor (tiny mce) $this->tpl_form_vars['tinymce'] = true; $iso = $this->context->language->iso_code; $this->tpl_form_vars['iso'] = file_exists(_PS_ROOT_DIR_ . '/js/tiny_mce/langs/' . $iso . '.js') ? $iso : 'en'; $this->tpl_form_vars['ad'] = dirname($_SERVER['PHP_SELF']); if (Validate::isLoadedObject($this->object)) { $id_product = (int) $this->object->id; } else { $id_product = (int) Tools::getvalue('id_product'); } $this->tpl_form_vars['form_action'] = $this->context->link->getAdminLink('AdminProducts') . '&' . ($id_product ? 'id_product=' . (int) $id_product : 'addproduct'); $this->tpl_form_vars['id_product'] = $id_product; // Transform configuration option 'upload_max_filesize' in octets $upload_max_filesize = Tools::getOctets(ini_get('upload_max_filesize')); // Transform configuration option 'upload_max_filesize' in MegaOctets $upload_max_filesize = $upload_max_filesize / 1024 / 1024; $this->tpl_form_vars['upload_max_filesize'] = $upload_max_filesize; $this->tpl_form_vars['country_display_tax_label'] = $this->context->country->display_tax_label; $this->tpl_form_vars['has_combinations'] = $this->object->hasAttributes(); $this->product_exists_in_shop = true; if ($this->display == 'edit' && Validate::isLoadedObject($product) && Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP && !$product->isAssociatedToShop($this->context->shop->id)) { $this->product_exists_in_shop = false; if ($this->tab_display == 'Informations') { $this->displayWarning($this->l('Warning: The product does not exist in this shop.')); } $default_product = new Product(); $definition = ObjectModel::getDefinition($product); foreach ($definition['fields'] as $field_name => $field) { if (isset($field['shop']) && $field['shop']) { $product->{$field_name} = ObjectModel::formatValue($default_product->{$field_name}, $field['type']); } } } // let's calculate this once for all if (!Validate::isLoadedObject($this->object) && Tools::getValue('id_product')) { $this->errors[] = 'Unable to load object'; } else { $this->_displayDraftWarning($this->object->active); // if there was an error while saving, we don't want to lose posted data if (!empty($this->errors)) { $this->copyFromPost($this->object, $this->table); } $this->initPack($this->object); $this->{'initForm' . $this->tab_display}($this->object); $this->tpl_form_vars['product'] = $this->object; if ($this->ajax) { if (!isset($this->tpl_form_vars['custom_form'])) { throw new PrestaShopException('custom_form empty for action ' . $this->tab_display); } else { return $this->tpl_form_vars['custom_form']; } } } $parent = parent::renderForm(); $this->addJqueryPlugin(array('autocomplete', 'fancybox', 'typewatch')); return $parent; }
/** * renderForm contains all necessary initialization needed for all tabs * * @return string|void * @throws PrestaShopException */ public function renderForm() { $data = $this->createTemplate('form.tpl'); // This nice code (irony) is here to store the product name, because the row after will erase product name in multishop context //$this->offer_name = $this->object->name[$this->context->language->id]; if (!method_exists($this, 'initForm' . $this->tab_display)) { return; } $this->tpl_form_vars['tabs_preloaded'] = $this->available_tabs; $this->tpl_form_vars['defaultFormLanguage'] = $this->default_form_language; $this->tpl_form_vars['allowEmployeeFormLang'] = $this->allow_employee_form_lang; $this->tpl_form_vars['vat_number'] = Module::isInstalled('vatnumber') && file_exists(_PS_MODULE_DIR_ . 'vatnumber/ajax.php'); $this->getLanguages(); $this->tpl_form_vars['languages'] = $this->_languages; $this->tpl_form_vars['id_lang_default'] = Configuration::get('PS_LANG_DEFAULT'); $this->tpl_form_vars['currentIndex'] = self::$currentIndex; $this->fields_form = array(''); $this->tpl_form_vars['token'] = $this->token; $this->tpl_form_vars['ps_force_friendly_product'] = Configuration::get('PS_FORCE_FRIENDLY_PRODUCT'); $this->tpl_form_vars['PS_ALLOW_ACCENTED_CHARS_URL'] = (int) Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL'); $this->tpl_form_vars['post_data'] = Tools::jsonEncode($_POST); $this->tpl_form_vars['save_error'] = !empty($this->errors); $this->tpl_form_vars['mod_evasive'] = Tools::apacheModExists('evasive'); $this->tpl_form_vars['mod_security'] = Tools::apacheModExists('security'); // autoload rich text editor (tiny mce) $this->tpl_form_vars['tinymce'] = true; $iso = $this->context->language->iso_code; $this->tpl_form_vars['iso'] = file_exists(_PS_CORE_DIR_ . '/js/tiny_mce/langs/' . $iso . '.js') ? $iso : 'en'; $this->tpl_form_vars['path_css'] = _THEME_CSS_DIR_; $this->tpl_form_vars['ad'] = __PS_BASE_URI__ . basename(_PS_ADMIN_DIR_); $this->tpl_form_vars['firstCall'] = true; if (Validate::isLoadedObject($this->object)) { $id_offer = (int) $this->object->id; } else { $id_offer = (int) Tools::getvalue('id_offer'); } $page = (int) Tools::getValue('page'); $this->tpl_form_vars['form_action'] = $this->context->link->getAdminLink('AdminAphOffers') . '&' . ($id_offer ? 'updateoffer&id_offer=' . (int) $id_offer : 'addoffer') . ($page > 1 ? '&page=' . (int) $page : ''); $this->tpl_form_vars['id_offer'] = $id_offer; // Transform configuration option 'upload_max_filesize' in octets $upload_max_filesize = Tools::getOctets(ini_get('upload_max_filesize')); // Transform configuration option 'upload_max_filesize' in MegaOctets $upload_max_filesize = $upload_max_filesize / 1024 / 1024; $this->tpl_form_vars['upload_max_filesize'] = $upload_max_filesize; $this->offer_exists_in_shop = true; // let's calculate this once for all if (!Validate::isLoadedObject($this->object) && Tools::getValue('id_offer')) { $this->errors[] = 'Impossibile caricare l\'oggetto'; } else { // if there was an error while saving, we don't want to lose posted data if (!empty($this->errors)) { $this->copyFromPost($this->object, $this->table); } $this->{'initForm' . $this->tab_display}($this->object); $this->tpl_form_vars['offer'] = $this->object; if ($this->ajax) { if (!isset($this->tpl_form_vars['custom_form'])) { throw new PrestaShopException('custom_form empty for action ' . $this->tab_display); } else { return $this->tpl_form_vars['custom_form']; } } } $data->assign($this->tpl_form_vars); $this->addJqueryPlugin(array('autocomplete', 'fancybox', 'typewatch')); return $data->fetch(); }
public function initContentVirtualProduct() { $ifqrqnfl = "id_product_download"; $satpetgggdq = "product"; $uvtmgqwfb = "product_download"; $odpjsjcw = "product_download"; ${"GLOBALS"}["dixhgmcc"] = "id_product_download"; $epxbkxu = "currency"; ${$satpetgggdq} = $this->object; ${$epxbkxu} = new Currency((int) Configuration::get("PS_CURRENCY_DEFAULT")); ${$uvtmgqwfb} = new ProductDownload(); if (${$ifqrqnfl} = $product_download->getIdFromIdProduct($this->getFieldValue(${${"GLOBALS"}["vmqqtmkyw"]}, "id"))) { ${$odpjsjcw} = new ProductDownload(${${"GLOBALS"}["dixhgmcc"]}); } $product->{"productDownload"} = ${${"GLOBALS"}["pctudmr"]}; $product->cache_default_attribute = (int) Product::getDefaultAttribute($product->id); ${${"GLOBALS"}["nnybqqo"]} = realpath(_PS_DOWNLOAD_DIR_) . "/" . $product->productDownload->filename; self::$smarty->assign("product_downloaded", $product->productDownload->id && !empty($product->productDownload->display_filename)); if (!file_exists(${${"GLOBALS"}["nnybqqo"]}) && !empty($product->productDownload->display_filename) && empty($product->cache_default_attribute)) { ${${"GLOBALS"}["ygidwjibrt"]} = sprintf(Tools::displayError("This file \"%s\" is missing"), $product->productDownload->display_filename); } else { ${${"GLOBALS"}["ygidwjibrt"]} = ""; } self::$smarty->assign("download_product_file_missing", ${${"GLOBALS"}["ygidwjibrt"]}); self::$smarty->assign("download_dir_writable", ProductDownload::checkWritableDir()); self::$smarty->assign("up_filename", strval(Tools::getValue("virtual_product_filename"))); self::$smarty->assign("product_type", (int) Tools::getValue("type_product", $product->getType())); $product->productDownload->nb_downloadable = $product->productDownload->id > 0 ? $product->productDownload->nb_downloadable : htmlentities(Tools::getValue("virtual_product_nb_downloable"), ENT_COMPAT, "UTF-8"); $pbrwepgkw = "upload_max_filesize"; $product->productDownload->date_expiration = $product->productDownload->id > 0 ? !empty($product->productDownload->date_expiration) && $product->productDownload->date_expiration != "0000-00-00 00:00:00" ? date("Y-m-d", strtotime($product->productDownload->date_expiration)) : "" : htmlentities(Tools::getValue("virtual_product_expiration_date"), ENT_COMPAT, "UTF-8"); $product->productDownload->nb_days_accessible = $product->productDownload->id > 0 ? $product->productDownload->nb_days_accessible : htmlentities(Tools::getValue("virtual_product_nb_days"), ENT_COMPAT, "UTF-8"); $product->productDownload->is_shareable = $product->productDownload->id > 0 && $product->productDownload->is_shareable; self::$smarty->assign("ad", dirname($_SERVER["PHP_SELF"])); self::$smarty->assign("product", ${${"GLOBALS"}["vmqqtmkyw"]}); self::$smarty->assign("currency", ${${"GLOBALS"}["sxexnhlq"]}); $ctepbh = "upload_max_filesize"; self::$smarty->assign("link", $this->context->link); self::$smarty->assign("is_file", $product->productDownload->checkFile()); ${"GLOBALS"}["hwvivbnezby"] = "upload_max_filesize"; ${${"GLOBALS"}["biwrimpair"]} = Tools::getOctets(ini_get("upload_max_filesize")); ${$pbrwepgkw} = ${${"GLOBALS"}["hwvivbnezby"]} / 1024 / 1024; self::$smarty->assign("upload_max_filesize", ${$ctepbh}); }
<?php $this->displayTemplate('header'); ?> <?php if (Tools::getMemoryLimit() < Tools::getOctets('32M')) { ?> <div class="warnBlock"><?php echo $this->translator->trans('PrestaShop requires at least 32 MB of memory to run: please check the memory_limit directive in your php.ini file or contact your host provider about this.', array(), 'Install'); ?> </div> <?php } ?> <?php if ($this->can_upgrade) { ?> <div class="warnBlock"> <img src="theme/img/pict_error.png" alt="" style="vertical-align: middle;" /> <?php echo $this->translator->trans('<b>Warning: You cannot use this tool to upgrade your store anymore.</b><br /><br />You already have <b>PrestaShop version %version% installed</b>.<br /><br />If you want to upgrade to the latest version, please read our documentation: <a href="%doc%">%doc%</a>', array('version' => $this->ps_version, '%doc%' => $this->getDocumentationUpgradeLink()), 'Install'); ?> </div> <?php } ?> <h2><?php echo $this->translator->trans('Welcome to the PrestaShop %version% Installer', array('%version%' => _PS_INSTALL_VERSION_), 'Install');
/** * @see InstallAbstractModel::display() */ public function display() { // The installer SHOULD take less than 32M, but may take up to 35/36M sometimes. So 42M is a good value :) $low_memory = Tools::getMemoryLimit() < Tools::getOctets('42M'); // We fill the process step used for Ajax queries $this->process_steps[] = array('key' => 'generateSettingsFile', 'lang' => $this->l('Create settings.inc file')); $this->process_steps[] = array('key' => 'installDatabase', 'lang' => $this->l('Create database tables')); $this->process_steps[] = array('key' => 'installDefaultData', 'lang' => $this->l('Create default shop and languages')); // If low memory, create subtasks for populateDatabase step (entity per entity) $populate_step = array('key' => 'populateDatabase', 'lang' => $this->l('Populate database tables')); if ($low_memory) { $populate_step['subtasks'] = array(); $xml_loader = new InstallXmlLoader(); foreach ($xml_loader->getSortedEntities() as $entity) { $populate_step['subtasks'][] = array('entity' => $entity); } } $this->process_steps[] = $populate_step; $this->process_steps[] = array('key' => 'configureShop', 'lang' => $this->l('Configure shop information')); $install_modules = array('key' => 'installModules', 'lang' => $this->l('Install modules')); if ($low_memory) { foreach ($this->model_install->getModulesList() as $module) { $install_modules['subtasks'][] = array('module' => $module); } } $this->process_steps[] = $install_modules; // Fixtures are installed only if option is selected if ($this->session->install_type == 'full') { // If low memory, create subtasks for installFixtures step (entity per entity) $fixtures_step = array('key' => 'installFixtures', 'lang' => $this->l('Install demonstration data')); if ($low_memory) { $fixtures_step['subtasks'] = array(); $xml_loader = new InstallXmlLoader(); $xml_loader->setFixturesPath(); foreach ($xml_loader->getSortedEntities() as $entity) { $fixtures_step['subtasks'][] = array('entity' => $entity); } } $this->process_steps[] = $fixtures_step; } $this->process_steps[] = array('key' => 'installTheme', 'lang' => $this->l('Install theme')); $this->displayTemplate('process'); }
/** * Update product download * * @param int $edit * @return bool */ public function updateDownloadProduct($edit = 0) { $app = JFactory::getApplication(); if ((int) $app->input->get('is_virtual_file') == 1) { if (isset($_FILES['virtual_product_file_uploader']) && $_FILES['virtual_product_file_uploader']['size'] > 0) { $virtual_product_filename = JeproshopProductDownloadModelProductDownload::getNewFilename(); $helper = new HelperUploader('virtual_product_file_uploader'); $files = $helper->setPostMaxSize(Tools::getOctets(ini_get('upload_max_filesize')))->setSavePath(_PS_DOWNLOAD_DIR_)->upload($_FILES['virtual_product_file_uploader'], $virtual_product_filename); } else { $virtual_product_filename = $app->input->get('virtual_product_filename', JeproshopProductDownloadModelProductDownload::getNewFilename()); } $this->setDefaultAttribute(0); //reset cache_default_attribute if ($app->input->get('virtual_product_expiration_date') && !JeproshopTools::isDate($app->input->get('virtual_product_expiration_date'))) { if (!$app->input->get('virtual_product_expiration_date')) { JText::_('The expiration-date attribute is required.'); $this->context->controller->has_errors = true; return false; } } // Trick's if ($edit == 1) { $product_download_id = (int) JeproshopProductDownloadModelProductDownload::getIdFromProductId((int) $this->product_id); if (!$product_download_id) { $product_download_id = (int) $app->input->get('virtual_product_id'); } } else { $product_download_id = $app->input->get('virtual_product_id'); } $is_sharable = $app->input->get('virtual_product_is_sharable'); $virtual_product_name = $app->input->get('virtual_product_name'); $virtual_product_nb_days = $app->input->get('virtual_product_nb_days'); $virtual_product_nb_downloadable = $app->input->get('virtual_product_nb_downloadable'); $virtual_product_expiration_date = $app->input->get('virtual_product_expiration_date'); $download = new JeproshopProductDownloadModelProductDownload((int) $product_download_id); $download->product_id = (int) $this->product_id; $download->display_filename = $virtual_product_name; $download->filename = $virtual_product_filename; $download->date_add = date('Y-m-d H:i:s'); $download->date_expiration = $virtual_product_expiration_date ? $virtual_product_expiration_date . ' 23:59:59' : ''; $download->nb_days_accessible = (int) $virtual_product_nb_days; $download->nb_downloadable = (int) $virtual_product_nb_downloadable; $download->published = 1; $download->is_sharable = (int) $is_sharable; if ($download->save()) { return true; } } else { /* un-active download product if checkbox not checked */ if ($edit == 1) { $product_download_id = (int) JeproshopProductDownloadModelProductDownload::getIdFromProductId((int) $this->product_id); if (!$product_download_id) { $product_download_id = (int) $app->input->get('virtual_product_id'); } } else { $product_download_id = JeproshopProductDownloadModelProductDownload::getIdFromProductId($this->product_id); } if (!empty($product_download_id)) { $product_download = new JeproshopProductDownloadModelProductDownload((int) $product_download_id); $product_download->date_expiration = date('Y-m-d H:i:s', time() - 1); $product_download->published = 0; return $product_download->save(); } } return false; }