Jump to content
  • 0

HomeFeatured/ProductCategory


TomSoiree

Question

Witam, 

mam problem z modułem homefeatured chce stworzyć coś na styl modułu productcategory, czyli wchodząc na produkt pokazuje inne produkty z tej samej kategorii, a więc standardowo stworzyłem nowy zaczep i skleciłem coś takiego:

 

$this->_clearCache('*');
Configuration::updateValue('HOME_FEATURED_NBR', 8);
Configuration::updateValue('HOME_FEATURED_CAT', [...]);
if (!$this->isCached('homefeatured.tpl', $this->getCacheId()))
{
	$this->_cacheProducts();
	$this->smarty->assign(
		array(
			'products' => HomeFeatured::$cache_products,
			'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
			'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
		)
	);
}
return $this->display(__FILE__, 'homefeatured.tpl', $this->getCacheId());
niestety nie wiem czego użyć po HOME_FEATURED_CAT aby pobrało mi kategorie obecnego produktu, nawet gdy już coś na siłę wkleje to wyskakuje komunikat, że w tej kategorii nie ma żadnych produktów, może ktoś mógły pomóc
Edited by TomSoiree (see edit history)
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

gdyby ktoś potrzebował:

$this->_clearCache('*');
		
$product = $params['product'];
$id_category_default = $product->getDefaultCategory();
		
Configuration::updateValue('HOME_FEATURED_NBR', 8);
Configuration::updateValue('HOME_FEATURED_CAT', $id_category_default);
if (!$this->isCached('homefeatured.tpl', $this->getCacheId()))
{
	$this->_cacheProducts();
	$this->smarty->assign(
		array(
			'products' => HomeFeatured::$cache_products,
			'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
			'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
		)
	);
}

return $this->display(__FILE__, 'homefeatured.tpl', $this->getCacheId());
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...