Jump to content

[free module] homepage featured new products block


Recommended Posts

Homepage featured new products block

today i want to share with you totally free module for your prestashop 1.5 only

 

This addon displays latest products added to your store on your homepage.

 

It works similar to featured products module but this one displays only new products

 

 

 

 

 

prestashop-home-new-products-module-big-

 

 

 

This free addon is great marketing tool

 

now you can promote your new products on most important page in your store: homepage!

 

 

 

download it for free:

 

 

 

 

homenewproducts.zip

  • Like 8

Share this post


Link to post
Share on other sites

hello

open modules/homenewproducts/ directory and remove all language files, for example:

en.php, es.php, it.php, de.php, pl.php

 

and let me know if this helps you

Share this post


Link to post
Share on other sites
  • 2 months later...
  • 4 weeks later...

it's not possible to easily add pagination to module like that, 

you can achieve this with custom development and it's not as easy as it seems, unfortunately.

Share this post


Link to post
Share on other sites
  • 4 weeks later...
  • 1 month later...

Hi Vekia,

 

I installed your module, and left anything on the default settings. as soon as I refresh my store with the new module, it crashes with the following error:

 

Fatal error: Call to undefined method homenewproducts::getCacheId() in /var/www/vhosts/17/165121/webspace/siteapps/Prestashop-168858/htdocs/modules/homenewproducts/homenewproducts.php on line 88

 

any ideas?

 

cheers

 

PS: my prestashop version is 1.5.3.1

Edited by beertjeb (see edit history)

Share this post


Link to post
Share on other sites

hello

it's because prestashop 1.5.3.1 doesnt support caching for modules.

solution here:

http://cart-help.com/topic/75-new-products-block-for-homepage-in-prestashop-1531

 

summary of topic above:

replace code from module php file with this:

<?php
if (!defined('_PS_VERSION_'))
	exit;

class homenewproducts extends Module
{
	private $_html = '';
	private $_postErrors = array();

	function __construct()
	{
		$this->name = 'homenewproducts';
		$this->tab = 'front_office_features';
		$this->version = '1.1';
		$this->author = 'MyPresta.eu';

		parent::__construct();

		$this->displayName = $this->l('New products on the homepage');
		$this->description = $this->l('Displays new products in the middle of your homepage.');
	}

	function install(){
		//$this->_clearCache('homenewproducts.tpl');
		Configuration::updateValue('HNP_NBR', 8);

		if (!parent::install()
			|| !$this->registerHook('displayHome')
			|| !$this->registerHook('header')
			|| !$this->registerHook('addproduct')
			|| !$this->registerHook('updateproduct')
			|| !$this->registerHook('deleteproduct')
		)
			return false;
		return true;
	}
	
	public function uninstall(){
		//$this->_clearCache('homenewproducts.tpl');
		return parent::uninstall();
	}

	public function getContent(){
		$output = '<h2>'.$this->displayName.'</h2>';
		if (Tools::isSubmit('submitHomeFeatured'))
		{
			$nbr = (int)Tools::getValue('nbr');
			if (!$nbr OR $nbr <= 0 OR !Validate::isInt($nbr))
				$errors[] = $this->l('An invalid number of products has been specified.');
			else
				Configuration::updateValue('HNP_NBR', (int)($nbr));
			if (isset($errors) AND sizeof($errors))
				$output .= $this->displayError(implode('<br />', $errors));
			else
				$output .= $this->displayConfirmation($this->l('Your settings have been updated.'));
		}
		return $output.$this->displayForm();
	}

	public function displayForm(){
		$output = '<iframe src="http://mypresta.eu/content/uploads/2012/09/htmlbox_advertise.html" width="100%" height="130" border="0" style="border:none;"></iframe>
		<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post">
			<fieldset><legend><img src="'.$this->_path.'logo.gif" alt="" title="" />'.$this->l('Settings').'</legend>
				<label>'.$this->l('Define the number of products to be displayed.').'</label>
				<div class="margin-form">
					<input type="text" size="5" name="nbr" value="'.Tools::safeOutput(Tools::getValue('nbr', (int)(Configuration::get('HNP_NBR')))).'" />
					<p class="clear">'.$this->l('Define the number of products that you would like to display on homepage (default: 8).').'</p>

				</div>
				<center><input type="submit" name="submitHomeFeatured" value="'.$this->l('Save').'" class="button" /></center>
			</fieldset>
		</form>'.$this->l('like us on Facebook').'</br><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Ffacebook.com%2Fmypresta&send=false&layout=button_count&width=120&show_faces=true&font=verdana&colorscheme=light&action=like&height=21&appId=276212249177933" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:120px; height:21px; margin-top:10px;" allowtransparency="true"></iframe>
        '.'<div style="float:right; text-align:right; display:inline-block; margin-top:10px; font-size:10px;">
        '.$this->l('Proudly developed by').' <a href="http://mypresta.eu" style="font-weight:bold; color:#B73737">MyPresta<font style="color:black;">.eu</font>.</a>
        ';
		return $output;
	}

	public function hookDisplayHeader($params){
		$this->hookHeader($params);
	}

	public function hookHeader($params){
		$this->context->controller->addCSS(($this->_path).'homenewproducts.css', 'all');
	}

	public function hookDisplayHome($params){
		//if (!$this->isCached('homenewproducts.tpl', $this->getCacheId('homenewproducts'))){
			$nb = (int)Configuration::get('HNP_NBR');  
            $productClass = new Product(); 
            $products = $productClass -> getNewProducts((int)Context::getContext()->language->id,0,($nb ? $nb : 8));
			$this->smarty->assign(array(
				'products' => $products,
				'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
				'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
			));
		//}
		return $this->display(__FILE__, 'homenewproducts.tpl');
	}

	public function hookAddProduct($params){
		//$this->_clearCache('homenewproducts.tpl');
	}

	public function hookUpdateProduct($params){
		//$this->_clearCache('homenewproducts.tpl');
	}

	public function hookDeleteProduct($params){
		//$this->_clearCache('homenewproducts.tpl');
	}
}

Share this post


Link to post
Share on other sites
  • 3 weeks later...

You should change id tag for your module, because it collides with homefeatured module. Both are named "featured-products_block_center".

 

oops :D

thank you, i will change it :)

Share this post


Link to post
Share on other sites

Hi Vekia,

 

I am using your module for some time.

 

I want to "force" a product be show as new (on top at the homepage) - despite it is not that new - ie. compared to the first 12 I had set to be shown, for commercial reasons (it boosts its sales).

 

Not to good in reading presta code but I tried manually to change @ db the product's ....

PS_product_owner > date_add value 

and

PS_product_shop > data_add value

to today's date, somehow to trick presta or your module that the product is newer that the other.

 

No change. (Could it be cache?). So question is..

 

Is there a value somewhere is db that if changed in today's date (for example, or it would be a more simple list elsewhere) would rearrange the product to be shown on top? (Fooling just this frontpage feature?)

Edited by BD-FSPS (see edit history)

Share this post


Link to post
Share on other sites

this module uses caching so it is more than possible that it's related to cache.

have you tried to clear it?

Share this post


Link to post
Share on other sites

I suspected so and yes I tried to clear it.

 

But in any case the method is correct? Are these the variables indeed that you use for sorting products? 

Share this post


Link to post
Share on other sites

function to get new products from database is based on date_add field

so if you change value of this field, products with "newest" date should be included to the feed.

it should work.

Share this post


Link to post
Share on other sites

Solved. It was the date_add inside "PS_product" actually, far to the right in db and I missed it, combined with some cache lame from my side.

 

Thanks for your help mate :)

Share this post


Link to post
Share on other sites
  • 2 months later...

I used homenewproducts in my P 1.5 installation which I recently updated to 1.6. As I can see, this ability to show new products on the homepage is now integrated in Prestashop 1.6 and shows a tab on top of the content area. In 1.5 I some how managed to have it show products as list but I am struggling after the update to make it work for 1.6. How could I show new products as a list instead of a grid? And as second question, how could the tab link "Newest arrivals" be moved to the menu in the sidebar?

Share this post


Link to post
Share on other sites

I have the problem, when i install this module, i seen "new products" as a list and i want it to have as "grid"

my featured products are showing as grid...

 

 

Thanks in advance!screenshot-website1.jpg

Share this post


Link to post
Share on other sites
  • 2 weeks later...

Hello,

 

Loving this module, its neat and functional. 2 questions though. 

 

1. Is it possibile to change the tiltle of the module displayed on homepage to something else? Now it says  ''NEW PRODUCTS'', I would like it to say ''Najnovejši izdelki''.

 

2. Is it possibile to make that same text clickable, like a link, and that clicking would take you to a page where all the new products, or last 20 would be displayed?

 

REGARDS,

 

PARANOiA

Share this post


Link to post
Share on other sites
  • 1 month later...

hi. I installed it but it doesn't follow the theme display logic.

Can you advice?

http://alltestdomain.com/gifk/

 

It works fine on your page :) If it's about bad aligning when product doesn't have images then it's theme's fault, not module's. You've changed home_default size to 270x270, but "No image available" image is 124x124. Just resize it.

Share this post


Link to post
Share on other sites
  • 4 months later...
  • 2 weeks later...
  • 2 weeks later...
  • 4 weeks later...
Hello,

I have a problem with the module and the smarty cache.

To view the new products, I must necessarily bleed the smarty cache.
The Presta version is 1.5.6.1

thank you

Share this post


Link to post
Share on other sites
  • 3 months later...
  • 6 months later...

Hi Vekia,

 

I know this thread maybe a little old now but reading it some people have said that the module "Home New Product" works OK on 1.6.x.

 

I'm trying a 1.6.1.4 at the moment where the module loads OK onto the "homeDisplay" hook but when displayed on the test site, displays a long "single item" list instead of a grid, simular to the picture posted by Yourim in 27 July 2014 on this thread.

 

Have you any idea what could be wrong? (I have regenerated all the produkt pictures etc.)

 

Thanks, in advance.

 

David C

Edited by darvidc (see edit history)

Share this post


Link to post
Share on other sites
  • 1 month later...

On latest prestashop it works fine but it displays the products on single column. Is it possible to adjust that to split the items to the full width of the template or to multiple columns?

Share this post


Link to post
Share on other sites
  • 3 weeks later...

On latest prestashop it works fine but it displays the products on single column. Is it possible to adjust that to split the items to the full width of the template or to multiple columns?

 

Unlike the default new product module that doesnt work this does but I also want to know how to get it to not do a straight line down but to look the way the default module does.

Share this post


Link to post
Share on other sites
  • 2 weeks later...
  • 11 months later...

On latest prestashop it works fine but it displays the products on single column. Is it possible to adjust that to split the items to the full width of the template or to multiple columns?

Same here... 

Share this post


Link to post
Share on other sites

Hi Vekia. 

I'm on 1.6.1.10 and in the 1.1 of your extension. 

I'm attaching you a screenshot. 

 

Im using the ps_lifestyle theme (https://addons.prestashop.com/en/jewelry-accessories-themes/20058-a-responsive-genesis-prestashop-lifestyle.html)

 

Thanks

 

leRxGX2.png

 

 

hello

unfortunately without access to page where you've got the problem i will not be able to say something more about the problem

case requires inspection in the shop where it does not look well.

Share this post


Link to post
Share on other sites

hello

unfortunately without access to page where you've got the problem i will not be able to say something more about the problem

case requires inspection in the shop where it does not look well.

 

The module is installed at experienciabebe.com, but now it's deactivated. 

;) 

Share this post


Link to post
Share on other sites
  • 3 months later...
  • 6 months later...
  • 1 month later...

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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More