* @link http://www.oxidmodule.com */ class d3_oxbasket_googleanalytics extends d3_oxbasket_googleanalytics_parent { /** * @return string */ public function d3GetCurrentLocatorTitle() { $sTitle = ''; /** @var oxview $oView */ $oView = oxRegistry::getConfig()->getActiveView(); if (method_exists($oView, 'getBreadCrumb') && ($aPaths = $oView->getBreadCrumb()) ) { foreach ($aPaths as $aPath) { $sTitle .= "/".$aPath['title']; } } elseif ($oView->getClassName() == 'details' && ( ( ($oCatTree = $oView->getCategoryTree()) && ($oCatPath = $oCatTree->getPath()) ) || ( ($oCatTree = $oView->getManufacturerTree()) && ($oCatPath = $oCatTree->getPath()) ) ) ) { foreach ($oCatPath as $oCat) { $sTitle .= "/".$oCat->getFieldData('oxtitle'); } } else { $sTitle = "page: ".ucfirst($oView->getClassName()); } return $sTitle; } /** * @param string $sProductID * @param float $dAmount * @param null $aSel * @param null $aPersParam * @param bool $blOverride * @param bool $blBundle * @param null $sOldBasketItemId * * @return object */ public function addToBasket( $sProductID, $dAmount, $aSel = null, $aPersParam = null, $blOverride = false, $blBundle = false, $sOldBasketItemId = null ) { $oBasketItem = parent::addToBasket( $sProductID, $dAmount, $aSel, $aPersParam, $blOverride, $blBundle, $sOldBasketItemId ); if ($oBasketItem) { $oBasketItem->d3SetLocatorTitle($this->d3GetCurrentLocatorTitle()); } return $oBasketItem; } }