Jump to content

LineTV

Members
  • Posts

    25
  • Joined

  • Last visited

Profile Information

  • Activity
    Agency

LineTV's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Oh I see. How do I remove the "Help" button on the admin (backoffice) tab? When clicked, it doesn't do anything - All it does is a circular animation thing, and if its not going to show help.. I'd like to remove it.. any suggestions?
  2. @Vekia, I did think about it and agree that it will be bad to have random display of all products on homepage. However, I have several multishops in the same group as the default shop, and would like to have the products added onto these multishop also show up on the default shop - perhaps in the "New Arrivals". How can I make that happen? Thanks for your advice.
  3. There are sooooo many answers and ways to do just one thing "Randomizing Product display" ... this is all a little "ALOT" confusing. I cal link up different threads from people telling you what and how to randomly display products on the site, one person says do this, the other says no, do it this way, and yet another says .. no, my way is the right way .. argghh!
  4. I was also wondering - If I want to display ALL products randomly as they are being added onto the site, can I use this code, what should I change in it... can any one help answer?
  5. @Vekia, Thank you for your support. I really appreciate it. I have sent you a couple of emails regarding another issue I'd like to fix. I needed to display products created on multistores on the default page (without sharing inventories, orders or customers) - How can I get this done? Please advice. Thanks
  6. How can I rename the admin folder after installation has been completed in PS 1.6? Any help will be great.
  7. Hello All, I am getting this error when I open up Module in PS 1.6.... 2 errors blocknewproducts (parse error in /modules/blocknewproducts/blocknewproducts.php) blocknewproducts (class missing in /modules/blocknewproducts/blocknewproducts.php) Is there anything Im missing, Can someone help, here is what my blocknewproducts.php file look like: if (!defined('_PS_VERSION_')) exit; class BlockNewProducts extends Module { protected static $cache_new_products; public function __construct() { $this->name = 'blocknewproducts'; $this->tab = 'front_office_features'; $this->version = '1.9'; $this->author = 'PrestaShop'; $this->need_instance = 0; $this->bootstrap = true; parent::__construct(); $this->displayName = $this->l('New products block'); $this->description = $this->l('Displays a block featuring your store\'s newest products.'); $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); } public function install() { $success = (parent::install() && $this->registerHook('header') && $this->registerHook('addproduct') && $this->registerHook('updateproduct') && $this->registerHook('deleteproduct') && Configuration::updateValue('NEW_PRODUCTS_NBR', 5) && $this->registerHook('displayHomeTab') && $this->registerHook('displayHomeTabContent') ); if ($success) { // Hook the module either on the left or right column $theme = new Theme(Context::getContext()->shop->id_theme); if ((!$theme->default_left_column || !$this->registerHook('leftColumn')) && (!$theme->default_right_column || !$this->registerHook('rightColumn'))) { // If there are no colums implemented by the template, throw an error and uninstall the module $this->_errors[] = $this->l('This module need to be hooked in a column and your theme does not implement one'); parent::uninstall(); return false; } } $this->_clearCache('*'); return $success; } public function uninstall() { $this->_clearCache('*'); return parent::uninstall(); } public function getContent() { $output = ''; if (Tools::isSubmit('submitBlockNewProducts')) { if (!($productNbr = Tools::getValue('NEW_PRODUCTS_NBR')) || empty($productNbr)) $output .= $this->displayError($this->l('Please complete the "products to display" field.')); elseif ((int)($productNbr) == 0) $output .= $this->displayError($this->l('Invalid number.')); else { Configuration::updateValue('PS_NB_DAYS_NEW_PRODUCT', (int)(Tools::getValue('PS_NB_DAYS_NEW_PRODUCT'))); Configuration::updateValue('PS_BLOCK_NEWPRODUCTS_DISPLAY', (int)(Tools::getValue('PS_BLOCK_NEWPRODUCTS_DISPLAY'))); Configuration::updateValue('NEW_PRODUCTS_NBR', (int)($productNbr)); $output .= $this->displayConfirmation($this->l('Settings updated')); } } return $output.$this->renderForm(); } private function getNewProducts() { if (!Configuration::get('NEW_PRODUCTS_NBR')) return; $newProducts = false; if (Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) $newProducts = Product::getNewProducts((int) $this->context->language->id, 0, (int)Configuration::get('NEW_PRODUCTS_NBR')); } if (!$newProducts && Configuration::get('PS_BLOCK_NEWPRODUCTS_DISPLAY')) return; return $newProducts; } public function hookRightColumn($params) { if (!$this->isCached('blocknewproducts.tpl', $this->getCacheId())) { if (!isset(BlockNewProducts::$cache_new_products)) BlockNewProducts::$cache_new_products = $this->getNewProducts(); $this->smarty->assign(array( 'new_products' => BlockNewProducts::$cache_new_products, 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), 'homeSize' => Image::getSize(ImageType::getFormatedName('home')) )); } if (BlockNewProducts::$cache_new_products === false) return false; return $this->display(__FILE__, 'blocknewproducts.tpl', $this->getCacheId()); } protected function getCacheId($name = null) { if ($name === null) $name = 'blocknewproducts'; return parent::getCacheId($name.'|'.date('Ymd')); } public function hookLeftColumn($params) { return $this->hookRightColumn($params); } public function hookdisplayHomeTab($params) { if (!$this->isCached('tab.tpl', $this->getCacheId('blocknewproducts-tab'))) BlockNewProducts::$cache_new_products = $this->getNewProducts(); if (BlockNewProducts::$cache_new_products === false) return false; return $this->display(__FILE__, 'tab.tpl', $this->getCacheId('blocknewproducts-tab')); } public function hookdisplayHomeTabContent($params) { if (!$this->isCached('blocknewproducts_home.tpl', $this->getCacheId('blocknewproducts-home'))) { $this->smarty->assign(array( 'new_products' => BlockNewProducts::$cache_new_products, 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), 'homeSize' => Image::getSize(ImageType::getFormatedName('home')) )); } if (BlockNewProducts::$cache_new_products === false) return false; return $this->display(__FILE__, 'blocknewproducts_home.tpl', $this->getCacheId('blocknewproducts-home')); } public function hookHeader($params) { if (isset($this->context->controller->php_self) && $this->context->controller->php_self == 'index') $this->context->controller->addCSS(_THEME_CSS_DIR_.'product_list.css'); $this->context->controller->addCSS($this->_path.'blocknewproducts.css', 'all'); } public function hookAddProduct($params) { $this->_clearCache('*'); } public function hookUpdateProduct($params) { $this->_clearCache('*'); } public function hookDeleteProduct($params) { $this->_clearCache('*'); } public function _clearCache($template, $cache_id = NULL, $compile_id = NULL) { parent::_clearCache('blocknewproducts.tpl'); parent::_clearCache('blocknewproducts_home.tpl', 'blocknewproducts-home'); parent::_clearCache('tab.tpl', 'blocknewproducts-tab'); } public function renderForm() { $fields_form = array( 'form' => array( 'legend' => array( 'title' => $this->l('Settings'), 'icon' => 'icon-cogs' ), 'input' => array( array( 'type' => 'text', 'label' => $this->l('Products to display'), 'name' => 'NEW_PRODUCTS_NBR', 'class' => 'fixed-width-xs', 'desc' => $this->l('Define the number of products to be displayed in this block.') ), array( 'type' => 'text', 'label' => $this->l('Number of days for which the product is considered \'new\''), 'name' => 'PS_NB_DAYS_NEW_PRODUCT', 'class' => 'fixed-width-xs', ), array( 'type' => 'switch', 'label' => $this->l('Always display this block'), 'name' => 'PS_BLOCK_NEWPRODUCTS_DISPLAY', 'desc' => $this->l('Show the block even if no new products are available.'), 'values' => array( array( 'id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled') ), array( 'id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled') ) ), ) ), 'submit' => array( 'title' => $this->l('Save'), ) ), ); $helper = new HelperForm(); $helper->show_toolbar = false; $helper->table = $this->table; $lang = new Language((int)Configuration::get('PS_LANG_DEFAULT')); $helper->default_form_language = $lang->id; $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0; $helper->identifier = $this->identifier; $helper->submit_action = 'submitBlockNewProducts'; $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name; $helper->token = Tools::getAdminTokenLite('AdminModules'); $helper->tpl_vars = array( 'fields_value' => $this->getConfigFieldsValues(), 'languages' => $this->context->controller->getLanguages(), 'id_language' => $this->context->language->id ); return $helper->generateForm(array($fields_form)); } public function getConfigFieldsValues() { return array( 'PS_NB_DAYS_NEW_PRODUCT' => Tools::getValue('PS_NB_DAYS_NEW_PRODUCT', Configuration::get('PS_NB_DAYS_NEW_PRODUCT')), 'PS_BLOCK_NEWPRODUCTS_DISPLAY' => Tools::getValue('PS_BLOCK_NEWPRODUCTS_DISPLAY', Configuration::get('PS_BLOCK_NEWPRODUCTS_DISPLAY')), 'NEW_PRODUCTS_NBR' => Tools::getValue('NEW_PRODUCTS_NBR', Configuration::get('NEW_PRODUCTS_NBR')), ); } }
  8. @Nemo, Thanks again for the pointer. I am somewhat skillful in php, not the best though, and I was able to make the edit from: $newProducts = Product::getNewProducts((int) $this->context->language->id, 0, (int)Configuration::get('NEW_PRODUCTS_NBR')); to: $newProducts = Product::getNewProducts(intval($params['cookie']->id_lang), 0, 100);shuffle($newProducts);array_splice($newProducts, Configuration::get('NEW_PRODUCTS_NBR') ); Do you thikn that's gonna fix it - make those products in multishop display on the default home?
  9. @Nemo, Hello and thank you for your response. So all I have to do is not pass a shop ID as a condition - Would I have to hire someone to write the codes or is this something a novince can do using Prestashop?
  10. I just want to know if its possible to display products created on multishops on the homepage of the Master (default) page. For example, lets say you have 5 different multishops, and want to have products created on these multishops to display on the Master (default) shop... How is it possible? I have called/email/ sought answer for this problem including Prestashop tech support, and I never got a yes or no answer from anyone - they all say "yes its possible", but no one knows how to configure.... So if you please know the answer to this question.. please help. Thanks
×
×
  • Create New...