adjust view_cart; extend Model\Category

add categories to ecommerce-DataLayer; add method to immediately get the requested Category-Steps
This commit is contained in:
2023-06-21 15:23:50 +02:00
parent 7b82476e8b
commit 5dd7b51fb5
5 changed files with 93 additions and 35 deletions

View File

@ -0,0 +1,44 @@
<?php
namespace D3\GoogleAnalytics4\Modules\Application\Model;
class Category extends Category_parent
{
/**
* @param int $indexOfArray
* @return string
*/
public function getSplitCategoryArray(int $indexOfArray = -1) :string
{
if ($indexOfArray > -1){
$splitCatArray =
array_values(
array_filter(
explode(
'/',
trim(
parse_url(
$this->getLink(),
5
)
)
)
)
);
if ($splitCatArray[$indexOfArray]){
return $splitCatArray[$indexOfArray];
}else{
return "";
}
}
return
trim(
parse_url(
$this->getLink(),
5
)
);
}
}