Back to PhocacartCoupon class

Method getGiftsByOrderId

public static
getGiftsByOrderId
(mixed $orderId)

Method getGiftsByOrderId - Source code

public static function getGiftsByOrderId($orderId)
{
    $db = Factory::getDBO();
    $query = 'SELECT c.id, c.title, c.code, c.discount, c.valid_from, c.valid_to, c.type, c.published,' . ' c.gift_order_id, c.gift_product_id, c.gift_order_product_id, c.coupon_type, c.gift_class_name,' . ' c.gift_title, c.gift_description, c.gift_image, c.gift_recipient_name, c.gift_recipient_email, c.gift_sender_name, c.gift_sender_message, c.gift_type' . ' FROM #__phocacart_coupons AS c' . ' WHERE c.gift_order_id = ' . (int) $orderId . ' ORDER BY c.id';
    $db->setQuery($query);
    $gifts = $db->loadAssocList();
    return $gifts;
}