<th class="q2c_width_15"> <?php echo JHtml::_('grid.sort', JText::_('QTC_DOWNLOADS_VALID_TILL'), 'f.expirary_date', $this->lists['order_Dir'], $this->lists['order']); ?> </th> <?php } ?> </tr> </thead> <tbody> <?php $id = 1; foreach ($this->allDownloads as $media) { $authorize = $productHelper->mediaFileAuthorise($media->product_file_id, 0, $guest_email, $media->order_item_id); $validDown = 'error'; if (!empty($authorize['validDownload']) && $authorize['validDownload'] == 1) { $validDown = 'success'; } ?> <tr class="<?php echo $validDown; ?> "> <td class="q2c_width_20"> <?php echo $media->prefix . $media->order_id; ?> <!--
/** This function starts download*/ function downStart() { $comquick2cartHelper = new comquick2cartHelper(); $Quick2cartControllerProduct = new Quick2cartControllerProduct(); $productHelper = new productHelper(); global $mainframe; $mainframe = JFactory::getApplication(); $myDonloadItemid = $comquick2cartHelper->getitemid('index.php?option=com_quick2cart&view=downloads'); $jinput = JFactory::getApplication()->input; $file_id = $jinput->get('fid', 0, 'INTEGER'); $strorecall = $jinput->get('strorecall', 0, 'INTEGER'); $guest_email = $jinput->get('guest_email', '', 'RAW'); $orderid = $jinput->get('orderid', 0, 'INTEGER'); $order_item_id = $jinput->get('order_item_id', 0, 'INTEGER'); $authorize = $productHelper->mediaFileAuthorise($file_id, $strorecall, $guest_email, $order_item_id); if (!empty($authorize['validDownload']) && $authorize['validDownload'] == 1) { $productHelper = new productHelper(); $filepath = $productHelper->getFilePathToDownload($file_id); // Download will start $down_status = $productHelper->download($filepath, '', '', 0); if ($down_status === 2) { // If filepath not exists The requested download file does not exists JFactory::getApplication()->enqueueMessage(JText::_('QTC_DOWNLOAD_FILEPATH_NOTEXISTS'), 'error'); $mainframe->redirect(JUri::root() . substr(JRoute::_('index.php?option=com_quick2cart&view=downloads&Itemid=' . $myDonloadItemid), strlen(JUri::base(true)) + 1)); } elseif (!empty($authorize['orderItemFileId'])) { // YOU WILL GET FOR THIS FIELD ONLY FOR PURCHASE REQUIRED FILE $productHelper->updateFileDownloadCount($authorize['orderItemFileId']); // kart_orderItemFiles tables primary key } // Exit tab return; } else { JFactory::getApplication()->enqueueMessage(JText::_('QTC_DOWNLOAD_NOT_AUTHORIZED'), 'error'); $mainframe->redirect(JUri::root() . substr(JRoute::_('index.php?option=com_quick2cart&view=downloads&Itemid=' . $myDonloadItemid), strlen(JUri::base(true)) + 1)); } JFactory::getApplication()->enqueueMessage(JText::_('SOME_ERROR_OCCURRED'), 'error'); $mainframe->redirect(JUri::root() . substr(JRoute::_('index.php?option=com_quick2cart&view=downloads&Itemid=' . $myDonloadItemid), strlen(JUri::base(true)) + 1)); }