Jump to content

Module modification


Kogkalidis

Recommended Posts

Yes and there is also one more of new products and I saw one guy selling one for the job that I need it (on addons) but it's like the free ones with a few modifications that I can do with your help ;)

 

one version is the mentioned above by Pascal and the other one is this http://www.landofcoder.com/prestashop/slider-a-slideshow/153-lof-new-products-prestashop-module.html

Link to comment
Share on other sites

in the libs/groups/product you've got:

 

function getListFeatured( $params ){
	    global $cookie, $link;
	    $id_lang = intval($cookie->id_lang);
  if(_PS_VERSION_ >= "1.5")
   $category = new Category(Context::getContext()->shop->getCategory(), (int)Context::getContext()->language->id);
  else
   $category = new Category(1, Configuration::get('PS_LANG_DEFAULT'));

	    $maxDesc = $params->get( 'des_max_chars',100);
  $limit_items = $params->get( 'limit_items',10);
  $listFeatured = $category->getProducts((int)(intval($cookie->id_lang)), 1, $limit_items);
  $listFeatured = Product::getProductsProperties($id_lang, $listFeatured);
	    foreach( $listFeatured as &$product ){
		    $product['description']=substr(trim(strip_tags($product['description_short'])),0, $maxDesc);
		    $product['price']=Tools::displayPrice($product['price']);				
		    $product = $this->parseImages( $product,$params );			   
		    $product = $this->generateImages( $product, $params );
	    }
	    return $listFeatured;
    }

 

instead

$listFeatured = $category->getProducts((int)(intval($cookie->id_lang)), 1, $limit_items);

 

you can use functions:

 

Product::getPricesDrop();

 

ProductSale::getBestSales(),

 

don't forget about function parameters.

  • Like 1
Link to comment
Share on other sites

in the libs/groups/product you've got:

 

function getListFeatured( $params ){
		global $cookie, $link;
		$id_lang = intval($cookie->id_lang);
  if(_PS_VERSION_ >= "1.5")
$category = new Category(Context::getContext()->shop->getCategory(), (int)Context::getContext()->language->id);
  else
$category = new Category(1, Configuration::get('PS_LANG_DEFAULT'));

		$maxDesc = $params->get( 'des_max_chars',100);
  $limit_items = $params->get( 'limit_items',10);
  $listFeatured = $category->getProducts((int)(intval($cookie->id_lang)), 1, $limit_items);
  $listFeatured = Product::getProductsProperties($id_lang, $listFeatured);
		foreach( $listFeatured as &$product ){
			$product['description']=substr(trim(strip_tags($product['description_short'])),0, $maxDesc);
			$product['price']=Tools::displayPrice($product['price']);				
			$product = $this->parseImages( $product,$params );			  
			$product = $this->generateImages( $product, $params );
		}
		return $listFeatured;
	}

 

instead

$listFeatured = $category->getProducts((int)(intval($cookie->id_lang)), 1, $limit_items);

 

you can use functions:

 

Product::getPricesDrop();

 

ProductSale::getBestSales(),

 

don't forget about function parameters.

 

So I edit only this and that's all? :D

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