If I am trying to add a php statement on my product page template that looks like this:

```
<?php if (Product Has Parent Category = 146) {
// Do this 
} elseif (Product Has Parent Category = 130) {
// Do this 
} else {
// Do this } ?>

```

Ofcourse this isnt the code, but how would I do this? Im basically trying to get the parent category that the subcategory is in. Any help would be greatly appreciated. Thanks!

UPDATE:

Each product is placed in multiple categories.. So I should have an array of Parent categories. Here is the database structure that I found for this.

**product\_to\_category**

```
product_id | category_id

```

**category**

```
category_id | parent_id | ...

```