mirror of
https://github.com/retailcrm/prestashop-module.git
synced 2025-03-02 19:33:14 +03:00
Fixed root-category relation with home-category
Co-authored-by: Eugene Polozov <eugene@retailcrm.es>
This commit is contained in:
parent
41ce30b143
commit
fb0c45bfd0
@ -88,7 +88,7 @@ class RetailcrmCatalog
|
|||||||
$categoriesIds[] = $categoryId;
|
$categoriesIds[] = $categoryId;
|
||||||
$categories[] = array(
|
$categories[] = array(
|
||||||
'id' => $categoryId,
|
'id' => $categoryId,
|
||||||
'parentId' => self::getParentCategoryId($category['id_parent']),
|
'parentId' => self::getParentCategoryId($categoryId, $category['id_parent']),
|
||||||
'name' => $category['name'],
|
'name' => $category['name'],
|
||||||
'picture' => $picture ? $protocol . $picture : ''
|
'picture' => $picture ? $protocol . $picture : ''
|
||||||
);
|
);
|
||||||
@ -173,7 +173,7 @@ class RetailcrmCatalog
|
|||||||
$width = round($product['width'], 3);
|
$width = round($product['width'], 3);
|
||||||
$height = round($product['height'], 3);
|
$height = round($product['height'], 3);
|
||||||
$depth = round($product['depth'], 3);
|
$depth = round($product['depth'], 3);
|
||||||
|
|
||||||
if (!empty($width) && !empty($height)) {
|
if (!empty($width) && !empty($height)) {
|
||||||
$dimensions = implode('/', array($width, $height, $depth));
|
$dimensions = implode('/', array($width, $height, $depth));
|
||||||
} else {
|
} else {
|
||||||
@ -231,7 +231,7 @@ class RetailcrmCatalog
|
|||||||
if ($offerCombination->wholesale_price > 0) {
|
if ($offerCombination->wholesale_price > 0) {
|
||||||
$offerPurchasePrice = round($offerCombination->wholesale_price, 2);
|
$offerPurchasePrice = round($offerCombination->wholesale_price, 2);
|
||||||
} else {
|
} else {
|
||||||
$offerPurchasePrice = $purchasePrice;
|
$offerPurchasePrice = $purchasePrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($offerCombination->reference)) {
|
if (!empty($offerCombination->reference)) {
|
||||||
@ -295,7 +295,7 @@ class RetailcrmCatalog
|
|||||||
'vendor' => $vendor,
|
'vendor' => $vendor,
|
||||||
'article' => $article,
|
'article' => $article,
|
||||||
'weight' => $weight,
|
'weight' => $weight,
|
||||||
'dimensions' => $dimensions
|
'dimensions' => $dimensions
|
||||||
);
|
);
|
||||||
|
|
||||||
$items[] = $item;
|
$items[] = $item;
|
||||||
@ -336,16 +336,21 @@ class RetailcrmCatalog
|
|||||||
/**
|
/**
|
||||||
* Returns active parent category
|
* Returns active parent category
|
||||||
*
|
*
|
||||||
|
* @param int $categoryId
|
||||||
* @param int $parentId
|
* @param int $parentId
|
||||||
*
|
*
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
private static function getParentCategoryId($parentId)
|
private static function getParentCategoryId($categoryId, $parentId)
|
||||||
{
|
{
|
||||||
$home = Configuration::get('PS_HOME_CATEGORY');
|
$home = Configuration::get('PS_HOME_CATEGORY');
|
||||||
|
|
||||||
if (empty($parentId)) {
|
if (empty($parentId)) {
|
||||||
return $home;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($categoryId == $home) {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($parentId == $home) {
|
if ($parentId == $home) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user