Files
grzanieplus.pl/plugins/appFacebookRemarketingPlugin/modules/appFacebookRemarketingFrontend/actions/components.class.php
2025-03-12 17:06:23 +01:00

83 lines
2.8 KiB
PHP

<?php
/**
* SOTESHOP/appFacebookRemarketingPlugin
*
*
* @package appFacebookRemarketingPlugin
* @author Pawel Byszewski <pawel@apes-apps.com>
*/
class appFacebookRemarketingFrontendComponents extends sfComponents
{
public function executeFbremarketing()
{
$config = stConfig::getInstance('appFacebookRemarketingBackend');
$this->fbremarketingConfig = $config->load();
$this->fbremarketingConfig['code_fbremarketing'] = $config->get('code_fbremarketing', null, true);
if ($this->fbremarketingConfig['enable_fbremarketing'] != 1 || $this->fbremarketingConfig['code_fbremarketing'] == null)
{
return sfView::NONE;
}
if ((sfContext::getInstance()->getActionName()=="show") && (sfContext::getInstance()->getModuleName()=="stProduct") && $this->fbremarketingConfig['product_card'] == 1)
{
$this->product_card = 1;
$this->product = sfContext::getInstance()->getActionStack()->getLastEntry()->getActionInstance()->product;
}
if ((sfContext::getInstance()->getActionName()=="summary") && (sfContext::getInstance()->getModuleName()=="stOrder") && $this->fbremarketingConfig['order'] == 1)
{
$this->orders = 1;
if (!sfContext::getInstance()->getUser()->getAttribute("fb_browser_send_purchase")) {
sfContext::getInstance()->getUser()->setAttribute("fb_browser_send_purchase", true);
$this->order = sfContext::getInstance()->getActionStack()->getLastEntry()->getActionInstance()->order;
}else{
return sfView::NONE;
}
}
if ((sfContext::getInstance()->getActionName()=="index") && (sfContext::getInstance()->getModuleName()=="stBasket") && $this->fbremarketingConfig['basket'] == 1) {
$this->basket = 1;
$this->items = $this->getUser()->getBasket()->getlastAddedItems();
$this->currency = stCurrency::getInstance(sfContext::getInstance())->get();
}
$this->smarty = new stSmarty('appFacebookRemarketingFrontend');
}
public function executeFbAddTrack() {
$config = stConfig::getInstance('appFacebookRemarketingBackend');
$this->fbremarketingConfig = $config->load();
$this->fbremarketingConfig['code_fbremarketing'] = $config->get('code_fbremarketing', null, true);
if ($this->fbremarketingConfig['enable_fbremarketing'] != 1 || $this->fbremarketingConfig['code_fbremarketing'] == null || $this->fbremarketingConfig['cart'] != 1)
{
return sfView::NONE;
}
$this->items = $this->getUser()->getBasket()->getlastAddedItems();
$this->currency = stCurrency::getInstance(sfContext::getInstance())->get();
}
}