# Shop Integration

When adding new shops or editing existing shops inside of `locations.lua` always remember that the shop `name` needs to be unique. This name is saved into `mk_vehicleshops` and is used when generating shop vehicles through `mk_utils` inside your frameworks server bridge file under the function `getShopVehicles`. The `categories` table is also passed to this function.

By default the `getShopVehicles` function will generate shop vehicles in the following priority:

* Is this vehicle not blacklisted by the server?
  * If the vehicle is blacklisted it will not be added to the shop
* Is this vehicle assigned specifically to a shop?
  * If this vehicle is assigned a `shop` then it can only be sold at that specific shop regardless of its vehicle category. Example: A vehicle that is assigned a shop of `pdm` with a category of `compacts` will only be sold at `pdm` and not at any other shops that list `compacts` as a category.
  * If this vehicle is not assigned to a specific shop then its category will be checked
* Is this vehicle assigned to a category associated with this shop?
  * If this vehicles assigned category is in the shop category list it will be added to the shop

Blacklist a vehicle:

{% tabs %}
{% tab title="qb" %}
Navigate to `qb-smallresources/config.lua`

Add your vehicle into `Config.BlacklistedVehs` table using the same format shown
{% endtab %}

{% tab title="qbx" %}
Navigate to `qbx_smallresources/qbx_entitiesblacklist/config.lua`&#x20;

Add your vehicle into `blacklisted` table using the same format shown
{% endtab %}

{% tab title="esx" %}
No blacklist
{% endtab %}
{% endtabs %}

Assign a vehicle to a specific shop:

{% tabs %}
{% tab title="qb" %}
Navigate to `qb-core/shared/vehicles.lua`

Add or find the vehicle you want to add to a specific shop

Edit its `shop` to match the `name` of the shop in `locations.lua` (They must match exactly)

![](https://51694285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSadY5GIZVZCGCeog04Gq%2Fuploads%2FMeYdi8u4O2rvt16PgknJ%2Fqb_shop.png?alt=media\&token=30ef0e36-337a-48fa-a6b8-7bba04468f76)
{% endtab %}

{% tab title="qbx" %}
Navigate to `qbx_core/shared/vehicles.lua`

Add or find the vehicle you want to add to a specific shop

Edit the table to add `shop = 'shopname'` (by default shop does not exist here) making shopname the exact `name` of the shop in `locations.lua` (They must match exactly)

![](https://51694285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSadY5GIZVZCGCeog04Gq%2Fuploads%2F7FQhF3RWNaxRVu0h7yJr%2Fshop_qbx.png?alt=media\&token=cfa30241-b2bc-4697-b009-a5464678e272)
{% endtab %}

{% tab title="esx" %}
Specific shops are not supported by ESX default vehicle structure
{% endtab %}
{% endtabs %}

Assign a vehicle to a specific category:

{% tabs %}
{% tab title="qb" %}
Navigate to `qb-core/shared/vehicles.lua`

Add or find the vehicle you want to assign a category to

Edit its `category` to match a category you will assign inside of the `categories` table of `locations.lua`&#x20;

![](https://51694285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSadY5GIZVZCGCeog04Gq%2Fuploads%2FZTG4MV5Q5tcGEPDjnF9u%2Fqb_cat.png?alt=media\&token=d4192e08-f258-4701-9eca-65ebe7892d52)
{% endtab %}

{% tab title="qbx" %}
Navigate to `qbx_core/shared/vehicles.lua`

Add or find the vehicle you want to assign a specific category

Edit its `category` to match a category you will assign inside of the `categories` table of `locations.lua`&#x20;

![](https://51694285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSadY5GIZVZCGCeog04Gq%2Fuploads%2FaNHLuGjzfaZwzU7FgqLe%2Fqbx_cat.png?alt=media\&token=1fde2f2a-d599-4432-9b25-489add95efe3)
{% endtab %}

{% tab title="esx" %}
If adding a new category navigate to your database `vehicle_categories` table

Insert a new row with the `category` name and its label

![](https://51694285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSadY5GIZVZCGCeog04Gq%2Fuploads%2FrAtzU3XiOZgccKJKKPEv%2Fesx_cat.png?alt=media\&token=e76c65fb-9730-4e1f-91f7-804eacaf772a)

Navigate to your database `vehicles` table

If your vehicle already exists in this table you can just edit the `category` field to match the category from `vehicle_categories`

If your vehicle doesn't exist you need to insert a new row filling out all fields and setting up the correct `category` you want to use
{% endtab %}
{% endtabs %}
