Closed stevenvandemoortele closed 5 years ago
I was getting my ads using an element criteria model:
{% set ad1 = craft.adWizard.ads.group('right').orderBy('RAND()').limit(1).one() %}
Resolved my issue by changing it to the following:
{% set ad1 = craft.adWizard.ads.group('right').where(['!=', 'assetId', '']).orderBy('RAND()').limit(1).one() %}
Fixed this bug. Thanks for reporting it!
In the upcoming v2.1, it will now render normally, and just log an error in the console instead of crashing everything.
The Image field has the following label: If no graphic is associated, the ad will not be displayed.
But an ad without a graphic gives the following error: Argument 1 passed to craft\services\Assets::getAssetById() must be of the type integer, null given, called in /vendor/doublesecretagency/craft-adwizard/src/services/Ads.php on line 156