/** * Get the default category id for a product * * @param \Thelia\Model\Product $product * @return null|int */ protected function getDefaultCategoryId($product) { $defaultCategoryId = null; if ((bool) $product->getVirtualColumn('is_default_category')) { $defaultCategoryId = $product->getVirtualColumn('default_category_id'); } else { $defaultCategoryId = $product->getDefaultCategoryId(); } return $defaultCategoryId; }