first commit
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
|
||||
class stRecentlyViewedProductsFrontendActions extends stActions
|
||||
{
|
||||
|
||||
public function executeShowProducts()
|
||||
{
|
||||
$this->smarty = new stSmarty('stRecentlyViewedProductsFrontend');
|
||||
|
||||
$config_recently = stConfig::getInstance(sfContext::getInstance(), 'stRecentlyViewedProductsBackend');
|
||||
|
||||
|
||||
if($config_recently->get('enabled')!=1){
|
||||
|
||||
if($config_recently->get('show_in_product')!=1){
|
||||
|
||||
return sfView::NONE;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(stRecentlyViewedProductsPluginListener::getRecentlyViewedProducts()){
|
||||
|
||||
$this->config = stConfig::getInstance(sfContext::getInstance(), 'stProduct');
|
||||
|
||||
$this->products = stRecentlyViewedProductsPluginListener::getRecentlyViewedProducts();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function executeShowProductsSidebar()
|
||||
{
|
||||
$this->smarty = new stSmarty('stRecentlyViewedProductsFrontend');
|
||||
|
||||
$config_recently = stConfig::getInstance(sfContext::getInstance(), 'stRecentlyViewedProductsBackend');
|
||||
|
||||
if($config_recently->get('enabled')!=1){
|
||||
|
||||
if($config_recently->get('show_in_sidebar')!=1){
|
||||
|
||||
return sfView::NONE;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$i18n = $this->getContext()->getI18n();
|
||||
|
||||
if(stRecentlyViewedProductsPluginListener::getRecentlyViewedProducts()){
|
||||
|
||||
$this->config = stConfig::getInstance(sfContext::getInstance(), 'stProduct');
|
||||
|
||||
$this->products = stRecentlyViewedProductsPluginListener::getRecentlyViewedProducts();
|
||||
|
||||
}else{
|
||||
return $this->renderText("<p>".$i18n->__('W tym miejscu pojawią się ostatnio oglądane produkty.')."</p>");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function executeRemoveProduct()
|
||||
{
|
||||
|
||||
$product_id = $this->getRequestParameter('product_id');
|
||||
|
||||
stRecentlyViewedProductsPluginListener::removeRecentlyViewedProduct($product_id);
|
||||
|
||||
//return sfView::NONE;
|
||||
|
||||
return $this->renderText("true");
|
||||
}
|
||||
|
||||
public function executeRemoveAll()
|
||||
{
|
||||
|
||||
stRecentlyViewedProductsPluginListener::removeAll();
|
||||
|
||||
//return sfView::NONE;
|
||||
return $this->renderText("true");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
|
||||
class stRecentlyViewedProductsFrontendComponents extends sfComponents
|
||||
{
|
||||
public function executeRecentlyViewedProducts()
|
||||
{
|
||||
$this->smarty = new stSmarty('stRecentlyViewedProductsFrontend');
|
||||
|
||||
$config = stConfig::getInstance(sfContext::getInstance(), 'stRecentlyViewedProductsBackend');
|
||||
|
||||
|
||||
if($config->get('enabled') != 1){
|
||||
|
||||
return sfView::NONE;
|
||||
}
|
||||
|
||||
if($config->get('show_in_product') != 1){
|
||||
|
||||
return sfView::NONE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function executeRecentlyViewedProductsSidebar()
|
||||
{
|
||||
$this->smarty = new stSmarty('stRecentlyViewedProductsFrontend');
|
||||
|
||||
$config = stConfig::getInstance(sfContext::getInstance(), 'stRecentlyViewedProductsBackend');
|
||||
|
||||
if($config->get('enabled') != 1){
|
||||
|
||||
return sfView::NONE;
|
||||
}
|
||||
|
||||
if($config->get('show_in_sidebar') != 1){
|
||||
|
||||
return sfView::NONE;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user