示例#1
0
//$addpre_select[] = JHtml::_('select.option','=', JText::_('QTC_ADDATTRI_PRESAM'));
$del_link = $qtc_base_url . 'index.php?option=com_quick2cart&task=attributes.delattribute';
if (!empty($pid) && $client) {
    // declaration section
    $quick2cartModelAttributes = new quick2cartModelAttributes();
    $path = JPATH_SITE . DS . 'components' . DS . 'com_quick2cart' . DS . 'helpers' . DS . 'product.php';
    if (!class_exists('productHelper')) {
        //require_once $path;
        JLoader::register('productHelper', $path);
        JLoader::load('productHelper');
    }
    $productHelper = new productHelper();
    if (empty($item_id)) {
    } else {
        $attributes = $quick2cartModelAttributes->getItemAttributes($item_id);
        $getMediaDetail = $productHelper->getMediaDetail($item_id);
        $addMediaLink = $qtc_base_url . 'index.php?option=com_quick2cart&view=attributes&layout=media&tmpl=component&item_id=' . $item_id;
    }
    ?>
	<script type="text/javascript">

		function EditFile(file_id,pid)
		{
				var tr_id = '.file_'+file_id;
				techjoomla.jQuery.ajax({
				url:'<?php 
    echo $qtc_base_url;
    ?>
?option=com_quick2cart&task=attributes.EditMediFile&pid='+pid+'&file_id='+file_id,
				type: 'GET',
				dataType: 'json',
示例#2
0
 /**
  * Display the view
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  void
  */
 public function display($tpl = null)
 {
     $this->params = JComponentHelper::getParams('com_quick2cart');
     $mainframe = JFactory::getApplication();
     $input = $mainframe->input;
     $option = $input->get('option');
     $layout = $input->get('layout', 'default');
     $this->comquick2cartHelper = new comquick2cartHelper();
     $this->productHelper = new productHelper();
     $storeHelper = new storeHelper();
     $productHelper = new productHelper();
     if ($layout == 'default') {
         $this->products = $this->items = $this->get('Items');
         $this->pagination = $this->get('Pagination');
         $this->state = $this->get('State');
         $this->filterForm = $this->get('FilterForm');
         $this->activeFilters = $this->get('ActiveFilters');
         // Creating status filter.
         $sstatus = array();
         if (JVERSION < '3.0') {
             $sstatus[] = JHtml::_('select.option', '', JText::_('JOPTION_SELECT_PUBLISHED'));
             $sstatus[] = JHtml::_('select.option', 1, JText::_('COM_QUICK2CART_PUBLISH'));
             $sstatus[] = JHtml::_('select.option', 0, JText::_('COM_QUICK2CART_UNPUBLISH'));
             $this->sstatus = $sstatus;
         }
         // Create clients array
         $clients = array();
         if (JVERSION < '3.0') {
             $clients[] = JHtml::_('select.option', '', JText::_('COM_QUICK2CART_FILTER_SELECT_CLIENT'));
             $clients[] = JHtml::_('select.option', 'com_quick2cart', JText::_('COM_QUICK2CART_NATIVE'));
             $clients[] = JHtml::_('select.option', 'com_content', JText::_('COM_QUICK2CART_CONTENT_ARTICLES'));
             $clients[] = JHtml::_('select.option', 'com_flexicontent', JText::_('COM_QUICK2CART_FLEXICONTENT'));
             $clients[] = JHtml::_('select.option', 'com_k2', JText::_('COM_QUICK2CART_K2'));
             $clients[] = JHtml::_('select.option', 'com_zoo', JText::_('COM_QUICK2CART_ZOO'));
             $this->clients = $clients;
         }
         // Get all stores.
         $this->store_details = $this->comquick2cartHelper->getAllStoreDetails();
     } elseif ($layout == "new") {
         // @TODO ADD CONDITION :: LOGGED IN USER MUST HV STORE
         // Gettting store id if store is changed
         $user = JFactory::getUser();
         global $mainframe;
         $mainframe = JFactory::getApplication();
         $change_storeto = $mainframe->getUserStateFromRequest('current_store', 'current_store', 0, 'INTEGER');
         // Get item_id from request from GET/POST
         $item_id = $mainframe->getUserStateFromRequest('item_id', 'item_id', '', 'STRING');
         // REMOVE FROM REQUEST
         $mainframe->setUserState('item_id', '');
         $this->client = $client = "com_quick2cart";
         $this->pid = 0;
         // LOAD CART MODEL
         $Quick2cartModelcart = $this->comquick2cartHelper->loadqtcClass(JPATH_SITE . "/components/com_quick2cart/models/cart.php", "Quick2cartModelcart");
         // If item_id NOT found then SET TO ''
         $this->item_id = '';
         // If edit task then fetch item DETAILS
         if (!empty($item_id)) {
             // Check whether called from backend
             $admin_call = $mainframe->getUserStateFromRequest('admin_call', 'admin_call', 0, 'INTEGER');
             if (!empty($admin_call)) {
                 // CHECK SPECIAL ACCESS
                 $special_access = $this->comquick2cartHelper->isSpecialAccess();
             }
             // Load Attributes model
             $path = '/components/com_quick2cart/models/attributes.php';
             $attri_model = $this->comquick2cartHelper->loadqtcClass(JPATH_SITE . $path, "quick2cartModelAttributes");
             // GET ITEM DETAIL
             $this->itemDetail = $itemDetail = $attri_model->getItemDetail(0, '', $item_id);
             // Getting attribure
             $this->item_id = !empty($this->itemDetail) ? $itemDetail['item_id'] : '';
             $this->allAttribues = $attri_model->getItemAttributes($this->item_id);
             $this->getMediaDetail = $productHelper->getMediaDetail($item_id);
             $this->store_id = $store_id = $this->store_role_list = $this->itemDetail['store_id'];
         } else {
             $storeHelper = new storeHelper();
             $storeList = (array) $storeHelper->getUserStore($user->id);
             $this->store_id = $storeList[0]['id'];
         }
         // IF ITEM_ID AND SPECIAL ACCESS EG ADMIN THEN FETCH STORE ID // means edit task
         // Else :
         if (!empty($item_id) && !empty($special_access)) {
             // WE DONT WANT TO SHOW STORE SELECT LIST
             $this->store_id = $store_id = $this->store_role_list = $this->itemDetail['store_id'];
         } else {
             $this->store_role_list = $store_role_list = $this->comquick2cartHelper->getStoreIds();
             // as no NEED TO CHECK AUTHORIZATION AT ADMINSIDE
             $storeHelper = new storeHelper();
             $this->defaultStoreId = $defaultStoreId = $storeHelper->getAdminDefaultStoreId();
             // get all store ids of vendor
             //	$this->authorized_store_id = $comquick2cartHelper->store_authorize("managecoupon_default",isset($change_storeto)?$change_storeto:$store_role_list[0]['store_id']);
             $this->store_id = $store_id = !empty($change_storeto) ? $change_storeto : $defaultStoreId;
             $this->selected_store = $store_id;
             if (!$this->store_id) {
                 $user = JFactory::getUser();
                 $storeHelper = $comquick2cartHelper->loadqtcClass(JPATH_SITE . DS . "components" . DS . "com_quick2cart" . DS . "helpers" . DS . "storeHelper.php", "storeHelper");
                 $storeList = (array) $storeHelper->getUserStore($user->id);
                 $this->store_id = $storeList[0]['id'];
             }
         }
         // ALL FETCH ALL CATEGORIES //$catid='',$onchangeSubmitForm=1,$name='prod_cat',$class=''
         if (!empty($this->itemDetail['category'])) {
             $this->cats = $this->comquick2cartHelper->getQ2cCatsJoomla($this->itemDetail['category'], 0, 'prod_cat', ' required ');
         } else {
             $this->cats = $this->comquick2cartHelper->getQ2cCatsJoomla('', 0, 'prod_cat', ' required ');
         }
     }
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     $this->addToolbar();
     if (JVERSION >= '3.0') {
         $this->sidebar = JHtmlSidebar::render();
     }
     parent::display($tpl);
 }
示例#3
0
    function EditMediFile()
    {
        // Add Language file.
        $lang = JFactory::getLanguage();
        $lang->load('com_quick2cart', JPATH_ADMINISTRATOR);
        $qtc_base_url = JUri::root();
        // get Product_id via ajax url.
        $jinput = JFactory::getApplication()->input;
        $item_id = $jinput->get('pid');
        // Get file id for delete.
        $file_id = $jinput->get('file_id');
        $path = JPATH_SITE . DS . 'components' . DS . 'com_quick2cart' . DS . 'models' . DS . 'attributes.php';
        if (!class_exists('attributes')) {
            // require_once $path;
            JLoader::register('attributes', $path);
            JLoader::load('attributes');
        }
        $quick2cartModelAttributes = new quick2cartModelAttributes();
        $path = JPATH_SITE . DS . 'components' . DS . 'com_quick2cart' . DS . 'helpers' . DS . 'product.php';
        if (!class_exists('productHelper')) {
            // require_once $path;
            JLoader::register('productHelper', $path);
            JLoader::load('productHelper');
        }
        $productHelper = new productHelper();
        $delFiles = array();
        $delFiles[] = $file_id;
        $attributes = $quick2cartModelAttributes->getItemAttributes($item_id);
        $getMediaDetail = $productHelper->getMediaDetail($item_id, $file_id);
        $addMediaLink = $qtc_base_url . 'index.php?option=com_quick2cart&view=attributes&layout=media&tmpl=component&item_id=' . $item_id;
        $html = '';
        $count = $jinput->get('count');
        $count = $count - 1;
        if (!empty($getMediaDetail)) {
            for ($i = 0; $i < count($getMediaDetail); $i++) {
                if ($i > $count) {
                    $html .= '<tr class="' . "file_" . $getMediaDetail[$i]['file_id'] . '">
							<td>' . $getMediaDetail[$i]['file_display_name'] . '</td>
							<td>';
                    $mediaClass = ' badge';
                    $purchaseStatus = JText::_('QTC_ADDATTRI_PURCHASE_REQ_NO');
                    if (!empty($getMediaDetail[$i]['purchase_required'])) {
                        $mediaClass = ' badge badge-success';
                        $purchaseStatus = JText::_('QTC_ADDATTRI_PURCHASE_REQ_YES');
                    }
                    $html .= '<span class="' . $mediaClass . '">' . $purchaseStatus . '</span>
							</td>';
                    $edit_link = $addMediaLink . '&file_id=' . $getMediaDetail[$i]['file_id'] . '&edit=1';
                    $del_link = $addMediaLink . '&file_id=' . $getMediaDetail[$i]['file_id'];
                    $html .= '<td>
								<a  rel="{handler: \'iframe\', size: {x: 800, y: 550}, onClose: function(){EditFile(' . $getMediaDetail[$i]['file_id'] . ',' . $item_id . ');}}" class="btn btn-mini btn-primary modal qtc_modal" href="' . $edit_link . '"> <i class="icon-pencil-2 icon-white"></i>
								</a>
								<button type="button" class="btn btn-mini btn-danger "  onclick="deleteMediFile(' . $getMediaDetail[$i]['file_id'] . ',' . $item_id . ' )"><i class="icon-trash icon-white"></i></button>

							 </td>
						</tr>';
                }
            }
            $data['html'] = $html;
            echo json_encode($html);
        }
        jexit();
    }
示例#4
0
    ?>
 </span>
				</div>
			</div>
		</div>
		<?php 
    return false;
}
$productHelper = new productHelper();
$m = 0;
$attribute_container_id = "qtc_mediaContainer" . $m;
$mediafile_id = $jinput->get('file_id', '', 'INT');
$mediaDetail = array();
// for edit media
if (!empty($mediafile_id)) {
    $mediaDetail = $productHelper->getMediaDetail(0, $mediafile_id);
}
?>
<div class="<?php 
echo Q2C_WRAPPER_CLASS;
?>
" >
<form method="POST" name="adminForm" class="form-validate" action="index.php">

	<legend><?php 
echo JText::_('QTC_CCK_ADD_MEDIA_FILES_TITLE');
?>
</legend>
	<div class="row-fluid"
	<div class="span12">
		<div id=<?php 
示例#5
0
    /**
     * On order confirm, add product media file in orderitemFIlesTable
     *
     * @param   INT  $order_id  order_id
     *
     * @return  VOID
     */
    public function addEntryInOrderItemFiles($order_id)
    {
        $productHelper = new productHelper();
        $comquick2cartHelper = new comquick2cartHelper();
        $params = JComponentHelper::getParams('com_quick2cart');
        $eProdExpFormat = $params->get('eProdExpFormat', 'epMonthExp');
        // Down count/ date limit / both
        $eProdUExpiryMode = $params->get('eProdUExpiryMode', 'epMaxDownload');
        $db = JFactory::getDBO();
        $q = "SELECT `item_id`,`order_item_id`,`product_quantity`\n\t\t\t\tFROM  `#__kart_order_item`\n\t\t\t\tWHERE `order_id` =" . (int) $order_id;
        $db->setQuery($q);
        $result = $db->loadAssocList();
        foreach ($result as $res) {
            $item_id = $res['item_id'];
            $mediaDetail = $productHelper->getMediaDetail($item_id);
            //  Copy all media
            foreach ($mediaDetail as $media) {
                $pfile = new stdClass();
                $pfile->product_file_id = $media['file_id'];
                $pfile->order_item_id = $res['order_item_id'];
                $pfile->expirary_date = '';
                $que = 'SELECT of.id FROM `#__kart_orderItemFiles` AS of
					where of.order_item_id=' . $pfile->order_item_id . ' AND of.`product_file_id`=' . $pfile->product_file_id . ' ORDER BY of.id';
                $db->setQuery($que);
                $fileid = $db->loadResult();
                if (!empty($fileid)) {
                    //  Actually will not come inside. still for worse case
                    $action = "updateObject";
                    $pfile->id = $fileid;
                } else {
                    $action = "insertObject";
                    $pfile->cdate = date('Y-m-d H:i:s');
                }
                //  if purchase require not req
                if ($media['purchase_required'] == 0) {
                    $pfile->download_limit = -1;
                } else {
                    //  DATE EXPIRATION
                    if ($eProdUExpiryMode == 'epDateExpiry' || $eProdUExpiryMode == 'epboth') {
                        //  expirary in months
                        if ($media['expiry_mode'] == 1) {
                            //  months
                            $exdate = $comquick2cartHelper->add_date($pfile->cdate, 0, $media['expiry_in']);
                        } else {
                            //  in days
                            $exdate = $comquick2cartHelper->add_date($pfile->cdate, $media['expiry_in']);
                        }
                        $pfile->expirary_date = $exdate;
                    }
                    if ($eProdUExpiryMode == 'epMaxDownload' || $eProdUExpiryMode == 'epboth') {
                        if ($media['download_limit'] > 0) {
                            //  not for unlimited
                            $pfile->download_limit = $media['download_limit'] * $res['product_quantity'];
                        } else {
                            $pfile->download_limit = $media['download_limit'];
                        }
                    }
                }
                $pfile->expiration_mode = $eProdUExpiryMode;
                if (!$db->{$action}('#__kart_orderItemFiles', $pfile, 'id')) {
                    echo JText::_("COM_QUICK2CART_ERROR_WHILE_ASSIGNING_MEIDA_FILE_TO_ORDER") . $db->stderr();
                    return false;
                }
            }
        }
    }