diff --git a/upload/modules/Tebex/widgets/FeaturedPackageWidget.php b/upload/modules/Tebex/widgets/FeaturedPackageWidget.php index 7b8fa7e..fbe0285 100644 --- a/upload/modules/Tebex/widgets/FeaturedPackageWidget.php +++ b/upload/modules/Tebex/widgets/FeaturedPackageWidget.php @@ -13,16 +13,25 @@ class FeaturedPackageWidget extends WidgetBase { private Language $_language, $_buycraft_language; public function __construct(Cache $cache, Smarty $smarty, Language $language, Language $buycraft_language){ - $this->_smarty = $smarty; - $this->_language = $language; - $this->_buycraft_language = $buycraft_language; - $this->_cache = $cache; - - // Set widget variables - $this->_module = 'Tebex'; - $this->_name = 'Featured Package'; - $this->_description = 'Display a store package to feature across your website'; - $this->_settings = ROOT_PATH . '/modules/Tebex/widgets/admin/featured_package.php'; + $widget_query = self::getData('Featured Package'); + + parent::__construct(self::parsePages($widget_query)); + + $this->_smarty = $smarty; + $this->_language = $language; + $this->_buycraft_language = $buycraft_language; + $this->_cache = $cache; + + // Get order + $order = DB::getInstance()->query('SELECT `order` FROM nl2_widgets WHERE `name` = ?', array('Featured Package'))->first(); + + // Set widget variables + $this->_module = 'Tebex'; + $this->_name = 'Featured Package'; + $this->_location = 'right'; + $this->_description = 'Display a store package to feature across your website'; + $this->_settings = ROOT_PATH . '/modules/Tebex/widgets/admin/featured_package.php'; + $this->_order = $order->order; } public function initialise(): void { diff --git a/upload/modules/Tebex/widgets/LatestPurchasesWidget.php b/upload/modules/Tebex/widgets/LatestPurchasesWidget.php index 777d261..2c6cbc0 100644 --- a/upload/modules/Tebex/widgets/LatestPurchasesWidget.php +++ b/upload/modules/Tebex/widgets/LatestPurchasesWidget.php @@ -12,17 +12,26 @@ class LatestPurchasesWidget extends WidgetBase { private Cache $_cache; private Language $_language, $_buycraft_language; - public function __construct(Cache $cache, Smarty $smarty, Language $language, Language $buycraft_language){ - $this->_smarty = $smarty; - $this->_language = $language; - $this->_buycraft_language = $buycraft_language; - $this->_cache = $cache; - - // Set widget variables - $this->_module = 'Tebex'; - $this->_name = 'Latest Purchases'; - $this->_description = 'Displays a list of your store\'s most recent purchases.'; - $this->_settings = ROOT_PATH . '/modules/Tebex/widgets/admin/latest_purchases.php'; + public function __construct(Cache $cache, Smarty $smarty, Language $language, Language $buycraft_language) { + $widget_query = self::getData('Latest Purchases'); + + parent::__construct(self::parsePages($widget_query)); + + $this->_smarty = $smarty; + $this->_language = $language; + $this->_buycraft_language = $buycraft_language; + $this->_cache = $cache; + + // Get order + $order = DB::getInstance()->query('SELECT `order` FROM nl2_widgets WHERE `name` = ?', array('Latest Purchases'))->first(); + + // Set widget variables + $this->_module = 'Tebex'; + $this->_name = 'Latest Purchases'; + $this->_location = 'right'; + $this->_description = 'Displays a list of your store\'s most recent purchases.'; + $this->_settings = ROOT_PATH . '/modules/Tebex/widgets/admin/latest_purchases.php'; + $this->_order = $order->order; } public function initialise(): void {