Welcome, Guest
Username: Password: Remember me

TOPIC: Custom call deal information

Custom call deal information 9 months 5 days ago #4045

  • mpretorius1995
  • mpretorius1995's Avatar
  • Offline
  • Fresh Boarder
  • Posts: 8
  • Karma: 0
I'm trying to call a deal file in a custom template.
I tried a bunch of variations but I keep an getting an empty array.

Basically I'm trying to duplicate this code:
$deal = $this->deal;
The only issue being that I'm not able to use "$this" because its not being loaded on the deal page.
I'm using an attribute to select the deal ID but as mentioned before, the array remains empty.
The code I have tried is as follow:
$cmgbstore_id = $attributes->cmgbstore_id;
$deal = CMGroupBuyingHelperDeal::getDealsByRefId($cmgbstore_id);

Any help would greatly be appreciated!

Kindest Regards
Martin
The administrator has disabled public write access.

Custom call deal information 9 months 4 days ago #4046

  • mpretorius1995
  • mpretorius1995's Avatar
  • Offline
  • Fresh Boarder
  • Posts: 8
  • Karma: 0
Okay I figure it out.
If someone else needs this, I used the following code:
        $cmgbstore_id = $attributes->cmgbstore_id;

	$db = JFactory::getDbo();
	$query = $db->getQuery(true);
	$query->select('name');
	$query->from($db->quoteName('#__cmgroupbuying_deals'));
	$query->where($db->quoteName('id')." = ".$cmgbstore_id);
This can be used to retrieve anything from the database such as the Name, Start date, End Date etc.
The administrator has disabled public write access.