Skip to content
Last updated

WHMCS\Product\Group

Class · extends AbstractModel · implements SlugInterface

A product group

A product group contains one or more order-able products and determines how those products are displayed in order forms to clients.

Traits

  • SlugTrait

Methods

boot

public static function boot()

products

public function products()

A product group has many products in it.

Returns \Illuminate\Database\Eloquent\Relations\HasMany

features

public function features()

A product group can have many features.

Returns \Illuminate\Database\Eloquent\Relations\HasMany

scopeSlug

public function scopeSlug($query, $slug)

Find by slug.

Returns Builder

scopeNotHidden

public function scopeNotHidden($query)

Restrict to groups which are publicly visible.

Returns Builder

scopeSorted

public function scopeSorted($query)

Sort by display order.

Returns Builder

getRoutePath

public function getRoutePath($fullUrl = false, ?int $pid = null)

Get client area route path for group.

Parameters

TypeNameDescription
bool$fullUrl

Returns string

validateSlugIsUnique

public function validateSlugIsUnique(string $slug): bool

Validate slug is unique.

Parameters

TypeNameDescription
string$slug

Returns bool

autoGenerateUniqueSlug

public function autoGenerateUniqueSlug(): string

Auto generate unique slug based on name.

Returns string;

getExistingSlugCheck

public function getExistingSlugCheck(string $slug): Builder

Parameters

TypeNameDescription
string$slug

Returns Builder

orderFormTemplate

public function orderFormTemplate()

Retrieve a product group's associated order form

Use the default template if the product group doesn't have an associated order form.

Returns \WHMCS\View\Template\OrderForm

translatedNames

public function translatedNames()

Return the translated names for the specific product

Returns \Illuminate\Database\Eloquent\Relations\HasMany\|\WHMCS\Language\DynamicTranslation[]

translatedHeadlines

public function translatedHeadlines()

Return the translated headlines for the specific product

Returns \Illuminate\Database\Eloquent\Relations\HasMany\|\WHMCS\Language\DynamicTranslation[]

translatedTaglines

public function translatedTaglines()

Return the translated taglines for the specific product

Returns \Illuminate\Database\Eloquent\Relations\HasMany\|\WHMCS\Language\DynamicTranslation[]

getNameAttribute

public function getNameAttribute($name)

Get the group's name - this will override the output from the db value if set in Lang.

Parameters

TypeNameDescription
string$nameThe value from the database

Returns string

getHeadlineAttribute

public function getHeadlineAttribute($headline)

Get the group's headline - this will override the output from the db value if set in Lang.

Parameters

TypeNameDescription
string$headlineThe value from the database

Returns string

getTaglineAttribute

public function getTaglineAttribute($tagline)

Get the group's tagline - this will override the output from the db value if set in Lang.

Parameters

TypeNameDescription
string$taglineThe value from the database

Returns string

getGroupName

public static function getGroupName($groupId, $fallback = '', $language = null)

Obtain the product group name for the current language, passed language or fallback to the currently defined value for the product group.

Parameters

TypeNameDescription
int$groupId
string$fallback
string$language

Returns string

getHeadline

public static function getHeadline($groupId, $fallback = '', $language = null)

Obtain the product headline for the current language, passed language or fallback to the currently defined value for the product group.

Parameters

TypeNameDescription
int$groupId
string$fallback
string$language

Returns string

getTagline

public static function getTagline($groupId, $fallback = '', $language = null)

Obtain the product tagline for the current language, passed language or fallback to the currently defined value for the product group.

Parameters

TypeNameDescription
int$groupId
string$fallback
string$language

Returns string

isMarketConnectGroup

public function isMarketConnectGroup()

Returns bool

getMarketConnectControllerClass

public function getMarketConnectControllerClass()

Returns string

productSlugs

public function productSlugs()

disallowedPaymentGateways

public function disallowedPaymentGateways(): Collection