Jump to content

Favourites not displaying in front office


Recommended Posts

I've checked Blockmyaccount.tpl

There's no Favourite.

But when I click on My account on the Front Office, I get Favourite at the end of the list.

 

I guess it should display in the home page too...cause a customer is not supposed to chase his Favourites on the website...

 

Any help please?

Link to comment
Share on other sites

Thanks for your help. Unfortunately I'm not that good in creating funtions...

 

Don't you think there is something wrong?..since the following is my Favoriteproducts.php

 

 

 

if (!defined('_CAN_LOAD_FILES_'))
exit;
 
class FavoriteProducts extends Module
{
public function __construct()
{
$this->name = 'favoriteproducts';
$this->tab = 'front_office_features';
$this->version = 1.0;
$this->author = 'PrestaShop';
$this->need_instance = 0;
 
parent::__construct();
 
$this->displayName = $this->l('Favorite Products');
$this->description = $this->l('Display a page featuring the customer\'s favorite products.');
}
 
public function install()
{
if (!parent::install()
|| !$this->registerHook('displayMyAccountBlock')
|| !$this->registerHook('displayCustomerAccount')
|| !$this->registerHook('displayLeftColumnProduct')
|| !$this->registerHook('extraLeft')
|| !$this->registerHook('displayHeader'))
return false;
 
if (!Db::getInstance()->execute('
CREATE TABLE `'._DB_PREFIX_.'favorite_product` (
`id_favorite_product` int(10) unsigned NOT NULL auto_increment,
`id_product` int(10) unsigned NOT NULL,
`id_customer` int(10) unsigned NOT NULL,
`id_shop` int(10) unsigned NOT NULL,
`date_add` datetime NOT NULL,
  `date_upd` datetime NOT NULL,
PRIMARY KEY (`id_favorite_product`))
ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8'))
return false;
 
return true;
}
 
public function uninstall()
{
if (!parent::uninstall() || !Db::getInstance()->execute('DROP TABLE `'._DB_PREFIX_.'favorite_product`'))
return false;
return true;
}
 
public function hookDisplayCustomerAccount($params)
{
$this->smarty->assign('in_footer', false);
return $this->display(__FILE__, 'my-account.tpl');
}
 
public function hookDisplayMyAccountBlock($params)
{
$this->smarty->assign('in_footer', true);
return $this->display(__FILE__, 'my-account.tpl');
}
 
public function hookDisplayLeftColumnProduct($params)
{
include_once(dirname(__FILE__).'/FavoriteProduct.php');
 
$this->smarty->assign(array(
'isCustomerFavoriteProduct' => (FavoriteProduct::isCustomerFavoriteProduct($this->context->customer->id, Tools::getValue('id_product')) ? 1 : 0),
'isLogged' => (int)$this->context->customer->logged,
));
return $this->display(__FILE__, 'favoriteproducts-extra.tpl');
}
 
public function hookDisplayHeader($params)
{
$this->context->controller->addCSS($this->_path.'favoriteproducts.css', 'all');
$this->context->controller->addJS($this->_path.'favoriteproducts.js');
return $this->display(__FILE__, 'favoriteproducts-header.tpl');
}
 
}
 
and it looks like "favorite" should display in the header in the homepage, but I don't have any Favorite in the home page...
 
:huh: 
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...